CORDET Framework - C2 Implementation
CrPsPcktAccFailFunc.c
Go to the documentation of this file.
1 
25 #include "CrPsPcktAccFailCreate.h"
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 <CrPsRepErr.h>
47 
48 #include <stdlib.h>
49 #include <time.h>
50 
51 static FwSmDesc_t rep;
52 
53 
54 /* ----------------------------------------------------------------------------------------------------------------- */
55 
56 /* ------------------------------------------------------------------------------------ */
58 void CrPsPcktAccFailN1(FwPrDesc_t prDesc)
59 {
60  CrFwCmpData_t *inData;
61  CrFwInRepData_t *inSpecificData;
62  CrFwPckt_t inPckt;
63  FwSmDesc_t smDesc;
64  prData_t *prData;
65  CrPsRepErrCode_t errCode;
66 
67  /* Generate error report INLOADER_ACC_FAIL */
68 
69  /* Get procedure parameters */
70  prData = FwPrGetData(prDesc);
71  smDesc = prData->smDesc;
72 
73  /* Get in packet */
74  inData = (CrFwCmpData_t*)FwSmGetData(smDesc);
75  inSpecificData = (CrFwInRepData_t*)inData->cmpSpecificData;
76  inPckt = inSpecificData->pckt;
77 
78  errCode = crInloaderAccFail;
80 
81  return;
82 }
83 
84 /* ------------------------------------------------------------------------------------ */
86 void CrPsPcktAccFailN2(FwPrDesc_t prDesc)
87 {
88  CRFW_UNUSED(prDesc);
89  /* Retrieve an OutComponent of type (1,2) from the OutFactory */
90 
91  /* Create out component */
93 
94  return;
95 }
96 
97 /* ------------------------------------------------------------------------------------ */
99 void CrPsPcktAccFailN3(FwPrDesc_t prDesc)
100 {
101  CrPsRepErrCode_t errCode;
102 
103  CRFW_UNUSED(prDesc);
104 
105  /* Generate error report OUTFACTORY_FAIL */
106 
107  errCode = crOutfactoryFail;
109 
110  return;
111 }
112 
113 /* ------------------------------------------------------------------------------------ */
115 void CrPsPcktAccFailN4(FwPrDesc_t prDesc)
116 {
117  CrFwDestSrc_t source;
118  CrPsFailData_t VerFailData;
119  CrFwCmpData_t* inData;
120  CrFwInCmdData_t* inSpecificData;
121  CrFwPckt_t inPckt;
122  FwSmDesc_t smDesc;
123  prData_t* prData;
124  CrFwCmpData_t* cmpDataStart;
125  CrFwOutCmpData_t* cmpSpecificData;
126  CrFwPckt_t pckt;
127  CrPsRid_t Rid;
128 
129  cmpDataStart = (CrFwCmpData_t *) FwSmGetData(rep);
130  cmpSpecificData = (CrFwOutCmpData_t *) cmpDataStart->cmpSpecificData;
131  pckt = cmpSpecificData->pckt;
132 
133  /* Configure report (1,2) and load it in the OutLoader */
134 
135  /* Get procedure parameters */
136  prData = FwPrGetData(prDesc);
137  smDesc = prData->smDesc;
138 
139  /* Get in packet */
140  inData = (CrFwCmpData_t*)FwSmGetData(smDesc);
141  inSpecificData = (CrFwInCmdData_t*)inData->cmpSpecificData;
142  inPckt = inSpecificData->pckt;
143 
144  /* set Packet request ID */
145  Rid = getPcktRid(inPckt);
146  setVerFailedAccRepRid(pckt, Rid);
147 
148  /* Set failCodeAccFailed */
149  setVerFailedAccRepFailureCode(pckt, (CrPsFailCode_t)prData->ushortParam1);
150 
151  /* Set verFailData */
152  VerFailData = getDpverFailData();
153  setVerFailedAccRepFailureData(pckt, VerFailData);
154 
155  /* Set the destination of the report to the source of the in-coming packet */
156  source = CrFwPcktGetSrc(inPckt);
157  CrFwOutCmpSetDest(rep, source);
158 
159  /* Load report in the Outloader */
161 
162  return;
163 }
164 
165 /* ------------------------------------------------------------------------------------ */
167 void CrPsPcktAccFailN5(FwPrDesc_t prDesc)
168 {
169  CrFwCounterU4_t nOfAccFailed;
170 
171  CRFW_UNUSED(prDesc);
172 
173  /* Increment data pool variable nOfAccFailed */
174 
175  nOfAccFailed = getDpnOfAccFailed();
176  nOfAccFailed += 1;
177  setDpnOfAccFailed(nOfAccFailed);
178 
179  return;
180 }
181 
182 /* ------------------------------------------------------------------------------------ */
184 void CrPsPcktAccFailN6(FwPrDesc_t prDesc)
185 {
186  CrFwTypeId_t PacketId;
187  CrFwCmpData_t *inData;
188  CrFwInCmdData_t *inSpecificData;
189  CrFwPckt_t inPckt;
190  FwSmDesc_t smDesc;
191  prData_t *prData;
192 
193  /* Update data pool variable pcktIdAccFailed, failCodeAccFailed */
194 
195  /* Get procedure parameters */
196  prData = FwPrGetData(prDesc);
197  smDesc = prData->smDesc;
198 
199  /* Get in packet */
200  inData = (CrFwCmpData_t*)FwSmGetData(smDesc);
201  inSpecificData = (CrFwInCmdData_t*)inData->cmpSpecificData;
202  inPckt = inSpecificData->pckt;
203 
204  /* Set pcktIdAccFailed */
205  PacketId = CrFwPcktGetApid(inPckt); /* --- adaptation point CrFwPckt ---> */
206  setDppcktIdAccFailed(PacketId);
207 
208  /* Set failCodeAccFailed */
209  setDpfailCodeAccFailed(prData->ushortParam1);
210 
211  return;
212 }
213 
214 /* ------------------------------------------------------------------------------------ */
215 /**************/
216 /*** GUARDS ***/
217 /**************/
218 
220 FwPrBool_t CrPsPcktAccFailG1(FwPrDesc_t prDesc)
221 {
222  FwSmDesc_t smDesc;
223  prData_t *prData;
224 
225  /* [ Packet encapsulates a report ] */
226 
227  /* Get procedure parameters */
228  prData = FwPrGetData(prDesc);
229  smDesc = prData->smDesc;
230 
231  if (CrFwCmpGetTypeId(smDesc) == CR_FW_INREPORT_TYPE)
232  {
233  return 1;
234  }
235  else
236  {
237  return 0;
238  }
239 
240 }
241 
243 FwPrBool_t CrPsPcktAccFailG1E(FwPrDesc_t prDesc)
244 {
245  FwSmDesc_t smDesc;
246  prData_t *prData;
247 
248  /* [ Packet encapsulates a command ] */
249 
250  /* Get procedure parameters */
251  prData = FwPrGetData(prDesc);
252  smDesc = prData->smDesc;
253 
254  if (CrFwCmpGetTypeId(smDesc) == CR_FW_INCOMMAND_TYPE)
255  {
256  return 1;
257  }
258  else
259  {
260  return 0;
261  }
262 
263 }
264 
266 FwPrBool_t CrPsPcktAccFailG2(FwPrDesc_t prDesc)
267 {
268  CRFW_UNUSED(prDesc);
269 
270  /* [ OutFactory fails to generate OutComponent ] */
271 
272  if (rep == NULL)
273  {
274  return 1;
275  }
276  else
277  {
278  return 0;
279  }
280 
281 }
282 
283 /* ----------------------------------------------------------------------------------------------------------------- */
284 
285 
static void setDpfailCodeAccFailed(CrPsFailCode_t failCodeAccFailed)
Sets the value of the datapool item failCodeAccFailed.
Type for the Framework Component Data (FCD).
static void setDpnOfAccFailed(CrFwCounterU4_t nOfAccFailed)
Sets the value of the datapool item nOfAccFailed.
The Inloader acceptance of a component failed (see CrPsRepErr.h)
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 CrPsPcktAccFailN2(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
Create one instance of the CrPsPcktAccFail procedure.
#define CR_FW_INREPORT_TYPE
Type identifier for the InReport component.
static CrPsFailData_t getDpverFailData()
Gets the value of the datapool item verFailData.
#define CRPS_REQVERIF_ACC_FAIL
Subtype identifier of the Request Verification Acceptance Failed out-going report packet...
Definition: CrPsConstants.h:90
FwPrBool_t CrPsPcktAccFailG1(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION1 to N1.
unsigned short int CrFwTypeId_t
Type used for the identifier of a component type.
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.
FwPrBool_t CrPsPcktAccFailG2(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION2 to N3.
static void setDppcktIdAccFailed(CrFwTypeId_t pcktIdAccFailed)
Sets the value of the datapool item pcktIdAccFailed.
static FwSmDesc_t rep
CrPsPcktAccFail function definitions.
#define CRPS_REQVERIF_PROG_SUCC
Subtype identifier of the Request Verification Progress Successful out-going report packet...
void CrPsPcktAccFailN6(FwPrDesc_t prDesc)
Action for node N6.
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.
void CrPsPcktAccFailN5(FwPrDesc_t prDesc)
Action for node N5.
CrPsRepErrCode_t
Identifier for the errors reported through the error reporting interface of CrFwRepErr.h.
FwPrBool_t CrPsPcktAccFailG1E(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION1 to N2.
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.
static CrFwCounterU4_t getDpnOfAccFailed()
Gets the value of the datapool item nOfAccFailed.
#define CR_FW_INCOMMAND_TYPE
Type identifier for the InCommand component.
void CrPsPcktAccFailN1(FwPrDesc_t prDesc)
Action for node N1.
uint16_t CrPsFailCode_t
Type used for the Failure Code of a packet.
static void setVerFailedAccRepFailureData(void *p, CrPsFailData_t FailureData)
Set "FailureData" in "VerFailedAccRep" packet.
void setVerFailedAccRepRid(void *p, CrPsRid_t Rid)
Set "RequestId" in a "VerFailedAccRep" packet.
CrFwServSubType_t CrFwPcktGetServSubType(CrFwPckt_t pckt)
Return the service sub-type of the command or report encapsulated in a packet.
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
Definition of Base Component.
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
void CrPsPcktAccFailN3(FwPrDesc_t prDesc)
Action for node N3.
static void setVerFailedAccRepFailureCode(void *p, CrPsFailCode_t FailureCode)
Set "FailureCode" in "VerFailedAccRep" 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 CrFwOutCmpSetDest(FwSmDesc_t smDesc, CrFwDestSrc_t dest)
Set the destination of the OutComponent.
Definition: CrFwOutCmp.c:192
Type for the data describing an InCommand.
void CrPsPcktAccFailN4(FwPrDesc_t prDesc)
Action for node N4.
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.
#define CRPS_REQVERIF
Type identifier of the Request Verification Service.
Definition: CrPsConstants.h:80
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved