CORDET Framework - C2 Implementation
CrPsServiceVeriTestCases.c
1 
21 /* Include FW Profile files */
22 #include "FwSmConstants.h"
23 #include "FwSmConfig.h"
24 #include "FwSmCore.h"
25 #include "FwPrConfig.h"
26 #include "FwPrCore.h"
27 #include "FwPrConstants.h"
28 /* Include configuration files */
29 #include "CrFwInStreamUserPar.h" /* TODO: CrPsInStreamUserPar.h" */
30 #include "CrFwOutRegistryUserPar.h" /* TODO: CrPsOutRegistryUserPar.h */
31 #include "CrFwOutFactoryUserPar.h"
32 /* Include framework files */
33 #include "CrFwCmpData.h"
35 #include "BaseCmp/CrFwBaseCmp.h"
36 #include "Pckt/CrFwPckt.h"
37 #include "InCmd/CrFwInCmd.h"
40 #include "CrFwTime.h"
41 #include "CrFwRepErr.h"
43 
46 #include <CrPsPkt.h>
48 
49 /* Include system files */
50 #include <stdlib.h>
51 #include <unistd.h>
52 
53 
54 /* ---------------------------------------------------------------------------------------------*/
56 {
57  /* Check Service 1 */
58  unsigned short i;
59  FwSmDesc_t inFactory, outFactory, outManager, inCmd, outCmp, outCmpArr[CR_FW_OUTFACTORY_MAX_NOF_OUTCMP], inRep, inManager;
60  CrFwPckt_t pckt, pckt2;
62  CrFwOutManagerData_t* outManagerCSData;
63  unsigned short ACK_WRONG_CHKSM = 1002, pcktID;
64 
65  /* run all getters for the procedure descriptors */
68 
69  /* Instantiate the OutFactory, InFactory, OutManager */
70  outFactory = CrFwOutFactoryMake();
71  if (outFactory == NULL)
72  return 0;
73  if (FwSmCheckRec(outFactory) != smSuccess)
74  return 0;
75 
76  inFactory = CrFwInFactoryMake();
77  if (inFactory == NULL)
78  return 0;
79  if (FwSmCheckRec(inFactory) != smSuccess)
80  return 0;
81 
82  outManager = CrFwOutManagerMake(0);
83  if (outManager == NULL)
84  return 0;
85  if (FwSmCheckRec(outManager) != smSuccess)
86  return 0;
87 
88  inManager = CrFwInManagerMake(0);
89  if (inManager == NULL)
90  return 0;
91  if (FwSmCheckRec(inManager) != smSuccess)
92  return 0;
93 
94  /* Initialize and Configure OutFactory and check success */
95  CrFwCmpInit(outFactory);
96  CrFwCmpReset(outFactory);
97  if (!CrFwCmpIsInConfigured(outFactory))
98  return 0;
99 
100  /* Initialize and Configure InFactory and check success */
101  CrFwCmpInit(inFactory);
102  CrFwCmpReset(inFactory);
103  if (!CrFwCmpIsInConfigured(inFactory))
104  return 0;
105 
106  /* Initialize and Configure OutManager and check success */
107  CrFwCmpInit(outManager);
108  CrFwCmpReset(outManager);
109  if (!CrFwCmpIsInConfigured(outManager))
110  return 0;
111 
112  /* Initialize and Configure InManager and check success */
113  CrFwCmpInit(inManager);
114  CrFwCmpReset(inManager);
115  if (!CrFwCmpIsInConfigured(inManager))
116  return 0;
117 
118  /* Check if number of Allocated Packets = 0*/
119  if (CrFwPcktGetNOfAllocated() != 0)
120  return 0;
121 
122  /* Allocate a 17,1 Packet */
123  pckt = CrFwPcktMake(100);
124  CrFwPcktSetServType(pckt,17);
125  CrFwPcktSetServSubType(pckt,1);
126  CrFwPcktSetDiscriminant(pckt,0);
128  CrFwPcktSetCmdRepId(pckt,0);
129  CrFwPcktSetSrc(pckt,0);
130  CrFwPcktSetDest(pckt,0);
131  CrFwPcktSetGroup(pckt,1);
132  CrFwPcktSetAckLevel(pckt,1,1,1,1);
133  CrFwPcktSetSeqCnt(pckt,2);
134 
135  /* Getting the Packet ID so that we can check that in the datapool later */
136  pcktID = getTmHeaderAPID(pckt);
137 
138  /* Check if number of Allocated Packets now is 1 */
139  if (CrFwPcktGetNOfAllocated() != 1)
140  return 0;
141 
142  /* Check if number of Allocated InCommands = 0 */
144  return 0;
145 
146  /*Creating an InCommand out of the 17,1 packet*/
147  inCmd = CrFwInFactoryMakeInCmd(pckt);
148 
149  /*Check if number of Allocated InCommands is now 1*/
151  return 0;
152 
153  /* Check the type identifier */
155  return 0;
156 
157  /* Check type and sub-type of the InCommand*/
158  if (CrFwInCmdGetServType(inCmd) != 17)
159  return 0;
160  if (CrFwInCmdGetServSubType(inCmd) != 1)
161  return 0;
162 
163  /*check that the InCommand is in ACCEPTED state*/
164  if (!CrFwInCmdIsInAccepted(inCmd))
165  return 0;
166 
167  /* Check if number of Allocated OutComponents = 0*/
169  return 0;
170 
171  /* Successful Acceptance Verification Report*/
172  /* Standard Check Service (1,1) */
174 
175  /* Check if number of Allocated OutComponents = 1*/
177  return 0;
178 
179  /* Check if number of loaded OutComponents in the OutManager = 1*/
180  if (CrFwOutManagerGetNOfLoadedOutCmp(outManager) != 1)
181  return 0;
182 
183  /* Get the Data from the out Manager */
184  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
185  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
186  outCmp = outManagerCSData->pocl[CrFwOutManagerGetNOfLoadedOutCmp(outManager)-1];
187 
188  /* Check if there is a 1,1 Report waitig in the OutManager (loaded) */
189  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
190  return 0;
191  if (CrFwOutCmpGetServType(outCmp) != 1)
192  return 0;
193  if (CrFwOutCmpGetServSubType(outCmp) != 1)
194  return 0;
195 
196  /*Release the OutComponent*/
198 
199  /* Check if number of Allocated OutComponents now is 0 */
201  return 0;
202 
203  /* Check that all DataPool Variables concerning (1,2) are initially 0 */
204  if (getDpfailCodeAccFailed() != 0)
205  return 0;
206  if (getDpnOfAccFailed() != 0)
207  return 0;
208  if (getDppcktIdAccFailed() != 0)
209  return 0;
210 
211  /* Failed Acceptance Verificatin Report */
212  /* Standard Check Service (1,2) */
214 
215  /* Check if number of Allocated OutComponents = 1*/
217  return 0;
218 
219  /* Check if number of loaded OutComponents in the OutManager = 2*/
220  if (CrFwOutManagerGetNOfLoadedOutCmp(outManager) != 2)
221  return 0;
222 
223  /* Check that all DataPool Variables concerning (1,2) are updated */
224  if (getDpfailCodeAccFailed() != 2) /* TODO ist es richtig dass hier 2 rein gehört als failure code ??*/
225  return 0;
226  if (getDpnOfAccFailed() != 1)
227  return 0;
228  if (getDppcktIdAccFailed() != pcktID)
229  return 0;
230 
231  /* Get the Data from the out Manager */
232  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
233  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
234  outCmp = outManagerCSData->pocl[CrFwOutManagerGetNOfLoadedOutCmp(outManager)-1];
235 
236  /* Check if there is a 1,2 Report waitig in the OutManager (loaded) */
237  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
238  return 0;
239  if (CrFwOutCmpGetServType(outCmp) != 1)
240  return 0;
241  if (CrFwOutCmpGetServSubType(outCmp) != 2)
242  return 0;
243 
244  /*Release the OutComponent*/
246 
247  /* Check if number of Allocated OutComponents now is 0 */
249  return 0;
250 
251  /*Successful Start of Execution Verification Report*/
252  /*Standard Check Service (1,3)*/
254 
255  /* Check if number of Allocated OutComponents = 1*/
257  return 0;
258 
259  /* Check if number of loaded OutComponents in the OutManager = 3*/
260  if (CrFwOutManagerGetNOfLoadedOutCmp(outManager) != 3)
261  return 0;
262 
263  /* Get the Data from the out Manager */
264  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
265  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
266  outCmp = outManagerCSData->pocl[CrFwOutManagerGetNOfLoadedOutCmp(outManager)-1];
267 
268  /* Check if there is a 1,3 Report waitig in the OutManager (loaded) */
269  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
270  return 0;
271  if (CrFwOutCmpGetServType(outCmp) != 1)
272  return 0;
273  if (CrFwOutCmpGetServSubType(outCmp) != 3)
274  return 0;
275 
276  /*Release the OutComponent*/
278 
279  /* Check if number of Allocated OutComponents now is 0 */
281  return 0;
282 
283  /* Check that all DataPool Variables concerning (1,4) are initially 0 */
284  if (getDpfailCodeStartFailed() != 0)
285  return 0;
286  if (getDpnOfStartFailed() != 0)
287  return 0;
288  if (getDppcktIdStartFailed() != 0)
289  return 0;
290 
291  /* Failed Start of Execution Verification Report */
292  /* Standard Check Service (1,4) */
293  SendReqVerifCmdFailRep(inCmd, CRPS_REQVERIF_START_FAIL, ACK_WRONG_CHKSM);
294 
295  /* Check if number of Allocated OutComponents = 1*/
297  return 0;
298 
299  /* Check if number of loaded OutComponents in the OutManager = 4*/
300  if (CrFwOutManagerGetNOfLoadedOutCmp(outManager) != 4)
301  return 0;
302 
303  /* Check that all DataPool Variables concerning (1.4) are updated */
304  if (getDpfailCodeStartFailed() != ACK_WRONG_CHKSM)
305  return 0;
306  if (getDpnOfStartFailed() != 1)
307  return 0;
308  if (getDppcktIdStartFailed() != pcktID)
309  return 0;
310 
311  /* Get the Data from the out Manager */
312  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
313  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
314  outCmp = outManagerCSData->pocl[CrFwOutManagerGetNOfLoadedOutCmp(outManager)-1];
315 
316  /* Check if there is a 1,4 Report waitig in the OutManager (loaded) */
317  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
318  return 0;
319  if (CrFwOutCmpGetServType(outCmp) != 1)
320  return 0;
321  if (CrFwOutCmpGetServSubType(outCmp) != 4)
322  return 0;
323 
324  /*Release the OutComponent*/
326 
327  /* Check if number of Allocated OutComponents now is 0 */
329  return 0;
330 
331  /* Successful Progress of Execution Verification Report */
332  /* Standard Check Service (1,5) */
334 
335  /* Check if number of Allocated OutComponents = 1*/
337  return 0;
338 
339  /* Check if number of loaded OutComponents in the OutManager = 5*/
340  if (CrFwOutManagerGetNOfLoadedOutCmp(outManager) != 5)
341  return 0;
342 
343  /* Get the Data from the out Manager */
344  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
345  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
346  outCmp = outManagerCSData->pocl[CrFwOutManagerGetNOfLoadedOutCmp(outManager)-1];
347 
348  /* Check if there is a 1.5 Report waitig in the OutManager (loaded) */
349  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
350  return 0;
351  if (CrFwOutCmpGetServType(outCmp) != 1)
352  return 0;
353  if (CrFwOutCmpGetServSubType(outCmp) != 5)
354  return 0;
355 
356  /*Release the OutComponent*/
358 
359  /* Check if number of Allocated OutComponents now is 0 */
361  return 0;
362 
363  /* Check that all DataPool Variables concerning (1,6) are initially 0 */
364  if (getDpfailCodePrgrFailed() != 0)
365  return 0;
366  if (getDpnOfPrgrFailed() != 0)
367  return 0;
368  if (getDppcktIdPrgrFailed() != 0)
369  return 0;
370  if (getDpstepPrgrFailed() != 0)
371  return 0;
372 
373  /* Failed Progress of Execution Verification Report */
374  /* Standard Check Service (1,6) */
375  SendReqVerifPrgrFailRep(inCmd, CRPS_REQVERIF_PROG_FAIL, ACK_WRONG_CHKSM);
376 
377  /* Check if number of Allocated OutComponents = 1*/
379  return 0;
380 
381  /* Check if number of loaded OutComponents in the OutManager = 6*/
382  if (CrFwOutManagerGetNOfLoadedOutCmp(outManager) != 6)
383  return 0;
384 
385  /* Check that all DataPool Variables concerning (1.6) are updated */
386  if (getDpfailCodePrgrFailed() != ACK_WRONG_CHKSM)
387  return 0;
388  if (getDpnOfPrgrFailed() != 1)
389  return 0;
390  if (getDppcktIdPrgrFailed() != pcktID)
391  return 0;
392  if (getDpstepPrgrFailed() != 6)
393  return 0;
394 
395  /* Get the Data from the out Manager */
396  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
397  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
398  outCmp = outManagerCSData->pocl[CrFwOutManagerGetNOfLoadedOutCmp(outManager)-1];
399 
400  /* Check if there is a 1,6 Report waitig in the OutManager (loaded) */
401  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
402  return 0;
403  if (CrFwOutCmpGetServType(outCmp) != 1)
404  return 0;
405  if (CrFwOutCmpGetServSubType(outCmp) != 6)
406  return 0;
407 
408  /*Release the OutComponent*/
410 
411  /* Check if number of Allocated OutComponents now is 0 */
413  return 0;
414 
415  /* Successful Completion of Execution Verification Report */
416  /* Standard Check Service (1,7) */
418 
419  /* Check if number of Allocated OutComponents = 1*/
421  return 0;
422 
423  /* Check if number of loaded OutComponents in the OutManager = 7*/
424  if (CrFwOutManagerGetNOfLoadedOutCmp(outManager) != 7)
425  return 0;
426 
427  /* Get the Data from the out Manager */
428  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
429  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
430  outCmp = outManagerCSData->pocl[CrFwOutManagerGetNOfLoadedOutCmp(outManager)-1];
431 
432  /* Check if there is a 1.7 Report waitig in the OutManager (loaded) */
433  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
434  return 0;
435  if (CrFwOutCmpGetServType(outCmp) != 1)
436  return 0;
437  if (CrFwOutCmpGetServSubType(outCmp) != 7)
438  return 0;
439 
440  /*Release the OutComponent*/
442 
443  /* Check if number of Allocated OutComponents now is 0 */
445  return 0;
446 
447  /* Check that all DataPool Variables concerning (1,8) are initially 0 */
448  if (getDpfailCodeTermFailed() != 0)
449  return 0;
450  if (getDpnOfTermFailed() != 0)
451  return 0;
452  if (getDppcktIdTermFailed() != 0)
453  return 0;
454 
455  /* Failed Completion of Execution Verification Report */
456  /* Standard Check Service (1,8) */
457  SendReqVerifCmdFailRep(inCmd, CRPS_REQVERIF_TERM_FAIL, ACK_WRONG_CHKSM);
458 
459  /* Check if number of Allocated OutComponents = 1*/
461  return 0;
462 
463  /* Check if number of loaded OutComponents in the OutManager = 8*/
464  if (CrFwOutManagerGetNOfLoadedOutCmp(outManager) != 8)
465  return 0;
466 
467  /* Check that all DataPool Variables concerning (1,8) are updated */
468  if (getDpfailCodeTermFailed() != ACK_WRONG_CHKSM)
469  return 0;
470  if (getDpnOfTermFailed() != 1)
471  return 0;
472  if (getDppcktIdTermFailed() != pcktID)
473  return 0;
474 
475  /* Get the Data from the out Manager */
476  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
477  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
478  outCmp = outManagerCSData->pocl[CrFwOutManagerGetNOfLoadedOutCmp(outManager)-1];
479 
480  /* Check if there is a 1.8 Report waitig in the OutManager (loaded) */
481  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
482  return 0;
483  if (CrFwOutCmpGetServType(outCmp) != 1)
484  return 0;
485  if (CrFwOutCmpGetServSubType(outCmp) != 8)
486  return 0;
487 
488  /*Release the OutComponent*/
490 
491  /* Check if number of Allocated OutComponents now is 0 */
493  return 0;
494 
495  /* Check that all DataPool Variables concerning (1,10) are initially 0 */
496  if (getDpinvDestRerouting() != 0)
497  return 0;
498  if (getDpnOfReroutingFailed() != 0)
499  return 0;
500  if (getDppcktIdReroutingFailed() != 0)
501  return 0;
502 
503  /* Failed Rerouting Verification Report */
504  /* Standard Check Service (1,10) */
505  SendReqVerifPcktReroutFailRep(inCmd, ACK_WRONG_CHKSM);
506 
507  /* Check if number of Allocated OutComponents = 1*/
509  return 0;
510 
511  /* Check if number of loaded OutComponents in the OutManager = 9*/
512  if (CrFwOutManagerGetNOfLoadedOutCmp(outManager) != 9)
513  return 0;
514 
515  /* Check that all DataPool Variables concerning (1.10) are updated */
516  if (getDpinvDestRerouting() != ACK_WRONG_CHKSM)
517  return 0;
518  if (getDpnOfReroutingFailed() != 1)
519  return 0;
520  if (getDppcktIdReroutingFailed() != pcktID)
521  return 0;
522 
523  /* Get the Data from the out Manager */
524  outManagerData = (CrFwCmpData_t*)FwSmGetData(outManager);
525  outManagerCSData = (CrFwOutManagerData_t*)outManagerData->cmpSpecificData;
526  outCmp = outManagerCSData->pocl[CrFwOutManagerGetNOfLoadedOutCmp(outManager)-1];
527 
528  /* Check if there is a 1,10 Report waitig in the OutManager (loaded) */
529  if (CrFwCmpGetTypeId(outCmp) != CR_FW_OUTCMP_TYPE)
530  return 0;
531  if (CrFwOutCmpGetServType(outCmp) != 1)
532  return 0;
533  if (CrFwOutCmpGetServSubType(outCmp) != 10)
534  return 0;
535 
536  /* Checking OutComponent Desicions of the Guards (1,2 and 1,10) */
537  /* Extended Check Service (1,2) for an OutComponent (no 1,2 should be created!) */
539 
540  /* Check if number of loaded OutComponents in the OutManager stays at 9 */
541  if (CrFwOutManagerGetNOfLoadedOutCmp(outManager) != 9)
542  return 0;
543 
544  /* Extended Check Service (1,10) for an OutComponent (no 1,10 should be created!) */
545  SendReqVerifPcktReroutFailRep(outCmp, ACK_WRONG_CHKSM);
546 
547  /* Check if number of loaded OutComponents in the OutManager stays at 9 */
548  if (CrFwOutManagerGetNOfLoadedOutCmp(outManager) != 9)
549  return 0;
550 
551  /* Release the OutComponent */
553 
554  /* Check if number of Allocated OutComponents now is 0 */
556  return 0;
557 
558  /* Checking REPORT Desicions of the Guards (1,2 and 1,10) */
559  /* allocate an 17,2 in Report */
560  pckt2 = CrFwPcktMake(100);
561  CrFwPcktSetServType(pckt2,17);
562  CrFwPcktSetServSubType(pckt2,2);
563  CrFwPcktSetDiscriminant(pckt2,0);
564  CrFwPcktSetAckLevel(pckt2, 0,0,0,0);
565  CrFwPcktSetSrc(pckt2,0);
566  CrFwPcktSetDest(pckt2,0);
567 
568  /* Check if number of Allocated Packets now is 2*/
569  if (CrFwPcktGetNOfAllocated() != 2)
570  return 0;
571 
572  /* Check if number of Allocated InReports now is 0 */
574  return 0;
575 
576  /* create an InReport from pckt2 (17,2) */
577  inRep = CrFwInFactoryMakeInRep(pckt2);
578 
579  /* Check if number of Allocated InReports now is 1 */
581  return 0;
582 
583  /* Extended Check Service (1,2) for an InReport (no 1,2 should be created!) */
585 
586  /* Check if number of Allocated OutComponents = 0*/
588  return 0;
589 
590  /* Check if number of loaded OutComponents in the OutManager stays at 9 */
591  if (CrFwOutManagerGetNOfLoadedOutCmp(outManager) != 9)
592  return 0;
593 
594  /* Extended Check Service (1,10) for an InReport (no 1,10 should be created!) */
595  SendReqVerifPcktReroutFailRep(inRep, ACK_WRONG_CHKSM);
596 
597  /* Check if number of Allocated OutComponents = 0*/
599  return 0;
600 
601  /* Check if number of loaded OutComponents in the OutManager stays at 9*/
602  if (CrFwOutManagerGetNOfLoadedOutCmp(outManager) != 9)
603  return 0;
604 
605  /*Fill the outfactory so that an Error could occur (leave no free slot)*/
606  for (i=0;i<=CR_FW_OUTFACTORY_MAX_NOF_OUTCMP-1;i++)
607  {
608  outCmpArr[i] = CrFwOutFactoryMakeOutCmp(17,2,0,0);
609  }
610 
611  /* Check if no Application Error has occured*/
612  if (CrFwGetAppErrCode() != 0)
613  return 0;
614 
615  /*Extended Check Service (1,1) no free slots in the OutFactory! Application Error should be 10*/
617 
618  /* Check if Application Error 10 has occured (An OutComponent allocation request has failed)*/
620  return 0;
621 
622  /* Set the Application Error to 0 and check it*/
624  if (CrFwGetAppErrCode() != 0)
625  return 0;
626 
627  /*Extended Check Service (1,2) no free slots i the OutFactory! Application Error should be 10*/
629 
630  /* Check if Application Error 10 has occured (An OutComponent allocation request has failed)*/
632  return 0;
633 
634  /* Set the Application Error to 0 and check it*/
636  if (CrFwGetAppErrCode() != 0)
637  return 0;
638 
639  /*Extended Check Service (1,3) no free slots i the OutFactory! Application Error should be 10*/
641 
642  /* Check if Application Error 10 has occured (An OutComponent allocation request has failed)*/
644  return 0;
645 
646  /* Set the Application Error to 0 and check it*/
648  if (CrFwGetAppErrCode() != 0)
649  return 0;
650 
651  /*Extended Check Service (1,4) no free slots i the OutFactory! Application Error should be 10*/
652  SendReqVerifCmdFailRep(inCmd, CRPS_REQVERIF_START_FAIL, ACK_WRONG_CHKSM);
653 
654  /* Check if Application Error 10 has occured (An OutComponent allocation request has failed)*/
656  return 0;
657 
658  /* Set the Application Error to 0 and check it*/
660  if (CrFwGetAppErrCode() != 0)
661  return 0;
662 
663  /*Extended Check Service (1,5) no free slots i the OutFactory! Application Error should be 10*/
665 
666  /* Check if Application Error 10 has occured (An OutComponent allocation request has failed)*/
668  return 0;
669 
670  /* Set the Application Error to 0 and check it*/
672  if (CrFwGetAppErrCode() != 0)
673  return 0;
674 
675  /*Extended Check Service (1,6) no free slots i the OutFactory! Application Error should be 10*/
676  SendReqVerifPrgrFailRep(inCmd, CRPS_REQVERIF_PROG_FAIL, ACK_WRONG_CHKSM);
677 
678  /* Check if Application Error 10 has occured (An OutComponent allocation request has failed)*/
680  return 0;
681 
682  /* Set the Application Error to 0 and check it*/
684  if (CrFwGetAppErrCode() != 0)
685  return 0;
686 
687  /*Extended Check Service (1,7) no free slots i the OutFactory! Application Error should be 10*/
689 
690  /* Check if Application Error 10 has occured (An OutComponent allocation request has failed)*/
692  return 0;
693 
694  /* Set the Application Error to 0 and check it*/
696  if (CrFwGetAppErrCode() != 0)
697  return 0;
698 
699  /*Extended Check Service (1,8) no free slots i the OutFactory! Application Error should be 10*/
700  SendReqVerifCmdFailRep(inCmd, CRPS_REQVERIF_TERM_FAIL, ACK_WRONG_CHKSM);
701 
702  /* Check if Application Error 10 has occured (An OutComponent allocation request has failed)*/
704  return 0;
705 
706  /* Set the Application Error to 0 and check it*/
708  if (CrFwGetAppErrCode() != 0)
709  return 0;
710 
711  /*Extended Check Service (1,10) no free slots i the OutFactory! Application Error should be 10*/
712  SendReqVerifPcktReroutFailRep(inCmd, ACK_WRONG_CHKSM);
713 
714  /* Check if Application Error 10 has occured (An OutComponent allocation request has failed)*/
716  return 0;
717 
718  /* Release all outcomponents, that have been created to fill the outfactory */
719  for (i=0;i<=CR_FW_OUTFACTORY_MAX_NOF_OUTCMP-1;i++)
720  {
721  CrFwOutFactoryReleaseOutCmp(outCmpArr[i]);
722  }
723 
724  /* Set the Application Error to 0 and check it*/
726  if (CrFwGetAppErrCode() != 0)
727  return 0;
728 
729  /* Reset OutManager and check that all OutComponents are unloaded and released */
730  CrFwCmpReset(outManager);
732  if (CrFwOutManagerGetNOfPendingOutCmp(outManager) != 0)
733  return 0;
734 
735  /* Reset InManager and check that all InComponents are unloaded and released */
736  CrFwCmpReset(inManager);
737  if (CrFwOutManagerGetNOfPendingOutCmp(inManager) != 0)
738  return 0;
739 
740  /* Reset the OutFactory and check that no OutComponents are allocated */
741  CrFwCmpReset(outFactory);
743  return 0;
744 
745  /* Reset the InFactory and check that no InCommands are allocated */
746  CrFwCmpReset(inFactory);
748  return 0;
749 
750  /* Check application errors */
751  if (CrFwGetAppErrCode() != crNoAppErr)
752  return 0;
753 
754  /* Check datapool entries */
755  if (getDpfailCodeAccFailed() != 2)
756  return 0;
757  if (getDpnOfAccFailed() != 1)
758  return 0;
759  if (getDppcktIdAccFailed() != pcktID)
760  return 0;
761  if (getDpfailCodeStartFailed() != ACK_WRONG_CHKSM)
762  return 0;
763  if (getDpnOfStartFailed() != 1)
764  return 0;
765  if (getDppcktIdStartFailed() != pcktID)
766  return 0;
767  if (getDpfailCodePrgrFailed() != ACK_WRONG_CHKSM)
768  return 0;
769  if (getDpnOfPrgrFailed() != 1)
770  return 0;
771  if (getDppcktIdPrgrFailed() != pcktID)
772  return 0;
773  if (getDpstepPrgrFailed() != 6)
774  return 0;
775  if (getDpfailCodeTermFailed() != ACK_WRONG_CHKSM)
776  return 0;
777  if (getDpnOfTermFailed() != 1)
778  return 0;
779  if (getDppcktIdTermFailed() != pcktID)
780  return 0;
781  if (getDpinvDestRerouting() != ACK_WRONG_CHKSM)
782  return 0;
783  if (getDpnOfReroutingFailed() != 1)
784  return 0;
785  if (getDppcktIdReroutingFailed() != pcktID)
786  return 0;
787 
788  return 1;
789 }
Type for the Framework Component Data (FCD).
Interface through which framework components access the current time.
CrFwCounterU4_t i
CrPsCmd5EidStart function definitions.
#define CR_FW_OUTCMP_TYPE
Type identifier for the OutComponent components.
CrFwTypeId_t CrFwCmpGetTypeId(FwSmDesc_t smDesc)
Return the type identifier of the argument component.
Definition: CrFwBaseCmp.c:156
void CrFwCmpInit(FwSmDesc_t smDesc)
Initialize a framework component.
Definition: CrFwBaseCmp.c:112
#define CRPS_REQVERIF_ACC_SUCC
Subtype identifier of the Request Verification Acceptance Successful out-going report packet...
Definition: CrPsConstants.h:85
void CrFwPcktSetServType(CrFwPckt_t pckt, CrFwServType_t servType)
Set the service type of the command or report encapsulated in a packet.
static FwSmDesc_t outCmp[CR_FW_OUTFACTORY_MAX_NOF_OUTCMP]
The pre-allocated OutComponent instances.
#define CRPS_REQVERIF_PROG_FAIL
Subtype identifier of the Request Verification Progress Failed out-going report packet.
CrFwBool_t CrFwCmpIsInConfigured(FwSmDesc_t smDesc)
Return true if the argument component is in state CONFIGURED.
Definition: CrFwBaseCmp.c:177
void CrFwSetAppErrCode(CrFwAppErrCode_t errCode)
Set the value of the application error code (see CrFwGetAppErrCode).
#define CRPS_REQVERIF_START_SUCC
Subtype identifier of the Request Verification Start Successful out-going report packet.
Definition: CrPsConstants.h:95
static FwSmDesc_t inFactory
The singleton instance of the InFactory.
void CrFwPcktSetSrc(CrFwPckt_t pckt, CrFwDestSrc_t src)
Set the source of the command or report encapsulated in a packet.
#define CR_FW_OUTFACTORY_MAX_NOF_OUTCMP
The maximum number of OutComponents which may be allocated at any one time.
#define CRPS_REQVERIF_ACC_FAIL
Subtype identifier of the Request Verification Acceptance Failed out-going report packet...
Definition: CrPsConstants.h:90
Definition of the OutFactory component.
An OutComponent allocation request has failed (see CrFwOutFactoryMakeOutCmp).
CrFwPckt_t CrFwPcktMake(CrFwPcktLength_t pcktLength)
Make function for command or report packets.
Header file to define all service and packet identifiers.
static CrFwCounterU4_t getDpnOfTermFailed()
Gets the value of the datapool item nOfTermFailed.
void CrFwPcktSetCmdRepId(CrFwPckt_t pckt, CrFwInstanceId_t id)
Set the command or report identifier in the command or report encapsulated in a packet.
static CrFwCmpData_t outManagerData[CR_FW_NOF_OUTMANAGER]
The data structures for the OutManager State Machines and their Procedures.
FwSmDesc_t CrFwOutManagerMake(CrFwInstanceId_t i)
Factory function to retrieve the i-th OutManager State Machine instance.
Interface for creating and accessing a report or command packet.
static CrFwTypeId_t getDppcktIdPrgrFailed()
Gets the value of the datapool item pcktIdPrgrFailed.
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:30
CrFwServType_t CrFwOutCmpGetServType(FwSmDesc_t smDesc)
Return the type of the OutComponent.
Definition: CrFwOutCmp.c:230
static CrPsDestSrc_t getDpinvDestRerouting()
Gets the value of the datapool item invDestRerouting.
Definition of the OutRegistry Component.
void CrFwPcktSetCmdRepType(CrFwPckt_t pckt, CrFwCmdRepType_t type)
Set the type of a packet (either a command packet or a report packet).
static CrPsFailCode_t getDpfailCodeTermFailed()
Gets the value of the datapool item failCodeTermFailed.
static CrFwTypeId_t getDppcktIdAccFailed()
Gets the value of the datapool item pcktIdAccFailed.
#define CRPS_REQVERIF_TERM_SUCC
Subtype identifier of the Request Verification Termination Successful out-going report packet...
void CrFwPcktSetSeqCnt(CrFwPckt_t pckt, CrFwSeqCnt_t seqCnt)
Set the sequence counter of the command or report encapsulated in a packet.
static CrPsStepId_t getDpstepPrgrFailed()
Gets the value of the datapool item stepPrgrFailed.
#define CRPS_REQVERIF_PROG_SUCC
Subtype identifier of the Request Verification Progress Successful out-going report packet...
Command type.
Definition: CrFwConstants.h:41
CrFwServType_t CrFwInCmdGetServSubType(FwSmDesc_t smDesc)
Return the sub-type of the InCommand.
Definition: CrFwInCmd.c:344
CrFwCounterU2_t CrFwOutManagerGetNOfLoadedOutCmp(FwSmDesc_t smDesc)
Return the number of OutComponents successfully loaded in the POCL of an OutManager since the OutMana...
void SendReqVerifAccSuccRep(FwSmDesc_t smDesc, uint16_t reqVerifAccSuccType)
Generate a Request Verification Acceptance/Start/Termination Successful out-going report...
static FwSmDesc_t outFactory
The singleton instance of the OutFactory.
CrFwBool_t CrFwInCmdIsInAccepted(FwSmDesc_t smDesc)
Return true if the argument InCommand is in state ACCEPTED.
Definition: CrFwInCmd.c:164
Interface for reporting an error detected by a framework component.
void SendReqVerifPcktReroutFailRep(FwSmDesc_t smDesc, CrPsFailCode_t FailureCode)
Generate a Request Verification Package Rerouting Failed out-going report.
static CrFwCounterU4_t getDpnOfStartFailed()
Gets the value of the datapool item nOfStartFailed.
void CrFwPcktSetGroup(CrFwPckt_t pckt, CrFwGroup_t group)
Set the group of the command/report encapsulated in a packet.
Interface for accessing data pool items.
CrFwServType_t CrFwOutCmpGetServSubType(FwSmDesc_t smDesc)
Return the sub-type of the OutComponent.
Definition: CrFwOutCmp.c:244
CrFwBool_t CrPsServVeriTestCase1()
Test the Service 1 Request Verification.
#define CRPS_REQVERIF_TERM_FAIL
Subtype identifier of the Request Verification Termination Failed out-going report packet...
FwSmDesc_t CrFwInManagerMake(CrFwInstanceId_t i)
Factory function to retrieve the i-th InManager State Machine instance.
Definition: CrFwInManager.c:96
static Eleven_Bit_t getTmHeaderAPID(void *p)
Get "APID" from "TmHeader" packet.
Definition: CrPsPkt.h:695
void * cmpSpecificData
Derived data which are specific to each type of framework component.
void CrFwPcktSetAckLevel(CrFwPckt_t pckt, CrFwBool_t accept, CrFwBool_t start, CrFwBool_t progress, CrFwBool_t term)
Set the acknowledge level for the command encapsulated in a packet.
Definition of the InFactory component.
static CrFwCounterU4_t getDpnOfAccFailed()
Gets the value of the datapool item nOfAccFailed.
static FwSmDesc_t inRep[CR_FW_INFACTORY_MAX_NOF_INREP]
The pre-allocated InReport instances.
Definition: CrFwInFactory.c:61
#define CR_FW_INCOMMAND_TYPE
Type identifier for the InCommand component.
#define CRPS_REQVERIF_START_FAIL
Subtype identifier of the Request Verification Start Failed out-going report packet.
Definition of the utility functions for the CORDET Framework.
void CrFwPcktSetServSubType(CrFwPckt_t pckt, CrFwServSubType_t servSubType)
Set the service sub-type of the command or report encapsulated in a packet.
Packet header definitions.
void CrFwCmpReset(FwSmDesc_t smDesc)
Reset a framework component.
Definition: CrFwBaseCmp.c:117
FwSmDesc_t * pocl
Pending OutComponent List (POCL) for the OutManager.
static CrFwTypeId_t getDppcktIdReroutingFailed()
Gets the value of the datapool item pcktIdReroutingFailed.
CrFwCounterU2_t CrFwPcktGetNOfAllocated()
Return the number of packets which are currently allocated.
CrFwOutFactoryPoolIndex_t CrFwOutFactoryGetNOfAllocatedOutCmp()
Return the number of OutComponents which are currently allocated.
static CrFwCounterU4_t getDpnOfReroutingFailed()
Gets the value of the datapool item nOfReroutingFailed.
void CrFwPcktSetDest(CrFwPckt_t pckt, CrFwDestSrc_t dest)
Set the destination of the command or report encapsulated in a packet.
Definition of Base Component.
void SendReqVerifPrgrSuccRep(FwSmDesc_t smDesc, CrPsStepId_t stepIdentifier)
Generate a Request Verification Progress Successful out-going report.
void SendReqVerifPrgrFailRep(FwSmDesc_t smDesc, CrPsStepId_t stepIdentifier, CrPsFailCode_t FailureCode)
Generate a Request Verification Progress Failed out-going report.
FwSmDesc_t CrFwInFactoryMake()
Factory function for the singleton instance of the InFactory.
void CrFwOutFactoryReleaseOutCmp(FwSmDesc_t outCmpInstance)
Release function for an OutComponent.
static CrPsFailCode_t getDpfailCodePrgrFailed()
Gets the value of the datapool item failCodePrgrFailed.
static CrFwTypeId_t getDppcktIdStartFailed()
Gets the value of the datapool item pcktIdStartFailed.
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
static CrPsFailCode_t getDpfailCodeAccFailed()
Gets the value of the datapool item failCodeAccFailed.
FwSmDesc_t CrFwOutFactoryMake()
Factory function for the singleton instance of the OutFactory.
FwSmDesc_t CrFwInFactoryMakeInRep(CrFwPckt_t pckt)
Make function for a component encapsulating an incoming report (InReport).
void SendReqVerifAccFailRep(FwSmDesc_t smDesc, CrPsFailCode_t FailureCode)
Generate a Request Verification Acceptance Failed out-going report.
Interface through which applications can initialize and execute framework PUS extension components...
int CrPsInitServReqVerif()
Initialization of CORDET Framework PUS Extension components.
CrFwCounterU1_t CrFwOutManagerGetNOfPendingOutCmp(FwSmDesc_t smDesc)
Return the number of OutComponents currently in the POCL of an OutManager.
CrFwInFactoryPoolIndex_t CrFwInFactoryGetNOfAllocatedInCmd()
Return the number of InCommands which are currently allocated.
No application errors have been detected.
static FwSmDesc_t inCmd[CR_FW_INFACTORY_MAX_NOF_INCMD]
The pre-allocated InCommand instances.
Definition: CrFwInFactory.c:58
CrFwInFactoryPoolIndex_t CrFwInFactoryGetNOfAllocatedInRep()
Return the number of InReports which are currently allocated.
CrFwServType_t CrFwInCmdGetServType(FwSmDesc_t smDesc)
Return the type of the InCommand.
Definition: CrFwInCmd.c:337
FwSmDesc_t CrFwOutFactoryMakeOutCmp(CrFwServType_t type, CrFwServSubType_t subType, CrFwDiscriminant_t discriminant, CrFwPcktLength_t length)
Make function for an OutComponent.
FwSmDesc_t CrFwInFactoryMakeInCmd(CrFwPckt_t pckt)
Make function for a component encapsulating an incoming command (InCommand).
static CrPsFailCode_t getDpfailCodeStartFailed()
Gets the value of the datapool item failCodeStartFailed.
static CrFwCounterU4_t getDpnOfPrgrFailed()
Gets the value of the datapool item nOfPrgrFailed.
CrFwAppErrCode_t CrFwGetAppErrCode()
Return the value of the application error code.
void CrFwPcktSetDiscriminant(CrFwPckt_t pckt, CrFwDiscriminant_t discriminant)
Set the discriminant of the command or report encapsulated in a packet.
void SendReqVerifCmdFailRep(FwSmDesc_t smDesc, uint16_t reqVerifCmdFailType, CrPsFailCode_t FailureCode)
Generate a Request Verification Start/Termination Failed out-going report.
void CrPsExecServReqVerif()
Execution of CORDET Framework PUS Extension components.
Definition of the InCommand Component of the framework.
Type for the data describing an OutManager.
static CrFwTypeId_t getDppcktIdTermFailed()
Gets the value of the datapool item pcktIdTermFailed.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved