automotive-dlt
dlt-test-client.c
Go to the documentation of this file.
1 /*
2  * @licence app begin@
3  * SPDX license identifier: MPL-2.0
4  *
5  * Copyright (C) 2011-2015, BMW AG
6  *
7  * This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
8  *
9  * This Source Code Form is subject to the terms of the
10  * Mozilla Public License (MPL), v. 2.0.
11  * If a copy of the MPL was not distributed with this file,
12  * You can obtain one at http://mozilla.org/MPL/2.0/.
13  *
14  * For further information see http://www.genivi.org/.
15  * @licence end@
16  */
17 
28 /*******************************************************************************
29 ** **
30 ** SRC-MODULE: dlt-test-client.c **
31 ** **
32 ** TARGET : linux **
33 ** **
34 ** PROJECT : DLT **
35 ** **
36 ** AUTHOR : Alexander Wenzel Alexander.AW.Wenzel@bmw.de **
37 ** Markus Klein **
38 ** **
39 ** PURPOSE : **
40 ** **
41 ** REMARKS : **
42 ** **
43 ** PLATFORM DEPENDANT [yes/no]: yes **
44 ** **
45 ** TO BE CHANGED BY USER [yes/no]: no **
46 ** **
47 *******************************************************************************/
48 
49 /*******************************************************************************
50 ** Author Identity **
51 ********************************************************************************
52 ** **
53 ** Initials Name Company **
54 ** -------- ------------------------- ---------------------------------- **
55 ** aw Alexander Wenzel BMW **
56 ** mk Markus Klein Fraunhofer ESK **
57 *******************************************************************************/
58 
59 /*******************************************************************************
60 ** Revision Control History **
61 *******************************************************************************/
62 
63 /*
64  * $LastChangedRevision: 1670 $
65  * $LastChangedDate: 2011-04-08 15:12:06 +0200 (Fr, 08. Apr 2011) $
66  * $LastChangedBy$
67  Initials Date Comment
68  aw 13.01.2010 initial
69  */
70 
71 #include <ctype.h> /* for isprint() */
72 #include <stdlib.h> /* for atoi() */
73 #include <sys/stat.h> /* for S_IRUSR, S_IWUSR, S_IRGRP, S_IROTH */
74 #include <fcntl.h> /* for open() */
75 #include <string.h> /* for strcmp() */
76 #include <sys/uio.h> /* for writev() */
77 
78 #include "dlt_client.h"
79 #include "dlt_protocol.h"
80 #include "dlt_user.h"
81 
82 #define DLT_TESTCLIENT_TEXTBUFSIZE 10024 /* Size of buffer for text output */
83 #define DLT_TESTCLIENT_ECU_ID "ECU1"
84 
85 #define DLT_TESTCLIENT_NUM_TESTS 9
86 
87 static int g_testsFailed = 0;
88 
89 /* Function prototypes */
91 
92 typedef struct
93 {
94  int aflag;
95  int sflag;
96  int xflag;
97  int mflag;
98  int vflag;
99  int yflag;
100  char *ovalue;
101  char *fvalue;
102  char *tvalue;
103  char *evalue;
104  int bvalue;
105 
106  char ecuid[4];
107  int ohandle;
108 
111 
113 
114  int test_counter_macro[DLT_TESTCLIENT_NUM_TESTS];
115  int test_counter_function[DLT_TESTCLIENT_NUM_TESTS];
116 
119 
120  int sock;
122 
126 void usage()
127 {
128  char version[255];
129 
130  dlt_get_version(version,255);
131 
132  printf("Usage: dlt-test-client [options] hostname/serial_device_name\n");
133  printf("Test against received data from dlt-test-user.\n");
134  printf("%s \n", version);
135  printf("Options:\n");
136  printf(" -a Print DLT messages; payload as ASCII\n");
137  printf(" -x Print DLT messages; payload as hex\n");
138  printf(" -m Print DLT messages; payload as hex and ASCII\n");
139  printf(" -s Print DLT messages; only headers\n");
140  printf(" -v Verbose mode\n");
141  printf(" -h Usage\n");
142  printf(" -y Serial device mode\n");
143  printf(" -b baudrate Serial device baudrate (Default: 115200)\n");
144  printf(" -e ecuid Set ECU ID (Default: ECU1)\n");
145  printf(" -o filename Output messages in new DLT file\n");
146  printf(" -f filename Enable filtering of messages\n");
147 }
148 
152 int main(int argc, char* argv[])
153 {
154  DltClient dltclient;
155  DltTestclientData dltdata;
156  int c,i;
157  int index;
158 
159  /* Initialize dltdata */
160  dltdata.aflag = 0;
161  dltdata.sflag = 0;
162  dltdata.xflag = 0;
163  dltdata.mflag = 0;
164  dltdata.vflag = 0;
165  dltdata.yflag = 0;
166  dltdata.ovalue = 0;
167  dltdata.fvalue = 0;
168  dltdata.evalue = 0;
169  dltdata.bvalue = 0;
170  dltdata.ohandle=-1;
171 
172  dltdata.running_test = 0;
173 
174  for (i=0;i<DLT_TESTCLIENT_NUM_TESTS;i++)
175  {
176  dltdata.test_counter_macro[i]=0;
177  dltdata.test_counter_function[i]=0;
178  }
179 
180  dltdata.tests_passed = 0;
181  dltdata.tests_failed = 0;
182 
183  dltdata.sock = -1;
184 
185  /* Fetch command line arguments */
186  opterr = 0;
187 
188  while ((c = getopt (argc, argv, "vashyxmf:o:e:b:")) != -1)
189  {
190  switch (c)
191  {
192  case 'v':
193  {
194  dltdata.vflag = 1;
195  break;
196  }
197  case 'a':
198  {
199  dltdata.aflag = 1;
200  break;
201  }
202  case 's':
203  {
204  dltdata.sflag = 1;
205  break;
206  }
207  case 'x':
208  {
209  dltdata.xflag = 1;
210  break;
211  }
212  case 'm':
213  {
214  dltdata.mflag = 1;
215  break;
216  }
217  case 'h':
218  {
219  usage();
220  return -1;
221  }
222  case 'y':
223  {
224  dltdata.yflag = 1;
225  break;
226  }
227  case 'f':
228  {
229  dltdata.fvalue = optarg;
230  break;
231  }
232  case 'o':
233  {
234  dltdata.ovalue = optarg;
235  break;
236  }
237  case 'e':
238  {
239  dltdata.evalue = optarg;
240  break;
241  }
242  case 'b':
243  {
244  dltdata.bvalue = atoi(optarg);
245  break;
246  }
247  case '?':
248  {
249  if (optopt == 'o' || optopt == 'f' || optopt == 't')
250  {
251  fprintf (stderr, "Option -%c requires an argument.\n", optopt);
252  }
253  else if (isprint (optopt))
254  {
255  fprintf (stderr, "Unknown option `-%c'.\n", optopt);
256  }
257  else
258  {
259  fprintf (stderr, "Unknown option character `\\x%x'.\n",optopt);
260  }
261  /* unknown or wrong option used, show usage information and terminate */
262  usage();
263  return -1;
264  }
265  default:
266  {
267  abort ();
268  return -1;//for parasoft
269  }
270  }
271  }
272 
273  /* Initialize DLT Client */
274  dlt_client_init(&dltclient, dltdata.vflag);
275 
276  /* Register callback to be called when message was received */
278 
279  /* Setup DLT Client structure */
280  dltclient.mode = dltdata.yflag;
281 
282  if (dltclient.mode==0)
283  {
284  for (index = optind; index < argc; index++)
285  {
286  if(dlt_client_set_server_ip(&dltclient, argv[index]) == -1)
287  {
288  fprintf(stderr,"set server ip didn't succeed\n");
289  return -1;
290  }
291  }
292 
293  if (dltclient.servIP == 0)
294  {
295  /* no hostname selected, show usage and terminate */
296  fprintf(stderr,"ERROR: No hostname selected\n");
297  usage();
298  dlt_client_cleanup(&dltclient,dltdata.vflag);
299  return -1;
300  }
301  }
302  else
303  {
304  for (index = optind; index < argc; index++)
305  {
306  if(dlt_client_set_serial_device(&dltclient, argv[index]) == -1)
307  {
308  fprintf(stderr,"set serial device didn't succeed\n");
309  return -1;
310  }
311  }
312 
313  if (dltclient.serialDevice == 0)
314  {
315  /* no serial device name selected, show usage and terminate */
316  fprintf(stderr,"ERROR: No serial device name specified\n");
317  usage();
318  return -1;
319  }
320 
321  dlt_client_setbaudrate(&dltclient,dltdata.bvalue);
322  }
323 
324  /* initialise structure to use DLT file */
325  dlt_file_init(&(dltdata.file),dltdata.vflag);
326 
327  /* first parse filter file if filter parameter is used */
328  dlt_filter_init(&(dltdata.filter),dltdata.vflag);
329 
330  if (dltdata.fvalue)
331  {
332  if (dlt_filter_load(&(dltdata.filter),dltdata.fvalue,dltdata.vflag) < DLT_RETURN_OK)
333  {
334  dlt_file_free(&(dltdata.file),dltdata.vflag);
335  return -1;
336  }
337 
338  dlt_file_set_filter(&(dltdata.file),&(dltdata.filter),dltdata.vflag);
339  }
340 
341  /* open DLT output file */
342  if (dltdata.ovalue)
343  {
344  dltdata.ohandle = open(dltdata.ovalue,O_WRONLY|O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); /* mode: wb */
345 
346  if (dltdata.ohandle == -1)
347  {
348  dlt_file_free(&(dltdata.file),dltdata.vflag);
349  fprintf(stderr,"ERROR: Output file %s cannot be opened!\n",dltdata.ovalue);
350  return -1;
351  }
352  }
353 
354  if (dltdata.evalue)
355  {
356  dlt_set_id(dltdata.ecuid,dltdata.evalue);
357  }
358  else
359  {
361  }
362 
363  /* Connect to TCP socket or open serial device */
364  if (dlt_client_connect(&dltclient, dltdata.vflag) != DLT_RETURN_ERROR)
365  {
366  dltdata.sock = dltclient.sock;
367 
368  /* Dlt Client Main Loop */
369  dlt_client_main_loop(&dltclient, &dltdata, dltdata.vflag);
370 
371  /* Dlt Client Cleanup */
372  dlt_client_cleanup(&dltclient,dltdata.vflag);
373  }
374 
375  /* dlt-receive cleanup */
376  if (dltdata.ovalue)
377  {
378  close(dltdata.ohandle);
379  }
380 
381  dlt_file_free(&(dltdata.file),dltdata.vflag);
382 
383  dlt_filter_free(&(dltdata.filter),dltdata.vflag);
384 
385  return g_testsFailed == 0 ? 0 : 1;
386 }
387 
389 {
390  static char text[DLT_TESTCLIENT_TEXTBUFSIZE];
391  int mtin;
392  DltTestclientData *dltdata;
393 
394  uint32_t type_info, type_info_tmp;
395  int16_t length,length_tmp; /* the macro can set this variable to -1 */
396  uint32_t length_tmp32 = 0;
397  uint8_t *ptr;
398  int32_t datalength;
399 
400  uint32_t id,id_tmp;
401  int slen;
402  int tc_old;
403 
404  struct iovec iov[2];
405  int bytes_written;
406 
407  if ((message==0) || (data==0))
408  {
409  return -1;
410  }
411 
412  dltdata = (DltTestclientData*)data;
413 
414  /* prepare storage header */
415  if (DLT_IS_HTYP_WEID(message->standardheader->htyp))
416  {
417  dlt_set_storageheader(message->storageheader,message->headerextra.ecu);
418  }
419  else
420  {
421  dlt_set_storageheader(message->storageheader,dltdata->ecuid);
422  }
423 
424  if ((dltdata->fvalue==0) || (dltdata->fvalue && dlt_message_filter_check(message,&(dltdata->filter),dltdata->vflag) == DLT_RETURN_TRUE))
425  {
426 
427  dlt_message_header(message,text,sizeof(text),dltdata->vflag);
428  if (dltdata->aflag)
429  {
430  printf("%s ",text);
431  }
432  dlt_message_payload(message,text,sizeof(text),DLT_OUTPUT_ASCII,dltdata->vflag);
433  if (dltdata->aflag)
434  {
435  printf("[%s]\n",text);
436  }
437 
438  if (strcmp(text,"Tests starting")==0)
439  {
440  printf("Tests starting\n");
441  }
442 
443  /* check test 1m */
444  if (strcmp(text,"Test1: (Macro IF) Test all log levels")==0)
445  {
446  printf("Test1m: (Macro IF) Test all log levels\n");
447  dltdata->running_test = 1;
448  dltdata->test_counter_macro[0] = 0;
449  }
450  else if (strcmp(text,"Test1: (Macro IF) finished")==0)
451  {
452  /* >=4, as "info" is default log level */
453  if (dltdata->test_counter_macro[0]>=4)
454  {
455  printf("Test1m PASSED\n");
456  dltdata->tests_passed++;
457  }
458  else
459  {
460  printf("Test1m FAILED\n");
461  dltdata->tests_failed++;
462  }
463  dltdata->running_test = 0;
464  }
465  else if (dltdata->running_test==1)
466  {
467  if (DLT_IS_HTYP_UEH(message->standardheader->htyp))
468  {
469  if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_LOG)
470  {
471  mtin=DLT_GET_MSIN_MTIN(message->extendedheader->msin);
472 
473  if (mtin==DLT_LOG_FATAL)
474  {
475  dltdata->test_counter_macro[0]++;
476  }
477  if (mtin==DLT_LOG_ERROR)
478  {
479  dltdata->test_counter_macro[0]++;
480  }
481  if (mtin==DLT_LOG_WARN)
482  {
483  dltdata->test_counter_macro[0]++;
484  }
485  if (mtin==DLT_LOG_INFO)
486  {
487  dltdata->test_counter_macro[0]++;
488  }
489  if (mtin==DLT_LOG_DEBUG)
490  {
491  dltdata->test_counter_macro[0]++;
492  }
493  if (mtin==DLT_LOG_VERBOSE)
494  {
495  dltdata->test_counter_macro[0]++;
496  }
497  }
498  }
499  }
500 
501  /* check test 2m */
502  if (strcmp(text,"Test2: (Macro IF) Test all variable types (verbose)")==0)
503  {
504  printf("Test2m: (Macro IF) Test all variable types (verbose)\n");
505  dltdata->running_test = 2;
506  dltdata->test_counter_macro[1] = 0;
507  }
508  else if (strcmp(text,"Test2: (Macro IF) finished")==0)
509  {
510  if (dltdata->test_counter_macro[1]==16)
511  {
512  printf("Test2m PASSED\n");
513  dltdata->tests_passed++;
514  }
515  else
516  {
517  printf("Test2m FAILED\n");
518  dltdata->tests_failed++;
519  }
520  dltdata->running_test = 0;
521  }
522  else if (dltdata->running_test==2)
523  {
524  /* Verbose */
525  if (!(DLT_MSG_IS_NONVERBOSE(message)))
526  {
527  type_info=0;
528  type_info_tmp=0;
529  length=0; /* the macro can set this variable to -1 */
530  length_tmp=0;
531  ptr = message->databuffer;
532  datalength = message->datasize;
533 
534  /* Log message */
535  if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_LOG)
536  {
537  if (message->extendedheader->noar>=2)
538  {
539  /* get type of first argument: must be string */
540  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
541  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
542 
543  if (type_info & DLT_TYPE_INFO_STRG)
544  {
545  /* skip string */
546  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
547  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
548 
549  if (length>=0)
550  {
551  ptr+=length;
552  datalength-=length;
553 
554  /* read type of second argument: must be raw */
555  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
556  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
557 
558  if ((type_info & DLT_TYPE_INFO_STRG) && ((type_info & DLT_TYPE_INFO_SCOD) == DLT_SCOD_ASCII))
559  {
560  if (datalength==(sizeof(uint16_t)+strlen("Hello world")+1))
561  {
562  dltdata->test_counter_macro[1]++;
563  }
564  }
565  else if ((type_info & DLT_TYPE_INFO_STRG) && ((type_info & DLT_TYPE_INFO_SCOD) == DLT_SCOD_UTF8))
566  {
567  if (datalength==(sizeof(uint16_t)+strlen("Hello world")+1))
568  {
569  dltdata->test_counter_macro[1]++;
570  }
571  }
572  else if (type_info & DLT_TYPE_INFO_BOOL)
573  {
574  if (datalength==sizeof(uint8_t))
575  {
576  dltdata->test_counter_macro[1]++;
577  }
578  }
579  else if (type_info & DLT_TYPE_INFO_SINT)
580  {
581  switch (type_info & DLT_TYPE_INFO_TYLE)
582  {
583  case DLT_TYLE_8BIT:
584  {
585  if (datalength==sizeof(int8_t))
586  {
587  dltdata->test_counter_macro[1]++;
588  }
589  break;
590  }
591  case DLT_TYLE_16BIT:
592  {
593  if (datalength==sizeof(int16_t))
594  {
595  dltdata->test_counter_macro[1]++;
596  }
597  break;
598  }
599  case DLT_TYLE_32BIT:
600  {
601  if (datalength==sizeof(int32_t))
602  {
603  dltdata->test_counter_macro[1]++;
604  }
605  break;
606  }
607  case DLT_TYLE_64BIT:
608  {
609  if (datalength==sizeof(int64_t))
610  {
611  dltdata->test_counter_macro[1]++;
612  }
613  break;
614  }
615  case DLT_TYLE_128BIT:
616  {
617  /* Not tested here */
618  break;
619  }
620  }
621  }
622  else if (type_info & DLT_TYPE_INFO_UINT)
623  {
624  switch (type_info & DLT_TYPE_INFO_TYLE)
625  {
626  case DLT_TYLE_8BIT:
627  {
628  if (datalength==sizeof(uint8_t))
629  {
630  dltdata->test_counter_macro[1]++;
631  }
632  break;
633  }
634  case DLT_TYLE_16BIT:
635  {
636  if (datalength==sizeof(uint16_t))
637  {
638  dltdata->test_counter_macro[1]++;
639  }
640  break;
641  }
642  case DLT_TYLE_32BIT:
643  {
644  if (datalength==sizeof(uint32_t))
645  {
646  dltdata->test_counter_macro[1]++;
647  }
648  break;
649  }
650  case DLT_TYLE_64BIT:
651  {
652  if (datalength==sizeof(uint64_t))
653  {
654  dltdata->test_counter_macro[1]++;
655  }
656  break;
657  }
658  case DLT_TYLE_128BIT:
659  {
660  /* Not tested here */
661  break;
662  }
663  }
664  }
665  else if (type_info & DLT_TYPE_INFO_FLOA)
666  {
667  switch (type_info & DLT_TYPE_INFO_TYLE)
668  {
669  case DLT_TYLE_8BIT:
670  {
671  /* Not tested here */
672  break;
673  }
674  case DLT_TYLE_16BIT:
675  {
676  /* Not tested here */
677  break;
678  }
679  case DLT_TYLE_32BIT:
680  {
681  if (datalength==(2*sizeof(float)+sizeof(uint32_t)))
682  {
683  dltdata->test_counter_macro[1]++;
684  }
685  break;
686  }
687  case DLT_TYLE_64BIT:
688  {
689  if (datalength==(2*sizeof(double)+sizeof(uint32_t)))
690  {
691  dltdata->test_counter_macro[1]++;
692  }
693  break;
694  }
695  case DLT_TYLE_128BIT:
696  /* Not tested here */
697  break;
698  }
699  }
700  else if (type_info & DLT_TYPE_INFO_RAWD)
701  {
702  /* Get length */
703  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
704  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
705  if ((length==datalength) && (10 == length))
706  {
707  dltdata->test_counter_macro[1]++;
708  }
709  }
710  }
711  }
712  }
713  }
714  }
715  }
716 
717  /* check test 3m */
718  if (strcmp(text,"Test3: (Macro IF) Test all variable types (non-verbose)")==0)
719  {
720  printf("Test3m: (Macro IF) Test all variable types (non-verbose)\n");
721  dltdata->running_test = 3;
722  dltdata->test_counter_macro[2]=0;
723  }
724  else if (strcmp(text,"Test3: (Macro IF) finished")==0)
725  {
726  if (dltdata->test_counter_macro[2]==16)
727  {
728  printf("Test3m PASSED\n");
729  dltdata->tests_passed++;
730  }
731  else
732  {
733  printf("Test3m FAILED\n");
734  dltdata->tests_failed++;
735  }
736  dltdata->running_test = 0;
737  }
738  else if (dltdata->running_test==3)
739  {
740  /* Nonverbose */
741  if (DLT_MSG_IS_NONVERBOSE(message))
742  {
743  id=0;
744  id_tmp=0;
745  ptr = message->databuffer;
746  datalength = message->datasize;
747  slen=-1;
748 
749  tc_old=dltdata->test_counter_macro[2];
750 
751  /* Get message id */
752  DLT_MSG_READ_VALUE(id_tmp,ptr,datalength,uint32_t);
753  id=DLT_ENDIAN_GET_32(message->standardheader->htyp, id_tmp);
754 
755  /* Length of string */
756  datalength-=sizeof(uint16_t);
757  ptr+=sizeof(uint16_t);
758 
759  switch (id)
760  {
761  case 1:
762  {
763  slen=strlen("string")+1;
764  datalength-=slen;
765  ptr+=slen;
766  if (datalength==sizeof(uint16_t)+strlen("Hello world")+1)
767  {
768  dltdata->test_counter_macro[2]++;
769  }
770  break;
771  }
772  case 2:
773  {
774  slen=strlen("utf8")+1;
775  datalength-=slen;
776  ptr+=slen;
777  if (datalength==sizeof(uint16_t)+strlen("Hello world")+1)
778  {
779  dltdata->test_counter_macro[2]++;
780  }
781  break;
782  }
783  case 3:
784  {
785  slen=strlen("bool")+1;
786  datalength-=slen;
787  ptr+=slen;
788  if (datalength==sizeof(uint8_t))
789  {
790  dltdata->test_counter_macro[2]++;
791  }
792  break;
793  }
794  case 4:
795  {
796  slen=strlen("int")+1;
797  datalength-=slen;
798  ptr+=slen;
799  if (datalength==sizeof(int))
800  {
801  dltdata->test_counter_macro[2]++;
802  }
803  break;
804  }
805  case 5:
806  {
807  slen=strlen("int8")+1;
808  datalength-=slen;
809  ptr+=slen;
810  if (datalength==sizeof(int8_t))
811  {
812  dltdata->test_counter_macro[2]++;
813  }
814  break;
815  }
816  case 6:
817  {
818  slen=strlen("int16")+1;
819  datalength-=slen;
820  ptr+=slen;
821  if (datalength==sizeof(int16_t))
822  {
823  dltdata->test_counter_macro[2]++;
824  }
825  break;
826  }
827  case 7:
828  {
829  slen=strlen("int32")+1;
830  datalength-=slen;
831  ptr+=slen;
832  if (datalength==sizeof(int32_t))
833  {
834  dltdata->test_counter_macro[2]++;
835  }
836  break;
837  }
838  case 8:
839  {
840  slen=strlen("int64")+1;
841  datalength-=slen;
842  ptr+=slen;
843  if (datalength==sizeof(int64_t))
844  {
845  dltdata->test_counter_macro[2]++;
846  }
847  break;
848  }
849  case 9:
850  {
851  slen=strlen("uint")+1;
852  datalength-=slen;
853  ptr+=slen;
854  if (datalength==sizeof(unsigned int))
855  {
856  dltdata->test_counter_macro[2]++;
857  }
858  break;
859  }
860  case 10:
861  {
862  slen=strlen("uint8")+1;
863  datalength-=slen;
864  ptr+=slen;
865  if (datalength==sizeof(uint8_t))
866  {
867  dltdata->test_counter_macro[2]++;
868  }
869  break;
870  }
871  case 11:
872  {
873  slen=strlen("uint16")+1;
874  datalength-=slen;
875  ptr+=slen;
876  if (datalength==sizeof(uint16_t))
877  {
878  dltdata->test_counter_macro[2]++;
879  }
880  break;
881  }
882  case 12:
883  {
884  slen=strlen("uint32")+1;
885  datalength-=slen;
886  ptr+=slen;
887  if (datalength==sizeof(uint32_t))
888  {
889  dltdata->test_counter_macro[2]++;
890  }
891  break;
892  }
893  case 13:
894  {
895  slen=strlen("uint64")+1;
896  datalength-=slen;
897  ptr+=slen;
898  if (datalength==sizeof(uint64_t))
899  {
900  dltdata->test_counter_macro[2]++;
901  }
902  break;
903  }
904  case 14:
905  {
906  slen=strlen("float32")+1;
907  datalength-=slen;
908  ptr+=slen;
909  /* 2*, as the min and the max is transfered */
910  if (datalength==2*sizeof(float))
911  {
912  dltdata->test_counter_macro[2]++;
913  }
914  break;
915  }
916  case 15:
917  {
918  slen=strlen("float64")+1;
919  datalength-=slen;
920  ptr+=slen;
921  /* 2*, as the min and the max is transfered */
922  if (datalength==2*sizeof(double))
923  {
924  dltdata->test_counter_macro[2]++;
925  }
926  break;
927  }
928  case 16:
929  {
930  slen=strlen("raw")+1;
931  datalength-=slen;
932  ptr+=slen;
933  datalength-=sizeof(uint16_t);
934  ptr+=sizeof(uint16_t);
935  if (datalength==10)
936  {
937  dltdata->test_counter_macro[2]++;
938  }
939  break;
940  }
941  }
942 
943  if ((slen>=0) && (tc_old==dltdata->test_counter_macro[2]))
944  {
945  printf("ID=%d, Datalength=%d => Failed!",id,datalength);
946  }
947  }
948  }
949 
950  /* check test 4m */
951  if (strcmp(text,"Test4: (Macro IF) Test different message sizes")==0)
952  {
953  printf("Test4m: (Macro IF) Test different message sizes\n");
954  dltdata->running_test = 4;
955  dltdata->test_counter_macro[3]=0;
956  }
957  else if (strcmp(text,"Test4: (Macro IF) finished")==0)
958  {
959  if (dltdata->test_counter_macro[3]==4)
960  {
961  printf("Test4m PASSED\n");
962  dltdata->tests_passed++;
963  }
964  else
965  {
966  printf("Test4m FAILED\n");
967  dltdata->tests_failed++;
968  }
969  dltdata->running_test = 0;
970  }
971  else if (dltdata->running_test==4)
972  {
973  /* Extended header */
974  if (DLT_IS_HTYP_UEH(message->standardheader->htyp))
975  {
976  /* Log message */
977  if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_LOG)
978  {
979  /* Verbose */
980  if (DLT_IS_MSIN_VERB(message->extendedheader->msin))
981  {
982  /* 2 arguments */
983  if (message->extendedheader->noar==2)
984  {
985  /* verbose mode */
986  type_info=0;
987  type_info_tmp=0;
988  length=0;
989  length_tmp=0; /* the macro can set this variable to -1 */
990 
991  ptr = message->databuffer;
992  datalength = message->datasize;
993 
994  /* first read the type info of the first argument: must be string */
995  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
996  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
997 
998  if (type_info & DLT_TYPE_INFO_STRG)
999  {
1000  /* skip string */
1001  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1002  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1003 
1004  if (length>=0)
1005  {
1006  ptr+=length;
1007  datalength-=length;
1008 
1009  /* read type of second argument: must be raw */
1010  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1011  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1012 
1013  if (type_info & DLT_TYPE_INFO_RAWD)
1014  {
1015  /* get length of raw data block */
1016  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1017  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1018 
1019  if ((length>=0) && (length==datalength))
1020  {
1021  //printf("Raw data found in payload, length=");
1022  //printf("%d, datalength=%d \n", length, datalength);
1023  dltdata->test_counter_macro[3]++;
1024  }
1025  }
1026  }
1027  }
1028  }
1029  }
1030  }
1031  }
1032  }
1033 
1034  /* check test 5m */
1035  if (strcmp(text,"Test5: (Macro IF) Test high-level API")==0)
1036  {
1037  printf("Test5m: (Macro IF) Test high-level API\n");
1038  dltdata->running_test = 5;
1039  dltdata->test_counter_macro[4]=0;
1040  }
1041  else if (strcmp(text,"Test5: (Macro IF) finished")==0)
1042  {
1043  if (dltdata->test_counter_macro[4]==12)
1044  {
1045  printf("Test5m PASSED\n");
1046  dltdata->tests_passed++;
1047  }
1048  else
1049  {
1050  printf("Test5m FAILED\n");
1051  dltdata->tests_failed++;
1052  }
1053  dltdata->running_test = 0;
1054  }
1055  else if (dltdata->running_test==5)
1056  {
1057  if (strcmp(text,"Next line: DLT_LOG_INT")==0)
1058  {
1059  dltdata->test_counter_macro[4]++;
1060  }
1061  if (strcmp(text,"-42")==0)
1062  {
1063  dltdata->test_counter_macro[4]++;
1064  }
1065 
1066  if (strcmp(text,"Next line: DLT_LOG_UINT")==0)
1067  {
1068  dltdata->test_counter_macro[4]++;
1069  }
1070  if (strcmp(text,"42")==0)
1071  {
1072  dltdata->test_counter_macro[4]++;
1073  }
1074 
1075  if (strcmp(text,"Next line: DLT_LOG_STRING")==0)
1076  {
1077  dltdata->test_counter_macro[4]++;
1078  }
1079  if (strcmp(text,"String output")==0)
1080  {
1081  dltdata->test_counter_macro[4]++;
1082  }
1083 
1084  if (strcmp(text,"Next line: DLT_LOG_RAW")==0)
1085  {
1086  dltdata->test_counter_macro[4]++;
1087  }
1088  if (strcmp(text,"00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f")==0)
1089  {
1090  dltdata->test_counter_macro[4]++;
1091  }
1092 
1093  if (strcmp(text,"Next line: DLT_LOG_STRING_INT")==0)
1094  {
1095  dltdata->test_counter_macro[4]++;
1096  }
1097  if (strcmp(text,"String output: -42")==0)
1098  {
1099  dltdata->test_counter_macro[4]++;
1100  }
1101 
1102  if (strcmp(text,"Next line: DLT_LOG_STRING_UINT")==0)
1103  {
1104  dltdata->test_counter_macro[4]++;
1105  }
1106  if (strcmp(text,"String output: 42")==0)
1107  {
1108  dltdata->test_counter_macro[4]++;
1109  }
1110  }
1111 
1112  /* check test 6m */
1113  if (strcmp(text,"Test 6: (Macro IF) Test local printing")==0)
1114  {
1115  printf("Test6m: (Macro IF) Test local printing\n");
1116  dltdata->running_test = 6;
1117  dltdata->test_counter_macro[5]=0;
1118  }
1119  else if (strcmp(text,"Test6: (Macro IF) finished")==0)
1120  {
1121  if (dltdata->test_counter_macro[5]==2)
1122  {
1123  printf("Test6m PASSED\n");
1124  dltdata->tests_passed++;
1125  }
1126  else
1127  {
1128  printf("Test6m FAILED\n");
1129  dltdata->tests_failed++;
1130  }
1131  dltdata->running_test = 0;
1132  }
1133  else if (dltdata->running_test==6)
1134  {
1135  if (strcmp(text,"Message (visible: locally printed)")==0)
1136  {
1137  printf("Message (visible: locally printed)\n");
1138  dltdata->test_counter_macro[5]++;
1139  }
1140  if (strcmp(text,"Message (invisible: not locally printed)")==0)
1141  {
1142  printf("Message (invisible: not locally printed)\n");
1143  dltdata->test_counter_macro[5]++;
1144  }
1145  }
1146 
1147  /* check test 7m */
1148  if (strcmp(text,"Test 7: (Macro IF) Test network trace")==0)
1149  {
1150  printf("Test7m: (Macro IF) Test network trace\n");
1151  dltdata->running_test = 7;
1152  dltdata->test_counter_macro[6]=0;
1153  }
1154  else if (strcmp(text,"Test7: (Macro IF) finished")==0)
1155  {
1156  if (dltdata->test_counter_macro[6]==8)
1157  {
1158  printf("Test7m PASSED\n");
1159  dltdata->tests_passed++;
1160  }
1161  else
1162  {
1163  printf("Test7m FAILED\n");
1164  dltdata->tests_failed++;
1165  }
1166  dltdata->running_test = 0;
1167  }
1168  else if (dltdata->running_test==7)
1169  {
1170  if (DLT_IS_HTYP_UEH(message->standardheader->htyp))
1171  {
1172  if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_NW_TRACE)
1173  {
1174  /* Check message type information*/
1175  /* Each correct message type increases the counter by 1 */
1176  mtin=DLT_GET_MSIN_MTIN(message->extendedheader->msin);
1177 
1178  if (mtin==DLT_NW_TRACE_IPC)
1179  {
1180  dltdata->test_counter_macro[6]++;
1181  }
1182  if (mtin==DLT_NW_TRACE_CAN)
1183  {
1184  dltdata->test_counter_macro[6]++;
1185  }
1186  if (mtin==DLT_NW_TRACE_FLEXRAY)
1187  {
1188  dltdata->test_counter_macro[6]++;
1189  }
1190  if (mtin==DLT_NW_TRACE_MOST)
1191  {
1192  dltdata->test_counter_macro[6]++;
1193  }
1194 
1195  /* Check payload, must be two arguments (2 raw data blocks) */
1196  /* If the payload is correct, the counter is increased by 1 */
1197  if (message->extendedheader->noar==2)
1198  {
1199  /* verbose mode */
1200  type_info=0;
1201  type_info_tmp=0;
1202  length=0,length_tmp=0; /* the macro can set this variable to -1 */
1203 
1204  ptr = message->databuffer;
1205  datalength = message->datasize;
1206 
1207  /* first read the type info of the first argument: must be string */
1208  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1209  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1210 
1211  if (type_info & DLT_TYPE_INFO_RAWD)
1212  {
1213  /* skip string */
1214  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1215  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1216 
1217  if (length>=0)
1218  {
1219  ptr+=length;
1220  datalength-=length;
1221 
1222  /* read type of second argument: must be raw */
1223  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1224  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1225 
1226  if (type_info & DLT_TYPE_INFO_RAWD)
1227  {
1228  /* get length of raw data block */
1229  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1230  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1231 
1232  if ((length>=0) && (length==datalength))
1233  {
1234  //printf("Raw data found in payload, length=");
1235  //printf("%d, datalength=%d \n", length, datalength);
1236  dltdata->test_counter_macro[6]++;
1237  }
1238  }
1239  }
1240  }
1241  }
1242  }
1243  }
1244  }
1245 
1246  /* check test 8m */
1247  if (strcmp(text,"Test 8: (Macro IF) Test truncated network trace")==0)
1248  {
1249  printf("Test8m: (Macro IF) Test truncated network trace\n");
1250  dltdata->running_test = 8;
1251  dltdata->test_counter_macro[7]=0;
1252  }
1253  else if (strcmp(text,"Test8: (Macro IF) finished")==0)
1254  {
1255  if (dltdata->test_counter_macro[7]==20)
1256  {
1257  printf("Test8m PASSED\n");
1258  dltdata->tests_passed++;
1259  }
1260  else
1261  {
1262  printf("Test8m FAILED\n");
1263  dltdata->tests_failed++;
1264  }
1265  dltdata->running_test = 0;
1266  }
1267  else if (dltdata->running_test==8)
1268  {
1269  if (DLT_IS_HTYP_UEH(message->standardheader->htyp))
1270  {
1271  if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_NW_TRACE)
1272  {
1273  /* Check message type information*/
1274  /* Each correct message type increases the counter by 1 */
1275  mtin=DLT_GET_MSIN_MTIN(message->extendedheader->msin);
1276 
1277  if (mtin==DLT_NW_TRACE_IPC)
1278  {
1279  dltdata->test_counter_macro[7]++;
1280  }
1281  if (mtin==DLT_NW_TRACE_CAN)
1282  {
1283  dltdata->test_counter_macro[7]++;
1284  }
1285  if (mtin==DLT_NW_TRACE_FLEXRAY)
1286  {
1287  dltdata->test_counter_macro[7]++;
1288  }
1289  if (mtin==DLT_NW_TRACE_MOST)
1290  {
1291  dltdata->test_counter_macro[7]++;
1292  }
1293 
1294  /* Check payload, must be two arguments (2 raw data blocks) */
1295  /* If the payload is correct, the counter is increased by 1 */
1296  if (message->extendedheader->noar==4)
1297  {
1298  type_info=0;
1299  type_info_tmp=0;
1300  length=0,length_tmp=0; /* the macro can set this variable to -1 */
1301 
1302  ptr = message->databuffer;
1303  datalength = message->datasize;
1304 
1305  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1306  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1307  if(type_info & DLT_TYPE_INFO_STRG)
1308  {
1309  // Read NWTR
1310  char chdr[10];
1311  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1312  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1313  DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
1314 
1315  if(strcmp((char *)chdr, "NWTR")==0)
1316  {
1317  dltdata->test_counter_macro[7]++;
1318  }
1319 
1320  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1321  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1322  if(type_info & DLT_TYPE_INFO_RAWD)
1323  {
1324  char hdr[2048];
1325  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1326  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1327  DLT_MSG_READ_STRING(hdr, ptr, datalength, length);
1328 
1329  if(length == 16 && hdr[15] == 15)
1330  {
1331  dltdata->test_counter_macro[7]++;
1332  }
1333 
1334  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1335  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1336  if(type_info & DLT_TYPE_INFO_UINT)
1337  {
1338  uint32_t orig_size;
1339  DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
1340  orig_size=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
1341  if(orig_size == 1024*5)
1342  {
1343  dltdata->test_counter_macro[7]++;
1344  }
1345 
1346  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1347  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1348  if(type_info & DLT_TYPE_INFO_RAWD)
1349  {
1350  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1351  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1352  // Size of the truncated message after headers
1353  if(length == DLT_USER_BUF_MAX_SIZE - 41 - sizeof(uint16_t) - sizeof(uint32_t))
1354  {
1355  dltdata->test_counter_macro[7]++;
1356  }
1357  }
1358  }
1359  }
1360  }
1361  }
1362  }
1363  }
1364  }
1365 
1366 
1367  /* check test 9m */
1368  if (strcmp(text,"Test 9: (Macro IF) Test segmented network trace")==0)
1369  {
1370  printf("Test9m: (Macro IF) Test segmented network trace\n");
1371  dltdata->running_test = 9;
1372  dltdata->test_counter_macro[8]=0;
1373  }
1374  else if (strcmp(text,"Test9: (Macro IF) finished")==0)
1375  {
1376  /* (Interface types) * (results per packet)*/
1377  if (dltdata->test_counter_macro[8]==4*35)
1378  {
1379  printf("Test9m PASSED\n");
1380  dltdata->tests_passed++;
1381  }
1382  else
1383  {
1384  printf("Test9m FAILED\n");
1385  dltdata->tests_failed++;
1386  }
1387  dltdata->running_test = 0;
1388  }
1389  else if (dltdata->running_test==9)
1390  {
1391  if (DLT_IS_HTYP_UEH(message->standardheader->htyp))
1392  {
1393  if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_NW_TRACE)
1394  {
1395  /* Check message type information*/
1396  /* Each correct message type increases the counter by 1 */
1397  mtin=DLT_GET_MSIN_MTIN(message->extendedheader->msin);
1398 
1399  if (mtin==DLT_NW_TRACE_IPC)
1400  {
1401  dltdata->test_counter_macro[8]++;
1402  }
1403  if (mtin==DLT_NW_TRACE_CAN)
1404  {
1405  dltdata->test_counter_macro[8]++;
1406  }
1407  if (mtin==DLT_NW_TRACE_FLEXRAY)
1408  {
1409  dltdata->test_counter_macro[8]++;
1410  }
1411  if (mtin==DLT_NW_TRACE_MOST)
1412  {
1413  dltdata->test_counter_macro[8]++;
1414  }
1415 
1416  /* Payload for first segmented message */
1417  if (message->extendedheader->noar==6)
1418  {
1419  /* verbose mode */
1420  type_info=0;
1421  type_info_tmp=0;
1422  length=0,length_tmp=0; /* the macro can set this variable to -1 */
1423 
1424  ptr = message->databuffer;
1425  datalength = message->datasize;
1426 
1427  /* NWST */
1428  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1429  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1430  if(type_info & DLT_TYPE_INFO_STRG)
1431  {
1432  char chdr[10];
1433  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1434  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1435  DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
1436  if(strcmp((char *)chdr, "NWST")==0)
1437  {
1438  dltdata->test_counter_macro[8]++;
1439  }
1440 
1441  /* Streahandle */
1442  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1443  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1444  if(type_info & DLT_TYPE_INFO_UINT)
1445  {
1446  uint32_t handle;
1447  DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
1448  handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
1449  if(handle > 0)
1450  {
1451  dltdata->test_counter_macro[8]++;
1452  }
1453 
1454  /* Header */
1455  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1456  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1457  if(type_info & DLT_TYPE_INFO_RAWD)
1458  {
1459  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1460  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1461 
1462  // Test packet header size 16
1463  if(length == 16)
1464  {
1465  dltdata->test_counter_macro[8]++;
1466  }
1467  /* Skip data */
1468  ptr+=length;
1469  datalength-=length;
1470 
1471  /* Payload size */
1472  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1473  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1474  if(type_info & DLT_TYPE_INFO_UINT)
1475  {
1476  uint32_t pl_sz;
1477  DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
1478  pl_sz=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
1479 
1480  // Test packet payload size.
1481  if(pl_sz == 5120)
1482  {
1483  dltdata->test_counter_macro[8]++;
1484  }
1485 
1486  /* Segmentcount */
1487  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1488  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1489  if(type_info & DLT_TYPE_INFO_UINT)
1490  {
1491  uint16_t scount;
1492  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1493  scount=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1494 
1495  /* Test packet segment count 5 */
1496  if(scount == 5)
1497  {
1498  dltdata->test_counter_macro[8]++;
1499  }
1500 
1501  /* Segment length */
1502  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1503  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1504  if(type_info & DLT_TYPE_INFO_UINT)
1505  {
1506  uint16_t slen;
1507  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1508  slen=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1509  /* Default segment size 1024 */
1510  if(slen == 1024)
1511  {
1512  dltdata->test_counter_macro[8]++;
1513  }
1514  }
1515  }
1516  }
1517  }
1518  }
1519  }
1520  }
1521  /* Data segment */
1522  else if (message->extendedheader->noar==4)
1523  {
1524  /* verbose mode */
1525  type_info=0;
1526  type_info_tmp=0;
1527  length=0,length_tmp=0; /* the macro can set this variable to -1 */
1528 
1529  ptr = message->databuffer;
1530  datalength = message->datasize;
1531 
1532  /* NWCH */
1533  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1534  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1535  if(type_info & DLT_TYPE_INFO_STRG)
1536  {
1537  char chdr[10];
1538  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1539  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1540  DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
1541  if(strcmp((char *)chdr, "NWCH")==0)
1542  {
1543  dltdata->test_counter_macro[8]++;
1544  }
1545 
1546  /* handle */
1547  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1548  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1549  if(type_info & DLT_TYPE_INFO_UINT)
1550  {
1551  uint32_t handle;
1552  DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
1553  handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
1554  if(handle > 0)
1555  {
1556  dltdata->test_counter_macro[8]++;
1557  }
1558 
1559  /* Sequence */
1560  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1561  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1562  if(type_info & DLT_TYPE_INFO_UINT)
1563  {
1564  //uint16_t seq;
1565  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1566  //seq=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1567  dltdata->test_counter_macro[8]++;
1568 
1569  /* Data */
1570  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1571  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1572  if(type_info & DLT_TYPE_INFO_RAWD)
1573  {
1574  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1575  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1576 
1577  // Segment size by default, 1024
1578  if(length == 1024)
1579  {
1580  dltdata->test_counter_macro[8]++;
1581  }
1582  }
1583  }
1584  }
1585  }
1586  }
1587  /* End segment */
1588  else if (message->extendedheader->noar==2)
1589  {
1590  /* verbose mode */
1591  type_info=0;
1592  type_info_tmp=0;
1593  length=0,length_tmp=0; /* the macro can set this variable to -1 */
1594 
1595  ptr = message->databuffer;
1596  datalength = message->datasize;
1597 
1598  /* NWEN */
1599  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1600  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1601  if(type_info & DLT_TYPE_INFO_STRG)
1602  {
1603  char chdr[10];
1604  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1605  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1606  DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
1607  if(strcmp((char *)chdr, "NWEN")==0)
1608  {
1609  dltdata->test_counter_macro[8]++;
1610  }
1611 
1612  /* handle */
1613  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1614  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1615  if(type_info & DLT_TYPE_INFO_UINT)
1616  {
1617  uint32_t handle;
1618  DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
1619  handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
1620  if(handle > 0)
1621  {
1622  dltdata->test_counter_macro[8]++;
1623  }
1624  }
1625  }
1626  }
1627  }
1628  }
1629  }
1630 
1631  /* check test 1f */
1632  if (strcmp(text,"Test1: (Function IF) Test all log levels")==0)
1633  {
1634  printf("Test1f: (Function IF) Test all log levels\n");
1635  dltdata->running_test = 10;
1636  dltdata->test_counter_function[0] = 0;
1637  }
1638  else if (strcmp(text,"Test1: (Function IF) finished")==0)
1639  {
1640  /* >=4, as "info" is default log level */
1641  if (dltdata->test_counter_function[0]>=4)
1642  {
1643  printf("Test1f PASSED\n");
1644  dltdata->tests_passed++;
1645  }
1646  else
1647  {
1648  printf("Test1f FAILED\n");
1649  dltdata->tests_failed++;
1650  }
1651  dltdata->running_test = 0;
1652  }
1653  else if (dltdata->running_test==10)
1654  {
1655  if (DLT_IS_HTYP_UEH(message->standardheader->htyp))
1656  {
1657  if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_LOG)
1658  {
1659  mtin=DLT_GET_MSIN_MTIN(message->extendedheader->msin);
1660 
1661  if (mtin==DLT_LOG_FATAL)
1662  {
1663  dltdata->test_counter_function[0]++;
1664  }
1665  if (mtin==DLT_LOG_ERROR)
1666  {
1667  dltdata->test_counter_function[0]++;
1668  }
1669  if (mtin==DLT_LOG_WARN)
1670  {
1671  dltdata->test_counter_function[0]++;
1672  }
1673  if (mtin==DLT_LOG_INFO)
1674  {
1675  dltdata->test_counter_function[0]++;
1676  }
1677  if (mtin==DLT_LOG_DEBUG)
1678  {
1679  dltdata->test_counter_function[0]++;
1680  }
1681  if (mtin==DLT_LOG_VERBOSE)
1682  {
1683  dltdata->test_counter_function[0]++;
1684  }
1685  }
1686  }
1687  }
1688 
1689  /* check test 2f */
1690  if (strcmp(text,"Test2: (Function IF) Test all variable types (verbose)")==0)
1691  {
1692  printf("Test2f: (Function IF) Test all variable types (verbose)\n");
1693  dltdata->running_test = 11;
1694  dltdata->test_counter_function[1] = 0;
1695  }
1696  else if (strcmp(text,"Test2: (Function IF) finished")==0)
1697  {
1698  if (dltdata->test_counter_function[1]==14)
1699  {
1700  printf("Test2f PASSED\n");
1701  dltdata->tests_passed++;
1702  }
1703  else
1704  {
1705  printf("Test2f FAILED\n");
1706  dltdata->tests_failed++;
1707  }
1708  dltdata->running_test = 0;
1709  }
1710  else if (dltdata->running_test==11)
1711  {
1712  /* Verbose */
1713  if (!(DLT_MSG_IS_NONVERBOSE(message)))
1714  {
1715  type_info=0;
1716  type_info_tmp=0;
1717  length=0;
1718  length_tmp=0; /* the macro can set this variable to -1 */
1719  ptr = message->databuffer;
1720  datalength = message->datasize;
1721 
1722  /* Log message */
1723  if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_LOG)
1724  {
1725  if (message->extendedheader->noar>=2)
1726  {
1727  /* get type of first argument: must be string */
1728  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1729  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1730 
1731  if (type_info & DLT_TYPE_INFO_STRG)
1732  {
1733  /* skip string */
1734  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1735  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1736 
1737  if (length>=0)
1738  {
1739  ptr+=length;
1740  datalength-=length;
1741 
1742  /* read type of second argument: must be raw */
1743  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
1744  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
1745 
1746  if (type_info & DLT_TYPE_INFO_BOOL)
1747  {
1748  if (datalength==sizeof(uint8_t))
1749  {
1750  dltdata->test_counter_function[1]++;
1751  }
1752  }
1753  else if (type_info & DLT_TYPE_INFO_SINT)
1754  {
1755  switch (type_info & DLT_TYPE_INFO_TYLE)
1756  {
1757  case DLT_TYLE_8BIT:
1758  {
1759  if (datalength==sizeof(int8_t))
1760  {
1761  dltdata->test_counter_function[1]++;
1762  }
1763  break;
1764  }
1765  case DLT_TYLE_16BIT:
1766  {
1767  if (datalength==sizeof(int16_t))
1768  {
1769  dltdata->test_counter_function[1]++;
1770  }
1771  break;
1772  }
1773  case DLT_TYLE_32BIT:
1774  {
1775  if (datalength==sizeof(int32_t))
1776  {
1777  dltdata->test_counter_function[1]++;
1778  }
1779  break;
1780  }
1781  case DLT_TYLE_64BIT:
1782  {
1783  if (datalength==sizeof(int64_t))
1784  {
1785  dltdata->test_counter_function[1]++;
1786  }
1787  break;
1788  }
1789  case DLT_TYLE_128BIT:
1790  {
1791  /* Not tested here */
1792  break;
1793  }
1794  }
1795  }
1796  else if (type_info & DLT_TYPE_INFO_UINT)
1797  {
1798  switch (type_info & DLT_TYPE_INFO_TYLE)
1799  {
1800  case DLT_TYLE_8BIT:
1801  {
1802  if (datalength==sizeof(uint8_t))
1803  {
1804  dltdata->test_counter_function[1]++;
1805  }
1806  break;
1807  }
1808  case DLT_TYLE_16BIT:
1809  {
1810  if (datalength==sizeof(uint16_t))
1811  {
1812  dltdata->test_counter_function[1]++;
1813  }
1814  break;
1815  }
1816  case DLT_TYLE_32BIT:
1817  {
1818  if (datalength==sizeof(uint32_t))
1819  {
1820  dltdata->test_counter_function[1]++;
1821  }
1822  break;
1823  }
1824  case DLT_TYLE_64BIT:
1825  {
1826  if (datalength==sizeof(uint64_t))
1827  {
1828  dltdata->test_counter_function[1]++;
1829  }
1830  break;
1831  }
1832  case DLT_TYLE_128BIT:
1833  {
1834  /* Not tested here */
1835  break;
1836  }
1837  }
1838  }
1839  else if (type_info & DLT_TYPE_INFO_FLOA)
1840  {
1841  switch (type_info & DLT_TYPE_INFO_TYLE)
1842  {
1843  case DLT_TYLE_8BIT:
1844  {
1845  /* Not tested here */
1846  break;
1847  }
1848  case DLT_TYLE_16BIT:
1849  {
1850  /* Not tested here */
1851  break;
1852  }
1853  case DLT_TYLE_32BIT:
1854  {
1855  if (datalength==(2*sizeof(float)+sizeof(uint32_t)))
1856  {
1857  dltdata->test_counter_function[1]++;
1858  }
1859  break;
1860  }
1861  case DLT_TYLE_64BIT:
1862  {
1863  if (datalength==(2*sizeof(double)+sizeof(uint32_t)))
1864  {
1865  dltdata->test_counter_function[1]++;
1866  }
1867  break;
1868  }
1869  case DLT_TYLE_128BIT:
1870  {
1871  /* Not tested here */
1872  break;
1873  }
1874  }
1875  }
1876  else if (type_info & DLT_TYPE_INFO_RAWD)
1877  {
1878  /* Get length */
1879  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
1880  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
1881  if ((length==datalength) && (length==10))
1882  {
1883  dltdata->test_counter_function[1]++;
1884  }
1885  }
1886  }
1887  }
1888  }
1889  }
1890  }
1891  }
1892 
1893  /* check test 3f */
1894  if (strcmp(text,"Test3: (Function IF) Test all variable types (non-verbose)")==0)
1895  {
1896  printf("Test3f: (Function IF) Test all variable types (non-verbose)\n");
1897  dltdata->running_test = 12;
1898  dltdata->test_counter_function[2]=0;
1899  }
1900  else if (strcmp(text,"Test3: (Function IF) finished")==0)
1901  {
1902  if (dltdata->test_counter_function[2]==14)
1903  {
1904  printf("Test3f PASSED\n");
1905  dltdata->tests_passed++;
1906  }
1907  else
1908  {
1909  printf("Test3f FAILED\n");
1910  dltdata->tests_failed++;
1911  }
1912  dltdata->running_test = 0;
1913  }
1914  else if (dltdata->running_test==12)
1915  {
1916  /* Nonverbose */
1917  if (DLT_MSG_IS_NONVERBOSE(message))
1918  {
1919  id=0;
1920  id_tmp=0;
1921  ptr = message->databuffer;
1922  datalength = message->datasize;
1923  slen=-1;
1924 
1925  tc_old=dltdata->test_counter_function[2];
1926 
1927  /* Get message id */
1928  DLT_MSG_READ_VALUE(id_tmp,ptr,datalength,uint32_t);
1929  id=DLT_ENDIAN_GET_32(message->standardheader->htyp, id_tmp);
1930 
1931  /* Length of string */
1932  datalength-=sizeof(uint16_t);
1933  ptr+=sizeof(uint16_t);
1934 
1935  switch (id)
1936  {
1937  case 1:
1938  {
1939  slen=strlen("bool")+1;
1940  datalength-=slen;
1941  ptr+=slen;
1942  if (datalength==sizeof(uint8_t))
1943  {
1944  dltdata->test_counter_function[2]++;
1945  }
1946  break;
1947  }
1948  case 2:
1949  {
1950  slen=strlen("int")+1;
1951  datalength-=slen;
1952  ptr+=slen;
1953  if (datalength==sizeof(int))
1954  {
1955  dltdata->test_counter_function[2]++;
1956  }
1957  break;
1958  }
1959  case 3:
1960  {
1961  slen=strlen("int8")+1;
1962  datalength-=slen;
1963  ptr+=slen;
1964  if (datalength==sizeof(int8_t))
1965  {
1966  dltdata->test_counter_function[2]++;
1967  }
1968  break;
1969  }
1970  case 4:
1971  {
1972  slen=strlen("int16")+1;
1973  datalength-=slen;
1974  ptr+=slen;
1975  if (datalength==sizeof(int16_t))
1976  {
1977  dltdata->test_counter_function[2]++;
1978  }
1979  break;
1980  }
1981  case 5:
1982  {
1983  slen=strlen("int32")+1;
1984  datalength-=slen;
1985  ptr+=slen;
1986  if (datalength==sizeof(int32_t))
1987  {
1988  dltdata->test_counter_function[2]++;
1989  }
1990  break;
1991  }
1992  case 6:
1993  {
1994  slen=strlen("int64")+1;
1995  datalength-=slen;
1996  ptr+=slen;
1997  if (datalength==sizeof(int64_t))
1998  {
1999  dltdata->test_counter_function[2]++;
2000  }
2001  break;
2002  }
2003  case 7:
2004  {
2005  slen=strlen("uint")+1;
2006  datalength-=slen;
2007  ptr+=slen;
2008  if (datalength==sizeof(unsigned int))
2009  {
2010  dltdata->test_counter_function[2]++;
2011  }
2012  break;
2013  }
2014  case 8:
2015  {
2016  slen=strlen("uint8")+1;
2017  datalength-=slen;
2018  ptr+=slen;
2019  if (datalength==sizeof(uint8_t))
2020  {
2021  dltdata->test_counter_function[2]++;
2022  }
2023  break;
2024  }
2025  case 9:
2026  {
2027  slen=strlen("uint16")+1;
2028  datalength-=slen;
2029  ptr+=slen;
2030  if (datalength==sizeof(uint16_t))
2031  {
2032  dltdata->test_counter_function[2]++;
2033  }
2034  break;
2035  }
2036  case 10:
2037  {
2038  slen=strlen("uint32")+1;
2039  datalength-=slen;
2040  ptr+=slen;
2041  if (datalength==sizeof(uint32_t))
2042  {
2043  dltdata->test_counter_function[2]++;
2044  }
2045  break;
2046  }
2047  case 11:
2048  {
2049  slen=strlen("uint64")+1;
2050  datalength-=slen;
2051  ptr+=slen;
2052  if (datalength==sizeof(uint64_t))
2053  {
2054  dltdata->test_counter_function[2]++;
2055  }
2056  break;
2057  }
2058  case 12:
2059  {
2060  slen=strlen("float32")+1;
2061  datalength-=slen;
2062  ptr+=slen;
2063  /* 2*, as the min and the max is transfered */
2064  if (datalength==2*sizeof(float))
2065  {
2066  dltdata->test_counter_function[2]++;
2067  }
2068  break;
2069  }
2070  case 13:
2071  {
2072  slen=strlen("float64")+1;
2073  datalength-=slen;
2074  ptr+=slen;
2075  /* 2*, as the min and the max is transfered */
2076  if (datalength==2*sizeof(double))
2077  {
2078  dltdata->test_counter_function[2]++;
2079  }
2080  break;
2081  }
2082  case 14:
2083  {
2084  slen=strlen("raw")+1;
2085  datalength-=slen;
2086  ptr+=slen;
2087  datalength-=sizeof(uint16_t);
2088  ptr+=sizeof(uint16_t);
2089  if (datalength==10)
2090  {
2091  dltdata->test_counter_function[2]++;
2092  }
2093  break;
2094  }
2095  }
2096 
2097  if ((slen>=0) && (tc_old==dltdata->test_counter_function[2]))
2098  {
2099  printf("ID=%d, Datalength=%d => Failed!",id,datalength);
2100  }
2101  }
2102  }
2103 
2104  /* check test 4f */
2105  if (strcmp(text,"Test4: (Function IF) Test different message sizes")==0)
2106  {
2107  printf("Test4f: (Function IF) Test different message sizes\n");
2108  dltdata->running_test = 13;
2109  dltdata->test_counter_function[3]=0;
2110  }
2111  else if (strcmp(text,"Test4: (Function IF) finished")==0)
2112  {
2113  if (dltdata->test_counter_function[3]==4)
2114  {
2115  printf("Test4f PASSED\n");
2116  dltdata->tests_passed++;
2117  }
2118  else
2119  {
2120  printf("Test4f FAILED\n");
2121  dltdata->tests_failed++;
2122  }
2123  dltdata->running_test = 0;
2124  }
2125  else if (dltdata->running_test==13)
2126  {
2127  /* Extended header */
2128  if (DLT_IS_HTYP_UEH(message->standardheader->htyp))
2129  {
2130  /* Log message */
2131  if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_LOG)
2132  {
2133  /* Verbose */
2134  if (DLT_IS_MSIN_VERB(message->extendedheader->msin))
2135  {
2136  /* 2 arguments */
2137  if (message->extendedheader->noar==2)
2138  {
2139  /* verbose mode */
2140  type_info=0;
2141  type_info_tmp=0;
2142  length=0;
2143  length_tmp=0; /* the macro can set this variable to -1 */
2144 
2145  ptr = message->databuffer;
2146  datalength = message->datasize;
2147 
2148  /* first read the type info of the first argument: should be string */
2149  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2150  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2151 
2152  if (type_info & DLT_TYPE_INFO_STRG)
2153  {
2154  /* skip string */
2155  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2156  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2157 
2158  if (length>=0)
2159  {
2160  ptr+=length;
2161  datalength-=length;
2162 
2163  /* read type of second argument: should be raw */
2164  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2165  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2166 
2167  if (type_info & DLT_TYPE_INFO_RAWD)
2168  {
2169  /* get length of raw data block */
2170  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2171  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2172 
2173  if ((length>=0) && (length==datalength))
2174  {
2175  //printf("Raw data found in payload, length=");
2176  //printf("%d, datalength=%d \n", length, datalength);
2177  dltdata->test_counter_function[3]++;
2178  }
2179  }
2180  }
2181  }
2182  }
2183  }
2184  }
2185  }
2186  }
2187 
2188  /* check test 5f */
2189  if (strcmp(text,"Test5: (Function IF) Test high-level API")==0)
2190  {
2191  printf("Test5f: (Function IF) Test high-level API\n");
2192  dltdata->running_test = 14;
2193  dltdata->test_counter_function[4]=0;
2194  }
2195  else if (strcmp(text,"Test5: (Function IF) finished")==0)
2196  {
2197  if (dltdata->test_counter_function[4]==12)
2198  {
2199  printf("Test5f PASSED\n");
2200  dltdata->tests_passed++;
2201  }
2202  else
2203  {
2204  printf("Test5f FAILED\n");
2205  dltdata->tests_failed++;
2206  }
2207  dltdata->running_test = 0;
2208  }
2209  else if (dltdata->running_test==14)
2210  {
2211  if (strcmp(text,"Next line: dlt_log_int()")==0)
2212  {
2213  dltdata->test_counter_function[4]++;
2214  }
2215  if (strcmp(text,"-42")==0)
2216  {
2217  dltdata->test_counter_function[4]++;
2218  }
2219 
2220  if (strcmp(text,"Next line: dlt_log_uint()")==0)
2221  {
2222  dltdata->test_counter_function[4]++;
2223  }
2224  if (strcmp(text,"42")==0)
2225  {
2226  dltdata->test_counter_function[4]++;
2227  }
2228 
2229  if (strcmp(text,"Next line: dlt_log_string()")==0)
2230  {
2231  dltdata->test_counter_function[4]++;
2232  }
2233  if (strcmp(text,"String output")==0)
2234  {
2235  dltdata->test_counter_function[4]++;
2236  }
2237 
2238  if (strcmp(text,"Next line: dlt_log_raw()")==0)
2239  {
2240  dltdata->test_counter_function[4]++;
2241  }
2242  if (strcmp(text,"00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f")==0)
2243  {
2244  dltdata->test_counter_function[4]++;
2245  }
2246 
2247  if (strcmp(text,"Next line: dlt_log_string_int()")==0)
2248  {
2249  dltdata->test_counter_function[4]++;
2250  }
2251  if (strcmp(text,"String output: -42")==0)
2252  {
2253  dltdata->test_counter_function[4]++;
2254  }
2255 
2256  if (strcmp(text,"Next line: dlt_log_string_uint()")==0)
2257  {
2258  dltdata->test_counter_function[4]++;
2259  }
2260  if (strcmp(text,"String output: 42")==0)
2261  {
2262  dltdata->test_counter_function[4]++;
2263  }
2264  }
2265 
2266  /* check test 6f */
2267  if (strcmp(text,"Test 6: (Function IF) Test local printing")==0)
2268  {
2269  printf("Test6f: (Function IF) Test local printing\n");
2270  dltdata->running_test = 15;
2271  dltdata->test_counter_function[5]=0;
2272  }
2273  else if (strcmp(text,"Test6: (Function IF) finished")==0)
2274  {
2275  if (dltdata->test_counter_function[5]==2)
2276  {
2277  printf("Test6f PASSED\n");
2278  dltdata->tests_passed++;
2279  }
2280  else
2281  {
2282  printf("Test6f FAILED\n");
2283  dltdata->tests_failed++;
2284  }
2285  dltdata->running_test = 0;
2286  }
2287  else if (dltdata->running_test==15)
2288  {
2289  if (strcmp(text,"Message (visible: locally printed)")==0)
2290  {
2291  printf("Message (visible: locally printed)\n");
2292  dltdata->test_counter_function[5]++;
2293  }
2294  if (strcmp(text,"Message (invisible: not locally printed)")==0)
2295  {
2296  printf("Message (invisible: not locally printed)\n");
2297  dltdata->test_counter_function[5]++;
2298  }
2299  }
2300 
2301  /* check test 7f */
2302  if (strcmp(text,"Test 7: (Function IF) Test network trace")==0)
2303  {
2304  printf("Test7f: (Function IF) Test network trace\n");
2305  dltdata->running_test = 16;
2306  dltdata->test_counter_function[6]=0;
2307  }
2308  else if (strcmp(text,"Test7: (Function IF) finished")==0)
2309  {
2310  if (dltdata->test_counter_function[6]==8)
2311  {
2312  printf("Test7f PASSED\n");
2313  dltdata->tests_passed++;
2314  }
2315  else
2316  {
2317  printf("Test7f FAILED\n");
2318  dltdata->tests_failed++;
2319  }
2320  dltdata->running_test = 0;
2321  }
2322  else if (dltdata->running_test==16)
2323  {
2324  if (DLT_IS_HTYP_UEH(message->standardheader->htyp))
2325  {
2326  if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_NW_TRACE)
2327  {
2328  /* Check message type information*/
2329  /* Each correct message type increases the counter by 1 */
2330  mtin=DLT_GET_MSIN_MTIN(message->extendedheader->msin);
2331 
2332  if (mtin==DLT_NW_TRACE_IPC)
2333  {
2334  dltdata->test_counter_function[6]++;
2335  }
2336  if (mtin==DLT_NW_TRACE_CAN)
2337  {
2338  dltdata->test_counter_function[6]++;
2339  }
2340  if (mtin==DLT_NW_TRACE_FLEXRAY)
2341  {
2342  dltdata->test_counter_function[6]++;
2343  }
2344  if (mtin==DLT_NW_TRACE_MOST)
2345  {
2346  dltdata->test_counter_function[6]++;
2347  }
2348 
2349  /* Check payload, must be two arguments (2 raw data blocks) */
2350  /* If the payload is correct, the counter is increased by 1 */
2351  if (message->extendedheader->noar==2)
2352  {
2353  /* verbose mode */
2354  type_info=0;
2355  type_info_tmp=0;
2356  length=0;
2357  length_tmp=0; /* the macro can set this variable to -1 */
2358 
2359  ptr = message->databuffer;
2360  datalength = message->datasize;
2361 
2362  /* first read the type info of the first argument: should be string */
2363  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2364  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2365 
2366  if (type_info & DLT_TYPE_INFO_RAWD)
2367  {
2368  /* skip string */
2369  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2370  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2371 
2372  if (length>=0)
2373  {
2374  ptr+=length;
2375  datalength-=length;
2376 
2377  /* read type of second argument: should be raw */
2378  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2379  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2380 
2381  if (type_info & DLT_TYPE_INFO_RAWD)
2382  {
2383  /* get length of raw data block */
2384  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2385  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2386 
2387  if ((length>=0) && (length==datalength))
2388  {
2389  //printf("Raw data found in payload, length=");
2390  //printf("%d, datalength=%d \n", length, datalength);
2391  dltdata->test_counter_function[6]++;
2392  }
2393  }
2394  }
2395  }
2396  }
2397  }
2398  }
2399  }
2400 
2401  /* check test 8f */
2402  if (strcmp(text,"Test 8: (Function IF) Test truncated network trace")==0)
2403  {
2404  printf("Test8f: (Function IF) Test truncated network trace\n");
2405  dltdata->running_test = 17;
2406  dltdata->test_counter_function[7]=0;
2407  }
2408  else if (strcmp(text,"Test8: (Function IF) finished")==0)
2409  {
2410  if (dltdata->test_counter_function[7]==20)
2411  {
2412  printf("Test8f PASSED\n");
2413  dltdata->tests_passed++;
2414  }
2415  else
2416  {
2417  printf("Test8f FAILED\n");
2418  dltdata->tests_failed++;
2419  }
2420  dltdata->running_test = 0;
2421  }
2422  else if (dltdata->running_test==17)
2423  {
2424  if (DLT_IS_HTYP_UEH(message->standardheader->htyp))
2425  {
2426  if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_NW_TRACE)
2427  {
2428  /* Check message type information*/
2429  /* Each correct message type increases the counter by 1 */
2430  mtin=DLT_GET_MSIN_MTIN(message->extendedheader->msin);
2431 
2432  if (mtin==DLT_NW_TRACE_IPC)
2433  {
2434  dltdata->test_counter_function[7]++;
2435  }
2436  if (mtin==DLT_NW_TRACE_CAN)
2437  {
2438  dltdata->test_counter_function[7]++;
2439  }
2440  if (mtin==DLT_NW_TRACE_FLEXRAY)
2441  {
2442  dltdata->test_counter_function[7]++;
2443  }
2444  if (mtin==DLT_NW_TRACE_MOST)
2445  {
2446  dltdata->test_counter_function[7]++;
2447  }
2448 
2449  /* Check payload, must be two arguments (2 raw data blocks) */
2450  /* If the payload is correct, the counter is increased by 1 */
2451  if (message->extendedheader->noar==4)
2452  {
2453  type_info=0;
2454  type_info_tmp=0;
2455  length=0,length_tmp=0; /* the macro can set this variable to -1 */
2456 
2457  ptr = message->databuffer;
2458  datalength = message->datasize;
2459 
2460  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2461  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2462  if(type_info & DLT_TYPE_INFO_STRG)
2463  {
2464  // Read NWTR
2465  char chdr[10];
2466  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2467  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2468  DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
2469 
2470  if(strcmp((char *)chdr, "NWTR")==0)
2471  {
2472  dltdata->test_counter_function[7]++;
2473  }
2474 
2475  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2476  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2477  if(type_info & DLT_TYPE_INFO_RAWD)
2478  {
2479  char hdr[2048];
2480  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2481  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2482  DLT_MSG_READ_STRING(hdr, ptr, datalength, length);
2483 
2484  if(length == 16 && hdr[15] == 15)
2485  {
2486  dltdata->test_counter_function[7]++;
2487  }
2488 
2489  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2490  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2491  if(type_info & DLT_TYPE_INFO_UINT)
2492  {
2493  uint32_t orig_size;
2494  DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
2495  orig_size=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
2496  if(orig_size == 1024*5)
2497  {
2498  dltdata->test_counter_function[7]++;
2499  }
2500 
2501  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2502  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2503  if(type_info & DLT_TYPE_INFO_RAWD)
2504  {
2505  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2506  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2507  // Size of the truncated message after headers
2508  if(length == DLT_USER_BUF_MAX_SIZE - 41 - sizeof(uint16_t) - sizeof(uint32_t))
2509  {
2510  dltdata->test_counter_function[7]++;
2511  }
2512  }
2513  }
2514  }
2515  }
2516  }
2517  }
2518  }
2519  }
2520 
2521  /* check test 9f */
2522  if (strcmp(text,"Test 9: (Function IF) Test segmented network trace")==0)
2523  {
2524  printf("Test9f: (Function IF) Test segmented network trace\n");
2525  dltdata->running_test = 18;
2526  dltdata->test_counter_function[8]=0;
2527  }
2528  else if (strcmp(text,"Test9: (Function IF) finished")==0)
2529  {
2530  /* (Interface types) * (number of messages per complete message) */
2531  if (dltdata->test_counter_function[8]==4*35)
2532  {
2533  printf("Test9f PASSED\n");
2534  dltdata->tests_passed++;
2535  }
2536  else
2537  {
2538  printf("Test9f FAILED\n");
2539  dltdata->tests_failed++;
2540  }
2541  dltdata->running_test = 0;
2542  }
2543  else if (dltdata->running_test==18)
2544  {
2545  if (DLT_IS_HTYP_UEH(message->standardheader->htyp))
2546  {
2547  if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_NW_TRACE)
2548  {
2549  /* Check message type information*/
2550  /* Each correct message type increases the counter by 1 */
2551  mtin=DLT_GET_MSIN_MTIN(message->extendedheader->msin);
2552 
2553  if (mtin==DLT_NW_TRACE_IPC)
2554  {
2555  dltdata->test_counter_function[8]++;
2556  }
2557  if (mtin==DLT_NW_TRACE_CAN)
2558  {
2559  dltdata->test_counter_function[8]++;
2560  }
2561  if (mtin==DLT_NW_TRACE_FLEXRAY)
2562  {
2563  dltdata->test_counter_function[8]++;
2564  }
2565  if (mtin==DLT_NW_TRACE_MOST)
2566  {
2567  dltdata->test_counter_function[8]++;
2568  }
2569 
2570  /* Payload for first segmented message */
2571  if (message->extendedheader->noar==6)
2572  {
2573  /* verbose mode */
2574  type_info=0;
2575  type_info_tmp=0;
2576  length=0,length_tmp=0; /* the macro can set this variable to -1 */
2577 
2578  ptr = message->databuffer;
2579  datalength = message->datasize;
2580 
2581  /* NWST */
2582  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2583  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2584  if(type_info & DLT_TYPE_INFO_STRG)
2585  {
2586  char chdr[10];
2587  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2588  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2589  DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
2590  if(strcmp((char *)chdr, "NWST")==0)
2591  {
2592  dltdata->test_counter_function[8]++;
2593  }
2594 
2595  /* Streahandle */
2596  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2597  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2598  if(type_info & DLT_TYPE_INFO_UINT)
2599  {
2600  uint32_t handle;
2601  DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
2602  handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
2603  if(handle > 0)
2604  {
2605  dltdata->test_counter_function[8]++;
2606  }
2607 
2608  /* Header */
2609  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2610  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2611  if(type_info & DLT_TYPE_INFO_RAWD)
2612  {
2613  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2614  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2615 
2616  // Test packet header size 16
2617  if(length == 16)
2618  {
2619  dltdata->test_counter_function[8]++;
2620  }
2621  /* Skip data */
2622  ptr+=length;
2623  datalength-=length;
2624 
2625  /* Payload size */
2626  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2627  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2628  if(type_info & DLT_TYPE_INFO_UINT)
2629  {
2630  uint32_t pl_sz;
2631  DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
2632  pl_sz=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
2633 
2634  // Test packet payload size.
2635  if(pl_sz == 5120)
2636  {
2637  dltdata->test_counter_function[8]++;
2638  }
2639 
2640  /* Segmentcount */
2641  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2642  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2643  if(type_info & DLT_TYPE_INFO_UINT)
2644  {
2645  uint16_t scount;
2646  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2647  scount=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2648 
2649  /* Test packet segment count 5 */
2650  if(scount == 5)
2651  {
2652  dltdata->test_counter_function[8]++;
2653  }
2654 
2655  /* Segment length */
2656  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2657  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2658  if(type_info & DLT_TYPE_INFO_UINT)
2659  {
2660  uint16_t slen;
2661  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2662  slen=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2663  /* Default segment size 1024 */
2664  if(slen == 1024)
2665  {
2666  dltdata->test_counter_function[8]++;
2667  }
2668  }
2669  }
2670  }
2671  }
2672  }
2673  }
2674  }
2675  /* Data segment */
2676  else if (message->extendedheader->noar==4)
2677  {
2678  /* verbose mode */
2679  type_info=0;
2680  type_info_tmp=0;
2681  length=0,length_tmp=0; /* the macro can set this variable to -1 */
2682 
2683  ptr = message->databuffer;
2684  datalength = message->datasize;
2685 
2686  /* NWCH */
2687  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2688  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2689  if(type_info & DLT_TYPE_INFO_STRG)
2690  {
2691  char chdr[10];
2692  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2693  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2694  DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
2695  if(strcmp((char *)chdr, "NWCH")==0)
2696  {
2697  dltdata->test_counter_function[8]++;
2698  }
2699 
2700  /* handle */
2701  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2702  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2703  if(type_info & DLT_TYPE_INFO_UINT)
2704  {
2705  uint32_t handle;
2706  DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
2707  handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
2708  if(handle > 0)
2709  {
2710  dltdata->test_counter_function[8]++;
2711  }
2712 
2713  /* Sequence */
2714  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2715  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2716  if(type_info & DLT_TYPE_INFO_UINT)
2717  {
2718  //uint16_t seq;
2719  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2720  //seq=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2721  dltdata->test_counter_function[8]++;
2722 
2723  /* Data */
2724  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2725  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2726  if(type_info & DLT_TYPE_INFO_RAWD)
2727  {
2728  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2729  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2730 
2731  // Segment size by default, 1024
2732  if(length == 1024)
2733  {
2734  dltdata->test_counter_function[8]++;
2735  }
2736  }
2737  }
2738  }
2739  }
2740  }
2741  /* End segment */
2742  else if (message->extendedheader->noar==2)
2743  {
2744  /* verbose mode */
2745  type_info=0;
2746  type_info_tmp=0;
2747  length=0,length_tmp=0; /* the macro can set this variable to -1 */
2748 
2749  ptr = message->databuffer;
2750  datalength = message->datasize;
2751 
2752  /* NWEN */
2753  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2754  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2755  if(type_info & DLT_TYPE_INFO_STRG)
2756  {
2757  char chdr[10];
2758  DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
2759  length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
2760  DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
2761  if(strcmp((char *)chdr, "NWEN")==0)
2762  {
2763  dltdata->test_counter_function[8]++;
2764  }
2765 
2766  /* handle */
2767  DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
2768  type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
2769  if(type_info & DLT_TYPE_INFO_UINT)
2770  {
2771  uint32_t handle;
2772  DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
2773  handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
2774  if(handle > 0)
2775  {
2776  dltdata->test_counter_function[8]++;
2777  }
2778  }
2779  }
2780  }
2781  }
2782  }
2783  }
2784  if (strcmp(text,"Tests finished")==0)
2785  {
2786  printf("Tests finished\n");
2787  dltdata->running_test = 1;
2788 
2789  printf("%d tests passed\n",dltdata->tests_passed);
2790  printf("%d tests failed\n",dltdata->tests_failed);
2791 
2792  if (dltdata->sock!=-1)
2793  {
2794  close(dltdata->sock);
2795  }
2796 
2797  g_testsFailed = dltdata->tests_failed;
2798 
2799  return 0;
2800  }
2801 
2802  /* if no filter set or filter is matching display message */
2803  if (dltdata->xflag)
2804  {
2806  }
2807  else if (dltdata->mflag)
2808  {
2810  }
2811  else if (dltdata->sflag)
2812  {
2813  dlt_message_print_header(message,text,sizeof(text),dltdata->vflag);
2814  }
2815 
2816  /* if file output enabled write message */
2817  if (dltdata->ovalue)
2818  {
2819  iov[0].iov_base = message->headerbuffer;
2820  iov[0].iov_len = message->headersize;
2821  iov[1].iov_base = message->databuffer;
2822  iov[1].iov_len = message->datasize;
2823 
2824  bytes_written = writev(dltdata->ohandle, iov, 2);
2825  if (0 > bytes_written){
2826  printf("dlt_testclient_message_callback, error in: writev(dltdata->ohandle, iov, 2)\n");
2827  return -1;
2828  }
2829  }
2830  }
2831 
2832  return 0;
2833 }
int32_t datasize
Definition: dlt_common.h:423
#define DLT_SCOD_UTF8
Definition: dlt_protocol.h:169
#define DLT_ENDIAN_GET_32(htyp, x)
Definition: dlt_common.h:165
int sock
Definition: dlt_client.h:92
DltReturnValue dlt_message_print_header(DltMessage *message, char *text, uint32_t size, int verbose)
Definition: dlt_common.c:3297
#define DLT_TYPE_INFO_SINT
Definition: dlt_protocol.h:150
DltStorageHeader * storageheader
Definition: dlt_common.h:432
#define DLT_TYLE_32BIT
Definition: dlt_protocol.h:164
void dlt_set_id(char *id, const char *text)
Definition: dlt_common.c:324
void dlt_client_register_message_callback(int(*registerd_callback)(DltMessage *message, void *data))
Definition: dlt_client.c:105
DltReturnValue dlt_file_set_filter(DltFile *file, DltFilter *filter, int verbose)
Definition: dlt_common.c:1331
#define DLT_GET_MSIN_MTIN(msin)
Definition: dlt_protocol.h:109
DltReturnValue dlt_client_main_loop(DltClient *client, void *data, int verbose)
Definition: dlt_client.c:326
int test_counter_macro[DLT_TESTCLIENT_NUM_TESTS]
int dlt_client_set_server_ip(DltClient *client, char *ipaddr)
Definition: dlt_client.c:839
#define DLT_TESTCLIENT_NUM_TESTS
DltReturnValue dlt_message_filter_check(DltMessage *msg, DltFilter *filter, int verbose)
Definition: dlt_common.c:1057
#define DLT_MSG_READ_VALUE(dst, src, length, type)
Definition: dlt_common.h:278
#define DLT_GET_MSIN_MSTP(msin)
Definition: dlt_protocol.h:108
DltReturnValue dlt_client_setbaudrate(DltClient *client, int baudrate)
Definition: dlt_client.c:827
DltReturnValue dlt_filter_init(DltFilter *filter, int verbose)
Definition: dlt_common.c:390
DltExtendedHeader * extendedheader
Definition: dlt_common.h:435
int dlt_client_set_serial_device(DltClient *client, char *serial_device)
Definition: dlt_client.c:850
#define DLT_IS_MSIN_VERB(msin)
Definition: dlt_protocol.h:107
#define DLT_ENDIAN_GET_16(htyp, x)
Definition: dlt_common.h:164
int dlt_testclient_message_callback(DltMessage *message, void *data)
#define DLT_TYLE_16BIT
Definition: dlt_protocol.h:163
static char data[kDataSize]
Definition: city-test.cc:40
DltReturnValue dlt_set_storageheader(DltStorageHeader *storageheader, const char *ecu)
Definition: dlt_common.c:2315
#define DLT_TYLE_128BIT
Definition: dlt_protocol.h:166
#define DLT_IS_HTYP_UEH(htyp)
Definition: dlt_protocol.h:89
DltReturnValue dlt_client_init(DltClient *client, int verbose)
Definition: dlt_client.c:133
#define DLT_MSG_IS_NONVERBOSE(MSG)
Definition: dlt_common.h:257
DltReturnValue dlt_filter_free(DltFilter *filter, int verbose)
Definition: dlt_common.c:404
#define DLT_TYPE_NW_TRACE
Definition: dlt_protocol.h:116
DltReturnValue dlt_client_cleanup(DltClient *client, int verbose)
Definition: dlt_client.c:301
DltReturnValue dlt_client_connect(DltClient *client, int verbose)
Definition: dlt_client.c:168
#define DLT_TESTCLIENT_TEXTBUFSIZE
DltReturnValue dlt_filter_load(DltFilter *filter, const char *filename, int verbose)
Definition: dlt_common.c:416
int32_t headersize
Definition: dlt_common.h:422
#define DLT_TYPE_INFO_FLOA
Definition: dlt_protocol.h:152
int test_counter_function[DLT_TESTCLIENT_NUM_TESTS]
uint8_t headerbuffer[sizeof(DltStorageHeader)+sizeof(DltStandardHeader)+sizeof(DltStandardHeaderExtra)+sizeof(DltExtendedHeader)]
Definition: dlt_common.h:427
#define DLT_IS_HTYP_WEID(htyp)
Definition: dlt_protocol.h:91
#define DLT_TYPE_INFO_STRG
Definition: dlt_protocol.h:154
DltStandardHeaderExtra headerextra
Definition: dlt_common.h:434
int main(int argc, char *argv[])
#define DLT_TESTCLIENT_ECU_ID
DltReturnValue dlt_file_init(DltFile *file, int verbose)
Definition: dlt_common.c:1305
#define DLT_TYPE_LOG
Definition: dlt_protocol.h:114
DltReturnValue dlt_message_payload(DltMessage *msg, char *text, int textlength, int type, int verbose)
Definition: dlt_common.c:891
#define DLT_SCOD_ASCII
Definition: dlt_protocol.h:168
DltReturnValue dlt_file_free(DltFile *file, int verbose)
Definition: dlt_common.c:1942
DltStandardHeader * standardheader
Definition: dlt_common.h:433
#define DLT_TYPE_INFO_BOOL
Definition: dlt_protocol.h:149
#define DLT_TYPE_INFO_RAWD
Definition: dlt_protocol.h:155
void usage()
void dlt_get_version(char *buf, size_t size)
Definition: dlt_common.c:3239
#define DLT_USER_BUF_MAX_SIZE
Definition: dlt_user.h:92
DltReturnValue dlt_message_header(DltMessage *msg, char *text, int textlength, int verbose)
Definition: dlt_common.c:710
#define DLT_TYPE_INFO_UINT
Definition: dlt_protocol.h:151
DltReturnValue dlt_message_print_hex(DltMessage *message, char *text, uint32_t size, int verbose)
Definition: dlt_common.c:3310
char * servIP
Definition: dlt_client.h:93
#define DLT_OUTPUT_ASCII
Definition: dlt_common.h:271
uint8_t * databuffer
Definition: dlt_common.h:428
#define DLT_TYPE_INFO_TYLE
Definition: dlt_protocol.h:148
char * serialDevice
Definition: dlt_client.h:95
#define DLT_TYLE_8BIT
Definition: dlt_protocol.h:162
DltClientMode mode
Definition: dlt_client.h:99
#define DLT_TYLE_64BIT
Definition: dlt_protocol.h:165
static int g_testsFailed
DltReturnValue dlt_message_print_mixed_plain(DltMessage *message, char *text, uint32_t size, int verbose)
Definition: dlt_common.c:3340
#define DLT_TYPE_INFO_SCOD
Definition: dlt_protocol.h:160
#define DLT_MSG_READ_STRING(dst, src, maxlength, length)
Definition: dlt_common.h:294