CORDET Framework - C2 Implementation
CrFwAux.c
Go to the documentation of this file.
1 
19 #include <stdlib.h>
20 /* Include framework files */
21 #include "CrFwConstants.h"
23 #include "CrFwAux.h"
24 #include "OutCmp/CrFwOutCmp.h"
25 /* Include configuration files */
26 #include "CrFwOutRegistryUserPar.h"
27 #include "CrFwOutFactoryUserPar.h"
28 #include "CrFwInFactoryUserPar.h"
29 #include "CrFwInStreamUserPar.h"
30 #include "CrFwOutStreamUserPar.h"
31 #include "CrFwOutManagerUserPar.h"
32 
35 
38 
41 
44 
47 
50 
53 
54 /* -------------------------------------------------------------------------- */
56 
59 
62 
65 
68 
70 }
71 
72 /* -------------------------------------------------------------------------- */
79  CrFwBool_t found;
80 
81  if (CR_FW_OUTREGISTRY_N < 1)
82  return 0;
83 
84  for (i=0; i<(CR_FW_OUTREGISTRY_NSERV-1); i++) {
85  if (servDesc[i].servType > servDesc[i+1].servType)
86  /* The following can be dead code, depending on the specific
87  * instantiation of the FW Profile.*/
88  return 0;
89  if (servDesc[i].servType == servDesc[i+1].servType)
90  if (servDesc[i].servSubType > servDesc[i+1].servSubType)
91  /* The following can be dead code, depending on the specific
92  * instantiation of the FW Profile.*/
93  return 0;
94  }
95 
96  for (i=0; i<CR_FW_OUTREGISTRY_NSERV; i++) {
97  servType = servDesc[i].servType;
98  servSubType = servDesc[i].servSubType;
99  found = 0;
100  for (j=0; j<CR_FW_OUTCMP_NKINDS; j++) {
101  if (outCmpKindDesc[j].servType == servType)
102  if (outCmpKindDesc[j].servSubType == servSubType) {
103  found = 1;
104  break;
105  }
106  if (outCmpKindDesc[j].servType > servType)
107  break;
108  }
109  if (found == 0)
110  /* The following can be dead code, depending on the specific
111  * instantiation of the FW Profile.*/
112  return 0;
113  }
114 
115  for (i=0; i<CR_FW_OUTREGISTRY_NSERV; i++) {
116  if (servDesc[i].lowerBoundDisc > servDesc[i].upperBoundDisc)
117  return 0;
118  }
119 
120  for (k=0; k<CR_FW_NOF_INSTREAM; k++)
121  /* The following can be dead code, depending on the specific
122  * instantiation of the FW Profile.*/
123  if (inStreamPcktQueueSize[k]<1)
124  return 0;
125 
126  for (k=0; k<CR_FW_NOF_OUTSTREAM; k++)
127  /* The following can be dead code, depending on the specific
128  * instantiation of the FW Profile.*/
129  if (outStreamPcktQueueSize[k]<1)
130  return 0;
131 
132  for (k=0; k<CR_FW_NOF_OUTMANAGER; k++)
133  /* The following can be dead code, depending on the specific
134  * instantiation of the FW Profile.*/
135  if (outManagerPoclSize[k]<1)
136  return 0;
137 
138  return 1;
139 }
140 
141 /* -------------------------------------------------------------------------- */
148  CrFwBool_t found;
149 
151  return 0;
152 
153  for (i=0; i<(CR_FW_OUTCMP_NKINDS-1); i++) {
154  if (outCmpKindDesc[i].servType > outCmpKindDesc[i+1].servType)
155  return 0;
156 
157  if (outCmpKindDesc[i].servType == outCmpKindDesc[i+1].servType)
158  if (outCmpKindDesc[i].servSubType > outCmpKindDesc[i+1].servSubType)
159  return 0;
160 
161  if (outCmpKindDesc[i].servType == outCmpKindDesc[i+1].servType)
162  if (outCmpKindDesc[i].servSubType == outCmpKindDesc[i+1].servSubType)
163  if (outCmpKindDesc[i].discriminant > outCmpKindDesc[i+1].discriminant)
164  return 0;
165 
166  if (outCmpKindDesc[i].pcktLength < 1)
167  return 0;
168  }
169 
170  for (i=0; i<CR_FW_OUTCMP_NKINDS; i++) {
171  servType = outCmpKindDesc[i].servType;
172  servSubType = outCmpKindDesc[i].servSubType;
173  disc = outCmpKindDesc[i].discriminant;
174  found = 0;
175  for (j=0; j<CR_FW_OUTREGISTRY_NSERV; j++) {
176  if (servDesc[j].servType == servType)
177  if (servDesc[j].servSubType == servSubType)
178  if (disc == 0) {
179  found = 1;
180  break;
181  }
182  if (disc <= servDesc[j].upperBoundDisc)
183  if (disc >= servDesc[j].lowerBoundDisc) {
184  found = 1;
185  break;
186  }
187  if (servDesc[j].servType > servType)
188  break;
189  }
190  if (found == 0)
191  return 0;
192  }
193 
194  return 1;
195 }
196 
197 /* -------------------------------------------------------------------------- */
200 
202  return 0;
203 
204  for (i=0; i<(CR_FW_INCMD_NKINDS-1); i++) {
205  if (inCmdKindDesc[i].servType > inCmdKindDesc[i+1].servType)
206  return 0;
207 
208  if (inCmdKindDesc[i].servType == inCmdKindDesc[i+1].servType)
209  if (inCmdKindDesc[i].servSubType > inCmdKindDesc[i+1].servSubType)
210  return 0;
211 
212  if (inCmdKindDesc[i].servType == inCmdKindDesc[i+1].servType)
213  if (inCmdKindDesc[i].servSubType == inCmdKindDesc[i+1].servSubType)
214  if (inCmdKindDesc[i].discriminant > inCmdKindDesc[i+1].discriminant)
215  return 0;
216  }
217 
218  for (i=0; i<CR_FW_INCMD_NKINDS; i++) {
219  if (inCmdKindDesc[i].servType > CR_FW_MAX_SERV_TYPE)
220  return 0;
221 
222  if (inCmdKindDesc[i].servSubType > CR_FW_MAX_SERV_SUBTYPE)
223  return 0;
224 
225  if (inCmdKindDesc[i].discriminant > CR_FW_MAX_DISCRIMINANT)
226  return 0;
227  }
228 
229  return 1;
230 }
231 
232 /* -------------------------------------------------------------------------- */
235 
237  return 0;
238 
239  for (i=0; i<(CR_FW_INREP_NKINDS-1); i++) {
240  if (inRepKindDesc[i].servType > inRepKindDesc[i+1].servType)
241  return 0;
242 
243  if (inRepKindDesc[i].servType == inRepKindDesc[i+1].servType)
244  if (inRepKindDesc[i].servSubType > inRepKindDesc[i+1].servSubType)
245  return 0;
246 
247  if (inRepKindDesc[i].servType == inRepKindDesc[i+1].servType)
248  if (inRepKindDesc[i].servSubType == inRepKindDesc[i+1].servSubType)
249  if (inRepKindDesc[i].discriminant > inRepKindDesc[i+1].discriminant)
250  return 0;
251  }
252 
253  for (i=0; i<CR_FW_INREP_NKINDS; i++) {
254  if (inRepKindDesc[i].servType > CR_FW_MAX_SERV_TYPE)
255  return 0;
256 
257  if (inRepKindDesc[i].servSubType > CR_FW_MAX_SERV_SUBTYPE)
258  return 0;
259 
260  if (inRepKindDesc[i].discriminant > CR_FW_MAX_DISCRIMINANT)
261  return 0;
262  }
263 
264  return 1;
265 }
unsigned char CrFwCounterU1_t
Type used for unsigned integers with a "short" range.
static CrFwInCmdKindDesc_t inCmdKindDesc[CR_FW_INCMD_NKINDS]
Array of InCommand descriptors.
Definition: CrFwAux.c:37
#define CR_FW_INREP_INIT_KIND_DESC
Definition of the incoming report kinds supported by an application.
CrFwServSubType_t servSubType
The service sub-type.
#define CR_FW_OUTFACTORY_MAX_NOF_OUTCMP
The maximum number of OutComponents which may be allocated at any one time.
static CrFwServDesc_t servDesc[CR_FW_OUTREGISTRY_NSERV]
Array of service descriptors.
Definition: CrFwAux.c:43
#define CR_FW_NOF_OUTSTREAM
The number of OutStream components in the application.
User-modifiable parameters for the InFactory component (see CrFwInFactory.h).
InFactory configuration parameters for InCommands are inconsistent (see CrFwAuxInFactoryInCmdConfigCh...
Definition: CrFwAux.h:51
#define CR_FW_OUTREGISTRY_INIT_SERV_DESC
Definition of the range of out-going services supported by an application.
#define CR_FW_INFACTORY_MAX_NOF_INREP
The maximum number of InReports which may be allocated at any one time.
unsigned short CrFwCmdRepIndex_t
Type for the index of a command or report in the InRegistry or OutRegistry.
Definition: CrFwConstants.h:35
Auxiliary module to check the static part of an application&#39;s configuration.
CrFwBool_t CrFwAuxOutFactoryConfigCheck()
Check the configuration of the OutFactory component.
Definition: CrFwAux.c:142
static CrFwCounterU1_t inStreamPcktQueueSize[CR_FW_NOF_INSTREAM]
The sizes of the packet queues in the InStream components.
Definition: CrFwAux.c:46
CrFwServType_t servType
The service type.
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:32
static CrFwServSubType_t servSubType
Service sub-type.
InCommand kind descriptor type.
Header file to define all invariant publicly available constants and types for the CORDET Framework...
unsigned short CrFwDiscriminant_t
Type used for the discriminant of a command or report.
#define CR_FW_NOF_OUTMANAGER
The number of OutManager components in the application.
CrFwConfigCheckOutcome_t CrFwAuxConfigCheck()
Check the configuration of an application.
Definition: CrFwAux.c:55
CrFwBool_t CrFwAuxInFactoryInRepConfigCheck()
Check the configuration of the InReport part of the InFactory component.
Definition: CrFwAux.c:233
#define CR_FW_OUTSTREAM_PQSIZE
The sizes of the packet queues in the OutStream component.
CrFwConfigCheckOutcome_t
Type for the outcome of the consistency check on the configuration parameters.
Definition: CrFwAux.h:43
unsigned short CrFwCmdRepKindIndex_t
Type for the index of a command or report kind.
#define CR_FW_INCMD_INIT_KIND_DESC
Definition of the incoming command kinds supported by an application.
static CrFwOutCmpKindDesc_t outCmpKindDesc[CR_FW_OUTCMP_NKINDS]
Array of OutComponent descriptors.
Definition: CrFwAux.c:34
User-modifiable parameters for the OutManager components (see CrFwOutManager.h).
OutComponent kind descriptor type.
static CrFwDiscriminant_t disc
Discriminant.
OutFactory configuration parameters are inconsistent (see CrFwAuxOutFactoryConfigCheck.h)
Definition: CrFwAux.h:49
All configuration consistency checks have been passed.
Definition: CrFwAux.h:45
#define CR_FW_MAX_DISCRIMINANT
Maximum value of the discriminant attribute of InReports and InCommands.
InReport kind descriptor type.
InFactory configuration parameters for InReports are inconsistent (see CrFwAuxInFactoryInRepConfigChe...
Definition: CrFwAux.h:53
Definition of the utility functions for the CORDET Framework.
CrFwServType_t servType
The service type.
#define CR_FW_MAX_SERV_SUBTYPE
Maximum value of the service sub-type attribute of InReports and InCommands.
CrFwServSubType_t servSubType
The service sub-type.
#define CR_FW_NOF_INSTREAM
The number of InStream components in the application.
static CrFwCounterU1_t outManagerPoclSize[CR_FW_NOF_OUTMANAGER]
The sizes of the POCL in the OutManager components.
Definition: CrFwAux.c:52
static CrFwInRepKindDesc_t inRepKindDesc[CR_FW_INREP_NKINDS]
Array of InReport service descriptors.
Definition: CrFwAux.c:40
static CrFwServType_t servType
The InCommand type as computed in the Validity Check.
#define CR_FW_OUTREGISTRY_N
The maximum number of out-going commands or reports which can be tracked by the OutRegistry.
User-modifiable parameters for the OutFactory component (see CrFwOutFactory.h).
CrFwBool_t CrFwAuxInFactoryInCmdConfigCheck()
Check the configuration of the InCommand part of the InFactory component.
Definition: CrFwAux.c:198
Definition of the OutComponent Component of the framework.
CrFwDiscriminant_t discriminant
The discriminant value (or zero if no discriminant for this type/sub-type)
#define CR_FW_INCMD_NKINDS
The total number of kinds of incoming commands supported by the application.
#define CR_FW_INREP_NKINDS
The total number of kinds of incoming reports supported by the application.
#define CR_FW_MAX_SERV_TYPE
Maximum value of the service type attribute of InReports and InCommands.
User-modifiable parameters for the OutRegistry component (see CrFwOutRegistry.h). ...
#define CR_FW_OUTCMP_INIT_KIND_DESC
Definition of the OutComponent kinds supported by an application.
User-modifiable parameters for the OutStream components (see CrFwOutStream.h).
#define CR_FW_OUTREGISTRY_NSERV
The total number of service types/sub-types provided by the application.
#define CR_FW_OUTCMP_NKINDS
The total number of kinds of OutComponents supported by the application.
#define CR_FW_OUTMANAGER_POCLSIZE
The sizes of the Pending OutComponent List (POCL) of the OutManager components.
User-modifiable parameters for the InStream components (see CrFwInStream.h).
unsigned char CrFwServType_t
Type used for the service type of a command or report.
#define CR_FW_INFACTORY_MAX_NOF_INCMD
The maximum number of components representing an incoming command which may be allocated at any one t...
Service descriptor type.
#define CR_FW_INSTREAM_PQSIZE
The sizes of the packet queues in the InStream components.
static CrFwCounterU1_t outStreamPcktQueueSize[CR_FW_NOF_OUTSTREAM]
The sizes of the packet queues in the OutStream components.
Definition: CrFwAux.c:49
unsigned char CrFwServSubType_t
Type used for the command or report sub-type.
CrFwBool_t CrFwAuxOutRegistryConfigCheck()
Check the configuration of the OutRegistry component.
Definition: CrFwAux.c:73
OutRegistry configuration parameters are inconsistent (see CrFwAuxOutRegistryConfigCheck.h)
Definition: CrFwAux.h:47
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved