CORDET Framework - C2 Implementation
CrFwSocketTestCases.c
Go to the documentation of this file.
1 
19 #include <stdlib.h>
20 #include "CrFwRepErrStub.h"
21 #include "CrFwInStreamSocket.h"
22 #include "CrFwClientSocket.h"
23 #include "CrFwServerSocket.h"
24 #include "CrFwOutStreamSocket.h"
25 #include "CrFwInStreamTestCases.h"
26 #include "CrFwInStreamStub.h"
27 /* Include FW Profile files */
28 #include "FwSmConstants.h"
29 #include "FwSmConfig.h"
30 #include "FwSmCore.h"
31 #include "FwPrConfig.h"
32 #include "FwPrCore.h"
33 #include "FwPrConstants.h"
34 /* Include configuration files */
35 #include "CrFwInStreamUserPar.h"
36 #include "CrFwCmpData.h"
37 /* Include framework files */
38 #include "InStream/CrFwInStream.h"
39 #include "BaseCmp/CrFwBaseCmp.h"
40 #include "Pckt/CrFwPckt.h"
41 #include "CrFwTime.h"
42 #include "CrFwRepErr.h"
44 /* Include system files */
45 #include <unistd.h>
46 
47 /* ---------------------------------------------------------------------------------------------*/
49  FwSmDesc_t inStream5, outStream5;
50  CrFwPckt_t pcktSend, pcktRec, pcktSend1, pcktRec1, pcktSend2, pcktRec2;
51 
52  /* Instantiate and start the socket-based InStream and OutStream */
53  inStream5 = CrFwInStreamMake(4);
54  if (inStream5 == NULL)
55  return 0;
56  FwSmStart(inStream5);
57  if (!CrFwCmpIsInCreated(inStream5))
58  return 0;
59 
60  outStream5 = CrFwOutStreamMake(4);
61  if (outStream5 == NULL)
62  return 0;
63  FwSmStart(outStream5);
64  if (!CrFwCmpIsInCreated(outStream5))
65  return 0;
66 
67  /* Set port number and host name */
69  CrFwInStreamSocketSetHost("localhost");
71 
72  /* Initialize the OutStream (the server) */
73  CrFwCmpInit(outStream5);
74  if (!CrFwCmpIsInInitialized(outStream5))
75  return 0;
76 
77  /* Wait 1-2 seconds */
78  sleep(1);
79 
80  /* Initialize the InStream (the client) */
81  CrFwCmpInit(inStream5);
82  if (!CrFwCmpIsInInitialized(inStream5))
83  return 0;
84 
85  /* Configure the InStream and OutStream */
86  CrFwCmpReset(inStream5);
87  if (!CrFwCmpIsInConfigured(inStream5)) {
88  CrFwCmpShutdown(inStream5);
89  CrFwCmpShutdown(outStream5);
90  return 0;
91  }
92 
93  /* Wait 1-2 seconds */
94  sleep(1);
95 
96  CrFwCmpReset(outStream5);
97  if (!CrFwCmpIsInConfigured(outStream5)) {
98  CrFwCmpShutdown(inStream5);
99  CrFwCmpShutdown(outStream5);
100  return 0;
101  }
102 
103  /* Send a packet through the OutStream */
104  pcktSend = CrFwPcktMake(100);
105  pcktSend[90] = 99; /* marker */
107  CrFwOutStreamSend(outStream5, pcktSend);
108  CrFwPcktRelease(pcktSend);
109 
110  /* Wait 1-2 seconds */
111  sleep(1);
112 
113  /* Poll the InStream and check that packet was received */
114  CrFwInStreamSocketPoll(inStream5);
115  pcktRec = CrFwInStreamGetPckt(inStream5);
116  if (pcktRec[90] != 99) {
117  CrFwCmpShutdown(inStream5);
118  CrFwCmpShutdown(outStream5);
119  return 0;
120  }
121  CrFwPcktRelease(pcktRec);
122 
123  /* Send two packets through the OutStream */
124  pcktSend1 = CrFwPcktMake(100);
125  pcktSend1[90] = 11; /* marker */
126  CrFwPcktSetSrc(pcktSend1, CR_FW_HOST_APP_ID);
127  CrFwOutStreamSend(outStream5, pcktSend1);
128  CrFwPcktRelease(pcktSend1);
129 
130  pcktSend2 = CrFwPcktMake(100);
131  pcktSend2[90] = 22; /* marker */
132  CrFwPcktSetSrc(pcktSend2, CR_FW_HOST_APP_ID);
133  CrFwOutStreamSend(outStream5, pcktSend2);
134  CrFwPcktRelease(pcktSend2);
135 
136  /* Wait 1-2 seconds */
137  sleep(1);
138 
139  /* Poll the InStream and check that both packets are received */
140  CrFwInStreamSocketPoll(inStream5);
141  pcktRec1 = CrFwInStreamGetPckt(inStream5);
142  if (pcktRec1[90] != 11) {
143  CrFwCmpShutdown(inStream5);
144  CrFwCmpShutdown(outStream5);
145  return 0;
146  }
147  pcktRec2 = CrFwInStreamGetPckt(inStream5);
148  if (pcktRec2[90] != 22) {
149  CrFwCmpShutdown(inStream5);
150  CrFwCmpShutdown(outStream5);
151  return 0;
152  }
153  if (CrFwInStreamGetPckt(inStream5) != NULL) {
154  CrFwCmpShutdown(inStream5);
155  CrFwCmpShutdown(outStream5);
156  return 0;
157  }
158  CrFwPcktRelease(pcktRec1);
159  CrFwPcktRelease(pcktRec2);
160 
161  /* Poll the InStream and check that nothing is returned */
162  CrFwInStreamSocketPoll(inStream5);
163  if (CrFwInStreamGetPckt(inStream5) != NULL) {
164  CrFwCmpShutdown(inStream5);
165  CrFwCmpShutdown(outStream5);
166  return 0;
167  }
168 
169  /* Wait 1-2 seconds */
170  sleep(1);
171 
172  /* Shutdown the InStream and OutStream (this will close the sockets) */
173  CrFwCmpShutdown(inStream5);
174  CrFwCmpShutdown(outStream5);
175 
176  /* Check that all packets have been de-allocated */
177  if (CrFwPcktGetNOfAllocated() != 0)
178  return 0;
179 
180  /* Check application errors */
181  if (CrFwGetAppErrCode() != crNoAppErr)
182  return 0;
183 
184  return 1;
185 }
186 
187 /* ---------------------------------------------------------------------------------------------*/
189  FwSmDesc_t inStream6, inStream7, outStream6, outStream7;
190  CrFwPckt_t pcktSend, pcktRec;
191 
192  /* Instantiate and start the socket-based InStreams and OutStreams */
193  inStream6 = CrFwInStreamMake(5);
194  if (inStream6 == NULL)
195  return 0;
196  FwSmStart(inStream6);
197  if (!CrFwCmpIsInCreated(inStream6))
198  return 0;
199 
200  inStream7 = CrFwInStreamMake(6);
201  if (inStream7 == NULL)
202  return 0;
203  FwSmStart(inStream7);
204  if (!CrFwCmpIsInCreated(inStream7))
205  return 0;
206 
207  outStream6 = CrFwOutStreamMake(5);
208  if (outStream6 == NULL)
209  return 0;
210  FwSmStart(outStream6);
211  if (!CrFwCmpIsInCreated(outStream6))
212  return 0;
213 
214  outStream7 = CrFwOutStreamMake(6);
215  if (outStream7 == NULL)
216  return 0;
217  FwSmStart(outStream7);
218  if (!CrFwCmpIsInCreated(outStream7))
219  return 0;
220 
221  /* Set port number and host name */
223  CrFwClientSocketSetHost("localhost");
225 
226  /* Initialize the server socket */
227  CrFwCmpInit(outStream7);
228  if (!CrFwCmpIsInInitialized(outStream7))
229  return 0;
230  CrFwCmpInit(inStream7);
231  if (!CrFwCmpIsInInitialized(inStream7))
232  return 0;
233 
234  /* Wait 1-2 seconds */
235  sleep(1);
236 
237  /* Initialize the client socket */
238  CrFwCmpInit(inStream6);
239  if (!CrFwCmpIsInInitialized(inStream6))
240  return 0;
241  CrFwCmpInit(outStream6);
242  if (!CrFwCmpIsInInitialized(outStream6))
243  return 0;
244 
245  /* Configure the two sockets and their InStreams/OutStreams */
246  CrFwCmpReset(inStream6);
247  if (!CrFwCmpIsInConfigured(inStream6))
248  return 0;
249  CrFwCmpReset(outStream6);
250  if (!CrFwCmpIsInConfigured(outStream6))
251  return 0;
252  sleep(1);
253  CrFwCmpReset(inStream7);
254  if (!CrFwCmpIsInConfigured(inStream7))
255  return 0;
256  CrFwCmpReset(outStream7);
257  if (!CrFwCmpIsInConfigured(outStream7))
258  return 0;
259 
260  /* Send a packet from the server socket to the client socket (i.e. from OutStream7 to InStream6) */
261  pcktSend = CrFwPcktMake(100);
262  CrFwPcktSetSrc(pcktSend,CrFwInStreamGetSrc(inStream6,1));
263  CrFwPcktSetDest(pcktSend,CrFwOutStreamGetDest(outStream7,1));
264  pcktSend[90] = 99; /* marker */
265  CrFwOutStreamSend(outStream7, pcktSend);
266  CrFwPcktRelease(pcktSend);
267 
268  /* Wait 1-2 seconds */
269  sleep(1);
270 
271  /* Poll the client socket and check that packet was received */
273  pcktRec = CrFwInStreamGetPckt(inStream6);
274  if (pcktRec[90] != 99)
275  return 0;
276  CrFwPcktRelease(pcktRec);
277 
278  /* Send a packet from the client socket to the server socket (i.e. from OutStream6 to InStream7) */
279  pcktSend = CrFwPcktMake(100);
280  CrFwPcktSetSrc(pcktSend,CrFwInStreamGetSrc(inStream7,1));
281  CrFwPcktSetDest(pcktSend,CrFwOutStreamGetDest(outStream6,1));
282  pcktSend[90] = 11; /* marker */
283  CrFwOutStreamSend(outStream6, pcktSend);
284  CrFwPcktRelease(pcktSend);
285 
286  /* Wait 1-2 seconds */
287  sleep(1);
288 
289  /* Poll the server socket and check that packet was received */
291  pcktRec = CrFwInStreamGetPckt(inStream7);
292  if (pcktRec[90] != 11)
293  return 0;
294  CrFwPcktRelease(pcktRec);
295 
296  /* Shutdown the InStreams and OutStreams (this will close the sockets) */
297  CrFwCmpShutdown(inStream6);
298  CrFwCmpShutdown(outStream6);
299  CrFwCmpShutdown(inStream7);
300  CrFwCmpShutdown(outStream7);
301 
302  /* Check that all packets have been de-allocated */
303  if (CrFwPcktGetNOfAllocated() != 0)
304  return 0;
305 
306  /* Check application errors */
307  if (CrFwGetAppErrCode() != crNoAppErr)
308  return 0;
309 
310  return 1;
311 }
312 
313 /* ---------------------------------------------------------------------------------------------*/
315  FwSmDesc_t inStream6, inStream7, outStream6, outStream7;
316  CrFwPckt_t pckt1, pckt2, pckt3, pcktRec;
317  CrFwDestSrc_t src;
318 
319  /* Reset error reporting interface */
321 
322  /* Instantiate and start the socket-based InStreams and OutStreams */
323  inStream6 = CrFwInStreamMake(5);
324  if (inStream6 == NULL)
325  return 0;
326  FwSmStart(inStream6);
327  if (!CrFwCmpIsInCreated(inStream6))
328  return 0;
329 
330  inStream7 = CrFwInStreamMake(6);
331  if (inStream7 == NULL)
332  return 0;
333  FwSmStart(inStream7);
334  if (!CrFwCmpIsInCreated(inStream7))
335  return 0;
336 
337  outStream6 = CrFwOutStreamMake(5);
338  if (outStream6 == NULL)
339  return 0;
340  FwSmStart(outStream6);
341  if (!CrFwCmpIsInCreated(outStream6))
342  return 0;
343 
344  outStream7 = CrFwOutStreamMake(6);
345  if (outStream7 == NULL)
346  return 0;
347  FwSmStart(outStream7);
348  if (!CrFwCmpIsInCreated(outStream7))
349  return 0;
350 
351  /* Set port number and host name */
353  CrFwClientSocketSetHost("localhost");
355 
356  /* Initialize the server socket */
357  CrFwCmpInit(outStream7);
358  if (!CrFwCmpIsInInitialized(outStream7))
359  return 0;
360  CrFwCmpInit(inStream7);
361  if (!CrFwCmpIsInInitialized(inStream7))
362  return 0;
363 
364  /* Wait 1-2 seconds */
365  sleep(1);
366 
367  /* Initialize the client socket */
368  CrFwCmpInit(inStream6);
369  if (!CrFwCmpIsInInitialized(inStream6))
370  return 0;
371  CrFwCmpInit(outStream6);
372  if (!CrFwCmpIsInInitialized(outStream6))
373  return 0;
374 
375  /* Configure the two sockets and their InStreams/OutStreams */
376  CrFwCmpReset(inStream6);
377  if (!CrFwCmpIsInConfigured(inStream6))
378  return 0;
379  CrFwCmpReset(outStream6);
380  if (!CrFwCmpIsInConfigured(outStream6))
381  return 0;
382  sleep(1);
383  CrFwCmpReset(inStream7);
384  if (!CrFwCmpIsInConfigured(inStream7))
385  return 0;
386  CrFwCmpReset(outStream7);
387  if (!CrFwCmpIsInConfigured(outStream7))
388  return 0;
389 
390  /* Send three packets from the server socket to the client socket */
391  pckt1 = CrFwPcktMake(100);
392  pckt2 = CrFwPcktMake(100);
393  pckt3 = CrFwPcktMake(100);
394  pckt1[90] = 99; /* marker */
395  pckt2[90] = 98; /* marker */
396  pckt3[90] = 97; /* marker */
397  src = CrFwInStreamGetSrc(inStream6, 1);
398  CrFwPcktSetSrc(pckt1,src);
399  CrFwPcktSetSrc(pckt2,src);
400  CrFwPcktSetSrc(pckt3,src);
401  CrFwPcktSetGroup(pckt1,0);
402  CrFwPcktSetGroup(pckt2,0);
403  CrFwPcktSetGroup(pckt3,0);
404  CrFwOutStreamSend(outStream7, pckt1);
405  CrFwOutStreamSend(outStream7, pckt2);
406  CrFwOutStreamSend(outStream7, pckt3);
407  CrFwPcktRelease(pckt1);
408  CrFwPcktRelease(pckt2);
409  CrFwPcktRelease(pckt3);
410 
411  /* Wait 1-2 seconds */
412  sleep(1);
413 
414  /* Poll the client socket and check that packets were received */
416  pcktRec = CrFwInStreamGetPckt(inStream6);
417  if (pcktRec[90] != 99)
418  return 0;
419  CrFwPcktRelease(pcktRec);
420  pcktRec = CrFwInStreamGetPckt(inStream6);
421  if (pcktRec[90] != 98)
422  return 0;
423  CrFwPcktRelease(pcktRec);
424  pcktRec = CrFwInStreamGetPckt(inStream6);
425  if (pcktRec[90] != 97)
426  return 0;
427  CrFwPcktRelease(pcktRec);
428 
429  /* Send a packet from the client socket to the server socket */
430  pckt1 = CrFwPcktMake(100);
431  pckt2 = CrFwPcktMake(100);
432  pckt3 = CrFwPcktMake(100);
433  pckt1[90] = 10; /* marker */
434  pckt2[90] = 11; /* marker */
435  pckt3[90] = 12; /* marker */
436  src = CrFwInStreamGetSrc(inStream7, 1);
437  CrFwPcktSetSrc(pckt1,src);
438  CrFwPcktSetSrc(pckt2,src);
439  CrFwPcktSetSrc(pckt3,src);
440  CrFwPcktSetGroup(pckt1,0);
441  CrFwPcktSetGroup(pckt2,0);
442  CrFwPcktSetGroup(pckt3,0);
443  CrFwOutStreamSend(outStream6, pckt1);
444  CrFwOutStreamSend(outStream6, pckt2);
445  CrFwOutStreamSend(outStream6, pckt3);
446  CrFwPcktRelease(pckt1);
447  CrFwPcktRelease(pckt2);
448  CrFwPcktRelease(pckt3);
449 
450  /* Wait 1-2 seconds */
451  sleep(1);
452 
453  /* Poll the server socket and check that packets were received */
455  pcktRec = CrFwInStreamGetPckt(inStream7);
456  if (pcktRec[90] != 10)
457  return 0;
458  CrFwPcktRelease(pcktRec);
459  pcktRec = CrFwInStreamGetPckt(inStream7);
460  if (pcktRec[90] != 11)
461  return 0;
462  CrFwPcktRelease(pcktRec);
463  pcktRec = CrFwInStreamGetPckt(inStream7);
464  if (pcktRec[90] != 12)
465  return 0;
466  CrFwPcktRelease(pcktRec);
467 
468  /* Shutdown the InStreams and OutStreams (this will close the sockets) */
469  CrFwCmpShutdown(inStream6);
470  CrFwCmpShutdown(outStream6);
471  CrFwCmpShutdown(inStream7);
472  CrFwCmpShutdown(outStream7);
473 
474  /* Check that no errors have been reported */
475  if (CrFwRepErrStubGetPos() != 0)
476  return 0;
477 
478  /* Check that all packets have been de-allocated */
479  if (CrFwPcktGetNOfAllocated() != 0)
480  return 0;
481 
482  /* Check application errors */
483  if (CrFwGetAppErrCode() != crNoAppErr)
484  return 0;
485 
486  return 1;
487 }
488 
489 /* ---------------------------------------------------------------------------------------------*/
491  FwSmDesc_t inStream6, inStream7, outStream6, outStream7;
492  CrFwPckt_t sPckt1, sPckt2, sPckt3, cPckt1, cPckt2, cPckt3, pcktRec;
493  CrFwDestSrc_t src;
494 
495  /* Reset error reporting interface */
497 
498  /* Instantiate and start the socket-based InStreams and OutStreams */
499  inStream6 = CrFwInStreamMake(5);
500  if (inStream6 == NULL)
501  return 0;
502  FwSmStart(inStream6);
503  if (!CrFwCmpIsInCreated(inStream6))
504  return 0;
505 
506  inStream7 = CrFwInStreamMake(6);
507  if (inStream7 == NULL)
508  return 0;
509  FwSmStart(inStream7);
510  if (!CrFwCmpIsInCreated(inStream7))
511  return 0;
512 
513  outStream6 = CrFwOutStreamMake(5);
514  if (outStream6 == NULL)
515  return 0;
516  FwSmStart(outStream6);
517  if (!CrFwCmpIsInCreated(outStream6))
518  return 0;
519 
520  outStream7 = CrFwOutStreamMake(6);
521  if (outStream7 == NULL)
522  return 0;
523  FwSmStart(outStream7);
524  if (!CrFwCmpIsInCreated(outStream7))
525  return 0;
526 
527  /* Set port number and host name */
529  CrFwClientSocketSetHost("localhost");
531 
532  /* Initialize the server socket */
533  CrFwCmpInit(outStream7);
534  if (!CrFwCmpIsInInitialized(outStream7))
535  return 0;
536  CrFwCmpInit(inStream7);
537  if (!CrFwCmpIsInInitialized(inStream7))
538  return 0;
539 
540  /* Wait 1-2 seconds */
541  sleep(1);
542 
543  /* Initialize the client socket */
544  CrFwCmpInit(inStream6);
545  if (!CrFwCmpIsInInitialized(inStream6))
546  return 0;
547  CrFwCmpInit(outStream6);
548  if (!CrFwCmpIsInInitialized(outStream6))
549  return 0;
550 
551  /* Configure the two sockets and their InStreams/OutStreams */
552  CrFwCmpReset(inStream6);
553  if (!CrFwCmpIsInConfigured(inStream6))
554  return 0;
555  CrFwCmpReset(outStream6);
556  if (!CrFwCmpIsInConfigured(outStream6))
557  return 0;
558  sleep(1);
559  CrFwCmpReset(inStream7);
560  if (!CrFwCmpIsInConfigured(inStream7))
561  return 0;
562  CrFwCmpReset(outStream7);
563  if (!CrFwCmpIsInConfigured(outStream7))
564  return 0;
565 
566  /* Send packets from one socket the other */
567  sPckt1 = CrFwPcktMake(100);
568  sPckt2 = CrFwPcktMake(100);
569  sPckt3 = CrFwPcktMake(100);
570  sPckt1[90] = 99; /* marker */
571  sPckt2[90] = 98; /* marker */
572  sPckt3[90] = 97; /* marker */
573  src = CrFwInStreamGetSrc(inStream6, 1);
574  CrFwPcktSetSrc(sPckt1,src);
575  CrFwPcktSetSrc(sPckt2,src);
576  CrFwPcktSetSrc(sPckt3,src);
577  CrFwPcktSetGroup(sPckt1,1);
578  CrFwPcktSetGroup(sPckt2,1);
579  CrFwPcktSetGroup(sPckt3,1);
580  cPckt1 = CrFwPcktMake(100);
581  cPckt2 = CrFwPcktMake(100);
582  cPckt3 = CrFwPcktMake(100);
583  cPckt1[90] = 10; /* marker */
584  cPckt2[90] = 11; /* marker */
585  cPckt3[90] = 12; /* marker */
586  src = CrFwInStreamGetSrc(inStream7, 1);
587  CrFwPcktSetSrc(cPckt1,src);
588  CrFwPcktSetSrc(cPckt2,src);
589  CrFwPcktSetSrc(cPckt3,src);
590  CrFwPcktSetGroup(cPckt1,0);
591  CrFwPcktSetGroup(cPckt2,0);
592  CrFwPcktSetGroup(cPckt3,0);
593 
594  CrFwOutStreamSend(outStream7, sPckt1);
595  CrFwOutStreamSend(outStream7, sPckt2);
596  CrFwOutStreamSend(outStream7, sPckt3);
597  CrFwOutStreamSend(outStream6, cPckt1);
598  CrFwOutStreamSend(outStream6, cPckt2);
599  CrFwOutStreamSend(outStream6, cPckt3);
600  CrFwPcktRelease(sPckt1);
601  CrFwPcktRelease(sPckt2);
602  CrFwPcktRelease(sPckt3);
603  CrFwPcktRelease(cPckt1);
604  CrFwPcktRelease(cPckt2);
605  CrFwPcktRelease(cPckt3);
606 
607  /* Wait 1-2 seconds */
608  sleep(1);
609 
610  /* Poll the client socket and check that packets were received */
612  pcktRec = CrFwInStreamGetPckt(inStream6);
613  if (pcktRec[90] != 99)
614  return 0;
615  CrFwPcktRelease(pcktRec);
616  pcktRec = CrFwInStreamGetPckt(inStream6);
617  if (pcktRec[90] != 98)
618  return 0;
619  CrFwPcktRelease(pcktRec);
620  pcktRec = CrFwInStreamGetPckt(inStream6);
621  if (pcktRec[90] != 97)
622  return 0;
623  CrFwPcktRelease(pcktRec);
624 
625  /* Poll the server socket and check that packets were received */
627  pcktRec = CrFwInStreamGetPckt(inStream7);
628  if (pcktRec[90] != 10)
629  return 0;
630  CrFwPcktRelease(pcktRec);
631  pcktRec = CrFwInStreamGetPckt(inStream7);
632  if (pcktRec[90] != 11)
633  return 0;
634  CrFwPcktRelease(pcktRec);
635  pcktRec = CrFwInStreamGetPckt(inStream7);
636  if (pcktRec[90] != 12)
637  return 0;
638  CrFwPcktRelease(pcktRec);
639 
640  /* Shutdown the InStreams and OutStreams (this will close the sockets) */
641  CrFwCmpShutdown(inStream6);
642  CrFwCmpShutdown(outStream6);
643  CrFwCmpShutdown(inStream7);
644  CrFwCmpShutdown(outStream7);
645 
646  /* Check that no errors have been reported */
647  if (CrFwRepErrStubGetPos() != 0)
648  return 0;
649 
650  /* Check that all packets have been de-allocated */
651  if (CrFwPcktGetNOfAllocated() != 0)
652  return 0;
653 
654  /* Check application errors */
655  if (CrFwGetAppErrCode() != crNoAppErr)
656  return 0;
657 
658  return 1;
659 }
void CrFwCmpInit(FwSmDesc_t smDesc)
Initialize a framework component.
Definition: CrFwBaseCmp.c:112
CrFwBool_t CrFwCmpIsInInitialized(FwSmDesc_t smDesc)
Return true if the argument component is in state INITIALIZED.
Definition: CrFwBaseCmp.c:172
void CrFwCmpShutdown(FwSmDesc_t smDesc)
Shutdown a framework component.
Definition: CrFwBaseCmp.c:122
CrFwBool_t CrFwCmpIsInConfigured(FwSmDesc_t smDesc)
Return true if the argument component is in state CONFIGURED.
Definition: CrFwBaseCmp.c:177
void CrFwCmpReset(FwSmDesc_t smDesc)
Reset a framework component.
Definition: CrFwBaseCmp.c:117
CrFwBool_t CrFwCmpIsInCreated(FwSmDesc_t smDesc)
Return true if the argument component is in state CREATED.
Definition: CrFwBaseCmp.c:167
Definition of Base Component.
void CrFwClientSocketSetPort(unsigned short n)
Set the port number for the socket.
void CrFwClientSocketSetHost(char *name)
Set the host name of the server.
void CrFwClientSocketPoll()
Poll the client socket to check whether a new packet has arrived.
Interface for a client socket to be used by InStreams and OutStreams.
Definition of the Framework Component Data (FCD) Type.
unsigned char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:38
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:32
CrFwPckt_t CrFwInStreamGetPckt(FwSmDesc_t smDesc)
Retrieve a packet from the InStream.
Definition: CrFwInStream.c:253
CrFwDestSrc_t CrFwInStreamGetSrc(FwSmDesc_t smDesc, CrFwCounterU1_t i)
Get the i-th packet source of the argument InStream.
Definition: CrFwInStream.c:228
FwSmDesc_t CrFwInStreamMake(CrFwInstanceId_t i)
Factory function to retrieve the i-th InStream State Machine instance.
Definition: CrFwInStream.c:128
Definition of the InStream component.
void CrFwInStreamSocketSetHost(char *name)
Set the host name of the server.
void CrFwInStreamSocketPoll(FwSmDesc_t inStream)
Poll the socket to check whether a new packet has arrived.
void CrFwInStreamSocketSetPort(unsigned short n)
Set the port number for the socket.
Interface for the Socket-Based InStream.
Interface for the InStream stub.
Declaration of the test cases for the InStream Component (see CrFwInStream.h).
User-modifiable parameters for the InStream components (see CrFwInStream.h).
CrFwDestSrc_t CrFwOutStreamGetDest(FwSmDesc_t outStream, CrFwCounterU1_t i)
Return the i-th destination associated to the argument outStream.
FwSmDesc_t CrFwOutStreamMake(CrFwInstanceId_t i)
Factory function to retrieve the i-th OutStream State Machine instance.
void CrFwOutStreamSend(FwSmDesc_t smDesc, CrFwPckt_t pckt)
Send a packet to the OutStream.
void CrFwOutStreamSocketSetPort(unsigned short n)
Set the port number for the socket.
Interface for the Socket-Based OutStream.
Interface for creating and accessing a report or command packet.
CrFwCounterU2_t CrFwPcktGetNOfAllocated()
Return the number of packets which are currently allocated.
Definition: CrFwPckt.c:214
void CrFwPcktRelease(CrFwPckt_t pckt)
Release function for command or report packets.
Definition: CrFwPckt.c:174
void CrFwPcktSetSrc(CrFwPckt_t pckt, CrFwDestSrc_t src)
Set the source of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:351
void CrFwPcktSetDest(CrFwPckt_t pckt, CrFwDestSrc_t dest)
Set the destination of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:339
void CrFwPcktSetGroup(CrFwPckt_t pckt, CrFwGroup_t group)
Set the group of the command/report encapsulated in a packet.
Definition: CrFwPckt.c:422
CrFwPckt_t CrFwPcktMake(CrFwPcktLength_t pcktLength)
Make function for command or report packets.
Definition: CrFwPckt.c:147
void CrFwRepErrStubReset()
Reset the error reporting interface.
Definition: CrFwRepErr.c:84
CrFwCounterU2_t CrFwRepErrStubGetPos()
Return the position in the error report array at which the next error report will be written.
Definition: CrFwRepErr.c:79
Interface for reporting an error detected by a framework component.
The CORDET Framework defines an interface for generating error reports (see CrFwRepErr....
void CrFwServerSocketPoll()
Poll the server socket to check whether a new packet has arrived.
void CrFwServerSocketSetPort(unsigned short n)
Set the port number for the socket.
Interface for a server socket to be used by InStreams and OutStreams.
CrFwBool_t CrFwSocketTestCase2()
Test the initialization and configuration of the client and server sockets of CrFwClientSocket....
CrFwBool_t CrFwSocketTestCase3()
Test the sending and receiving of multiple packets through client and server sockets of CrFwClientSoc...
CrFwBool_t CrFwSocketTestCase4()
Test the interleaved sending and receiving of multiple packets through client and server sockets of C...
CrFwBool_t CrFwSocketTestCase1()
Test the initialization and configuration of the socket-based InStream and OutStream.
Interface through which framework components access the current time.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
@ crNoAppErr
No application errors have been detected.
#define CR_FW_HOST_APP_ID
The identifier of the host application (i.e.
CrFwAppErrCode_t CrFwGetAppErrCode()
Return the value of the application error code.
Definition of the utility functions for the CORDET Framework.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved