CORDET Framework - C2 Implementation
CrPsUtilitiesServReqVerif.c
Go to the documentation of this file.
1 
22 #include "Pckt/CrFwPckt.h" /* --- interface to adaptation point CrFwPckt --- */
23 
24 /* CrFramework includes */
27 #include <CrFwCmpData.h>
28 
29 /* FwProfile includes */
30 #include <FwPrCore.h>
31 #include <FwPrConfig.h>
32 #include <FwSmConfig.h>
33 
41 
42 #include <DataPool/CrPsDp.h>
44 
45 #include <stdlib.h>
46 
47 
48 /* global handles for the procedures */
49 FwPrDesc_t prDescServReqVerifPcktReroutFail, prDescServReqVerifPcktAccFail;
50 FwPrDesc_t prDescServReqVerifCmdVerSucc, prDescServReqVerifCmdVerFail;
51 FwPrDesc_t prDescServReqVerifCmdPrgrSucc, prDescServReqVerifCmdPrgrFail;
52 
53 
58 {
59 
60  /***********************************************************************/
61  /* Service Request Verification Packet Rerouting Failure Procedure */
62  /***********************************************************************/
63  prDescServReqVerifPcktReroutFail = CrPsPcktReroutingFailCreate(NULL);
64  if (FwPrCheck(prDescServReqVerifPcktReroutFail) != prSuccess)
65  {
66  return EXIT_FAILURE;
67  }
68 
69  /***********************************************************************/
70  /* Service Request Verification Packet Acceptance Failure Procedure */
71  /***********************************************************************/
72  prDescServReqVerifPcktAccFail = CrPsPcktAccFailCreate(NULL);
73  if (FwPrCheck(prDescServReqVerifPcktAccFail) != prSuccess)
74  {
75  return EXIT_FAILURE;
76  }
77 
78  /***********************************************************************/
79  /* Service Request Verification Command Verification Success Procedure */
80  /***********************************************************************/
81  prDescServReqVerifCmdVerSucc = CrPsCmdVerSuccCreate(NULL);
82  if (FwPrCheck(prDescServReqVerifCmdVerSucc) != prSuccess)
83  {
84  return EXIT_FAILURE;
85  }
86 
87  /***********************************************************************/
88  /* Service Request Verification Command Verification Failure Procedure */
89  /***********************************************************************/
90  prDescServReqVerifCmdVerFail = CrPsCmdVerFailCreate(NULL);
91  if (FwPrCheck(prDescServReqVerifCmdVerFail) != prSuccess)
92  {
93  return EXIT_FAILURE;
94  }
95 
96  /***********************************************************************/
97  /* Service Request Verification Command Progress Success Procedure */
98  /***********************************************************************/
99  prDescServReqVerifCmdPrgrSucc = CrPsCmdPrgrSuccCreate(NULL);
100  if (FwPrCheck(prDescServReqVerifCmdPrgrSucc) != prSuccess)
101  {
102  return EXIT_FAILURE;
103  }
104 
105  /***********************************************************************/
106  /* Service Request Verification Command Progress Failure Procedure */
107  /***********************************************************************/
108  prDescServReqVerifCmdPrgrFail = CrPsCmdPrgrFailCreate(NULL);
109  if (FwPrCheck(prDescServReqVerifCmdPrgrFail) != prSuccess)
110  {
111  return EXIT_FAILURE;
112  }
113 
114  /* initialize Datapool Values */
116 
117  return EXIT_SUCCESS;
118 }
119 
124 {
125  return;
126 }
127 
132 {
133  return prDescServReqVerifPcktReroutFail;
134 }
135 
140 {
141  return prDescServReqVerifPcktAccFail;
142 }
143 
148 {
149  return prDescServReqVerifCmdVerSucc;
150 }
151 
156 {
157  return prDescServReqVerifCmdVerFail;
158 }
159 
164 {
165  return prDescServReqVerifCmdPrgrSucc;
166 }
167 
172 {
173  return prDescServReqVerifCmdPrgrFail;
174 }
175 
180 void SendReqVerifAccSuccRep(FwSmDesc_t smDesc, uint16_t reqVerifAccSuccType)
181 {
182  CrFwCmpData_t* inData;
183  CrFwInCmdData_t* inSpecificData;
184  CrFwPckt_t inPckt;
185  CrFwBool_t isAckFlag;
186  prData_t prData;
187 
188  /* Get in packet */
189  inData = (CrFwCmpData_t*)FwSmGetData(smDesc);
190  inSpecificData = (CrFwInCmdData_t*)inData->cmpSpecificData;
191  inPckt = inSpecificData->pckt;
192 
193  if (reqVerifAccSuccType == CRPS_REQVERIF_ACC_SUCC)
194  {
195  isAckFlag = CrFwPcktIsAcceptAck(inPckt);
196  }
197  else if (reqVerifAccSuccType == CRPS_REQVERIF_START_SUCC)
198  {
199  isAckFlag = CrFwPcktIsStartAck(inPckt);
200  }
201  else if (reqVerifAccSuccType == CRPS_REQVERIF_TERM_SUCC)
202  {
203  isAckFlag = CrFwPcktIsTermAck(inPckt);
204  }
205  else
206  {
207  isAckFlag = 0;
208  }
209 
210  if (isAckFlag == 1)
211  {
212  prData.smDesc = smDesc;
213  prData.ushortParam1 = reqVerifAccSuccType;
214  FwPrSetData(prDescServReqVerifCmdVerSucc, &prData);
215  FwPrRun(prDescServReqVerifCmdVerSucc);
216  }
217 
218  return;
219 }
220 
225 void SendReqVerifAccFailRep(FwSmDesc_t smDesc, CrPsFailCode_t FailureCode)
226 {
227  prData_t prData;
228 
229  prData.smDesc = smDesc;
230  prData.ushortParam1 = FailureCode;
231  FwPrSetData(prDescServReqVerifPcktAccFail, &prData);
232  FwPrRun(prDescServReqVerifPcktAccFail);
233 
234  return;
235 }
236 
241 void SendReqVerifCmdFailRep(FwSmDesc_t smDesc, uint16_t reqVerifCmdFailType, CrPsFailCode_t FailureCode)
242 {
243  prData_t prData;
244 
245  prData.smDesc = smDesc;
246  prData.ushortParam1 = FailureCode;
247  prData.ushortParam2 = reqVerifCmdFailType;
248  FwPrSetData(prDescServReqVerifCmdVerFail, &prData);
249  FwPrRun(prDescServReqVerifCmdVerFail);
250 
251  return;
252 }
253 
258 void SendReqVerifPrgrSuccRep(FwSmDesc_t smDesc, CrPsStepId_t stepIdentifier)
259 {
260  CrFwCmpData_t* inData;
261  CrFwInCmdData_t* inSpecificData;
262  CrFwPckt_t inPckt;
263  CrFwBool_t isAckFlag;
264  prData_t prData;
265 
266  /* Get in packet */
267  inData = (CrFwCmpData_t*)FwSmGetData(smDesc);
268  inSpecificData = (CrFwInCmdData_t*)inData->cmpSpecificData;
269  inPckt = inSpecificData->pckt;
270 
271  isAckFlag = CrFwPcktIsProgressAck(inPckt);
272 
273  if (isAckFlag == 1)
274  {
275  prData.smDesc = smDesc;
276  prData.ushortParam1 = stepIdentifier;
277  FwPrSetData(prDescServReqVerifCmdPrgrSucc, &prData);
278  FwPrRun(prDescServReqVerifCmdPrgrSucc);
279  }
280 
281  return;
282 }
283 
288 void SendReqVerifPrgrFailRep(FwSmDesc_t smDesc, CrPsStepId_t stepIdentifier, CrPsFailCode_t FailureCode)
289 {
290  prData_t prData;
291 
292  prData.smDesc = smDesc;
293  prData.ushortParam1 = stepIdentifier;
294  prData.ushortParam2 = FailureCode;
295  FwPrSetData(prDescServReqVerifCmdPrgrFail, &prData);
296  FwPrRun(prDescServReqVerifCmdPrgrFail);
297 
298  return;
299 }
300 
305 void SendReqVerifPcktReroutFailRep(FwSmDesc_t smDesc, CrPsFailCode_t FailureCode)
306 {
307  prData_t prData;
308 
309  prData.smDesc = smDesc;
310  prData.ushortParam1 = FailureCode;
311  FwPrSetData(prDescServReqVerifPcktReroutFail, &prData);
312  FwPrRun(prDescServReqVerifPcktReroutFail);
313 
314  return;
315 }
316 
void initDpServReqVerif(void)
Initialises ServReqVerif.
Type for the Framework Component Data (FCD).
#define CRPS_REQVERIF_ACC_SUCC
Subtype identifier of the Request Verification Acceptance Successful out-going report packet...
Definition: CrPsConstants.h:85
FwPrDesc_t CrPsPcktAccFailCreate(void *prData)
Create a new procedure descriptor.
Create one instance of the CrPsPcktAccFail procedure.
CrFwBool_t CrFwPcktIsTermAck(CrFwPckt_t pckt)
Return the acknowledge level for command termination for the command encapsulated in the packet...
FwPrDesc_t CrPsCmdVerFailCreate(void *prData)
Create a new procedure descriptor.
#define CRPS_REQVERIF_START_SUCC
Subtype identifier of the Request Verification Start Successful out-going report packet.
Definition: CrPsConstants.h:95
FwPrDesc_t getPrDescServReqVerifCmdPrgrFail()
Getter for ReqVerifCmdPrgrFail procedure descriptor.
Definition of the OutFactory component.
CrFwPckt_t pckt
Packet holding the InCommand.
Header file to define all service and packet identifiers.
FwPrDesc_t CrPsCmdPrgrSuccCreate(void *prData)
Create a new procedure descriptor.
FwPrDesc_t CrPsCmdPrgrFailCreate(void *prData)
Create a new procedure descriptor.
Interface for creating and accessing a report or command packet.
FwPrDesc_t getPrDescServReqVerifCmdPrgrSucc()
Getter for ReqVerifCmdPrgrSucc procedure descriptor.
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:30
Create one instance of the CrPsCmdPrgrSucc procedure.
FwPrDesc_t CrPsCmdVerSuccCreate(void *prData)
Create a new procedure descriptor.
#define CRPS_REQVERIF_TERM_SUCC
Subtype identifier of the Request Verification Termination Successful out-going report packet...
uint32_t CrPsStepId_t
Type used for the Step ID of a packet.
void SendReqVerifAccSuccRep(FwSmDesc_t smDesc, uint16_t reqVerifAccSuccType)
Generate a Request Verification Acceptance/Start/Termination Successful out-going report...
void SendReqVerifPcktReroutFailRep(FwSmDesc_t smDesc, CrPsFailCode_t FailureCode)
Generate a Request Verification Package Rerouting Failed out-going report.
Interface for accessing data pool items.
CrFwBool_t CrFwPcktIsProgressAck(CrFwPckt_t pckt)
Return the acknowledge level for command progress for the command encapsulated in the packet...
FwPrDesc_t CrPsPcktReroutingFailCreate(void *prData)
Create a new procedure descriptor.
void * cmpSpecificData
Derived data which are specific to each type of framework component.
FwPrDesc_t getPrDescServReqVerifCmdVerFail()
Getter for ReqVerifCmdVerFail procedure descriptor.
uint16_t CrPsFailCode_t
Type used for the Failure Code of a packet.
void SendReqVerifPrgrSuccRep(FwSmDesc_t smDesc, CrPsStepId_t stepIdentifier)
Generate a Request Verification Progress Successful out-going report.
Create one instance of the CrPsCmdPrgrFail procedure.
void SendReqVerifPrgrFailRep(FwSmDesc_t smDesc, CrPsStepId_t stepIdentifier, CrPsFailCode_t FailureCode)
Generate a Request Verification Progress Failed out-going report.
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
CrFwBool_t CrFwPcktIsAcceptAck(CrFwPckt_t pckt)
Return the acknowledge level for command acceptance for the command encapsulated in the packet...
Create one instance of the CrPsCmdVerSucc procedure.
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.
FwPrDesc_t getPrDescServReqVerifPcktAccFail()
Getter for ReqVerifPcktAccFail procedure descriptor.
Type for the data describing an InCommand.
CrFwBool_t CrFwPcktIsStartAck(CrFwPckt_t pckt)
Return the acknowledge level for command start for the command encapsulated in the packet...
Interface for accessing data pool items.
Create one instance of the CrPsPcktReroutingFail procedure.
Definition of the OutLoader component.
FwPrDesc_t getPrDescServReqVerifCmdVerSucc()
Getter for ReqVerifCmdVerSucc procedure descriptor.
FwPrDesc_t getPrDescServReqVerifPcktReroutFail()
Getter for ReqVerifPcktReroutFail procedure descriptor.
Create one instance of the CrPsCmdVerFail procedure.
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.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved