CORDET Framework - C2 Implementation
CrFwInStreamTestCases.c
Go to the documentation of this file.
1 
19 #include <stdlib.h>
20 #include "CrFwRepErrStub.h"
21 #include "CrFwInStreamTestCases.h"
22 #include "CrFwInStreamStub.h"
23 /* Include FW Profile files */
24 #include "FwSmConstants.h"
25 #include "FwSmConfig.h"
26 #include "FwSmCore.h"
27 #include "FwPrConfig.h"
28 #include "FwPrCore.h"
29 #include "FwPrConstants.h"
30 /* Include configuration files */
31 #include "CrFwInStreamUserPar.h"
32 #include "CrFwCmpData.h"
33 /* Include framework files */
34 #include "InStream/CrFwInStream.h"
35 #include "BaseCmp/CrFwBaseCmp.h"
36 #include "Pckt/CrFwPckt.h"
37 #include "CrFwTime.h"
38 #include "CrFwRepErr.h"
40 
41 /* ---------------------------------------------------------------------------------------------*/
43  FwSmDesc_t inStream0, inStreamBis, inStream[CR_FW_NOF_INSTREAM];
46 
47  /* Attempt to instantiate an InStream with an illegal identifier */
49  return 0;
50  inStream0 = CrFwInStreamMake(CR_FW_NOF_INSTREAM + 1);
51  if (inStream0 != NULL)
52  return 0;
54  return 0;
55  CrFwSetAppErrCode(crNoAppErr); /* reset application error code */
56 
57  /* Create the first InStream */
58  inStream0 = CrFwInStreamMake(0);
59  if (inStream0 == NULL)
60  return 0;
61 
62  /* Create the first InStream again and check that the same component is returned */
63  inStreamBis = CrFwInStreamMake(0);
64  if (inStream0 != inStreamBis)
65  return 0;
66 
67  /* Check configuration of InStream */
68  if (FwSmCheckRec(inStream0) != smSuccess)
69  return 0;
70 
71  /* Initialize inStream and check success */
72  if (!CrFwCmpIsInCreated(inStream0))
73  return 0;
74 
75  CrFwCmpInit(inStream0);
76  if (!CrFwCmpIsInInitialized(inStream0))
77  return 0;
78 
79  /* Verify sources attached to inStream0 */
80  if (CrFwInStreamGetNOfSrc(inStream0) != 2) /* Sources of inStream0 are defined in CR_FW_INSTREAM_SRC_PAIRS */
81  return 0;
82  if (CrFwInStreamGetSrc(inStream0, 1) != 1)
83  return 0;
84  if (CrFwInStreamGetSrc(inStream0, 2) != 6)
85  return 0;
86 
87  /* Verify packet queue size (defined in CR_FW_INSTREAM_PQSIZE) */
88  if (CrFwInStreamGetPcktQueueSize(inStream0) != 3)
89  return 0;
90 
91  /* Reset InStream */
92  CrFwCmpReset(inStream0);
93  if (!CrFwCmpIsInConfigured(inStream0))
94  return 0;
95 
96  /* Since the packet available stub declares "packet is not available", the InStream is in WAITING */
97  if (!CrFwInStreamIsInWaiting(inStream0))
98  return 0;
99 
100  if (CrFwInStreamGetSeqCnt(0) != 0)
101  return 0;
102 
103  if (CrFwInStreamGetNOfPendingPckts(inStream0) != 0)
104  return 0;
105 
106  /* Check the function to get the InStream as a function of packet source under nominal conditions */
107  for (i=0; i<CR_FW_NOF_INSTREAM; i++)
108  inStream[i] = CrFwInStreamMake(i);
109  if (CrFwInStreamGet(inStreamSrcPairs[0][0])!=inStream[inStreamSrcPairs[0][1]])
110  return 0;
111  if (CrFwInStreamGet(inStreamSrcPairs[1][0])!=inStream[inStreamSrcPairs[1][1]])
112  return 0;
115  return 0;
116 
117  /* Check the function to get the InStream as a function of packet source under non-nominal conditions */
118  if (CrFwGetAppErrCode() != crNoAppErr)
119  return 0;
120  if (CrFwInStreamGet(0)!=NULL) /* No packet source has identifier zero */
121  return 0;
123  return 0;
124  CrFwSetAppErrCode(crNoAppErr); /* reset application error code */
125 
126  /* Check the function to get the number of groups (this is set in CrFwInStreamUserPar.h) */
127  if (CrFwInStreamGetNOfGroups() != 2)
128  return 0;
129 
130  /* Check that all packets have been de-allocated */
131  if (CrFwPcktGetNOfAllocated() != 0)
132  return 0;
133 
134  /* Check application errors */
135  if (CrFwGetAppErrCode() != crNoAppErr)
136  return 0;
137 
138  return 1;
139 }
140 
141 /* ---------------------------------------------------------------------------------------------*/
143  FwSmDesc_t inStream0;
144  CrFwPckt_t pckt1, pckt2;
145 
146  /* Retrieve the first InStream */
147  inStream0 = CrFwInStreamMake(0);
148  if (inStream0 == NULL)
149  return 0;
150 
151  /* Check packet queue size (defined in CR_FW_INSTREAM_PQSIZE)*/
152  if (CrFwInStreamGetPcktQueueSize(inStream0) != 3)
153  return 0;
154 
155  /* Verify that InStream is in WAITING */
156  if (!CrFwInStreamIsInWaiting(inStream0))
157  return 0;
158 
159  /* Send PACKET_AVAILABLE command to InStream at a time when no packets are available and
160  * verify that InStream remains in WAITING */
161  CrFwInStreamPcktAvail(inStream0);
162  if (!CrFwInStreamIsInWaiting(inStream0))
163  return 0;
164  if (CrFwInStreamGetNOfPendingPckts(inStream0) != 0)
165  return 0;
166 
167  /* Send GET_PCKT command to InStream and verify that nothing is returned */
168  pckt1 = CrFwInStreamGetPckt(inStream0);
169  if (pckt1 != NULL)
170  return 0;
171  if (!CrFwInStreamIsInWaiting(inStream0))
172  return 0;
173  if (CrFwInStreamGetNOfPendingPckts(inStream0) != 0)
174  return 0;
175 
176  /* Set up stub to simulate presence of two packets for the host application */
181 
182  /* Send PACKET_AVAILABLE command to InStream */
183  CrFwInStreamSetSeqCnt(0, 5555);
184  CrFwInStreamPcktAvail(inStream0);
185  if (!CrFwInStreamIsInPcktAvail(inStream0))
186  return 0;
187  if (CrFwInStreamGetNOfPendingPckts(inStream0) != 2)
188  return 0;
189  if (CrFwInStreamGetSeqCnt(0) != (5555+2))
190  return 0;
191 
192  /* Send first GET_PCKT command to InStream */
193  pckt1 = CrFwInStreamGetPckt(inStream0);
194  if (!CrFwInStreamIsInPcktAvail(inStream0))
195  return 0;
196  if (CrFwInStreamGetNOfPendingPckts(inStream0) != 1)
197  return 0;
198  if (CrFwPcktGetSeqCnt(pckt1) != 5556)
199  return 0;
200 
201  /* Send second GET_PCKT command to InStream */
202  pckt2 = CrFwInStreamGetPckt(inStream0);
203  if (!CrFwInStreamIsInWaiting(inStream0))
204  return 0;
205  if (CrFwInStreamGetNOfPendingPckts(inStream0) != 0)
206  return 0;
207  if (CrFwPcktGetSeqCnt(pckt2) != 5557)
208  return 0;
209 
210  /* De-allocate packets */
211  CrFwPcktRelease(pckt1);
212  CrFwPcktRelease(pckt2);
213 
214  /* Check that all packets have been de-allocated */
215  if (CrFwPcktGetNOfAllocated() != 0)
216  return 0;
217 
218  /* Check application errors */
219  if (CrFwGetAppErrCode() != crNoAppErr)
220  return 0;
221 
222  return 1;
223 }
224 
225 /* ---------------------------------------------------------------------------------------------*/
227  FwSmDesc_t inStream0;
229 
230  /* Retrieve the first InStream */
231  inStream0 = CrFwInStreamMake(0);
232  if (inStream0 == NULL)
233  return 0;
234 
235  /* Set up stub to simulate presence of one packet for the host application */
237  CrFwInStreamStubSetPcktGroup(0); /* First InStream only has one group */
239 
240  /* Check initial state of InStream */
241  if (!CrFwInStreamIsInWaiting(inStream0))
242  return 0;
243 
244  /* Get current sequence counter value */
246 
247  /* Send PACKET_AVAILABLE command to InStream */
248  CrFwInStreamPcktAvail(inStream0);
249  if (!CrFwInStreamIsInPcktAvail(inStream0))
250  return 0;
251  if (CrFwInStreamGetNOfPendingPckts(inStream0) != 1)
252  return 0;
253  if (CrFwInStreamGetSeqCnt(0) != seqCnt+1)
254  return 0;
255 
256  /* Set up stub to simulate presence of one more packet in the middleware */
258 
259  /* Send PACKET_AVAILABLE command again to InStream */
260  CrFwInStreamPcktAvail(inStream0);
261  if (!CrFwInStreamIsInPcktAvail(inStream0))
262  return 0;
263  if (CrFwInStreamGetNOfPendingPckts(inStream0) != 2)
264  return 0;
265  if (CrFwInStreamGetSeqCnt(0) != seqCnt+2)
266  return 0;
267 
268  /* Send SHUTDOWN command to InStream */
269  CrFwCmpShutdown(inStream0);
270  if (CrFwCmpIsStarted(inStream0) != 0)
271  return 0;
272  if (CrFwInStreamGetNOfPendingPckts(inStream0) != 0)
273  return 0;
274 
275  /* Check that all packets have been de-allocated */
276  if (CrFwPcktGetNOfAllocated() != 0)
277  return 0;
278 
279  /* Check application errors */
280  if (CrFwGetAppErrCode() != crNoAppErr)
281  return 0;
282 
283  return 1;
284 }
285 
286 /* ---------------------------------------------------------------------------------------------*/
288  FwSmDesc_t inStream0;
289  CrFwCounterU2_t errRepPosLocal;
290  CrFwPckt_t pckt;
291  CrFwPcktLength_t i, n;
292 
293  /* Reset the error reporting interface */
295 
296  /* Retrieve the first InStream */
297  inStream0 = CrFwInStreamMake(0);
298  if (inStream0 == NULL)
299  return 0;
300 
301  /* Check the initial state of the InStream */
302  if (CrFwCmpIsStarted(inStream0) != 0)
303  return 0;
304 
305  /* Set up stub to simulate absence of packets in the middleware */
307 
308  /* Start and configure the InStream */
309  FwSmStart(inStream0);
310  CrFwCmpInit(inStream0);
311  CrFwCmpReset(inStream0);
312  if (!CrFwInStreamIsInWaiting(inStream0))
313  return 0;
314 
315  /* Set up stub to simulate packets for the host application (i.e. not in transit) */
317  CrFwInStreamStubSetPcktGroup(0); /* First InStream only has one group */
318 
319  /* Set up stub to simulate presence of one packet for the host application */
321 
322  /* Reset the sequence counter of the packets generated by the middleware stub */
324 
325  /* Send PACKET_AVAILABLE command to InStream */
326  CrFwInStreamPcktAvail(inStream0);
327  if (!CrFwInStreamIsInPcktAvail(inStream0))
328  return 0;
329  if (CrFwInStreamGetNOfPendingPckts(inStream0) != 1)
330  return 0;
331  if (CrFwInStreamGetSeqCnt(0) != 1)
332  return 0;
333 
334  /* Set up stub to simulate presence of one more packet in the middleware */
336 
337  /* Set up the stub to simulate a sequence counter error */
339 
340  /* Store the current value of the error report counter */
341  errRepPosLocal = CrFwRepErrStubGetPos();
342 
343  /* Send PACKET_AVAILABLE command to InStream */
344  CrFwInStreamPcktAvail(inStream0);
345  if (!CrFwInStreamIsInPcktAvail(inStream0))
346  return 0;
347  if (CrFwInStreamGetNOfPendingPckts(inStream0) != 2)
348  return 0;
349  if (CrFwInStreamGetSeqCnt(0) != 10)
350  return 0;
351  if (CrFwRepErrStubGetPos() != errRepPosLocal+1)
352  return 0;
354  return 0;
356  return 0;
358  return 0;
360  return 0;
362  return 0;
363 
364  /* Set up stub to simulate presence of a packet in transit in the middleware */
366  CrFwInStreamStubSetPcktGroup(99); /* group should not matter since packet is in transit */
368 
369  /* Set up the stub to simulate a sequence counter error */
371 
372  /* Store the current value of the error report counter */
373  errRepPosLocal = CrFwRepErrStubGetPos();
374 
375  /* Send PACKET_AVAILABLE command to InStream */
376  CrFwInStreamPcktAvail(inStream0);
377  if (!CrFwInStreamIsInPcktAvail(inStream0))
378  return 0;
379  if (CrFwInStreamGetNOfPendingPckts(inStream0) != 3)
380  return 0;
381  if (CrFwInStreamGetSeqCnt(0) != 10)
382  return 0;
383  if (CrFwRepErrStubGetPos() != errRepPosLocal)
384  return 0;
385 
386  /* Collect and release the packets in the packet queue */
387  n = CrFwInStreamGetNOfPendingPckts(inStream0);
388  for (i=0; i<n; i++) {
389  pckt = CrFwInStreamGetPckt(inStream0);
390  if (pckt == NULL)
391  return 0;
392  CrFwPcktRelease(pckt);
393  }
394 
395  /* Set up the stub to simulate the presence of (N+1) packets for the host application */
397  CrFwInStreamStubSetPcktGroup(0); /* First InStream only has one group */
399  CrFwInStreamStubSetPcktSeqCnt(CrFwInStreamGetSeqCnt(0)); /* no seq. cnt. error */
400 
401  /* Store the current value of the error report counter */
402  errRepPosLocal = CrFwRepErrStubGetPos();
403 
404  /* Send PACKET_AVAILABLE command to InStream (this results in a "PQ Full" error */
405  CrFwInStreamPcktAvail(inStream0);
406  if (!CrFwInStreamIsInPcktAvail(inStream0))
407  return 0;
409  return 0;
411  return 0;
412  if (CrFwRepErrStubGetPos() != errRepPosLocal+1)
413  return 0;
415  return 0;
417  return 0;
419  return 0;
420 
421  /* Collect and release the packets in the packet queue */
422  n = CrFwInStreamGetNOfPendingPckts(inStream0);
423  for (i=0; i<n; i++) {
424  pckt = CrFwInStreamGetPckt(inStream0);
425  if (pckt == NULL)
426  return 0;
427  CrFwPcktRelease(pckt);
428  }
429 
430  /* Reset InStream (to ensure that any hanging packets are released) */
431  CrFwCmpReset(inStream0);
432 
433  /* Check that all packets have been released */
434  if (CrFwPcktGetNOfAllocated() != 0)
435  return 0;
436 
437  /* Check application errors */
438  if (CrFwGetAppErrCode() != crNoAppErr)
439  return 0;
440 
441  return 1;
442 }
443 
444 
445 /* ---------------------------------------------------------------------------------------------*/
447  FwSmDesc_t inStream3;
448 
449  /* Create the fourth InStream */
450  inStream3 = CrFwInStreamMake(3);
451  if (inStream3 == NULL)
452  return 0;
453 
454  /* Configure the newly-created InStream */
455  CrFwCmpInit(inStream3);
456  CrFwCmpReset(inStream3);
457  if (!CrFwCmpIsInConfigured(inStream3))
458  return 0;
459 
460  /* Check that the correct source has been loaded */
461  if (CrFwInStreamGetSrc(inStream3, 1) != 4)
462  return 0;
463 
464  /* Shut down the newly-created InStream */
465  CrFwCmpShutdown(inStream3);
466 
467  /* Configure initialization check and action until initialization succeeds */
470  FwSmStart(inStream3);
471  if (!CrFwCmpIsInCreated(inStream3))
472  return 0;
473 
474  CrFwCmpInit(inStream3);
475  if (!CrFwCmpIsInCreated(inStream3))
476  return 0;
477 
480  CrFwCmpInit(inStream3);
481  if (!CrFwCmpIsInCreated(inStream3))
482  return 0;
483 
486  CrFwCmpInit(inStream3);
487  if (!CrFwCmpIsInCreated(inStream3))
488  return 0;
489 
492  CrFwCmpInit(inStream3);
493  if (!CrFwCmpIsInInitialized(inStream3))
494  return 0;
495 
496  /* Configure configuration check and action until configuration succeeds */
499  CrFwCmpReset(inStream3);
500  if (!CrFwCmpIsInInitialized(inStream3))
501  return 0;
502 
505  CrFwCmpReset(inStream3);
506  if (!CrFwCmpIsInInitialized(inStream3))
507  return 0;
508 
511  CrFwCmpReset(inStream3);
512  if (!CrFwCmpIsInInitialized(inStream3))
513  return 0;
514 
517  CrFwCmpReset(inStream3);
518  if (!CrFwCmpIsInConfigured(inStream3))
519  return 0;
520 
521  /* Configure configuration check and action to fail and then check that component reset fails */
523  CrFwCmpReset(inStream3);
524  if (!CrFwCmpIsInInitialized(inStream3))
525  return 0;
526 
527  /* Shut down the InStream */
528  CrFwCmpShutdown(inStream3);
529 
530  /* Check application errors */
531  if (CrFwGetAppErrCode() != crNoAppErr)
532  return 0;
533 
534  return 1;
535 }
536 
537 /* ---------------------------------------------------------------------------------------------*/
539  FwSmDesc_t inStream1;
540 
541  /* Create the second InStream */
542  inStream1 = CrFwInStreamMake(1);
543  if (inStream1 == NULL)
544  return 0;
545 
546  /* Check that InStream is in STARTED state */
547  if (CrFwCmpIsStarted(inStream1) != 1)
548  return 0;
549 
550  /* Set up stub to simulate presence of one packet for the host application */
552  CrFwInStreamStubSetPcktGroup(0); /* Second InStream only has one group */
554 
555  /* Bring InStream to state CONFIGURED */
556  FwSmStart(inStream1);
557  CrFwCmpInit(inStream1);
558  CrFwCmpReset(inStream1);
559  if (!CrFwCmpIsInConfigured(inStream1))
560  return 0;
561 
562  /* Check that InStream is in PCKT_AVAIL */
563  if (!CrFwInStreamIsInPcktAvail(inStream1))
564  return 0;
565 
566  /* Shutdown the newly-created InStream */
567  CrFwCmpShutdown(inStream1);
569  return 0;
570 
571  if (CrFwCmpIsStarted(inStream1) != 0)
572  return 0;
573 
574  /* Check application errors */
575  if (CrFwGetAppErrCode() != crNoAppErr)
576  return 0;
577 
578  return 1;
579 }
580 
581 /* ---------------------------------------------------------------------------------------------*/
583  FwSmDesc_t inStream2;
584  CrFwPckt_t pckt1, pckt2, pckt3;
585  CrFwGroup_t i;
586  CrFwCounterU2_t errRepPosLocal;
587 
588  /* Reset the error reporting interface */
590 
591  /* Store the current value of the error report counter */
592  errRepPosLocal = CrFwRepErrStubGetPos();
593 
594  /* Retrieve the third InStream (this InStream must have two groups) */
595  inStream2 = CrFwInStreamMake(2);
596  if (inStream2 == NULL)
597  return 0;
598 
599  /* Start and configure the InStream */
600  FwSmStart(inStream2);
601  CrFwCmpInit(inStream2);
602  CrFwCmpReset(inStream2);
603  if (!CrFwInStreamIsInWaiting(inStream2))
604  return 0;
605 
606  /* Check value of sequence counters */
607  for (i=0; i<CrFwInStreamGetNOfGroups(); i++)
608  if (CrFwInStreamGetSeqCnt(i) != 0)
609  return 0;
610 
611  /* Set up stub to simulate presence of two packets for the host application belonging to first group */
616 
617  /* Send PACKET_AVAILABLE command to InStream */
618  CrFwInStreamPcktAvail(inStream2);
619  if (!CrFwInStreamIsInPcktAvail(inStream2))
620  return 0;
621  if (CrFwInStreamGetNOfPendingPckts(inStream2) != 2)
622  return 0;
623  if (CrFwInStreamGetSeqCnt(0) != 102)
624  return 0;
625 
626  /* Set up stub to simulate presence of packet for the host application belonging to second group */
631 
632  /* Send PACKET_AVAILABLE command to InStream */
633  CrFwInStreamPcktAvail(inStream2);
634  if (!CrFwInStreamIsInPcktAvail(inStream2))
635  return 0;
636  if (CrFwInStreamGetNOfPendingPckts(inStream2) != 3)
637  return 0;
638  if (CrFwInStreamGetSeqCnt(1) != 201)
639  return 0;
640 
641  /* Send GET_PCKT commands to InStream */
642  pckt1 = CrFwInStreamGetPckt(inStream2);
643  if (!CrFwInStreamIsInPcktAvail(inStream2))
644  return 0;
645  if (CrFwInStreamGetNOfPendingPckts(inStream2) != 2)
646  return 0;
647  if (CrFwPcktGetSeqCnt(pckt1) != 101)
648  return 0;
649 
650  pckt2 = CrFwInStreamGetPckt(inStream2);
651  if (!CrFwInStreamIsInPcktAvail(inStream2))
652  return 0;
653  if (CrFwInStreamGetNOfPendingPckts(inStream2) != 1)
654  return 0;
655  if (CrFwPcktGetSeqCnt(pckt2) != 102)
656  return 0;
657 
658  pckt3 = CrFwInStreamGetPckt(inStream2);
659  if (!CrFwInStreamIsInWaiting(inStream2))
660  return 0;
661  if (CrFwInStreamGetNOfPendingPckts(inStream2) != 0)
662  return 0;
663  if (CrFwPcktGetSeqCnt(pckt3) != 201)
664  return 0;
665 
666  if (CrFwRepErrStubGetPos() != errRepPosLocal)
667  return 0;
668 
669  /* De-allocate packets */
670  CrFwPcktRelease(pckt1);
671  CrFwPcktRelease(pckt2);
672  CrFwPcktRelease(pckt3);
673 
674  /* Set up stub to simulate presence of packet for the host application belonging to non-existent group */
678 
679  /* Send PACKET_AVAILABLE command to InStream */
680  CrFwInStreamPcktAvail(inStream2);
681  if (!CrFwInStreamIsInPcktAvail(inStream2))
682  return 0;
683  if (CrFwInStreamGetNOfPendingPckts(inStream2) != 1)
684  return 0;
685  if (CrFwInStreamGetSeqCnt(0) != 102)
686  return 0;
687  if (CrFwInStreamGetSeqCnt(1) != 201)
688  return 0;
689 
690  if (CrFwRepErrStubGetPos() != errRepPosLocal+1)
691  return 0;
693  return 0;
694 
695  /* Send GET_PCKT command to InStream */
696  pckt1 = CrFwInStreamGetPckt(inStream2);
697  if (!CrFwInStreamIsInWaiting(inStream2))
698  return 0;
699  if (CrFwInStreamGetNOfPendingPckts(inStream2) != 0)
700  return 0;
701 
702  /* De-allocate packets */
703  CrFwPcktRelease(pckt1);
704 
705  /* Shutdown the InStream */
706  CrFwCmpShutdown(inStream2);
707 
708  /* Check that all packets have been de-allocated */
709  if (CrFwPcktGetNOfAllocated() != 0)
710  return 0;
711 
712  /* Check application errors */
713  if (CrFwGetAppErrCode() != crNoAppErr)
714  return 0;
715 
716  return 1;
717 }
CrFwBool_t CrFwCmpIsStarted(FwSmDesc_t smDesc)
Return true if the state machine of the argument component has been started.
Definition: CrFwBaseCmp.c:162
void CrFwCmpInit(FwSmDesc_t smDesc)
Initialize a framework component.
Definition: CrFwBaseCmp.c:112
CrFwBool_t CrFwCmpIsInInitialized(FwSmDesc_t smDesc)
Return true if the argument component is in state INITIALIZED.
Definition: CrFwBaseCmp.c:172
void CrFwCmpShutdown(FwSmDesc_t smDesc)
Shutdown a framework component.
Definition: CrFwBaseCmp.c:122
CrFwBool_t CrFwCmpIsInConfigured(FwSmDesc_t smDesc)
Return true if the argument component is in state CONFIGURED.
Definition: CrFwBaseCmp.c:177
void CrFwCmpReset(FwSmDesc_t smDesc)
Reset a framework component.
Definition: CrFwBaseCmp.c:117
CrFwBool_t CrFwCmpIsInCreated(FwSmDesc_t smDesc)
Return true if the argument component is in state CREATED.
Definition: CrFwBaseCmp.c:167
Definition of Base Component.
Definition of the Framework Component Data (FCD) Type.
unsigned char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:38
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:32
#define CR_FW_INSTREAM_TYPE
Type identifier for the InStream components.
CrFwBool_t CrFwInStreamIsInWaiting(FwSmDesc_t smDesc)
Return true if the argument InStream is in state WAITING.
Definition: CrFwInStream.c:243
CrFwCounterU1_t CrFwInStreamGetNOfSrc(FwSmDesc_t smDesc)
Get the number of packet sources of the argument InStream.
Definition: CrFwInStream.c:236
static CrFwDestSrc_t inStreamSrcPairs[CR_FW_INSTREAM_NOF_SRCS][2]
The association between sources and inSreams.
Definition: CrFwInStream.c:77
CrFwCounterU1_t CrFwInStreamGetPcktQueueSize(FwSmDesc_t smDesc)
Return the size of the packet queue of the InStream.
Definition: CrFwInStream.c:291
CrFwCounterU1_t CrFwInStreamGetNOfPendingPckts(FwSmDesc_t smDesc)
Return the number of packets currently in the packet queue of an InStream.
Definition: CrFwInStream.c:279
CrFwPckt_t CrFwInStreamGetPckt(FwSmDesc_t smDesc)
Retrieve a packet from the InStream.
Definition: CrFwInStream.c:253
CrFwBool_t CrFwInStreamIsInPcktAvail(FwSmDesc_t smDesc)
Return true if the argument InStream is in state PCKT_AVAIL.
Definition: CrFwInStream.c:248
void CrFwInStreamSetSeqCnt(CrFwGroup_t group, CrFwSeqCnt_t seqCnt)
Overwrites the sequence counter value of the last packet for a group.
Definition: CrFwInStream.c:273
CrFwDestSrc_t CrFwInStreamGetSrc(FwSmDesc_t smDesc, CrFwCounterU1_t i)
Get the i-th packet source of the argument InStream.
Definition: CrFwInStream.c:228
FwSmDesc_t CrFwInStreamGet(CrFwDestSrc_t src)
Getter function for the InStream corresponding to the argument source.
Definition: CrFwInStream.c:217
CrFwGroup_t CrFwInStreamGetNOfGroups()
Return the number of groups managed by the InStreams.
Definition: CrFwInStream.c:286
CrFwSeqCnt_t CrFwInStreamGetSeqCnt(CrFwGroup_t group)
Return the value of the sequence counter of the last packet successfully collected by the InStreams f...
Definition: CrFwInStream.c:267
void CrFwInStreamPcktAvail(FwSmDesc_t smDesc)
Query the middleware for available packets and collect them if they are available.
Definition: CrFwInStream.c:262
FwSmDesc_t CrFwInStreamMake(CrFwInstanceId_t i)
Factory function to retrieve the i-th InStream State Machine instance.
Definition: CrFwInStream.c:128
Definition of the InStream component.
void CrFwInStreamStubSetPcktDest(CrFwDestSrc_t d)
Set the value of the destination of the next packet collected (see CrFwInStreamStubPcktCollect).
void CrFwInStreamStubSetPcktSeqCnt(CrFwSeqCnt_t cnt)
Set the value of the sequence counter of the next packet collected (see CrFwInStreamStubPcktCollect).
void CrFwInStreamStubSetActionFlag(CrFwBool_t flag)
Set the value of the action flag which determines the outcome of the initialization or configuration ...
void CrFwInStreamStubSetPcktCollectionCnt(CrFwCounterU1_t cnt)
Set the value of the packet collection counter which defines the number of packets available at the m...
void CrFwInStreamStubSetPcktGroup(CrFwGroup_t group)
Set the value of the group of the next packet collected (see CrFwInStreamStubPcktCollect).
CrFwCounterU1_t CrFwInStreamStubGetShutdownCnt()
Get the value of the shutdown counter (see CrFwInStreamStubShutdown).
void CrFwInStreamStubSetCheckFlag(CrFwBool_t flag)
Set the value of the check flag which determines the outcome of the dummy check of CrFwInStreamStubDu...
Interface for the InStream stub.
CrFwBool_t CrFwInStreamTestCase3()
Test the self-transition on state PCKT_AVAIL and the shutdown of an InStream.
CrFwBool_t CrFwInStreamTestCase1()
Test the initialization and packet queue (PQ) management of the InStream.
CrFwBool_t CrFwInStreamTestCase7()
Test the management of groups by the InStream.
CrFwBool_t CrFwInStreamTestCase6()
Test the function to override the Shutdown Operation of an InStream and to verify entry into PCKT_AVA...
CrFwBool_t CrFwInStreamTestCase5()
Test the InStream with checks and actions which may be configured to succeed or fail.
CrFwBool_t CrFwInStreamTestCase2()
Test the collection of packets from an InStream.
CrFwBool_t CrFwInStreamTestCase4()
Test the error reporting functionalities of an InStream.
Declaration of the test cases for the InStream Component (see CrFwInStream.h).
User-modifiable parameters for the InStream components (see CrFwInStream.h).
#define CR_FW_NOF_INSTREAM
The number of InStream components in the application.
#define CR_FW_INSTREAM_SRC_PAIRS
The association of sources to InStreams.
#define CR_FW_INSTREAM_NOF_SRCS
The number of distinct sources from which the InStream components may receive packets.
static CrFwSeqCnt_t seqCnt[CR_FW_OUTSTREAM_STUB_MEM_LEN]
Sequence counters of most recently received packets.
Interface for creating and accessing a report or command packet.
CrFwSeqCnt_t CrFwPcktGetSeqCnt(CrFwPckt_t pckt)
Return the sequence counter of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:241
CrFwCounterU2_t CrFwPcktGetNOfAllocated()
Return the number of packets which are currently allocated.
Definition: CrFwPckt.c:214
void CrFwPcktRelease(CrFwPckt_t pckt)
Release function for command or report packets.
Definition: CrFwPckt.c:174
CrFwSeqCnt_t CrFwRepErrStubGetActualSeqCnt(CrFwCounterU2_t errRepPos)
Return the actual sequence counter associated to the error report at position errRepPos.
Definition: CrFwRepErr.c:298
void CrFwRepErrStubReset()
Reset the error reporting interface.
Definition: CrFwRepErr.c:84
CrFwInstanceId_t CrFwRepErrStubGetInstanceId(CrFwCounterU2_t errRepPos)
Return the type identifier of the error report at position errRepPos.
Definition: CrFwRepErr.c:277
CrFwSeqCnt_t CrFwRepErrStubGetExpSeqCnt(CrFwCounterU2_t errRepPos)
Return the expected sequence counter associated to the error report at position errRepPos.
Definition: CrFwRepErr.c:292
CrFwCounterU2_t CrFwRepErrStubGetPos()
Return the position in the error report array at which the next error report will be written.
Definition: CrFwRepErr.c:79
CrFwTypeId_t CrFwRepErrStubGetTypeId(CrFwCounterU2_t errRepPos)
Return the type identifier of the error report at position errRepPos.
Definition: CrFwRepErr.c:272
CrFwRepErrCode_t CrFwRepErrStubGetErrCode(CrFwCounterU2_t errRepPos)
Return the error code of the error report at position errRepPos.
Definition: CrFwRepErr.c:267
Interface for reporting an error detected by a framework component.
The CORDET Framework defines an interface for generating error reports (see CrFwRepErr....
Interface through which framework components access the current time.
unsigned int CrFwSeqCnt_t
Type used for the sequence counter of commands or reports.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
unsigned short CrFwCounterU2_t
Type used for unsigned integers with a "medium" range.
unsigned char CrFwCounterU1_t
Type used for unsigned integers with a "short" range.
unsigned short int CrFwPcktLength_t
Type for the packet length.
unsigned char CrFwGroup_t
Type used for the destination or source group of a packet.
@ crInStreamSCErr
An InStream has encountered a sequence counter error (see CrFwInStream.h)
@ crInStreamIllGroup
An incoming command or report has an illegal group.
@ crInStreamPQFull
The packet queue of an InStream is full (see CrFwInStream.h)
@ crInStreamUndefDest
A framework function has been called with a source attribute which is not associated to any InStream.
@ crNoAppErr
No application errors have been detected.
@ crInStreamIllId
A framework function has been called with an illegal InStream identifier.
#define CR_FW_HOST_APP_ID
The identifier of the host application (i.e.
unsigned short CrFwInstanceId_t
Type used for instance identifiers.
CrFwAppErrCode_t CrFwGetAppErrCode()
Return the value of the application error code.
void CrFwSetAppErrCode(CrFwAppErrCode_t errCode)
Set the value of the application error code (see CrFwGetAppErrCode).
Definition of the utility functions for the CORDET Framework.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved