automotive-dlt
dlt_common.h File Reference
#include <stdio.h>
#include <linux/limits.h>
#include <unistd.h>
#include <time.h>
#include <termios.h>
#include "dlt_types.h"
#include "dlt_protocol.h"
Include dependency graph for dlt_common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  sDltMessage
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  PACKED
 
struct  DltFilter
 
struct  sDltFile
 
struct  DltReceiver
 
struct  DltBuffer
 
struct  DltBufferHead
 
struct  DltBufferBlockHead
 

Macros

#define PACKED   __attribute__((aligned(1),packed))
 
#define DLT_SWAP_64(value)   ((((uint64_t)DLT_SWAP_32((value)&0xffffffffull))<<32) | (DLT_SWAP_32((value)>>32)))
 
#define DLT_SWAP_16(value)   ((((value) >> 8)&0xff) | (((value) << 8)&0xff00))
 
#define DLT_SWAP_32(value)   ((((value) >> 24)&0xff) | (((value) << 8)&0xff0000) | (((value) >> 8)&0xff00) | (((value) << 24)&0xff000000))
 
#define LITTLE_ENDIAN   1234
 
#define BIG_ENDIAN   4321
 
#define BYTE_ORDER   LITTLE_ENDIAN
 
#define DLT_HTOBE_16(x)   DLT_SWAP_16((x))
 
#define DLT_HTOLE_16(x)   ((x))
 
#define DLT_BETOH_16(x)   DLT_SWAP_16((x))
 
#define DLT_LETOH_16(x)   ((x))
 
#define DLT_HTOBE_32(x)   DLT_SWAP_32((x))
 
#define DLT_HTOLE_32(x)   ((x))
 
#define DLT_BETOH_32(x)   DLT_SWAP_32((x))
 
#define DLT_LETOH_32(x)   ((x))
 
#define DLT_HTOBE_64(x)   DLT_SWAP_64((x))
 
#define DLT_HTOLE_64(x)   ((x))
 
#define DLT_BETOH_64(x)   DLT_SWAP_64((x))
 
#define DLT_LETOH_64(x)   ((x))
 
#define DLT_ENDIAN_GET_16(htyp, x)   ((((htyp) & DLT_HTYP_MSBF)>0)?DLT_BETOH_16(x):DLT_LETOH_16(x))
 
#define DLT_ENDIAN_GET_32(htyp, x)   ((((htyp) & DLT_HTYP_MSBF)>0)?DLT_BETOH_32(x):DLT_LETOH_32(x))
 
#define DLT_ENDIAN_GET_64(htyp, x)   ((((htyp) & DLT_HTYP_MSBF)>0)?DLT_BETOH_64(x):DLT_LETOH_64(x))
 
#define DLT_DAEMON_TCP_PORT   3490
 
#define DLT_FD_INIT   -1
 
#define DLT_FD_MINIMUM   3
 
#define DLT_ID_SIZE   4
 
#define DLT_SIZE_WEID   DLT_ID_SIZE
 
#define DLT_SIZE_WSID   (sizeof(uint32_t))
 
#define DLT_SIZE_WTMS   (sizeof(uint32_t))
 
#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) )
 
#define PRINT_FUNCTION_VERBOSE(_verbose)
 
#define NULL   (char*)0
 
#define DLT_MSG_IS_CONTROL(MSG)
 
#define DLT_MSG_IS_CONTROL_REQUEST(MSG)
 
#define DLT_MSG_IS_CONTROL_RESPONSE(MSG)
 
#define DLT_MSG_IS_CONTROL_TIME(MSG)
 
#define DLT_MSG_IS_NW_TRACE(MSG)
 
#define DLT_MSG_IS_TRACE_MOST(MSG)
 
#define DLT_MSG_IS_NONVERBOSE(MSG)
 
#define DLT_MESSAGE_BUFFER_NO_OVERFLOW   0x00
 
#define DLT_MESSAGE_BUFFER_OVERFLOW   0x01
 
#define DLT_OUTPUT_HEX   1
 
#define DLT_OUTPUT_ASCII   2
 
#define DLT_OUTPUT_MIXED_FOR_PLAIN   3
 
#define DLT_OUTPUT_MIXED_FOR_HTML   4
 
#define DLT_OUTPUT_ASCII_LIMITED   5
 
#define DLT_FILTER_MAX   30
 
#define DLT_MSG_READ_VALUE(dst, src, length, type)
 
#define DLT_MSG_READ_ID(dst, src, length)
 
#define DLT_MSG_READ_STRING(dst, src, maxlength, length)
 
#define DLT_MSG_READ_NULL(src, maxlength, length)
 
#define DLT_HEADER_SHOW_NONE   0x0000
 
#define DLT_HEADER_SHOW_TIME   0x0001
 
#define DLT_HEADER_SHOW_TMSTP   0x0002
 
#define DLT_HEADER_SHOW_MSGCNT   0x0004
 
#define DLT_HEADER_SHOW_ECUID   0x0008
 
#define DLT_HEADER_SHOW_APID   0x0010
 
#define DLT_HEADER_SHOW_CTID   0x0020
 
#define DLT_HEADER_SHOW_MSGTYPE   0x0040
 
#define DLT_HEADER_SHOW_MSGSUBTYPE   0x0080
 
#define DLT_HEADER_SHOW_VNVSTATUS   0x0100
 
#define DLT_HEADER_SHOW_NOARG   0x0200
 
#define DLT_HEADER_SHOW_ALL   0xFFFF
 
#define DLT_RCV_NONE   0
 
#define DLT_RCV_SKIP_HEADER   (1 << 0)
 
#define DLT_RCV_REMOVE   (1 << 1)
 
#define DLT_MOUNT_PATH_MAX   1024
 
#define DLT_ENTRY_MAX   100
 
#define STATIC   static
 
#define DLT_BUFFER_HEAD   "SHM"
 
#define DLT_MESSAGE_ERROR_OK   0
 
#define DLT_MESSAGE_ERROR_UNKNOWN   -1
 
#define DLT_MESSAGE_ERROR_SIZE   -2
 
#define DLT_MESSAGE_ERROR_CONTENT   -3
 

Typedefs

typedef char ID4[DLT_ID_SIZE]
 
typedef struct sDltMessage DltMessage
 
typedef struct sDltFile DltFile
 

Enumerations

enum  { DLT_LOG_TO_CONSOLE =0, DLT_LOG_TO_SYSLOG =1, DLT_LOG_TO_FILE =2, DLT_LOG_DROPPED =3 }
 

Functions

void dlt_print_hex (uint8_t *ptr, int size)
 
DltReturnValue dlt_print_hex_string (char *text, int textlength, uint8_t *ptr, int size)
 
DltReturnValue dlt_print_mixed_string (char *text, int textlength, uint8_t *ptr, int size, int html)
 
DltReturnValue dlt_print_char_string (char **text, int textlength, uint8_t *ptr, int size)
 
void dlt_print_id (char *text, const char *id)
 
void dlt_set_id (char *id, const char *text)
 
void dlt_clean_string (char *text, int length)
 
DltReturnValue dlt_filter_init (DltFilter *filter, int verbose)
 
DltReturnValue dlt_filter_free (DltFilter *filter, int verbose)
 
DltReturnValue dlt_filter_load (DltFilter *filter, const char *filename, int verbose)
 
DltReturnValue dlt_filter_save (DltFilter *filter, const char *filename, int verbose)
 
int dlt_filter_find (DltFilter *filter, const char *apid, const char *ctid, int verbose)
 
DltReturnValue dlt_filter_add (DltFilter *filter, const char *apid, const char *ctid, int verbose)
 
DltReturnValue dlt_filter_delete (DltFilter *filter, const char *apid, const char *ctid, int verbose)
 
DltReturnValue dlt_message_init (DltMessage *msg, int verbose)
 
DltReturnValue dlt_message_free (DltMessage *msg, int verbose)
 
DltReturnValue dlt_message_header (DltMessage *msg, char *text, int textlength, int verbose)
 
DltReturnValue dlt_message_header_flags (DltMessage *msg, char *text, int textlength, int flags, int verbose)
 
DltReturnValue dlt_message_payload (DltMessage *msg, char *text, int textlength, int type, int verbose)
 
DltReturnValue dlt_message_filter_check (DltMessage *msg, DltFilter *filter, int verbose)
 
int dlt_message_read (DltMessage *msg, uint8_t *buffer, unsigned int length, int resync, int verbose)
 
DltReturnValue dlt_message_get_extraparameters (DltMessage *msg, int verbose)
 
DltReturnValue dlt_message_set_extraparameters (DltMessage *msg, int verbose)
 
DltReturnValue dlt_file_init (DltFile *file, int verbose)
 
DltReturnValue dlt_file_set_filter (DltFile *file, DltFilter *filter, int verbose)
 
DltReturnValue dlt_file_open (DltFile *file, const char *filename, int verbose)
 
DltReturnValue dlt_file_read (DltFile *file, int verbose)
 
DltReturnValue dlt_file_read_raw (DltFile *file, int resync, int verbose)
 
DltReturnValue dlt_file_close (DltFile *file, int verbose)
 
DltReturnValue dlt_file_read_header (DltFile *file, int verbose)
 
