CORDET Framework - C2 Implementation
CrPsPcktReroutingFailFunc.c
Go to the documentation of this file.
1 
26 
28 #include "FwPrConstants.h"
29 #include "FwPrDCreate.h"
30 #include "FwPrConfig.h"
31 #include "FwPrCore.h"
32 #include "FwSmConfig.h"
33 
34 #include "Pckt/CrFwPckt.h" /* --- interface to adaptation point CrFwPckt --- */
35 #include <CrFwCmpData.h>
36 #include <BaseCmp/CrFwBaseCmp.h>
39 #include <OutCmp/CrFwOutCmp.h>
40 
41 #include <CrPsUserConstants.h>
42 #include <CrPsRepErr.h>
48 
49 #include <stdlib.h>
50 #include <time.h>
51 
52 static FwSmDesc_t rep;
53 
54 
55 /* ----------------------------------------------------------------------------------------------------------------- */
56 
57 /* ------------------------------------------------------------------------------------ */
59 void CrPsPcktReroutingFailN1(FwPrDesc_t prDesc)
60 {
61  CrFwCmpData_t *inData;
62  CrFwInRepData_t *inSpecificData;
63  CrFwPckt_t inPckt;
64  FwSmDesc_t smDesc;
65  prData_t *prData;
66  CrPsRepErrCode_t errCode;
67 
68  /* Generate error report INLOADER_INV_DEST */
69 
70  /* Get procedure parameters */
71  prData = FwPrGetData(prDesc);
72  smDesc = prData->smDesc;
73 
74  /* Get in packet */
75  inData = (CrFwCmpData_t*)FwSmGetData(smDesc);
76  inSpecificData = (CrFwInRepData_t*)inData->cmpSpecificData;
77  inPckt = inSpecificData->pckt;
78 
79  errCode = crInloaderInvDest;
81 
82  return;
83 }
84 
85 /* ------------------------------------------------------------------------------------ */
87 void CrPsPcktReroutingFailN2(FwPrDesc_t prDesc)
88 {
89  CRFW_UNUSED(prDesc);
90 
91  /* Retrieve an OutComponent of type (1,10) from the OutFactory */
92 
93  /* Create out component */
95 
96  return;
97 }
98 
99 /* ------------------------------------------------------------------------------------ */
101 void CrPsPcktReroutingFailN3(FwPrDesc_t prDesc)
102 {
103  CrPsRepErrCode_t errCode;
104 
105  CRFW_UNUSED(prDesc);
106 
107  /* Generate error report OUTFACTORY_FAIL */
108 
109  errCode = crOutfactoryFail;
111 
112  return;
113 }
114 
115 /* ------------------------------------------------------------------------------------ */
117 void CrPsPcktReroutingFailN4(FwPrDesc_t prDesc)
118 {
119  CrFwDestSrc_t source;
120  CrPsFailData_t VerFailData;
121  CrFwCmpData_t* inData;
122  CrFwInCmdData_t* inSpecificData;
123  CrFwPckt_t inPckt;
124  CrPsRid_t Rid;
125  FwSmDesc_t smDesc;
126  prData_t* prData;
127  CrFwCmpData_t* cmpDataStart;
128  CrFwOutCmpData_t* cmpSpecificData;
129  CrFwPckt_t pckt;
130 
131  cmpDataStart = (CrFwCmpData_t *) FwSmGetData(rep);
132  cmpSpecificData = (CrFwOutCmpData_t *) cmpDataStart->cmpSpecificData;
133  pckt = cmpSpecificData->pckt;
134 
135  /* Configure report (1,10) and load it in the OutLoader */
136 
137  /* Get procedure parameters */
138  prData = FwPrGetData(prDesc);
139 
140  smDesc = prData->smDesc;
141 
142  /* Get in packet */
143  inData = FwSmGetData(smDesc);
144  inSpecificData = (CrFwInCmdData_t*)inData->cmpSpecificData;
145  inPckt = inSpecificData->pckt;
146 
147  /* set Packet request ID */
148  Rid = getPcktRid(inPckt);
149  setVerFailedRoutingRepRid(pckt, Rid);
150 
151  /* Set failCodeAccFailed */
152  setVerFailedRoutingRepFailureCode(pckt, (CrPsFailCode_t)INLOADER_INV_DEST);
153 
154  /* Set verFailData */
155  VerFailData = getDpverFailData(); /* get it from data pool */
156  setVerFailedRoutingRepFailureData(pckt, VerFailData);
157 
158  /* Set the destination of the report to the source of the in-coming packet */
159  source = CrFwPcktGetSrc(inPckt);
160  CrFwOutCmpSetDest(rep, source);
161 
162  /* Load report in the Outloader */
164 
165  return;
166 }
167 
168 /* ------------------------------------------------------------------------------------ */
170 void CrPsPcktReroutingFailN5(FwPrDesc_t prDesc)
171 {
172  CrFwCounterU4_t nOfReroutingFailed;
173 
174  CRFW_UNUSED(prDesc);
175 
176  /* Increment data pool variable nOfReroutingFailed */
177 
178  nOfReroutingFailed = getDpnOfReroutingFailed();
179  nOfReroutingFailed += 1;
180  setDpnOfReroutingFailed(nOfReroutingFailed);
181 
182  return;
183 }
184 
185 /* ------------------------------------------------------------------------------------ */
187 void CrPsPcktReroutingFailN6(FwPrDesc_t prDesc)
188 {
189  CrFwTypeId_t PacketId;
190  CrFwCmpData_t *inData;
191  CrFwInCmdData_t *inSpecificData;
192  CrFwPckt_t inPckt;
193  FwSmDesc_t smDesc;
194  prData_t *prData;
195 
196  /* Update data pool variable pcktIdRerouting, invDestRerouting */
197 
198  /* Get procedure parameters */
199  prData = FwPrGetData(prDesc);
200  smDesc = prData->smDesc;
201 
202  /* Get in packet */
203  inData = (CrFwCmpData_t*)FwSmGetData(smDesc);
204  inSpecificData = (CrFwInCmdData_t*)inData->cmpSpecificData;
205  inPckt = inSpecificData->pckt;
206 
207  /* Set pcktIdRerouting */
208  PacketId = CrFwPcktGetApid(inPckt); /* --- adaptation point CrFwPckt ---> */
209  setDppcktIdReroutingFailed(PacketId);
210 
211  /* Set invDestRerouting */
212  setDpinvDestRerouting(prData->ushortParam1);
213 
214  return;
215 }
216 
217 /* ------------------------------------------------------------------------------------ */
218 /**************/
219 /*** GUARDS ***/
220 /**************/
221 
223 FwPrBool_t CrPsPcktReroutingFailG1(FwPrDesc_t prDesc)
224 {
225  FwSmDesc_t smDesc;
226  prData_t *prData;
227 
228  /* [ Packet encapsulates a report ] */
229 
230  /* Get procedure parameters */
231  prData = FwPrGetData(prDesc);
232  smDesc = prData->smDesc;
233 
234  if (CrFwCmpGetTypeId(smDesc) == CR_FW_INREPORT_TYPE)
235  {
236  return 1;
237  }
238  else
239  {
240  return 0;
241  }
242 }
243 
245 FwPrBool_t CrPsPcktReroutingFailG1E(FwPrDesc_t prDesc)
246 {
247  FwSmDesc_t smDesc;
248  prData_t *prData;
249 
250  /* [ Packet encapsulates a command ] */
251 
252  /* Get procedure parameters */
253  prData = FwPrGetData(prDesc);
254  smDesc = prData->smDesc;
255 
256  if (CrFwCmpGetTypeId(smDesc) == CR_FW_INCOMMAND_TYPE)
257  {
258  return 1;
259  }
260  else
261  {
262  return 0;
263  }
264 }
265 
267 FwPrBool_t CrPsPcktReroutingFailG2(FwPrDesc_t prDesc)
268 {
269  CRFW_UNUSED(prDesc);
270 
271  /* [ OutFactory fails to generate OutComponent ] */
272 
273  if (rep == NULL)
274  {
275  return 1;
276  }
277  else
278  {
279  return 0;
280  }
281 
282 }
283 
284 /* ----------------------------------------------------------------------------------------------------------------- */
285 
FwPrBool_t CrPsPcktReroutingFailG2(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION2 to N3.
Type for the Framework Component Data (FCD).
FwPrBool_t CrPsPcktReroutingFailG1E(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION1 to N2.
CrFwDestSrc_t CrFwPcktGetSrc(CrFwPckt_t pckt)
Return the source of the command or report encapsulated in a packet.
CrFwServType_t CrFwPcktGetServType(CrFwPckt_t pckt)
Return the service type of the command or report encapsulated in a packet.
CrFwDiscriminant_t CrFwPcktGetDiscriminant(CrFwPckt_t pckt)
Return the discriminant of the command or report encapsulated in a packet.
CrFwTypeId_t CrFwCmpGetTypeId(FwSmDesc_t smDesc)
Return the type identifier of the argument component.
Definition: CrFwBaseCmp.c:156
void CrPsPcktReroutingFailN2(FwPrDesc_t prDesc)
Action for node N2.
#define CRFW_UNUSED(x)
A macro that can be used to specify that a function parameter is not used.
Definition: CrFwConstants.h:27
static FwSmDesc_t rep
CrPsPcktReroutingFail function definitions.
Header file to define all user-configurable constants and types for the IASW Application.
#define CR_FW_INREPORT_TYPE
Type identifier for the InReport component.
static CrPsFailData_t getDpverFailData()
Gets the value of the datapool item verFailData.
void CrPsPcktReroutingFailN3(FwPrDesc_t prDesc)
Action for node N3.
unsigned short int CrFwTypeId_t
Type used for the identifier of a component type.
FwPrBool_t CrPsPcktReroutingFailG1(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION1 to N1.
Definition of the OutFactory component.
Type for the data describing an OutComponent.
CrFwPckt_t pckt
Packet holding the InCommand.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
Header file to define all service and packet identifiers.
Type for the data describing an InReport.
CrFwPckt_t pckt
Packet to which the out-going command or report is serialized.
Interface for creating and accessing a report or command packet.
CrFwPckt_t pckt
Packet holding the InReport.
static void setDppcktIdReroutingFailed(CrFwTypeId_t pcktIdReroutingFailed)
Sets the value of the datapool item pcktIdReroutingFailed.
static void setVerFailedRoutingRepFailureCode(void *p, CrPsFailCode_t FailureCode)
Set "FailureCode" in "VerFailedRoutingRep" packet.
#define CRPS_REQVERIF_PROG_SUCC
Subtype identifier of the Request Verification Progress Successful out-going report packet...
The Inloader detects an invalid destination (see CrPsRepErr.h)
void CrFwOutLoaderLoad(FwSmDesc_t outCmp)
Load an OutComponent into its OutManager.
Interface for accessing fields in packets of service "ServReqVerif".
The Outfactory failed to make the component (see CrPsRepErr.h)
Interface for accessing data pool items.
CrPsRepErrCode_t
Identifier for the errors reported through the error reporting interface of CrFwRepErr.h.
void CrPsPcktReroutingFailN6(FwPrDesc_t prDesc)
Action for node N6.
generic Interface for accessing fields in packets.
uint32_t CrPsFailData_t
Type used for the Failure Data of a packet.
void * cmpSpecificData
Derived data which are specific to each type of framework component.
#define CR_FW_INCOMMAND_TYPE
Type identifier for the InCommand component.
static void setVerFailedRoutingRepFailureData(void *p, CrPsFailData_t FailureData)
Set "FailureData" in "VerFailedRoutingRep" packet.
uint16_t CrPsFailCode_t
Type used for the Failure Code of a packet.
CrFwServSubType_t CrFwPcktGetServSubType(CrFwPckt_t pckt)
Return the service sub-type of the command or report encapsulated in a packet.
void CrPsPcktReroutingFailN1(FwPrDesc_t prDesc)
Action for node N1.
void CrPsRepErr(CrPsRepErrCode_t errCode, CrFwServType_t repType, CrFwServSubType_t repSubType, CrFwDiscriminant_t repDiscriminant)
Report an error which has no parameters attached to it.
Definition: CrPsRepErr.c:37
static CrFwCounterU4_t getDpnOfReroutingFailed()
Gets the value of the datapool item nOfReroutingFailed.
Definition of Base Component.
static void setDpnOfReroutingFailed(CrFwCounterU4_t nOfReroutingFailed)
Sets the value of the datapool item nOfReroutingFailed.
Interface for reporting an error detected by a PUS Extension component.
auxiliary Interface for accessing fields in packets of service "ServReqVerif".
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
#define CRPS_REQVERIF_REROUT_FAIL
Subtype identifier of the Request Verification Rerouting Failed out-going report packet.
Definition of the OutComponent Component of the framework.
static CrPsRid_t getPcktRid(void *p)
Getter for the RequestId from a packet.
Definition: CrPsPkt.h:1067
void setVerFailedRoutingRepRid(void *p, CrPsRid_t Rid)
Set "RequestId" in a "VerFailedRoutingRep" packet.
void CrFwOutCmpSetDest(FwSmDesc_t smDesc, CrFwDestSrc_t dest)
Set the destination of the OutComponent.
Definition: CrFwOutCmp.c:192
void CrPsPcktReroutingFailN5(FwPrDesc_t prDesc)
Action for node N5.
static void setDpinvDestRerouting(CrPsDestSrc_t invDestRerouting)
Sets the value of the datapool item invDestRerouting.
Type for the data describing an InCommand.
Create one instance of the CrPsPcktReroutingFail procedure.
Definition of the OutLoader component.
FwSmDesc_t CrFwOutFactoryMakeOutCmp(CrFwServType_t type, CrFwServSubType_t subType, CrFwDiscriminant_t discriminant, CrFwPcktLength_t length)
Make function for an OutComponent.
void CrPsPcktReroutingFailN4(FwPrDesc_t prDesc)
Action for node N4.
#define CRPS_REQVERIF
Type identifier of the Request Verification Service.
Definition: CrPsConstants.h:80
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved