Environement variables added to configure internal logging in library.
[profile/ivi/dlt-daemon.git] / include / dlt / dlt_common.h
1 /**
2  * @licence app begin@
3  * Copyright (C) 2012  BMW AG
4  *
5  * This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps.
6  *
7  * Contributions are licensed to the GENIVI Alliance under one or more
8  * Contribution License Agreements.
9  *
10  * \copyright
11  * This Source Code Form is subject to the terms of the
12  * Mozilla Public License, v. 2.0. If a  copy of the MPL was not distributed with
13  * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
14  *
15  *
16  * \author Alexander Wenzel <alexander.aw.wenzel@bmw.de> BMW 2011-2012
17  *
18  * \file dlt_common.h
19  * For further information see http://www.genivi.org/.
20  * @licence end@
21  */
22
23 /*******************************************************************************
24 **                                                                            **
25 **  SRC-MODULE: dlt_common.h                                                  **
26 **                                                                            **
27 **  TARGET    : linux                                                         **
28 **                                                                            **
29 **  PROJECT   : DLT                                                           **
30 **                                                                            **
31 **  AUTHOR    : Alexander Wenzel Alexander.AW.Wenzel@bmw.de                   **
32 **              Markus Klein                                                  **
33 **                                                                            **
34 **  PURPOSE   :                                                               **
35 **                                                                            **
36 **  REMARKS   :                                                               **
37 **                                                                            **
38 **  PLATFORM DEPENDANT [yes/no]: yes                                          **
39 **                                                                            **
40 **  TO BE CHANGED BY USER [yes/no]: no                                        **
41 **                                                                            **
42 *******************************************************************************/
43
44 /*******************************************************************************
45 **                      Author Identity                                       **
46 ********************************************************************************
47 **                                                                            **
48 ** Initials     Name                       Company                            **
49 ** --------     -------------------------  ---------------------------------- **
50 **  aw          Alexander Wenzel           BMW                                **
51 **  mk          Markus Klein               Fraunhofer ESK                     **
52 *******************************************************************************/
53
54 /*******************************************************************************
55 **                      Revision Control History                              **
56 *******************************************************************************/
57
58 /*
59  * $LastChangedRevision: 1670 $
60  * $LastChangedDate: 2011-04-08 15:12:06 +0200 (Fr, 08. Apr 2011) $
61  * $LastChangedBy$
62  Initials    Date         Comment
63  aw          13.01.2010   initial
64  */
65 #ifndef DLT_COMMON_H
66 #define DLT_COMMON_H
67
68 /**
69   \defgroup commonapi DLT Common API
70   \addtogroup commonapi
71   \{
72 */
73
74 #include <stdio.h>
75
76 #if !defined(_MSC_VER)
77 #include <unistd.h>
78 #include <time.h>
79 #endif
80
81 #if !defined (__WIN32__) && !defined(_MSC_VER)
82 #include <termios.h>
83 #endif
84
85 #include "dlt_types.h"
86 #include "dlt_protocol.h"
87
88 #if !defined (PACKED)
89 #define PACKED __attribute__((aligned(1),packed))
90 #endif
91
92 #if defined (__MSDOS__) || defined (_MSC_VER)
93 /* set instead /Zp8 flag in Visual C++ configuration */
94 #undef PACKED
95 #define PACKED
96 #endif
97
98 /*
99  * Macros to swap the byte order.
100  */
101 #define DLT_SWAP_64(value) ((((uint64_t)DLT_SWAP_32((value)&0xffffffffull))<<32) | (DLT_SWAP_32((value)>>32)))
102
103 #define DLT_SWAP_16(value) ((((value) >> 8)&0xff) | (((value) << 8)&0xff00))
104 #define DLT_SWAP_32(value) ((((value) >> 24)&0xff) | (((value) << 8)&0xff0000) | (((value) >> 8)&0xff00) | (((value) << 24)&0xff000000))
105
106 /* Set Big Endian and Little Endian to a initial value, if not defined */
107 #if !defined __USE_BSD
108 #ifndef LITTLE_ENDIAN
109 #define LITTLE_ENDIAN 1234
110 #endif
111
112 #ifndef BIG_ENDIAN
113 #define BIG_ENDIAN    4321
114 #endif
115 #endif /* __USE_BSD */
116
117 /* If byte order is not defined, default to little endian */
118 #if !defined __USE_BSD
119 #ifndef BYTE_ORDER
120 #define BYTE_ORDER LITTLE_ENDIAN
121 #endif
122 #endif /* __USE_BSD */
123
124 /* Check for byte-order */
125 #if (BYTE_ORDER==BIG_ENDIAN)
126 /* #warning "Big Endian Architecture!" */
127 #define DLT_HTOBE_16(x) ((x))
128 #define DLT_HTOLE_16(x) DLT_SWAP_16((x))
129 #define DLT_BETOH_16(x) ((x))
130 #define DLT_LETOH_16(x) DLT_SWAP_16((x))
131
132 #define DLT_HTOBE_32(x) ((x))
133 #define DLT_HTOLE_32(x) DLT_SWAP_32((x))
134 #define DLT_BETOH_32(x) ((x))
135 #define DLT_LETOH_32(x) DLT_SWAP_32((x))
136
137 #define DLT_HTOBE_64(x) ((x))
138 #define DLT_HTOLE_64(x) DLT_SWAP_64((x))
139 #define DLT_BETOH_64(x) ((x))
140 #define DLT_LETOH_64(x) DLT_SWAP_64((x))
141 #else
142 /* #warning "Litte Endian Architecture!" */
143 #define DLT_HTOBE_16(x) DLT_SWAP_16((x))
144 #define DLT_HTOLE_16(x) ((x))
145 #define DLT_BETOH_16(x) DLT_SWAP_16((x))
146 #define DLT_LETOH_16(x) ((x))
147
148 #define DLT_HTOBE_32(x) DLT_SWAP_32((x))
149 #define DLT_HTOLE_32(x) ((x))
150 #define DLT_BETOH_32(x) DLT_SWAP_32((x))
151 #define DLT_LETOH_32(x) ((x))
152
153 #define DLT_HTOBE_64(x) DLT_SWAP_64((x))
154 #define DLT_HTOLE_64(x) ((x))
155 #define DLT_BETOH_64(x) DLT_SWAP_64((x))
156 #define DLT_LETOH_64(x) ((x))
157 #endif
158
159 #define DLT_ENDIAN_GET_16(htyp,x) ((((htyp) & DLT_HTYP_MSBF)>0)?DLT_BETOH_16(x):DLT_LETOH_16(x))
160 #define DLT_ENDIAN_GET_32(htyp,x) ((((htyp) & DLT_HTYP_MSBF)>0)?DLT_BETOH_32(x):DLT_LETOH_32(x))
161 #define DLT_ENDIAN_GET_64(htyp,x) ((((htyp) & DLT_HTYP_MSBF)>0)?DLT_BETOH_64(x):DLT_LETOH_64(x))
162
163 #if defined (__WIN32__) || defined (_MSC_VER)
164 #define LOG_EMERG       0
165 #define LOG_ALERT       1
166 #define LOG_CRIT        2
167 #define LOG_ERR         3
168 #define LOG_WARNING     4
169 #define LOG_NOTICE      5
170 #define LOG_INFO        6
171 #define LOG_DEBUG       7
172
173 #define LOG_PID         0x01
174 #define LOG_DAEMON      (3<<3)
175 #endif
176
177 enum {
178     DLT_LOG_TO_CONSOLE=0,
179     DLT_LOG_TO_SYSLOG=1,
180     DLT_LOG_TO_FILE=2,
181     DLT_LOG_DROPPED=3
182 };
183
184 /**
185  * The standard TCP Port used for DLT daemon
186  */
187 #define DLT_DAEMON_TCP_PORT 3490
188
189
190 /* Initi value for file descritpor */
191 #define DLT_FD_INIT -1
192
193 /* Minimum value for a file descriptor except the POSIX Standards: stdin=0, stdout=1, stderr=2 */
194 #define DLT_FD_MINIMUM 3
195
196 /**
197  * The size of a DLT ID
198  */
199 #define DLT_ID_SIZE 4
200
201 #define DLT_SIZE_WEID DLT_ID_SIZE
202 #define DLT_SIZE_WSID (sizeof(uint32_t))
203 #define DLT_SIZE_WTMS (sizeof(uint32_t))
204
205 /**
206  * Get the size of extra header parameters, depends on htyp.
207  */
208 #define DLT_STANDARD_HEADER_EXTRA_SIZE(htyp) ( (DLT_IS_HTYP_WEID(htyp) ? DLT_SIZE_WEID : 0) + (DLT_IS_HTYP_WSID(htyp) ? DLT_SIZE_WSID : 0) + (DLT_IS_HTYP_WTMS(htyp) ? DLT_SIZE_WTMS : 0) )
209
210
211 #if defined (__MSDOS__) || defined (_MSC_VER)
212 #define __func__ __FUNCTION__
213 #endif
214
215 #define PRINT_FUNCTION_VERBOSE(_verbose)  \
216 { \
217         static char _strbuf[255]; \
218     \
219     if(_verbose) \
220     { \
221                 snprintf(_strbuf, 255, "%s()\n",__func__); \
222                 dlt_log(LOG_INFO, _strbuf); \
223     } \
224 }
225
226 #ifndef NULL
227 #define NULL (char*)0
228 #endif
229
230 #define DLT_MSG_IS_CONTROL(MSG)          ((DLT_IS_HTYP_UEH((MSG)->standardheader->htyp)) && \
231                                           (DLT_GET_MSIN_MSTP((MSG)->extendedheader->msin)==DLT_TYPE_CONTROL))
232
233 #define DLT_MSG_IS_CONTROL_REQUEST(MSG)  ((DLT_IS_HTYP_UEH((MSG)->standardheader->htyp)) && \
234                                           (DLT_GET_MSIN_MSTP((MSG)->extendedheader->msin)==DLT_TYPE_CONTROL) && \
235                                           (DLT_GET_MSIN_MTIN((MSG)->extendedheader->msin)==DLT_CONTROL_REQUEST))
236
237 #define DLT_MSG_IS_CONTROL_RESPONSE(MSG) ((DLT_IS_HTYP_UEH((MSG)->standardheader->htyp)) && \
238                                           (DLT_GET_MSIN_MSTP((MSG)->extendedheader->msin)==DLT_TYPE_CONTROL) && \
239                                           (DLT_GET_MSIN_MTIN((MSG)->extendedheader->msin)==DLT_CONTROL_RESPONSE))
240
241 #define DLT_MSG_IS_CONTROL_TIME(MSG)     ((DLT_IS_HTYP_UEH((MSG)->standardheader->htyp)) && \
242                                           (DLT_GET_MSIN_MSTP((MSG)->extendedheader->msin)==DLT_TYPE_CONTROL) && \
243                                           (DLT_GET_MSIN_MTIN((MSG)->extendedheader->msin)==DLT_CONTROL_TIME))
244
245 #define DLT_MSG_IS_NW_TRACE(MSG)         ((DLT_IS_HTYP_UEH((MSG)->standardheader->htyp)) && \
246                                                                               (DLT_GET_MSIN_MSTP((MSG)->extendedheader->msin)==DLT_TYPE_NW_TRACE))
247
248 #define DLT_MSG_IS_TRACE_MOST(MSG)       ((DLT_IS_HTYP_UEH((MSG)->standardheader->htyp)) && \
249                                                                               (DLT_GET_MSIN_MSTP((MSG)->extendedheader->msin)==DLT_TYPE_NW_TRACE) && \
250                                                                               (DLT_GET_MSIN_MTIN((MSG)->extendedheader->msin)==DLT_NW_TRACE_MOST))
251
252 #define DLT_MSG_IS_NONVERBOSE(MSG)       (!(DLT_IS_HTYP_UEH((MSG)->standardheader->htyp)) || \
253                                           ((DLT_IS_HTYP_UEH((MSG)->standardheader->htyp)) && (!(DLT_IS_MSIN_VERB((MSG)->extendedheader->msin)))))
254
255 /*
256
257  * Definitions of DLT message buffer overflow
258  */
259 #define DLT_MESSAGE_BUFFER_NO_OVERFLOW     0x00 /**< Buffer overflow has not occured */
260 #define DLT_MESSAGE_BUFFER_OVERFLOW        0x01 /**< Buffer overflow has occured */
261
262 /*
263  * Definition of DLT output variants
264  */
265 #define DLT_OUTPUT_HEX              1
266 #define DLT_OUTPUT_ASCII            2
267 #define DLT_OUTPUT_MIXED_FOR_PLAIN  3
268 #define DLT_OUTPUT_MIXED_FOR_HTML   4
269 #define DLT_OUTPUT_ASCII_LIMITED    5
270
271 #define DLT_FILTER_MAX 30 /**< Maximum number of filters */
272
273 #define DLT_MSG_READ_VALUE(dst,src,length,type) \
274     { \
275     if((length<0) || ((length)<((int32_t)sizeof(type)))) \
276         { length = -1; } \
277     else \
278         { dst = *((type*)src);src+=sizeof(type);length-=sizeof(type); } \
279     }
280
281 #define DLT_MSG_READ_ID(dst,src,length) \
282     { \
283     if((length<0) || ((length)<DLT_ID_SIZE)) \
284         { length = -1; } \
285     else \
286         { memcpy(dst,src,DLT_ID_SIZE);src+=DLT_ID_SIZE;length-=DLT_ID_SIZE; } \
287     }
288
289 #define DLT_MSG_READ_STRING(dst,src,maxlength,length) \
290     { \
291     if(((maxlength)<0) || ((length)<0) || ((maxlength)<(length))) \
292         { maxlength = -1; } \
293     else \
294         { memcpy(dst,src,length);dlt_clean_string(dst,length);dst[length]=0; \
295           src+=length;maxlength-=length; } \
296     }
297
298 #define DLT_MSG_READ_NULL(src,maxlength,length) \
299     { \
300     if(((maxlength)<0) || ((length)<0) || ((maxlength)<(length))) \
301         { length = -1; } \
302     else \
303         { src+=length;maxlength-=length; } \
304     }
305
306 #define DLT_HEADER_SHOW_NONE       0x0000
307 #define DLT_HEADER_SHOW_TIME       0x0001
308 #define DLT_HEADER_SHOW_TMSTP      0x0002
309 #define DLT_HEADER_SHOW_MSGCNT     0x0004
310 #define DLT_HEADER_SHOW_ECUID      0x0008
311 #define DLT_HEADER_SHOW_APID       0x0010
312 #define DLT_HEADER_SHOW_CTID       0x0020
313 #define DLT_HEADER_SHOW_MSGTYPE    0x0040
314 #define DLT_HEADER_SHOW_MSGSUBTYPE 0x0080
315 #define DLT_HEADER_SHOW_VNVSTATUS  0x0100
316 #define DLT_HEADER_SHOW_NOARG      0x0200
317 #define DLT_HEADER_SHOW_ALL        0xFFFF
318
319 /**
320  * The definition of the serial header containing the characters "DLS" + 0x01.
321  */
322 extern const char dltSerialHeader[DLT_ID_SIZE];
323
324 /**
325  * The definition of the serial header containing the characters "DLS" + 0x01 as char.
326  */
327 extern char dltSerialHeaderChar[DLT_ID_SIZE];
328
329 /**
330
331  * The type of a DLT ID (context id, application id, etc.)
332  */
333 typedef char ID4[DLT_ID_SIZE];
334
335 /**
336  * The structure of the DLT file storage header. This header is used before each stored DLT message.
337  */
338 typedef struct
339 {
340     char pattern[DLT_ID_SIZE];          /**< This pattern should be DLT0x01 */
341     uint32_t seconds;                               /**< seconds since 1.1.1970 */
342     int32_t microseconds;                       /**< Microseconds */
343     char ecu[DLT_ID_SIZE];                      /**< The ECU id is added, if it is not already in the DLT message itself */
344 } PACKED DltStorageHeader;
345
346 /**
347  * The structure of the DLT standard header. This header is used in each DLT message.
348  */
349 typedef struct
350 {
351     uint8_t htyp;           /**< This parameter contains several informations, see definitions below */
352     uint8_t mcnt;           /**< The message counter is increased with each sent DLT message */
353     uint16_t len;           /**< Length of the complete message, without storage header */
354 } PACKED DltStandardHeader;
355
356 /**
357  * The structure of the DLT extra header parameters. Each parameter is sent only if enabled in htyp.
358  */
359 typedef struct
360 {
361     char ecu[DLT_ID_SIZE];       /**< ECU id */
362     uint32_t seid;     /**< Session number */
363     uint32_t tmsp;     /**< Timestamp since system start in 0.1 milliseconds */
364 } PACKED DltStandardHeaderExtra;
365
366 /**
367  * The structure of the DLT extended header. This header is only sent if enabled in htyp parameter.
368  */
369 typedef struct
370 {
371     uint8_t msin;          /**< messsage info */
372     uint8_t noar;          /**< number of arguments */
373     char apid[DLT_ID_SIZE];          /**< application id */
374     char ctid[DLT_ID_SIZE];          /**< context id */
375 } PACKED DltExtendedHeader;
376
377 /**
378  * The structure to organise the DLT messages.
379  * This structure is used by the corresponding functions.
380  */
381 typedef struct sDltMessage
382 {
383     /* flags */
384     int8_t found_serialheader;
385
386     /* offsets */
387     int32_t resync_offset;
388
389     /* size parameters */
390     int32_t headersize;    /**< size of complete header including storage header */
391     int32_t datasize;      /**< size of complete payload */
392
393     /* buffer for current loaded message */
394     uint8_t headerbuffer[sizeof(DltStorageHeader)+
395                          sizeof(DltStandardHeader)+sizeof(DltStandardHeaderExtra)+sizeof(DltExtendedHeader)]; /**< buffer for loading complete header */
396     uint8_t *databuffer;         /**< buffer for loading payload */
397         int32_t databuffersize;
398
399     /* header values of current loaded message */
400     DltStorageHeader       *storageheader;  /**< pointer to storage header of current loaded header */
401     DltStandardHeader      *standardheader; /**< pointer to standard header of current loaded header */
402     DltStandardHeaderExtra headerextra;     /**< extra parameters of current loaded header */
403     DltExtendedHeader      *extendedheader; /**< pointer to extended of current loaded header */
404 } DltMessage;
405
406 /**
407  * The structure of the DLT Service Get Log Info.
408  */
409 typedef struct
410 {
411     uint32_t service_id;            /**< service ID */
412     uint8_t options;                /**< type of request */
413     char apid[DLT_ID_SIZE];                   /**< application id */
414     char ctid[DLT_ID_SIZE];                   /**< context id */
415     char com[DLT_ID_SIZE];                    /**< communication interface */
416 } PACKED DltServiceGetLogInfoRequest;
417
418 /**
419  * The structure of the DLT Service Set Log Level.
420  */
421 typedef struct
422 {
423
424     uint32_t service_id;            /**< service ID */
425     char apid[DLT_ID_SIZE];                   /**< application id */
426     char ctid[DLT_ID_SIZE];                   /**< context id */
427     uint8_t log_level;              /**< log level to be set */
428     char com[DLT_ID_SIZE];                    /**< communication interface */
429 } PACKED DltServiceSetLogLevel;
430
431 /**
432  * The structure of the DLT Service Set Default Log Level.
433  */
434 typedef struct
435 {
436     uint32_t service_id;            /**< service ID */
437     uint8_t log_level;              /**< default log level to be set */
438     char com[DLT_ID_SIZE];                    /**< communication interface */
439 } PACKED DltServiceSetDefaultLogLevel;
440
441 /**
442  * The structure of the DLT Service Set Verbose Mode
443  */
444 typedef struct
445 {
446     uint32_t service_id;            /**< service ID */
447     uint8_t new_status;             /**< new status to be set */
448 } PACKED DltServiceSetVerboseMode;
449
450 /**
451  * The structure of the DLT Service Set Communication Interface Status
452  */
453 typedef struct
454 {
455     uint32_t service_id;            /**< service ID */
456     char com[DLT_ID_SIZE];                    /**< communication interface */
457     uint8_t new_status;             /**< new status to be set */
458 } PACKED DltServiceSetCommunicationInterfaceStatus;
459
460 /**
461  * The structure of the DLT Service Set Communication Maximum Bandwidth
462  */
463 typedef struct
464 {
465     uint32_t service_id;            /**< service ID */
466     char com[DLT_ID_SIZE];                    /**< communication interface */
467     uint32_t max_bandwidth;         /**< maximum bandwith */
468 } PACKED DltServiceSetCommunicationMaximumBandwidth;
469
470 typedef struct
471 {
472     uint32_t service_id;            /**< service ID */
473     uint8_t status;                 /**< reponse status */
474 } PACKED DltServiceResponse;
475
476 typedef struct
477 {
478     uint32_t service_id;            /**< service ID */
479     uint8_t status;                 /**< reponse status */
480     uint8_t log_level;              /**< log level */
481 } PACKED DltServiceGetDefaultLogLevelResponse;
482
483 typedef struct
484 {
485     uint32_t service_id;            /**< service ID */
486     uint8_t status;                 /**< reponse status */
487     uint8_t overflow;               /**< overflow status */
488     uint32_t overflow_counter;      /**< overflow counter */
489 } PACKED DltServiceMessageBufferOverflowResponse;
490
491 typedef struct
492 {
493     uint32_t service_id;            /**< service ID */
494     uint8_t  status;                /**< reponse status */
495     uint32_t length;                /**< length of following payload */
496     /*char [] payload;*/
497 } PACKED DltServiceGetSoftwareVersionResponse;
498
499 /**
500  * The structure of the DLT Service Unregister Context.
501  */
502 typedef struct
503 {
504     uint32_t service_id;            /**< service ID */
505     uint8_t status;                 /**< reponse status */
506     char apid[DLT_ID_SIZE];         /**< application id */
507     char ctid[DLT_ID_SIZE];         /**< context id */
508     char comid[DLT_ID_SIZE];        /**< communication interface */
509 } PACKED DltServiceUnregisterContext;
510
511 /**
512  * The structure of the DLT Service Connection Info
513  */
514 typedef struct
515 {
516     uint32_t service_id;            /**< service ID */
517     uint8_t status;                 /**< reponse status */
518     uint8_t state;                  /**< new state */
519     char comid[DLT_ID_SIZE];        /**< communication interface */
520 } PACKED DltServiceConnectionInfo;
521
522 /**
523  * Structure to store filter parameters.
524  * ID are maximal four characters. Unused values are filled with zeros.
525  * If every value as filter is valid, the id should be empty by having only zero values.
526  */
527 typedef struct
528 {
529     char apid[DLT_FILTER_MAX][DLT_ID_SIZE]; /**< application id */
530     char ctid[DLT_FILTER_MAX][DLT_ID_SIZE]; /**< context id */
531     int  counter;                           /**< number of filters */
532 } DltFilter;
533
534 /**
535  * The structure to organise the access to DLT files.
536  * This structure is used by the corresponding functions.
537  */
538 typedef struct sDltFile
539 {
540     /* file handle and index for fast access */
541     FILE *handle;      /**< file handle of opened DLT file */
542     long *index;       /**< file positions of all DLT messages for fast access to file, only filtered messages */
543
544     /* size parameters */
545     int32_t counter;       /**< number of messages in DLT file with filter */
546     int32_t counter_total; /**< number of messages in DLT file without filter */
547     int32_t position;      /**< current index to message parsed in DLT file starting at 0 */
548     long file_length;  /**< length of the file */
549     long file_position; /**< current position in the file */
550
551     /* error counters */
552     int32_t error_messages; /**< number of incomplete DLT messages found during file parsing */
553
554     /* filter parameters */
555     DltFilter *filter;  /**< pointer to filter list. Zero if no filter is set. */
556     int32_t filter_counter; /**< number of filter set */
557
558     /* current loaded message */
559     DltMessage msg;     /**< pointer to message */
560
561 } DltFile;
562
563 /**
564  * The structure is used to organise the receiving of data
565  * including buffer handling.
566  * This structure is used by the corresponding functions.
567  */
568 typedef struct
569 {
570     int32_t lastBytesRcvd;    /**< bytes received in last receive call */
571     int32_t bytesRcvd;        /**< received bytes */
572     int32_t totalBytesRcvd;   /**< total number of received bytes */
573     char *buffer;         /**< pointer to receiver buffer */
574     char *buf;            /**< pointer to position within receiver buffer */
575     int fd;               /**< connection handle */
576     int32_t buffersize;       /**< size of receiver buffer */
577 } DltReceiver;
578
579 typedef struct
580 {
581         unsigned char* shm;     /* pointer to beginning of shared memory */
582         int size;       /* size of data area in shared memory */
583         unsigned char* mem;     /* pointer to data area in shared memory */     
584         
585     uint32_t    min_size;  /**< Minimum size of buffer */
586     uint32_t    max_size;  /**< Maximum size of buffer */
587     uint32_t    step_size; /**< Step size of buffer */
588 } DltBuffer;
589
590 typedef struct
591 {
592         int write;
593         int read;
594         int count;      
595 } DltBufferHead;
596
597 #define DLT_BUFFER_HEAD         "SHM"
598
599 typedef struct
600 {
601         char head[4];
602         unsigned char status;
603         int size;       
604 } DltBufferBlockHead;
605
606 #ifdef __cplusplus
607 extern "C"
608 {
609 #endif
610
611     /**
612      * Helper function to print a byte array in hex.
613      * @param ptr pointer to the byte array.
614      * @param size number of bytes to be printed.
615      */
616     void dlt_print_hex(uint8_t *ptr,int size);
617     /**
618      * Helper function to print a byte array in hex into a string.
619      * @param text pointer to a ASCII string, in which the text is written
620      * @param textlength maximal size of text buffer
621      * @param ptr pointer to the byte array.
622      * @param size number of bytes to be printed.
623      * @return negative value if there was an error
624      */
625     int dlt_print_hex_string(char *text,int textlength,uint8_t *ptr,int size);
626     /**
627      * Helper function to print a byte array in hex and ascii into a string.
628      * @param text pointer to a ASCII string, in which the text is written
629      * @param textlength maximal size of text buffer
630      * @param ptr pointer to the byte array.
631      * @param size number of bytes to be printed.
632      * @param html output is html? 0 - false, 1 - true
633      * @return negative value if there was an error
634      */
635     int dlt_print_mixed_string(char *text,int textlength,uint8_t *ptr,int size,int html);
636     /**
637      * Helper function to print a byte array in ascii into a string.
638      * @param text pointer to a ASCII string, in which the text is written
639      * @param textlength maximal size of text buffer
640      * @param ptr pointer to the byte array.
641      * @param size number of bytes to be printed.
642      * @return negative value if there was an error
643      */
644     int dlt_print_char_string(char **text,int textlength,uint8_t *ptr,int size);
645
646     /**
647      * Helper function to print an id.
648      * @param text pointer to ASCII string where to write the id
649      * @param id four byte char array as used in DLT mesages as IDs.
650      */
651     void dlt_print_id(char *text,const char *id);
652
653     /**
654      * Helper function to set an ID parameter.
655      * @param id four byte char array as used in DLT mesages as IDs.
656      * @param text string to be copied into char array.
657      */
658     void dlt_set_id(char *id,const char *text);
659
660     /**
661      * Helper function to remove not nice to print characters, e.g. NULL or carage return.
662      * @param text pointer to string to be cleaned.
663      * @param length length of string excluding terminating zero.
664      */
665     void dlt_clean_string(char *text,int length);
666
667     /**
668      * Initialise the filter list.
669      * This function must be called before using further dlt filter.
670      * @param filter pointer to structure of organising DLT filter
671      * @param verbose if set to true verbose information is printed out.
672      * @return negative value if there was an error
673      */
674     int dlt_filter_init(DltFilter *filter,int verbose);
675     /**
676      * Free the used memory by the organising structure of filter.
677      * @param filter pointer to structure of organising DLT filter
678      * @param verbose if set to true verbose information is printed out.
679      * @return negative value if there was an error
680      */
681     int dlt_filter_free(DltFilter *filter,int verbose);
682     /**
683      * Load filter list from file.
684      * @param filter pointer to structure of organising DLT filter
685      * @param filename filename to load filters from
686      * @param verbose if set to true verbose information is printed out.
687      * @return negative value if there was an error
688      */
689     int dlt_filter_load(DltFilter *filter,const char *filename,int verbose);
690     /**
691      * Save filter list to file.
692      * @param filter pointer to structure of organising DLT filter
693      * @param filename filename to load filters from
694      * @param verbose if set to true verbose information is printed out.
695      * @return negative value if there was an error
696      */
697     int dlt_filter_save(DltFilter *filter,const char *filename,int verbose);
698     /**
699      * Find index of filter in filter list
700      * @param filter pointer to structure of organising DLT filter
701      * @param apid application id to be found in filter list
702      * @param ctid context id to be found in filter list
703      * @param verbose if set to true verbose information is printed out.
704      * @return negative value if there was an error (or not found), else return index of filter
705      */
706     int dlt_filter_find(DltFilter *filter,const char *apid,const char *ctid, int verbose);
707     /**
708      * Add new filter to filter list.
709      * @param filter pointer to structure of organising DLT filter
710      * @param apid application id to be added to filter list (must always be set).
711      * @param ctid context id to be added to filter list. empty equals don't care.
712      * @param verbose if set to true verbose information is printed out.
713      * @return negative value if there was an error
714      */
715     int dlt_filter_add(DltFilter *filter,const char *apid,const char *ctid,int verbose);
716     /**
717      * Delete filter from filter list
718      * @param filter pointer to structure of organising DLT filter
719      * @param apid application id to be deleted from filter list
720      * @param ctid context id to be deleted from filter list
721      * @param verbose if set to true verbose information is printed out.
722      * @return negative value if there was an error
723      */
724     int dlt_filter_delete(DltFilter *filter,const char *apid,const char *ctid,int verbose);
725
726     /**
727      * Initialise the structure used to access a DLT message.
728      * This function must be called before using further dlt_message functions.
729      * @param msg pointer to structure of organising access to DLT messages
730      * @param verbose if set to true verbose information is printed out.
731      * @return negative value if there was an error
732      */
733     int dlt_message_init(DltMessage *msg,int verbose);
734     /**
735      * Free the used memory by the organising structure of file.
736      * @param msg pointer to structure of organising access to DLT messages
737      * @param verbose if set to true verbose information is printed out.
738      * @return negative value if there was an error
739      */
740     int dlt_message_free(DltMessage *msg,int verbose);
741     /**
742      * Print Header into an ASCII string.
743      * This function calls dlt_message_header_flags() with flags=DLT_HEADER_SHOW_ALL
744      * @param msg pointer to structure of organising access to DLT messages
745      * @param text pointer to a ASCII string, in which the header is written
746      * @param textlength maximal size of text buffer
747      * @param verbose if set to true verbose information is printed out.
748      * @return negative value if there was an error
749      */
750     int dlt_message_header(DltMessage *msg,char *text,int textlength,int verbose);
751     /**
752      * Print Header into an ASCII string, selective.
753      * @param msg pointer to structure of organising access to DLT messages
754      * @param text pointer to a ASCII string, in which the header is written
755      * @param textlength maximal size of text buffer
756      * @param flags select, bit-field to select, what should be printed (DLT_HEADER_SHOW_...)
757      * @param verbose if set to true verbose information is printed out.
758      * @return negative value if there was an error
759      */
760     int dlt_message_header_flags(DltMessage *msg,char *text,int textlength,int flags, int verbose);
761     /**
762      * Print Payload into an ASCII string.
763      * @param msg pointer to structure of organising access to DLT messages
764      * @param text pointer to a ASCII string, in which the header is written
765      * @param textlength maximal size of text buffer
766      * @param type 1 = payload as hex, 2 = payload as ASCII.
767      * @param verbose if set to true verbose information is printed out.
768      * @return negative value if there was an error
769      */
770     int dlt_message_payload(DltMessage *msg,char *text,int textlength,int type,int verbose);
771     /**
772      * Check if message is filtered or not. All filters are applied (logical OR).
773      * @param msg pointer to structure of organising access to DLT messages
774      * @param filter pointer to filter
775      * @param verbose if set to true verbose information is printed out.
776      * @return 1 = filter matches, 0 = filter does not match, negative value if there was an error
777      */
778     int dlt_message_filter_check(DltMessage *msg,DltFilter *filter,int verbose);
779
780     /**
781      * Read message from memory buffer.
782      * Message in buffer has no storage header.
783      * @param msg pointer to structure of organising access to DLT messages
784      * @param buffer pointer to memory buffer
785      * @param length length of message in buffer
786      * @param resync if set to true resync to serial header is enforced
787      * @param verbose if set to true verbose information is printed out.
788      * @return negative value if there was an error
789      */
790     int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int resync,int verbose);
791
792     /**
793      * Get standard header extra parameters
794      * @param msg pointer to structure of organising access to DLT messages
795      * @param verbose if set to true verbose information is printed out.
796      * @return negative value if there was an error
797      */
798     int dlt_message_get_extraparameters(DltMessage *msg,int verbose);
799
800     /**
801      * Set standard header extra parameters
802      * @param msg pointer to structure of organising access to DLT messages
803      * @param verbose if set to true verbose information is printed out.
804      * @return negative value if there was an error
805      */
806     int dlt_message_set_extraparameters(DltMessage *msg,int verbose);
807
808     /**
809      * Initialise the structure used to access a DLT file.
810      * This function must be called before using further dlt_file functions.
811      * @param file pointer to structure of organising access to DLT file
812      * @param verbose if set to true verbose information is printed out.
813      * @return negative value if there was an error
814      */
815     int dlt_file_init(DltFile *file,int verbose);
816     /**
817      * Set a list to filters.
818      * This function should be called before loading a DLT file, if filters should be used.
819      * A filter list is an array of filters. Several filters are combined logically by or operation.
820      * The filter list is not copied, so take care to keep list in memory.
821      * @param file pointer to structure of organising access to DLT file
822      * @param filter pointer to filter list array
823      * @param verbose if set to true verbose information is printed out.
824      * @return negative value if there was an error
825      */
826     int dlt_file_set_filter(DltFile *file,DltFilter *filter,int verbose);
827     /**
828      * Initialising loading a DLT file.
829      * @param file pointer to structure of organising access to DLT file
830      * @param filename filename of DLT file
831      * @param verbose if set to true verbose information is printed out.
832      * @return negative value if there was an error
833      */
834     int dlt_file_open(DltFile *file,const char *filename,int verbose);
835     /**
836      * Find next message in the DLT file and parse them.
837      * This function finds the next message in the DLT file.
838      * If a filter is set, the filter list is used.
839      * @param file pointer to structure of organising access to DLT file
840      * @param verbose if set to true verbose information is printed out.
841      * @return 0 = message does not match filter, 1 = message was read, negative value if there was an error
842      */
843     int dlt_file_read(DltFile *file,int verbose);
844     /**
845      * Find next message in the DLT file in RAW format (without storage header) and parse them.
846      * This function finds the next message in the DLT file.
847      * If a filter is set, the filter list is used.
848      * @param file pointer to structure of organising access to DLT file
849      * @param resync Resync to serial header when set to true
850      * @param verbose if set to true verbose information is printed out.
851      * @return 0 = message does not match filter, 1 = message was read, negative value if there was an error
852      */
853     int dlt_file_read_raw(DltFile *file,int resync,int verbose);
854     /**
855      * Closing loading a DLT file.
856      * @param file pointer to structure of organising access to DLT file
857      * @param verbose if set to true verbose information is printed out.
858      * @return negative value if there was an error
859      */
860     int dlt_file_close(DltFile *file,int verbose);
861     /**
862      * Load standard header of a message from file
863      * @param file pointer to structure of organising access to DLT file
864      * @param verbose if set to true verbose information is printed out.
865      * @return negative value if there was an error
866      */
867     int dlt_file_read_header(DltFile *file,int verbose);
868     /**
869      * Load standard header of a message from file in RAW format (without storage header)
870      * @param file pointer to structure of organising access to DLT file
871      * @param resync Resync to serial header when set to true
872      * @param verbose if set to true verbose information is printed out.
873      * @return negative value if there was an error
874      */
875     int dlt_file_read_header_raw(DltFile *file,int resync,int verbose);
876     /**
877      * Load, if available in message, extra standard header fields and
878      * extended header of a message from file
879      * (dlt_file_read_header() must have been called before this call!)
880      * @param file pointer to structure of organising access to DLT file
881      * @param verbose if set to true verbose information is printed out.
882      * @return negative value if there was an error
883      */
884     int dlt_file_read_header_extended(DltFile *file, int verbose);
885     /**
886      * Load payload of a message from file
887      * (dlt_file_read_header() must have been called before this call!)
888      * @param file pointer to structure of organising access to DLT file
889      * @param verbose if set to true verbose information is printed out.
890      * @return negative value if there was an error
891      */
892     int dlt_file_read_data(DltFile *file, int verbose);
893     /**
894      * Load headers and payload of a message selected by the index.
895      * If filters are set, index is based on the filtered list.
896      * @param file pointer to structure of organising access to DLT file
897      * @param index position of message in the files beginning from zero
898      * @param verbose if set to true verbose information is printed out.
899      * @return number of messages loaded, negative value if there was an error
900      */
901     int dlt_file_message(DltFile *file,int index,int verbose);
902     /**
903      * Free the used memory by the organising structure of file.
904      * @param file pointer to structure of organising access to DLT file
905      * @param verbose if set to true verbose information is printed out.
906      * @return negative value if there was an error
907      */
908     int dlt_file_free(DltFile *file,int verbose);
909
910     /**
911      * Set internal logging filename if mode 2
912      * @param filename the filename
913      */
914     void dlt_log_set_filename(const char *filename);
915     /**
916      * Set internal logging level
917      * @param level the level
918      */
919     void dlt_log_set_level(int level);
920     /**
921      * Initialize (external) logging facility
922      * @param mode positive, 0 = log to stdout, 1 = log to syslog, 2 = log to file
923      */
924     void dlt_log_init(int mode);
925     /**
926      * Log ASCII string with null-termination to (external) logging facility
927      * @param prio priority (see syslog() call)
928      * @param s Pointer to ASCII string with null-termination
929      * @return negative value if there was an error
930      */
931     int dlt_log(int prio, char *s);
932     /**
933      * De-Initialize (external) logging facility
934      */
935     void dlt_log_free(void);
936
937     /**
938      * Initialising a dlt receiver structure
939      * @param receiver pointer to dlt receiver structure
940      * @param _fd handle to file/socket/fifo, fram which the data should be received
941      * @param _buffersize size of data buffer for storing the received data
942      * @return negative value if there was an error
943      */
944     int dlt_receiver_init(DltReceiver *receiver,int _fd, int _buffersize);
945     /**
946      * De-Initialize a dlt receiver structure
947      * @param receiver pointer to dlt receiver structure
948      * @return negative value if there was an error
949      */
950     int dlt_receiver_free(DltReceiver *receiver);
951     /**
952      * Receive data from socket using the dlt receiver structure
953      * @param receiver pointer to dlt receiver structure
954      * @return negative value if there was an error
955      */
956     int dlt_receiver_receive_socket(DltReceiver *receiver);
957     /**
958      * Receive data from file/fifo using the dlt receiver structure
959      * @param receiver pointer to dlt receiver structure
960      * @return negative value if there was an error
961      */
962     int dlt_receiver_receive_fd(DltReceiver *receiver);
963     /**
964      * Remove a specific size of bytes from the received data
965      * @param receiver pointer to dlt receiver structure
966      * @param size amount of bytes to be removed
967      * @return negative value if there was an error
968      */
969     int dlt_receiver_remove(DltReceiver *receiver,int size);
970     /**
971      * Move data from last receive call to front of receive buffer
972      * @param receiver pointer to dlt receiver structure
973      * @return negative value if there was an error
974      */
975     int dlt_receiver_move_to_begin(DltReceiver *receiver);
976
977     /**
978      * Fill out storage header of a dlt message
979      * @param storageheader pointer to storage header of a dlt message
980      * @param ecu name of ecu to be set in storage header
981      * @return negative value if there was an error
982      */
983     int dlt_set_storageheader(DltStorageHeader *storageheader, const char *ecu);
984     /**
985      * Check if a storage header contains its marker
986      * @param storageheader pointer to storage header of a dlt message
987      * @return 0 no, 1 yes, negative value if there was an error
988      */
989     int dlt_check_storageheader(DltStorageHeader *storageheader);
990
991
992     /**
993      * Initialise static ringbuffer with a size of size.
994      * Initialise as server. Init counters. 
995      * Memory is already allocated.
996      * @param buf Pointer to ringbuffer structure
997      * @param ptr Ptr to ringbuffer memory
998      * @param size Maximum size of buffer in bytes
999      * @return negative value if there was an error
1000      */
1001     int dlt_buffer_init_static_server(DltBuffer *buf, const unsigned char *ptr, uint32_t size);
1002
1003     /**
1004      * Initialize static ringbuffer with a size of size.
1005      * Initialise as a client. Do not change counters.
1006      * Memory is already allocated.
1007      * @param buf Pointer to ringbuffer structure
1008      * @param ptr Ptr to ringbuffer memory
1009      * @param size Maximum size of buffer in bytes
1010      * @return negative value if there was an error
1011      */
1012     int dlt_buffer_init_static_client(DltBuffer *buf, const unsigned char *ptr, uint32_t size);
1013
1014     /**
1015      * Initialize dynamic ringbuffer with a size of size.
1016      * Initialise as a client. Do not change counters.
1017      * Memory will be allocated starting with min_size.
1018      * If more memory is needed size is increased wit step_size.
1019      * The maximum size is max_size.
1020      * @param buf Pointer to ringbuffer structure
1021      * @param min_size Minimum size of buffer in bytes
1022      * @param max_size Maximum size of buffer in bytes
1023      * @param step_size size of which ringbuffer is increased
1024      * @return negative value if there was an error
1025      */
1026     int dlt_buffer_init_dynamic(DltBuffer *buf, uint32_t min_size, uint32_t max_size,uint32_t step_size);
1027
1028     /**
1029      * Deinitilaise usage of static ringbuffer
1030      * @param buf Pointer to ringbuffer structure
1031      * @return negative value if there was an error
1032      */
1033     int dlt_buffer_free_static(DltBuffer *buf);
1034
1035     /**
1036      * Release and free memory used by dynamic ringbuffer
1037      * @param buf Pointer to ringbuffer structure
1038      * @return negative value if there was an error
1039      */
1040     int dlt_buffer_free_dynamic(DltBuffer *buf);
1041
1042     /**
1043      * Write one entry to ringbuffer
1044      * @param buf Pointer to ringbuffer structure
1045      * @param data Pointer to data to be written to ringbuffer
1046      * @param size Size of data in bytes to be written to ringbuffer
1047      * @return negative value if there was an error
1048      */
1049         int dlt_buffer_push(DltBuffer *buf,const unsigned char *data,unsigned int size);
1050
1051     /**
1052      * Write up to three entries to ringbuffer.
1053      * Entries are joined to one block.
1054      * @param dlt Pointer to ringbuffer structure
1055      * @param data1 Pointer to data to be written to ringbuffer
1056      * @param size1 Size of data in bytes to be written to ringbuffer
1057      * @param data2 Pointer to data to be written to ringbuffer
1058      * @param size2 Size of data in bytes to be written to ringbuffer
1059      * @param data3 Pointer to data to be written to ringbuffer
1060      * @param size3 Size of data in bytes to be written to ringbuffer
1061      * @return negative value if there was an error
1062      */
1063         int dlt_buffer_push3(DltBuffer *buf,const unsigned char *data1,unsigned int size1,const unsigned char *data2,unsigned int size2,const unsigned char *data3,unsigned int size3);
1064
1065     /**
1066      * Read one entry from ringbuffer.
1067      * Remove it from ringbuffer.
1068      * @param buf Pointer to ringbuffer structure
1069      * @param data Pointer to data read from ringbuffer
1070      * @param max_size Max size of read data in bytes from ringbuffer
1071      * @return size of read data, zero if no data available, negative value if there was an error
1072      */
1073         int dlt_buffer_pull(DltBuffer *buf,unsigned char *data, int max_size);
1074
1075     /**
1076      * Read one entry from ringbuffer.
1077      * Do not remove it from ringbuffer.
1078      * @param buf Pointer to ringbuffer structure
1079      * @param data Pointer to data read from ringbuffer
1080      * @param max_size Max size of read data in bytes from ringbuffer
1081      * @return size of read data, zero if no data available, negative value if there was an error
1082      */
1083         int dlt_buffer_copy(DltBuffer *buf,unsigned char *data, int max_size);
1084
1085     /**
1086      * Remove entry from ringbuffer.
1087      * @param buf Pointer to ringbuffer structure
1088      * @return size of read data, zero if no data available, negative value if there was an error
1089      */
1090         int dlt_buffer_remove(DltBuffer *buf);
1091
1092     /**
1093      * Print information about buffer and log to internal DLT log.
1094      * @param buf Pointer to ringbuffer structure
1095      */
1096         void dlt_buffer_info(DltBuffer *buf);
1097
1098     /**
1099      * Print status of buffer and log to internal DLT log.
1100      * @param buf Pointer to ringbuffer structure
1101      */
1102         void dlt_buffer_status(DltBuffer *buf);
1103
1104     /**
1105      * Get total size in bytes of ringbuffer.
1106      * If buffer is dynamic, max size is returned.
1107      * @param buf Pointer to ringbuffer structure
1108      * @return total size of buffer
1109      */
1110         int dlt_buffer_get_total_size(DltBuffer *buf);
1111
1112     /**
1113      * Get used size in bytes of ringbuffer.
1114      * @param buf Pointer to ringbuffer structure
1115      * @return used size of buffer
1116      */
1117         int dlt_buffer_get_used_size(DltBuffer *buf);
1118
1119     /**
1120      * Get number of entries in ringbuffer.
1121      * @param buf Pointer to ringbuffer structure
1122      * @return number of entries
1123      */
1124         int dlt_buffer_get_message_count(DltBuffer *buf);
1125
1126 #if !defined (__WIN32__)
1127
1128     /**
1129      * Helper function: Setup serial connection
1130      * @param fd File descriptor of serial tty device
1131      * @param speed Serial line speed, as defined in termios.h
1132      * @return negative value if there was an error
1133      */
1134     int dlt_setup_serial(int fd, speed_t speed);
1135
1136     /**
1137      * Helper function: Convert serial line baudrate (as number) to line speed (as defined in termios.h)
1138      * @param baudrate Serial line baudrate (as number)
1139      * @return Serial line speed, as defined in termios.h
1140      */
1141     speed_t dlt_convert_serial_speed(int baudrate);
1142
1143     /**
1144      * Print dlt version and dlt svn version to buffer
1145      * @param buf Pointer to buffer
1146      */
1147     void dlt_get_version(char *buf);
1148
1149     /**
1150     * Print dlt major version to buffer
1151     * @param buf Pointer to buffer
1152     */
1153     void dlt_get_major_version(char *buf);
1154
1155     /**
1156     * Print dlt minor version to buffer
1157     * @param buf Pointer to buffer
1158     */
1159     void dlt_get_minor_version(char *buf);
1160
1161 #endif
1162
1163     /* Function prototypes which should be used only internally */
1164     /*                                                          */
1165
1166     /**
1167      * Common part of initialisation
1168      * @return negative value if there was an error
1169      */
1170     int dlt_init_common(void);
1171
1172     /**
1173      * Return the uptime of the system in 0.1 ms resolution
1174      * @return 0 if there was an error
1175      */
1176     uint32_t dlt_uptime(void);
1177
1178     /**
1179      * Print header of a DLT message
1180      * @param message pointer to structure of organising access to DLT messages
1181      * @param text pointer to a ASCII string, in which the header is written
1182      * @param size maximal size of text buffer
1183      * @param verbose if set to true verbose information is printed out.
1184      * @return negative value if there was an error
1185      */
1186     int dlt_message_print_header(DltMessage *message, char *text, uint32_t size, int verbose);
1187
1188     /**
1189      * Print payload of a DLT message as Hex-Output
1190      * @param message pointer to structure of organising access to DLT messages
1191      * @param text pointer to a ASCII string, in which the output is written
1192      * @param size maximal size of text buffer
1193      * @param verbose if set to true verbose information is printed out.
1194      * @return negative value if there was an error
1195      */
1196     int dlt_message_print_hex(DltMessage *message, char *text, uint32_t size, int verbose);
1197
1198     /**
1199      * Print payload of a DLT message as ASCII-Output
1200      * @param message pointer to structure of organising access to DLT messages
1201      * @param text pointer to a ASCII string, in which the output is written
1202      * @param size maximal size of text buffer
1203      * @param verbose if set to true verbose information is printed out.
1204      * @return negative value if there was an error
1205      */
1206     int dlt_message_print_ascii(DltMessage *message, char *text, uint32_t size, int verbose);
1207
1208     /**
1209      * Print payload of a DLT message as Mixed-Ouput (Hex and ASCII), for plain text output
1210      * @param message pointer to structure of organising access to DLT messages
1211      * @param text pointer to a ASCII string, in which the output is written
1212      * @param size maximal size of text buffer
1213      * @param verbose if set to true verbose information is printed out.
1214      * @return negative value if there was an error
1215      */
1216     int dlt_message_print_mixed_plain(DltMessage *message, char *text, uint32_t size, int verbose);
1217
1218     /**
1219      * Print payload of a DLT message as Mixed-Ouput (Hex and ASCII), for HTML text output
1220      * @param message pointer to structure of organising access to DLT messages
1221      * @param text pointer to a ASCII string, in which the output is written
1222      * @param size maximal size of text buffer
1223      * @param verbose if set to true verbose information is printed out.
1224      * @return negative value if there was an error
1225      */
1226     int dlt_message_print_mixed_html(DltMessage *message, char *text, uint32_t size, int verbose);
1227
1228     /**
1229      * Decode and print a argument of a DLT message
1230      * @param msg pointer to structure of organising access to DLT messages
1231      * @param type_info Type of argument
1232      * @param ptr pointer to pointer to data (pointer to data is changed within this function)
1233      * @param datalength pointer to datalength (datalength is changed within this function)
1234      * @param text pointer to a ASCII string, in which the output is written
1235      * @param textlength maximal size of text buffer
1236      * @param byteLength If argument is a string, and this value is 0 or greater, this value will be taken as string length
1237      * @param verbose if set to true verbose information is printed out.
1238      * @return negative value if there was an error
1239      */
1240     int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,int32_t *datalength,char *text,int textlength,int byteLength,int verbose);
1241
1242     /**
1243      * Check environment variables.
1244      */
1245         void dlt_check_envvar();
1246
1247 #ifdef __cplusplus
1248 }
1249 #endif
1250
1251 /**
1252   \}
1253 */
1254
1255 #endif /* DLT_COMMON_H */