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 "CrFwInRegistryUserPar.h"
27 #include "CrFwInManagerUserPar.h"
28 #include "CrFwOutRegistryUserPar.h"
29 #include "CrFwOutFactoryUserPar.h"
30 #include "CrFwInFactoryUserPar.h"
31 #include "CrFwInStreamUserPar.h"
32 #include "CrFwOutStreamUserPar.h"
33 #include "CrFwOutManagerUserPar.h"
34 
37 
40 
43 
46 
49 
52 
55 
58 
61 
64 
65 
66 /* -------------------------------------------------------------------------- */
68 
71 
74 
77 
80 
81  if (CrFwAuxOutStreamConfigCheck() == 0)
83 
84  if (CrFwAuxInStreamConfigCheck() == 0)
86 
89 
90  if (CrFwAuxInManagerConfigCheck() == 0)
92 
95 
97 }
98 
99 /* -------------------------------------------------------------------------- */
101  unsigned int i;
102 
103  if (CR_FW_NOF_OUTSTREAM < 1)
104  return 0;
105 
106  if (CR_FW_OUTSTREAM_NOF_DEST < 1)
107  return 0;
108 
109  for (i=0; i<CR_FW_OUTSTREAM_NOF_DEST; i++) {
110  if (outStreamDest[i][1] >= CR_FW_NOF_OUTSTREAM)
111  return 0;
112  if (outStreamDest[i][0] < 1)
113  return 0;
114  }
115 
116  for (i=0; i<CR_FW_NOF_OUTSTREAM; i++)
117  if (outStreamPcktQueueSize[i] < 1)
118  return 0;
119 
121  return 0;
122 
123  return 1;
124 }
125 
126 /* -------------------------------------------------------------------------- */
128  unsigned int i;
129 
130  if (CR_FW_NOF_INSTREAM < 1)
131  return 0;
132 
133  if (CR_FW_INSTREAM_NOF_SRCS < 1)
134  return 0;
135 
136  for (i=0; i<CR_FW_INSTREAM_NOF_SRCS; i++) {
137  if (inStreamSrc[i][1] >= CR_FW_NOF_INSTREAM)
138  return 0;
139  if (inStreamSrc[i][0] < 1)
140  return 0;
141  }
142 
143  for (i=0; i<CR_FW_NOF_INSTREAM; i++)
144  if (inStreamPcktQueueSize[i] < 1)
145  return 0;
146 
148  return 0;
149 
150  return 1;
151 }
152 
153 /* -------------------------------------------------------------------------- */
157  CrFwCounterU1_t k;
160  CrFwBool_t found;
161 
162  if (CR_FW_OUTREGISTRY_N < 1)
163  return 0;
164 
165  for (i=0; i<(CR_FW_OUTREGISTRY_NSERV-1); i++) {
166  if (servDesc[i].servType > servDesc[i+1].servType)
167  return 0;
168  if (servDesc[i].servType == servDesc[i+1].servType)
170  return 0;
171  }
172 
173  for (i=0; i<CR_FW_OUTREGISTRY_NSERV; i++) {
176  found = 0;
177  for (j=0; j<CR_FW_OUTCMP_NKINDS; j++) {
178  if (outCmpKindDesc[j].servType == servType)
180  found = 1;
181  break;
182  }
184  break;
185  }
186  if (found == 0)
187  return 0;
188  }
189 
190  for (i=0; i<CR_FW_OUTREGISTRY_NSERV; i++) {
191  if (servDesc[i].lowerBoundDisc > servDesc[i].upperBoundDisc)
192  return 0;
193  }
194 
195  for (k=0; k<CR_FW_NOF_INSTREAM; k++)
196  if (inStreamPcktQueueSize[k]<1)
197  return 0;
198 
199  for (k=0; k<CR_FW_NOF_OUTSTREAM; k++)
200  if (outStreamPcktQueueSize[k]<1)
201  return 0;
202 
203  return 1;
204 }
205 
206 /* -------------------------------------------------------------------------- */
213  CrFwBool_t found;
214 
216  return 0;
217 
218  for (i=0; i<(CR_FW_OUTCMP_NKINDS-1); i++) {
220  return 0;
221 
224  return 0;
225 
228  if (outCmpKindDesc[i].discriminant > outCmpKindDesc[i+1].discriminant)
229  return 0;
230 
231  if (outCmpKindDesc[i].pcktLength < 1)
232  return 0;
233  }
234 
235  for (i=0; i<CR_FW_OUTCMP_NKINDS; i++) {
239  found = 0;
240  for (j=0; j<CR_FW_OUTREGISTRY_NSERV; j++) {
241  if (servDesc[j].servType == servType)
242  if (servDesc[j].servSubType == servSubType)
243  if (disc == 0) {
244  found = 1;
245  break;
246  }
247  if (disc <= servDesc[j].upperBoundDisc)
248  if (disc >= servDesc[j].lowerBoundDisc) {
249  found = 1;
250  break;
251  }
252  if (servDesc[j].servType > servType)
253  break;
254  }
255  if (found == 0)
256  return 0;
257  }
258 
259  return 1;
260 }
261 
262 /* -------------------------------------------------------------------------- */
265 
267  return 0;
268 
269  for (i=0; i<(CR_FW_INCMD_NKINDS-1); i++) {
271  return 0;
272 
275  return 0;
276 
279  if (inCmdKindDesc[i].discriminant > inCmdKindDesc[i+1].discriminant)
280  return 0;
281  }
282 
283  for (i=0; i<CR_FW_INCMD_NKINDS; i++) {
285  return 0;
286 
288  return 0;
289 
290  if (inCmdKindDesc[i].discriminant > CR_FW_MAX_DISCRIMINANT)
291  return 0;
292  }
293 
294  return 1;
295 }
296 
297 /* -------------------------------------------------------------------------- */
300 
302  return 0;
303 
304  for (i=0; i<(CR_FW_INREP_NKINDS-1); i++) {
306  return 0;
307 
310  return 0;
311 
314  if (inRepKindDesc[i].discriminant > inRepKindDesc[i+1].discriminant)
315  return 0;
316  }
317 
318  for (i=0; i<CR_FW_INREP_NKINDS; i++) {
320  return 0;
321 
323  return 0;
324 
325  if (inRepKindDesc[i].discriminant > CR_FW_MAX_DISCRIMINANT)
326  return 0;
327  }
328 
329  return 1;
330 }
331 
332 /* -------------------------------------------------------------------------- */
334  if (CR_FW_INREGISTRY_N < 1)
335  return 0;
336 
337  return 1;
338 }
339 
340 /* -------------------------------------------------------------------------- */
342  unsigned int i;
343 
344  if (CR_FW_NOF_INMANAGER < 1)
345  return 0;
346 
347  for (i=0; i<CR_FW_NOF_INMANAGER; i++)
348  if (inManagerPcrlSize[i] < 1)
349  return 0;
350 
351  return 1;
352 }
353 
354 /* -------------------------------------------------------------------------- */
356  unsigned int i;
357 
358  if (CR_FW_NOF_OUTMANAGER < 1)
359  return 0;
360 
361  for (i=0; i<CR_FW_NOF_OUTMANAGER; i++)
362  if (outManagerPoclSize[i] < 1)
363  return 0;
364 
365  return 1;
366 }
static CrFwServDesc_t servDesc[CR_FW_OUTREGISTRY_NSERV]
Array of service descriptors.
Definition: CrFwAux.c:45
static CrFwInCmdKindDesc_t inCmdKindDesc[CR_FW_INCMD_NKINDS]
Array of InCommand descriptors.
Definition: CrFwAux.c:39
static CrFwInRepKindDesc_t inRepKindDesc[CR_FW_INREP_NKINDS]
Array of InReport service descriptors.
Definition: CrFwAux.c:42
CrFwBool_t CrFwAuxInStreamConfigCheck()
Check the configuration of the InStream component.
Definition: CrFwAux.c:127
CrFwBool_t CrFwAuxOutRegistryConfigCheck()
Check the configuration of the OutRegistry component.
Definition: CrFwAux.c:154
CrFwBool_t CrFwAuxOutStreamConfigCheck()
Check the configuration of the OutStream component.
Definition: CrFwAux.c:100
static CrFwCounterU1_t outManagerPoclSize[CR_FW_NOF_OUTMANAGER]
The sizes of the POCL in the OutManager components.
Definition: CrFwAux.c:51
CrFwConfigCheckOutcome_t CrFwAuxConfigCheck()
Check the configuration of an application.
Definition: CrFwAux.c:67
static CrFwCounterU1_t inStreamPcktQueueSize[CR_FW_NOF_INSTREAM]
The sizes of the packet queues in the InStream components.
Definition: CrFwAux.c:48
static CrFwCounterU1_t outStreamPcktQueueSize[CR_FW_NOF_OUTSTREAM]
The sizes of the packet queues in the OutStream components.
Definition: CrFwAux.c:54
static CrFwDestSrc_t inStreamSrc[CR_FW_INSTREAM_NOF_SRCS][2]
The (source, inStream) pairs.
Definition: CrFwAux.c:60
static CrFwDestSrc_t inManagerPcrlSize[CR_FW_NOF_INMANAGER]
The InManager packet queue sizes.
Definition: CrFwAux.c:63
CrFwBool_t CrFwAuxInFactoryInRepConfigCheck()
Check the configuration of the InReport part of the InFactory component.
Definition: CrFwAux.c:298
CrFwBool_t CrFwAuxInManagerConfigCheck()
Check the configuration of the InManager component.
Definition: CrFwAux.c:341
CrFwBool_t CrFwAuxOutManagerConfigCheck()
Check the configuration of the OutManager component.
Definition: CrFwAux.c:355
CrFwBool_t CrFwAuxOutFactoryConfigCheck()
Check the configuration of the OutFactory component.
Definition: CrFwAux.c:207
static CrFwDestSrc_t outStreamDest[CR_FW_OUTSTREAM_NOF_DEST][2]
The (destination, outStream) pairs.
Definition: CrFwAux.c:57
CrFwBool_t CrFwAuxInFactoryInCmdConfigCheck()
Check the configuration of the InCommand part of the InFactory component.
Definition: CrFwAux.c:263
static CrFwOutCmpKindDesc_t outCmpKindDesc[CR_FW_OUTCMP_NKINDS]
Array of OutComponent descriptors.
Definition: CrFwAux.c:36
CrFwBool_t CrFwAuxInRegistryConfigCheck()
Check the configuration of the InRegistry component.
Definition: CrFwAux.c:333
Auxiliary module to check the static part of an application's configuration.
CrFwConfigCheckOutcome_t
Type for the outcome of the consistency check on the configuration parameters.
Definition: CrFwAux.h:43
@ crOutManagerConfigParInconsistent
OutManager configuration parameters are inconsistent (see CrFwAuxOutManagerConfigCheck....
Definition: CrFwAux.h:63
@ crConsistencyCheckSuccess
All configuration consistency checks have been passed
Definition: CrFwAux.h:45
@ crInRegistryConfigParInconsistent
InRegistry configuration parameters are inconsistent (see CrFwAuxInRegistryConfigCheck....
Definition: CrFwAux.h:59
@ crOutRegistryConfigParInconsistent
OutRegistry configuration parameters are inconsistent (see CrFwAuxOutRegistryConfigCheck....
Definition: CrFwAux.h:47
@ crOutStreamConfigParInconsistent
OutStream configuration parameters are inconsistent (see CrFwAuxOutStreamConfigCheck....
Definition: CrFwAux.h:55
@ crInStreamConfigParInconsistent
InStream configuration parameters are inconsistent (see CrFwAuxInStreamConfigCheck....
Definition: CrFwAux.h:57
@ crInFactoryInCmdConfigParInconsistent
InFactory configuration parameters for InCommands are inconsistent (see CrFwAuxInFactoryInCmdConfigCh...
Definition: CrFwAux.h:51
@ crOutFactoryConfigParInconsistent
OutFactory configuration parameters are inconsistent (see CrFwAuxOutFactoryConfigCheck....
Definition: CrFwAux.h:49
@ crInManagerConfigParInconsistent
InManager configuration parameters are inconsistent (see CrFwAuxInManagerConfigCheck....
Definition: CrFwAux.h:61
@ crInFactoryInRepConfigParInconsistent
InFactory configuration parameters for InReports are inconsistent (see CrFwAuxInFactoryInRepConfigChe...
Definition: CrFwAux.h:53
Header file to define all invariant publicly available constants and types for the CORDET Framework.
unsigned short CrFwCmdRepIndex_t
Type for the index of a command or report in the InRegistry or OutRegistry.
Definition: CrFwConstants.h:35
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:32
static CrFwServType_t servType
The InCommand type as computed in the Validity Check.
User-modifiable parameters for the InFactory component (see CrFwInFactory.h).
#define CR_FW_INREP_INIT_KIND_DESC
Definition of the incoming report kinds supported by an application.
#define CR_FW_INFACTORY_MAX_NOF_INCMD
The maximum number of components representing an incoming command which may be allocated at any one t...
#define CR_FW_INFACTORY_MAX_NOF_INREP
The maximum number of InReports which may be allocated at any one time.
#define CR_FW_INREP_NKINDS
The total number of kinds of incoming reports supported by the application.
#define CR_FW_INCMD_INIT_KIND_DESC
Definition of the incoming command kinds supported by an application.
#define CR_FW_INCMD_NKINDS
The total number of kinds of incoming commands supported by the application.
User-modifiable parameters for the InManager components (see CrFwInManager.h).
#define CR_FW_NOF_INMANAGER
The number of InManager components in the application.
#define CR_FW_INMANAGER_PCRLSIZE
The sizes of the Pending Command/Report List (PCRL) of the InManager components.
User-modifiable parameters for the InRegistry component (see CrFwInRegistry.h).
#define CR_FW_INREGISTRY_N
The maximum number of commands or reports which can be tracked by the InRegistry.
static CrFwDiscriminant_t disc
Discriminant.
static CrFwServSubType_t servSubType
Service sub-type.
User-modifiable parameters for the InStream components (see CrFwInStream.h).
#define CR_FW_INSTREAM_PQSIZE
The sizes of the packet queues in the InStream components.
#define CR_FW_NOF_INSTREAM
The number of InStream components in the application.
#define CR_FW_INSTREAM_SRC_PAIRS
The association of sources to InStreams.
#define CR_FW_INSTREAM_NOF_SRCS
The number of distinct sources from which the InStream components may receive packets.
#define CR_FW_INSTREAM_NOF_GROUPS
The number of groups managed by the InStream components.
Definition of the OutComponent Component of the framework.
User-modifiable parameters for the OutFactory component (see CrFwOutFactory.h).
#define CR_FW_OUTCMP_INIT_KIND_DESC
Definition of the OutComponent kinds supported by an application.
#define CR_FW_OUTCMP_NKINDS
The total number of kinds of OutComponents supported by the application.
#define CR_FW_OUTFACTORY_MAX_NOF_OUTCMP
The maximum number of OutComponents which may be allocated at any one time.
User-modifiable parameters for the OutManager components (see CrFwOutManager.h).
#define CR_FW_NOF_OUTMANAGER
The number of OutManager components in the application.
#define CR_FW_OUTMANAGER_POCLSIZE
The sizes of the Pending OutComponent List (POCL) of the OutManager components.
User-modifiable parameters for the OutRegistry component (see CrFwOutRegistry.h).
#define CR_FW_OUTREGISTRY_INIT_SERV_DESC
Definition of the range of out-going services supported by an application.
#define CR_FW_OUTREGISTRY_N
The maximum number of out-going commands or reports which can be tracked by the OutRegistry.
#define CR_FW_OUTREGISTRY_NSERV
The total number of service types/sub-types provided by the application.
User-modifiable parameters for the OutStream components (see CrFwOutStream.h).
#define CR_FW_NOF_OUTSTREAM
The number of OutStream components in the application.
#define CR_FW_OUTSTREAM_PQSIZE
The sizes of the packet queues in the OutStream component.
#define CR_FW_OUTSTREAM_NOF_DEST
Number of destinations for out-going packets.
#define CR_FW_OUTSTREAM_DEST_PAIRS
The association of destinations to OutStreams.
#define CR_FW_OUTSTREAM_NOF_GROUPS
The number of groups managed by the OutStream components.
#define CR_FW_MAX_SERV_SUBTYPE
Maximum value of the service sub-type attribute of InReports and InCommands.
unsigned char CrFwServType_t
Type used for the service type of a command or report.
#define CR_FW_MAX_SERV_TYPE
Maximum value of the service type attribute of InReports and InCommands.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
unsigned short CrFwDiscriminant_t
Type used for the discriminant of a command or report.
unsigned char CrFwCounterU1_t
Type used for unsigned integers with a "short" range.
unsigned short CrFwCmdRepKindIndex_t
Type for the index of a command or report kind.
#define CR_FW_MAX_DISCRIMINANT
Maximum value of the discriminant attribute of InReports and InCommands.
unsigned char CrFwServSubType_t
Type used for the command or report sub-type.
Definition of the utility functions for the CORDET Framework.
InCommand kind descriptor type.
InReport kind descriptor type.
OutComponent kind descriptor type.
CrFwDiscriminant_t discriminant
The discriminant value (or zero if no discriminant for this type/sub-type)
CrFwServType_t servType
The service type.
CrFwServSubType_t servSubType
The service sub-type.
Service descriptor type.
CrFwServType_t servType
The service type.
CrFwServSubType_t servSubType
The service sub-type.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved