CORDET Framework - C2 Implementation
CrPsCmdVerSuccFunc.c
Go to the documentation of this file.
1 
25 #include "CrPsCmdVerSuccCreate.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>
38 #include <OutCmp/CrFwOutCmp.h>
39 
40 #include <CrPsRepErr.h>
45 
46 #include <stdlib.h>
47 #include <time.h>
48 
49 static FwSmDesc_t rep;
50 
51 /* ----------------------------------------------------------------------------------------------------------------- */
52 
53 /* ------------------------------------------------------------------------------------ */
55 void CrPsCmdVerSuccN2(FwPrDesc_t prDesc)
56 {
57  prData_t* prData;
58 
59  /* Retrieve an OutComponent of type (1,1), (1,3) or (1,7) from the OutFactory */
60 
61  /* Get procedure parameters */
62  prData = FwPrGetData(prDesc);
63  rep = NULL;
64 
65  /* Create out component */
66  rep = CrFwOutFactoryMakeOutCmp(CRPS_REQVERIF, prData->ushortParam1, 0, 0);
67 
68  return;
69 }
70 
71 /* ------------------------------------------------------------------------------------ */
73 void CrPsCmdVerSuccN3(FwPrDesc_t prDesc)
74 {
75  CrPsRepErrCode_t errCode;
76 
77  CRFW_UNUSED(prDesc);
78 
79  /* Generate error report OUTFACTORY_FAIL */
80 
81  errCode = crOutfactoryFail;
83 
84  return;
85 }
86 
87 /* ------------------------------------------------------------------------------------ */
89 void CrPsCmdVerSuccN4(FwPrDesc_t prDesc)
90 {
91  CrFwDestSrc_t source;
92  CrFwCmpData_t *inData;
93  CrFwInCmdData_t *inSpecificData;
94  CrFwPckt_t inPckt;
95  FwSmDesc_t smDesc;
96  prData_t *prData;
97  CrFwCmpData_t *cmpDataStart;
98  CrFwOutCmpData_t *cmpSpecificData;
99  CrFwPckt_t pckt;
100  CrPsRid_t Rid; /* The request ID containing the packet version number the packet id and the packet sequence control */
101 
102  cmpDataStart = (CrFwCmpData_t *) FwSmGetData(rep);
103  cmpSpecificData = (CrFwOutCmpData_t *) cmpDataStart->cmpSpecificData;
104  pckt = cmpSpecificData->pckt;
105 
106  /* Configure report and load it in the OutLoader */
107 
108  /* Get procedure parameters */
109  prData = FwPrGetData(prDesc);
110 
111  /*smDesc = prData[0];*/
112  smDesc = prData->smDesc;
113 
114  /* Get in packet */
115  inData = FwSmGetData(smDesc);
116  inSpecificData = (CrFwInCmdData_t*)inData->cmpSpecificData;
117  inPckt = inSpecificData->pckt;
118 
119  Rid = getPcktRid(inPckt);
120 
121  if (prData->ushortParam1 == CRPS_REQVERIF_ACC_SUCC)
122  {
123  /* 1,1 */
124  /* Set pcktIdAccFailed */
125  setVerSuccessAccRepRid(pckt, Rid);
126  }
127 
128  if (prData->ushortParam1 == CRPS_REQVERIF_START_SUCC)
129  {
130  /* 1,3 */
131  /* Set pcktIdAccFailed */
132  setVerSuccessStartRepRid(pckt, Rid);
133  }
134 
135  if (prData->ushortParam1 == CRPS_REQVERIF_TERM_SUCC)
136  {
137  /* 1,7 */
138  /* Set pcktIdAccFailed */
139  setVerSuccessTermRepRid(pckt, Rid);
140  }
141 
142  /* Set the destination of the report to the source of the in-coming packet */
143  source = CrFwPcktGetSrc(inPckt);
144  CrFwOutCmpSetDest(rep, source);
145 
146  /* Load report in the Outloader */
148 
149  return;
150 }
151 
152 /* ------------------------------------------------------------------------------------ */
153 /**************/
154 /*** GUARDS ***/
155 /**************/
156 
158 FwPrBool_t CrPsCmdVerSuccG1(FwPrDesc_t prDesc)
159 {
160  CRFW_UNUSED(prDesc);
161 
162  /* [ OutFactory fails to generate OutComponent ] */
163 
164  if (rep == NULL)
165  {
166  return 1;
167  }
168  else
169  {
170  return 0;
171  }
172 
173 }
174 
175 /* ----------------------------------------------------------------------------------------------------------------- */
176 
Type for the Framework Component Data (FCD).
CrFwDestSrc_t CrFwPcktGetSrc(CrFwPckt_t pckt)
Return the source of the command or report encapsulated in a packet.
#define CRPS_REQVERIF_ACC_SUCC
Subtype identifier of the Request Verification Acceptance Successful out-going report packet...
Definition: CrPsConstants.h:85
#define CRFW_UNUSED(x)
A macro that can be used to specify that a function parameter is not used.
Definition: CrFwConstants.h:27
#define CRPS_REQVERIF_START_SUCC
Subtype identifier of the Request Verification Start Successful out-going report packet.
Definition: CrPsConstants.h:95
void setVerSuccessAccRepRid(void *p, CrPsRid_t Rid)
Set "RequestId" in a "VerSuccessAcc" packet.
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.
#define CRPS_TEST_AREYOUALIVE_CONNECTION_CMD
Subtype identifier of the Test AreYouAlive Connection in-coming command packet.
Header file to define all service and packet identifiers.
CrFwPckt_t pckt
Packet to which the out-going command or report is serialized.
Interface for creating and accessing a report or command packet.
#define CRPS_TEST
Type identifier of the Test Service.
#define CRPS_REQVERIF_TERM_SUCC
Subtype identifier of the Request Verification Termination Successful out-going report packet...
void CrPsCmdVerSuccN2(FwPrDesc_t prDesc)
Action for node N2.
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)
CrPsRepErrCode_t
Identifier for the errors reported through the error reporting interface of CrFwRepErr.h.
generic Interface for accessing fields in packets.
void * cmpSpecificData
Derived data which are specific to each type of framework component.
void CrPsCmdVerSuccN3(FwPrDesc_t prDesc)
Action for node N3.
void CrPsCmdVerSuccN4(FwPrDesc_t prDesc)
Action for node N4.
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
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
Definition of the OutComponent Component of the framework.
void setVerSuccessStartRepRid(void *p, CrPsRid_t Rid)
Set "RequestId" in a "VerSuccessStartRep" packet.
static CrPsRid_t getPcktRid(void *p)
Getter for the RequestId from a packet.
Definition: CrPsPkt.h:1067
Create one instance of the CrPsCmdVerSucc procedure.
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.
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 setVerSuccessTermRepRid(void *p, CrPsRid_t Rid)
Set "RequestId" in a "VerSuccessTermRep" packet.
#define CRPS_REQVERIF
Type identifier of the Request Verification Service.
Definition: CrPsConstants.h:80
FwPrBool_t CrPsCmdVerSuccG1(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION2 to N3.
static FwSmDesc_t rep
CrPsCmdVerSucc function definitions.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved