automotive-dlt
dlt_common.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <limits.h>
#include <inttypes.h>
#include <stdarg.h>
#include <errno.h>
#include <sys/stat.h>
#include "dlt_user_shared.h"
#include "dlt_common.h"
#include "dlt_common_cfg.h"
#include "dlt_version.h"
#include <sys/socket.h>
#include <syslog.h>
#include <unistd.h>
#include <sys/time.h>
Include dependency graph for dlt_common.c:

Go to the source code of this file.

Functions

int dlt_buffer_get (DltBuffer *buf, unsigned char *data, int max_size, int delete)
 
int dlt_buffer_reset (DltBuffer *buf)
 
int dlt_buffer_increase_size (DltBuffer *buf)
 
int dlt_buffer_minimize_size (DltBuffer *buf)
 
void dlt_buffer_write_block (DltBuffer *buf, int *write, const unsigned char *data, unsigned int size)
 
void dlt_buffer_read_block (DltBuffer *buf, int *read, unsigned char *data, unsigned int size)
 
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_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_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_message (DltFile *file, int index, int verbose)
 
DltReturnValue dlt_file_free (DltFile *file, int verbose)
 
void dlt_log_set_level (int level)
 
void dlt_log_set_filename (const char *filename)
 
void dlt_log_set_fifo_basedir (const char *env_pipe_dir)
 
void dlt_log_init (int mode)
 
void dlt_log_free (void)
 
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,...)
 
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 flags)
 
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)
 
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)
 
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)
 
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 __attribute__((unused)) verbose)
 
void dlt_check_envvar ()
 
int dlt_mkdir_recursive (const char *dir)
 

Variables

static char str [DLT_COMMON_BUFFER_LENGTH]
 
const char dltSerialHeader [DLT_ID_SIZE] = { 'D','L','S',1 }
 
char dltSerialHeaderChar [DLT_ID_SIZE] = { 'D','L','S',1 }
 
char dltFifoBaseDir [PATH_MAX+1] = "/tmp"
 
static int logging_mode = DLT_LOG_TO_CONSOLE
 
static int logging_level = LOG_INFO
 
static char logging_filename [NAME_MAX+1] = ""
 
static FILE * logging_handle = NULL
 
char * message_type [] = {"log","app_trace","nw_trace","control","","","",""}
 
char * log_info [] = {"","fatal","error","warn","info","debug","verbose","","","","","","","","",""}
 
char * trace_type [] = {"","variable","func_in","func_out","state","vfb","","","","","","","","","",""}
 
char * nw_trace_type [] = {"","ipc","can","flexray","most","vfb","","","","","","","","","",""}
 
char * control_type [] = {"","request","response","time","","","","","","","","","","","",""}
 
static char * service_id []
 
static char * return_type [] = {"ok","not_supported","error","","","","","","no_matching_context_id"}
 

Detailed Description

Author
Alexander Wenzel alexa.nosp@m.nder.nosp@m..aw.w.nosp@m.enze.nosp@m.l@bmw.nosp@m..de Markus Klein Marku.nosp@m.s.Kl.nosp@m.ein@e.nosp@m.sk.f.nosp@m.raunh.nosp@m.ofer.nosp@m..de Mikko Rapeli mikko.nosp@m..rap.nosp@m.eli@b.nosp@m.mw.d.nosp@m.e

Definition in file dlt_common.c.

Function Documentation

int dlt_buffer_minimize_size ( DltBuffer buf)

Definition at line 2618 of file dlt_common.c.

References dlt_log(), DltBuffer::mem, DltBuffer::min_size, NULL, DltBuffer::shm, DltBuffer::size, and str.

Referenced by dlt_buffer_get().

void dlt_buffer_read_block ( DltBuffer buf,
int *  read,
unsigned char *  data,
unsigned int  size 
)

Definition at line 2535 of file dlt_common.c.

References dlt_log(), DltBuffer::mem, NULL, and DltBuffer::size.

Referenced by dlt_buffer_get().

int dlt_buffer_reset ( DltBuffer buf)

Definition at line 2664 of file dlt_common.c.

References dlt_log(), DltBuffer::mem, NULL, DltBuffer::shm, and DltBuffer::size.

Referenced by dlt_buffer_get(), and dlt_buffer_push3().

void dlt_buffer_write_block ( DltBuffer buf,
int *  write,
const unsigned char *  data,
unsigned int  size 
)

Definition at line 2513 of file dlt_common.c.

References dlt_log(), DltBuffer::mem, NULL, and DltBuffer::size.

Referenced by dlt_buffer_push3().

void dlt_log_set_fifo_basedir ( const char *  env_pipe_dir)

Definition at line 1994 of file dlt_common.c.

References dltFifoBaseDir.

Referenced by dlt_check_envvar().

Variable Documentation

char* control_type[] = {"","request","response","time","","","","","","","","","","","",""}

Definition at line 84 of file dlt_common.c.

Referenced by dlt_message_header_flags().

char* log_info[] = {"","fatal","error","warn","info","debug","verbose","","","","","","","","",""}

Definition at line 81 of file dlt_common.c.

Referenced by dlt_message_header_flags().

char logging_filename[NAME_MAX+1] = ""
static

Definition at line 77 of file dlt_common.c.

Referenced by dlt_log_init(), and dlt_log_set_filename().

FILE* logging_handle = NULL
static

Definition at line 78 of file dlt_common.c.

Referenced by dlt_log(), dlt_log_free(), and dlt_log_init().

int logging_level = LOG_INFO
static

Definition at line 76 of file dlt_common.c.

Referenced by dlt_log(), dlt_log_set_level(), dlt_vlog(), and dlt_vnlog().

int logging_mode = DLT_LOG_TO_CONSOLE
static

Definition at line 75 of file dlt_common.c.

Referenced by dlt_log(), dlt_log_free(), and dlt_log_init().

char* message_type[] = {"log","app_trace","nw_trace","control","","","",""}

Definition at line 80 of file dlt_common.c.

Referenced by dlt_message_header_flags().

char* nw_trace_type[] = {"","ipc","can","flexray","most","vfb","","","","","","","","","",""}
char* return_type[] = {"ok","not_supported","error","","","","","","no_matching_context_id"}
static

Definition at line 90 of file dlt_common.c.

Referenced by dlt_message_payload().

char* service_id[]
static
Initial value:
= {"","set_log_level","set_trace_status","get_log_info","get_default_log_level","store_config","reset_to_factory_default",
"set_com_interface_status","set_com_interface_max_bandwidth","set_verbose_mode","set_message_filtering","set_timing_packets",
"get_local_time","use_ecu_id","use_session_id","use_timestamp","use_extended_header","set_default_log_level","set_default_trace_status",
"get_software_version","message_buffer_overflow"
}

Definition at line 85 of file dlt_common.c.

Referenced by dlt_client_send_reset_to_factory_default(), dlt_client_send_store_config(), dlt_message_payload(), dlt_receive_message_callback(), and dlt_register_injection_callback().

char* trace_type[] = {"","variable","func_in","func_out","state","vfb","","","","","","","","","",""}

Definition at line 82 of file dlt_common.c.

Referenced by dlt_message_header_flags().