DltReturnValue dlt_file_read_header_raw (DltFile *file, int resync, int verbose)
 
DltReturnValue dlt_file_read_header_extended (DltFile *file, int verbose)
 
DltReturnValue dlt_file_read_data (DltFile *file, int verbose)
 
DltReturnValue dlt_file_message (DltFile *file, int index, int verbose)
 
DltReturnValue dlt_file_free (DltFile *file, int verbose)
 
void dlt_log_set_filename (const char *filename)
 
void dlt_log_set_level (int level)
 
void dlt_log_init (int mode)
 
DltReturnValue dlt_log (int prio, char *s)
 
DltReturnValue dlt_vlog (int prio, const char *format,...)
 
DltReturnValue dlt_vnlog (int prio, size_t size, const char *format,...)
 
void dlt_log_free (void)
 
DltReturnValue dlt_receiver_init (DltReceiver *receiver, int _fd, int _buffersize)
 
DltReturnValue dlt_receiver_free (DltReceiver *receiver)
 
int dlt_receiver_receive_socket (DltReceiver *receiver)
 
int dlt_receiver_receive_fd (DltReceiver *receiver)
 
DltReturnValue dlt_receiver_remove (DltReceiver *receiver, int size)
 
DltReturnValue dlt_receiver_move_to_begin (DltReceiver *receiver)
 
int dlt_receiver_check_and_get (DltReceiver *receiver, void *dest, unsigned int to_get, unsigned int skip_header)
 
DltReturnValue dlt_set_storageheader (DltStorageHeader *storageheader, const char *ecu)
 
DltReturnValue dlt_check_storageheader (DltStorageHeader *storageheader)
 
DltReturnValue dlt_buffer_init_static_server (DltBuffer *buf, const unsigned char *ptr, uint32_t size)
 
DltReturnValue dlt_buffer_init_static_client (DltBuffer *buf, const unsigned char *ptr, uint32_t size)
 
DltReturnValue dlt_buffer_init_dynamic (DltBuffer *buf, uint32_t min_size, uint32_t max_size, uint32_t step_size)
 
DltReturnValue dlt_buffer_free_static (DltBuffer *buf)
 
DltReturnValue dlt_buffer_free_dynamic (DltBuffer *buf)
 
DltReturnValue dlt_buffer_push (DltBuffer *buf, const unsigned char *data, unsigned int size)
 
DltReturnValue 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)
 
int dlt_buffer_pull (DltBuffer *buf, unsigned char *data, int max_size)
 
int dlt_buffer_copy (DltBuffer *buf, unsigned char *data, int max_size)
 
int dlt_buffer_remove (DltBuffer *buf)
 
void dlt_buffer_info (DltBuffer *buf)
 
void dlt_buffer_status (DltBuffer *buf)
 
uint32_t dlt_buffer_get_total_size (DltBuffer *buf)
 
int dlt_buffer_get_used_size (DltBuffer *buf)
 
int dlt_buffer_get_message_count (DltBuffer *buf)
 
DltReturnValue dlt_setup_serial (int fd, speed_t speed)
 
speed_t dlt_convert_serial_speed (int baudrate)
 
void dlt_get_version (char *buf, size_t size)
 
void dlt_get_major_version (char *buf, size_t size)
 
void dlt_get_minor_version (char *buf, size_t size)
 
DltReturnValue dlt_init_common (void)
 
uint32_t dlt_uptime (void)
 
DltReturnValue dlt_message_print_header (DltMessage *message, char *text, uint32_t size, int verbose)
 
DltReturnValue dlt_message_print_hex (DltMessage *message, char *text, uint32_t size, int verbose)
 
DltReturnValue dlt_message_print_ascii (DltMessage *message, char *text, uint32_t size, int verbose)
 
DltReturnValue dlt_message_print_mixed_plain (DltMessage *message, char *text, uint32_t size, int verbose)
 
DltReturnValue dlt_message_print_mixed_html (DltMessage *message, char *text, uint32_t size, int verbose)
 
DltReturnValue dlt_message_argument_print (DltMessage *msg, uint32_t type_info, uint8_t **ptr, int32_t *datalength, char *text, int textlength, int byteLength, int verbose)
 
void dlt_check_envvar ()
 
int dlt_mkdir_recursive (const char *dir)
 

Variables

const char dltSerialHeader [DLT_ID_SIZE]
 
char dltSerialHeaderChar [DLT_ID_SIZE]
 
char dltFifoBaseDir [PATH_MAX+1]
 

Detailed Description

Author
Alexander Wenzel alexa.nosp@m.nder.nosp@m..aw.w.nosp@m.enze.nosp@m.l@bmw.nosp@m..de

Definition in file dlt_common.h.