summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLutz Helwing <lutz_helwing@mentor.com>2015-07-15 14:14:19 +0200
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2015-10-07 10:40:33 +0200
commit1236195e9b93aeb6bfa625956fa027f96003756d (patch)
tree07b08c892a486f9f97c1674e0d253099eb3388f3 /include
parent033a69218af3490f6be409f66f350c1568655f61 (diff)
downloadDLT-daemon-1236195e9b93aeb6bfa625956fa027f96003756d.tar.gz
DLT daemon improvement - dlt_init()-check
DLT daemon improvement - parameter value range check Adapt unit tests to check for enum return values Changed C version to gnu99 and C++ version to gnu++0c Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'include')
-rw-r--r--include/dlt/dlt_client.h56
-rw-r--r--include/dlt/dlt_common.h123
-rw-r--r--include/dlt/dlt_offline_trace.h8
-rw-r--r--include/dlt/dlt_shm.h6
-rw-r--r--include/dlt/dlt_types.h93
-rw-r--r--include/dlt/dlt_user.h298
6 files changed, 310 insertions, 274 deletions
diff --git a/include/dlt/dlt_client.h b/include/dlt/dlt_client.h
index 6f62a67..a7ff7d4 100644
--- a/include/dlt/dlt_client.h
+++ b/include/dlt/dlt_client.h
@@ -98,31 +98,31 @@ void dlt_client_register_message_callback(int (*registerd_callback) (DltMessage
* Initialising dlt client structure
* @param client pointer to dlt client structure
* @param verbose if set to true verbose information is printed out.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_init(DltClient *client, int verbose);
+DltReturnValue dlt_client_init(DltClient *client, int verbose);
/**
* Connect to dlt daemon using the information from the dlt client structure
* @param client pointer to dlt client structure
* @param verbose if set to true verbose information is printed out.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_connect(DltClient *client, int verbose);
+DltReturnValue dlt_client_connect(DltClient *client, int verbose);
/**
* Cleanup dlt client structure
* @param client pointer to dlt client structure
* @param verbose if set to true verbose information is printed out.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_cleanup(DltClient *client, int verbose);
+DltReturnValue dlt_client_cleanup(DltClient *client, int verbose);
/**
* Main Loop of dlt client application
* @param client pointer to dlt client structure
* @param data pointer to data to be provided to the main loop
* @param verbose if set to true verbose information is printed out.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_main_loop(DltClient *client, void *data, int verbose);
+DltReturnValue dlt_client_main_loop(DltClient *client, void *data, int verbose);
/**
* Send ancontrol message to the dlt daemon
* @param client pointer to dlt client structure
@@ -130,9 +130,9 @@ int dlt_client_main_loop(DltClient *client, void *data, int verbose);
* @param ctid context id
* @param payload Buffer filled with control message data
* @param size Size of control message data
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_send_ctrl_msg(DltClient *client, char *apid, char *ctid, uint8_t *payload, uint32_t size);
+DltReturnValue dlt_client_send_ctrl_msg(DltClient *client, char *apid, char *ctid, uint8_t *payload, uint32_t size);
/**
* Send an injection message to the dlt daemon
* @param client pointer to dlt client structure
@@ -141,68 +141,68 @@ int dlt_client_send_ctrl_msg(DltClient *client, char *apid, char *ctid, uint8_t
* @param serviceID service id
* @param buffer Buffer filled with injection message data
* @param size Size of injection data within buffer
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_send_inject_msg(DltClient *client, char *apid, char *ctid, uint32_t serviceID, uint8_t *buffer, uint32_t size);
+DltReturnValue dlt_client_send_inject_msg(DltClient *client, char *apid, char *ctid, uint32_t serviceID, uint8_t *buffer, uint32_t size);
/**
* Send an set log level message to the dlt daemon
* @param client pointer to dlt client structure
* @param apid application id
* @param ctid context id
* @param SendLogLevel Log Level
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_send_log_level(DltClient *client, char *apid, char *ctid, uint8_t logLevel);
+DltReturnValue dlt_client_send_log_level(DltClient *client, char *apid, char *ctid, uint8_t logLevel);
/**
* Send a set trace status message to the dlt daemon
* @param client pointer to dlt client structure
* @param apid application id
* @param ctid context id
* @param defaultTraceStatus Default Trace Status
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_send_trace_status(DltClient *client, char *apid, char *ctid, uint8_t traceStatus);
+DltReturnValue dlt_client_send_trace_status(DltClient *client, char *apid, char *ctid, uint8_t traceStatus);
/**
* Send the default log level to the dlt daemon
* @param client pointer to dlt client structure
* @param defaultLogLevel Default Log Level
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_send_default_log_level(DltClient *client, uint8_t defaultLogLevel);
+DltReturnValue dlt_client_send_default_log_level(DltClient *client, uint8_t defaultLogLevel);
/**
* Send the default trace status to the dlt daemon
* @param client pointer to dlt client structure
* @param defaultTraceStatus Default Trace Status
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_send_default_trace_status(DltClient *client, uint8_t defaultTraceStatus);
+DltReturnValue dlt_client_send_default_trace_status(DltClient *client, uint8_t defaultTraceStatus);
/**
* Send the timing pakets status to the dlt daemon
* @param client pointer to dlt client structure
* @param timingPakets Timing pakets enabled
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_send_timing_pakets(DltClient *client, uint8_t timingPakets);
+DltReturnValue dlt_client_send_timing_pakets(DltClient *client, uint8_t timingPakets);
/**
* Send the store config command to the dlt daemon
* @param client pointer to dlt client structure
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_send_store_config(DltClient *client);
+DltReturnValue dlt_client_send_store_config(DltClient *client);
/**
* Send the reset to factory default command to the dlt daemon
* @param client pointer to dlt client structure
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_send_reset_to_factory_default(DltClient *client);
+DltReturnValue dlt_client_send_reset_to_factory_default(DltClient *client);
/**
* Set baudrate within dlt client structure
* @param client pointer to dlt client structure
* @param baudrate Baudrate
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_client_setbaudrate(DltClient *client, int baudrate);
+DltReturnValue dlt_client_setbaudrate(DltClient *client, int baudrate);
#ifdef __cplusplus
}
diff --git a/include/dlt/dlt_common.h b/include/dlt/dlt_common.h
index da9835c..4b7f45f 100644
--- a/include/dlt/dlt_common.h
+++ b/include/dlt/dlt_common.h
@@ -667,7 +667,7 @@ extern "C"
* @param size number of bytes to be printed.
* @return negative value if there was an error
*/
- int dlt_print_hex_string(char *text,int textlength,uint8_t *ptr,int size);
+ DltReturnValue dlt_print_hex_string(char *text,int textlength,uint8_t *ptr,int size);
/**
* Helper function to print a byte array in hex and ascii into a string.
* @param text pointer to a ASCII string, in which the text is written
@@ -677,7 +677,7 @@ extern "C"
* @param html output is html? 0 - false, 1 - true
* @return negative value if there was an error
*/
- int dlt_print_mixed_string(char *text,int textlength,uint8_t *ptr,int size,int html);
+ DltReturnValue dlt_print_mixed_string(char *text,int textlength,uint8_t *ptr,int size,int html);
/**
* Helper function to print a byte array in ascii into a string.
* @param text pointer to a ASCII string, in which the text is written
@@ -686,7 +686,7 @@ extern "C"
* @param size number of bytes to be printed.
* @return negative value if there was an error
*/
- int dlt_print_char_string(char **text,int textlength,uint8_t *ptr,int size);
+ DltReturnValue dlt_print_char_string(char **text,int textlength,uint8_t *ptr,int size);
/**
* Helper function to print an id.
@@ -716,14 +716,14 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_filter_init(DltFilter *filter,int verbose);
+ DltReturnValue dlt_filter_init(DltFilter *filter,int verbose);
/**
* Free the used memory by the organising structure of filter.
* @param filter pointer to structure of organising DLT filter
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_filter_free(DltFilter *filter,int verbose);
+ DltReturnValue dlt_filter_free(DltFilter *filter,int verbose);
/**
* Load filter list from file.
* @param filter pointer to structure of organising DLT filter
@@ -731,7 +731,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_filter_load(DltFilter *filter,const char *filename,int verbose);
+ DltReturnValue dlt_filter_load(DltFilter *filter,const char *filename,int verbose);
/**
* Save filter list to file.
* @param filter pointer to structure of organising DLT filter
@@ -739,7 +739,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_filter_save(DltFilter *filter,const char *filename,int verbose);
+ DltReturnValue dlt_filter_save(DltFilter *filter,const char *filename,int verbose);
/**
* Find index of filter in filter list
* @param filter pointer to structure of organising DLT filter
@@ -757,7 +757,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_filter_add(DltFilter *filter,const char *apid,const char *ctid,int verbose);
+ DltReturnValue dlt_filter_add(DltFilter *filter,const char *apid,const char *ctid,int verbose);
/**
* Delete filter from filter list
* @param filter pointer to structure of organising DLT filter
@@ -766,7 +766,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_filter_delete(DltFilter *filter,const char *apid,const char *ctid,int verbose);
+ DltReturnValue dlt_filter_delete(DltFilter *filter,const char *apid,const char *ctid,int verbose);
/**
* Initialise the structure used to access a DLT message.
@@ -775,14 +775,14 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_message_init(DltMessage *msg,int verbose);
+ DltReturnValue dlt_message_init(DltMessage *msg,int verbose);
/**
* Free the used memory by the organising structure of file.
* @param msg pointer to structure of organising access to DLT messages
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_message_free(DltMessage *msg,int verbose);
+ DltReturnValue dlt_message_free(DltMessage *msg,int verbose);
/**
* Print Header into an ASCII string.
* This function calls dlt_message_header_flags() with flags=DLT_HEADER_SHOW_ALL
@@ -792,7 +792,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_message_header(DltMessage *msg,char *text,int textlength,int verbose);
+ DltReturnValue dlt_message_header(DltMessage *msg,char *text,int textlength,int verbose);
/**
* Print Header into an ASCII string, selective.
* @param msg pointer to structure of organising access to DLT messages
@@ -802,7 +802,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_message_header_flags(DltMessage *msg,char *text,int textlength,int flags, int verbose);
+ DltReturnValue dlt_message_header_flags(DltMessage *msg,char *text,int textlength,int flags, int verbose);
/**
* Print Payload into an ASCII string.
* @param msg pointer to structure of organising access to DLT messages
@@ -812,7 +812,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_message_payload(DltMessage *msg,char *text,int textlength,int type,int verbose);
+ DltReturnValue dlt_message_payload(DltMessage *msg,char *text,int textlength,int type,int verbose);
/**
* Check if message is filtered or not. All filters are applied (logical OR).
* @param msg pointer to structure of organising access to DLT messages
@@ -820,7 +820,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return 1 = filter matches, 0 = filter does not match, negative value if there was an error
*/
- int dlt_message_filter_check(DltMessage *msg,DltFilter *filter,int verbose);
+ DltReturnValue dlt_message_filter_check(DltMessage *msg,DltFilter *filter,int verbose);
/**
* Read message from memory buffer.
@@ -840,7 +840,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_message_get_extraparameters(DltMessage *msg,int verbose);
+ DltReturnValue dlt_message_get_extraparameters(DltMessage *msg,int verbose);
/**
* Set standard header extra parameters
@@ -848,7 +848,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_message_set_extraparameters(DltMessage *msg,int verbose);
+ DltReturnValue dlt_message_set_extraparameters(DltMessage *msg,int verbose);
/**
* Initialise the structure used to access a DLT file.
@@ -857,7 +857,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_file_init(DltFile *file,int verbose);
+ DltReturnValue dlt_file_init(DltFile *file,int verbose);
/**
* Set a list to filters.
* This function should be called before loading a DLT file, if filters should be used.
@@ -868,7 +868,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_file_set_filter(DltFile *file,DltFilter *filter,int verbose);
+ DltReturnValue dlt_file_set_filter(DltFile *file,DltFilter *filter,int verbose);
/**
* Initialising loading a DLT file.
* @param file pointer to structure of organising access to DLT file
@@ -876,7 +876,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_file_open(DltFile *file,const char *filename,int verbose);
+ DltReturnValue dlt_file_open(DltFile *file,const char *filename,int verbose);
/**
* Find next message in the DLT file and parse them.
* This function finds the next message in the DLT file.
@@ -885,7 +885,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return 0 = message does not match filter, 1 = message was read, negative value if there was an error
*/
- int dlt_file_read(DltFile *file,int verbose);
+ DltReturnValue dlt_file_read(DltFile *file,int verbose);
/**
* Find next message in the DLT file in RAW format (without storage header) and parse them.
* This function finds the next message in the DLT file.
@@ -895,21 +895,21 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return 0 = message does not match filter, 1 = message was read, negative value if there was an error
*/
- int dlt_file_read_raw(DltFile *file,int resync,int verbose);
+ DltReturnValue dlt_file_read_raw(DltFile *file,int resync,int verbose);
/**
* Closing loading a DLT file.
* @param file pointer to structure of organising access to DLT file
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_file_close(DltFile *file,int verbose);
+ DltReturnValue dlt_file_close(DltFile *file,int verbose);
/**
* Load standard header of a message from file
* @param file pointer to structure of organising access to DLT file
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_file_read_header(DltFile *file,int verbose);
+ DltReturnValue dlt_file_read_header(DltFile *file,int verbose);
/**
* Load standard header of a message from file in RAW format (without storage header)
* @param file pointer to structure of organising access to DLT file
@@ -917,7 +917,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_file_read_header_raw(DltFile *file,int resync,int verbose);
+ DltReturnValue dlt_file_read_header_raw(DltFile *file,int resync,int verbose);
/**
* Load, if available in message, extra standard header fields and
* extended header of a message from file
@@ -926,7 +926,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_file_read_header_extended(DltFile *file, int verbose);
+ DltReturnValue dlt_file_read_header_extended(DltFile *file, int verbose);
/**
* Load payload of a message from file
* (dlt_file_read_header() must have been called before this call!)
@@ -934,7 +934,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_file_read_data(DltFile *file, int verbose);
+ DltReturnValue dlt_file_read_data(DltFile *file, int verbose);
/**
* Load headers and payload of a message selected by the index.
* If filters are set, index is based on the filtered list.
@@ -943,14 +943,14 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return number of messages loaded, negative value if there was an error
*/
- int dlt_file_message(DltFile *file,int index,int verbose);
+ DltReturnValue dlt_file_message(DltFile *file,int index,int verbose);
/**
* Free the used memory by the organising structure of file.
* @param file pointer to structure of organising access to DLT file
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_file_free(DltFile *file,int verbose);
+ DltReturnValue dlt_file_free(DltFile *file,int verbose);
/**
* Set internal logging filename if mode 2
@@ -973,7 +973,22 @@ extern "C"
* @param s Pointer to ASCII string with null-termination
* @return negative value if there was an error
*/
- int dlt_log(int prio, char *s);
+ DltReturnValue dlt_log(int prio, char *s);
+ /**
+ * Log with variable arguments to (external) logging facility (like printf)
+ * @param prio priority (see syslog() call)
+ * @param format format string for log message
+ * @return negative value if there was an error
+ */
+ DltReturnValue dlt_vlog(int prio, const char *format, ...);
+ /**
+ * Log size bytes with variable arguments to (external) logging facility (similar to snprintf)
+ * @param prio priority (see syslog() call)
+ * @param size number of bytes to log
+ * @param format format string for log message
+ * @return negative value if there was an error
+ */
+ DltReturnValue dlt_vnlog(int prio, size_t size, const char *format, ...);
/**
* De-Initialize (external) logging facility
*/
@@ -986,23 +1001,23 @@ extern "C"
* @param _buffersize size of data buffer for storing the received data
* @return negative value if there was an error
*/
- int dlt_receiver_init(DltReceiver *receiver,int _fd, int _buffersize);
+ DltReturnValue dlt_receiver_init(DltReceiver *receiver,int _fd, int _buffersize);
/**
* De-Initialize a dlt receiver structure
* @param receiver pointer to dlt receiver structure
* @return negative value if there was an error
*/
- int dlt_receiver_free(DltReceiver *receiver);
+ DltReturnValue dlt_receiver_free(DltReceiver *receiver);
/**
* Receive data from socket using the dlt receiver structure
* @param receiver pointer to dlt receiver structure
- * @return negative value if there was an error
+ * @return number of received bytes or negative value if there was an error
*/
int dlt_receiver_receive_socket(DltReceiver *receiver);
/**
* Receive data from file/fifo using the dlt receiver structure
* @param receiver pointer to dlt receiver structure
- * @return negative value if there was an error
+ * @return number of received bytes or negative value if there was an error
*/
int dlt_receiver_receive_fd(DltReceiver *receiver);
/**
@@ -1011,13 +1026,13 @@ extern "C"
* @param size amount of bytes to be removed
* @return negative value if there was an error
*/
- int dlt_receiver_remove(DltReceiver *receiver,int size);
+ DltReturnValue dlt_receiver_remove(DltReceiver *receiver,int size);
/**
* Move data from last receive call to front of receive buffer
* @param receiver pointer to dlt receiver structure
* @return negative value if there was an error
*/
- int dlt_receiver_move_to_begin(DltReceiver *receiver);
+ DltReturnValue dlt_receiver_move_to_begin(DltReceiver *receiver);
/**
* Fill out storage header of a dlt message
@@ -1025,13 +1040,13 @@ extern "C"
* @param ecu name of ecu to be set in storage header
* @return negative value if there was an error
*/
- int dlt_set_storageheader(DltStorageHeader *storageheader, const char *ecu);
+ DltReturnValue dlt_set_storageheader(DltStorageHeader *storageheader, const char *ecu);
/**
* Check if a storage header contains its marker
* @param storageheader pointer to storage header of a dlt message
* @return 0 no, 1 yes, negative value if there was an error
*/
- int dlt_check_storageheader(DltStorageHeader *storageheader);
+ DltReturnValue dlt_check_storageheader(DltStorageHeader *storageheader);
/**
@@ -1043,7 +1058,7 @@ extern "C"
* @param size Maximum size of buffer in bytes
* @return negative value if there was an error
*/
- int dlt_buffer_init_static_server(DltBuffer *buf, const unsigned char *ptr, uint32_t size);
+ DltReturnValue dlt_buffer_init_static_server(DltBuffer *buf, const unsigned char *ptr, uint32_t size);
/**
* Initialize static ringbuffer with a size of size.
@@ -1054,7 +1069,7 @@ extern "C"
* @param size Maximum size of buffer in bytes
* @return negative value if there was an error
*/
- int dlt_buffer_init_static_client(DltBuffer *buf, const unsigned char *ptr, uint32_t size);
+ DltReturnValue dlt_buffer_init_static_client(DltBuffer *buf, const unsigned char *ptr, uint32_t size);
/**
* Initialize dynamic ringbuffer with a size of size.
@@ -1068,21 +1083,21 @@ extern "C"
* @param step_size size of which ringbuffer is increased
* @return negative value if there was an error
*/
- int dlt_buffer_init_dynamic(DltBuffer *buf, uint32_t min_size, uint32_t max_size,uint32_t step_size);
+ DltReturnValue dlt_buffer_init_dynamic(DltBuffer *buf, uint32_t min_size, uint32_t max_size,uint32_t step_size);
/**
* Deinitilaise usage of static ringbuffer
* @param buf Pointer to ringbuffer structure
* @return negative value if there was an error
*/
- int dlt_buffer_free_static(DltBuffer *buf);
+ DltReturnValue dlt_buffer_free_static(DltBuffer *buf);
/**
* Release and free memory used by dynamic ringbuffer
* @param buf Pointer to ringbuffer structure
* @return negative value if there was an error
*/
- int dlt_buffer_free_dynamic(DltBuffer *buf);
+ DltReturnValue dlt_buffer_free_dynamic(DltBuffer *buf);
/**
* Write one entry to ringbuffer
@@ -1091,7 +1106,7 @@ extern "C"
* @param size Size of data in bytes to be written to ringbuffer
* @return negative value if there was an error
*/
- int dlt_buffer_push(DltBuffer *buf,const unsigned char *data,unsigned int size);
+ DltReturnValue dlt_buffer_push(DltBuffer *buf,const unsigned char *data,unsigned int size);
/**
* Write up to three entries to ringbuffer.
@@ -1105,7 +1120,7 @@ extern "C"
* @param size3 Size of data in bytes to be written to ringbuffer
* @return negative value if there was an error
*/
- 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);
+ 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);
/**
* Read one entry from ringbuffer.
@@ -1152,7 +1167,7 @@ extern "C"
* @param buf Pointer to ringbuffer structure
* @return total size of buffer
*/
- int dlt_buffer_get_total_size(DltBuffer *buf);
+ uint32_t dlt_buffer_get_total_size(DltBuffer *buf);
/**
* Get used size in bytes of ringbuffer.
@@ -1176,7 +1191,7 @@ extern "C"
* @param speed Serial line speed, as defined in termios.h
* @return negative value if there was an error
*/
- int dlt_setup_serial(int fd, speed_t speed);
+ DltReturnValue dlt_setup_serial(int fd, speed_t speed);
/**
* Helper function: Convert serial line baudrate (as number) to line speed (as defined in termios.h)
@@ -1215,7 +1230,7 @@ extern "C"
* Common part of initialisation
* @return negative value if there was an error
*/
- int dlt_init_common(void);
+ DltReturnValue dlt_init_common(void);
/**
* Return the uptime of the system in 0.1 ms resolution
@@ -1231,7 +1246,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_message_print_header(DltMessage *message, char *text, uint32_t size, int verbose);
+ DltReturnValue dlt_message_print_header(DltMessage *message, char *text, uint32_t size, int verbose);
/**
* Print payload of a DLT message as Hex-Output
@@ -1241,7 +1256,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_message_print_hex(DltMessage *message, char *text, uint32_t size, int verbose);
+ DltReturnValue dlt_message_print_hex(DltMessage *message, char *text, uint32_t size, int verbose);
/**
* Print payload of a DLT message as ASCII-Output
@@ -1251,7 +1266,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_message_print_ascii(DltMessage *message, char *text, uint32_t size, int verbose);
+ DltReturnValue dlt_message_print_ascii(DltMessage *message, char *text, uint32_t size, int verbose);
/**
* Print payload of a DLT message as Mixed-Ouput (Hex and ASCII), for plain text output
@@ -1261,7 +1276,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_message_print_mixed_plain(DltMessage *message, char *text, uint32_t size, int verbose);
+ DltReturnValue dlt_message_print_mixed_plain(DltMessage *message, char *text, uint32_t size, int verbose);
/**
* Print payload of a DLT message as Mixed-Ouput (Hex and ASCII), for HTML text output
@@ -1271,7 +1286,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- int dlt_message_print_mixed_html(DltMessage *message, char *text, uint32_t size, int verbose);
+ DltReturnValue dlt_message_print_mixed_html(DltMessage *message, char *text, uint32_t size, int verbose);
/**
* Decode and print a argument of a DLT message
@@ -1285,7 +1300,7 @@ extern "C"
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
- 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);
+ 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);
/**
* Check environment variables.
diff --git a/include/dlt/dlt_offline_trace.h b/include/dlt/dlt_offline_trace.h
index 64a6afe..90cfa96 100644
--- a/include/dlt/dlt_offline_trace.h
+++ b/include/dlt/dlt_offline_trace.h
@@ -59,6 +59,8 @@
#include <limits.h>
+#include "dlt_types.h"
+
typedef struct
{
char directory[NAME_MAX + 1];/**< (String) Store DLT messages to local directory */
@@ -80,7 +82,7 @@ typedef struct
* @param maxSize maximum size of complete offline trace in bytes.
* @return negative value if there was an error
*/
-extern int dlt_offline_trace_init(DltOfflineTrace *trace,const char *directory,int fileSize,int maxSize);
+extern DltReturnValue dlt_offline_trace_init(DltOfflineTrace *trace,const char *directory,int fileSize,int maxSize);
/**
* Uninitialise the offline trace
@@ -89,7 +91,7 @@ extern int dlt_offline_trace_init(DltOfflineTrace *trace,const char *directory,i
* @param trace pointer to offline trace structure
* @return negative value if there was an error
*/
-extern int dlt_offline_trace_free(DltOfflineTrace *buf);
+extern DltReturnValue dlt_offline_trace_free(DltOfflineTrace *buf);
/**
* Write data into offline trace
@@ -105,7 +107,7 @@ extern int dlt_offline_trace_free(DltOfflineTrace *buf);
* @param size3 size in bytes of third data block to be written, 0 if not used
* @return negative value if there was an error
*/
-extern int dlt_offline_trace_write(DltOfflineTrace *trace,unsigned char *data1,int size1,unsigned char *data2,int size2,unsigned char *data3,int size3);
+extern DltReturnValue dlt_offline_trace_write(DltOfflineTrace *trace,unsigned char *data1,int size1,unsigned char *data2,int size2,unsigned char *data3,int size3);
/**
* Get size of currently used offline trace buffer
diff --git a/include/dlt/dlt_shm.h b/include/dlt/dlt_shm.h
index 52e8e1a..20f9110 100644
--- a/include/dlt/dlt_shm.h
+++ b/include/dlt/dlt_shm.h
@@ -99,7 +99,7 @@ typedef struct
* @param key the identifier of the shm, must be the same for server and client
* @return negative value if there was an error
*/
-extern int dlt_shm_init_client(DltShm *buf,int key);
+extern DltReturnValue dlt_shm_init_client(DltShm *buf,int key);
/**
* Initialise the shared memory on the server side.
@@ -109,7 +109,7 @@ extern int dlt_shm_init_client(DltShm *buf,int key);
* @param size the requested size of the shm
* @return negative value if there was an error
*/
-extern int dlt_shm_init_server(DltShm *buf,int key,int size);
+extern DltReturnValue dlt_shm_init_server(DltShm *buf,int key,int size);
/**
* Push data from client onto the shm.
@@ -172,7 +172,7 @@ extern void dlt_shm_status(DltShm *buf);
* @param buf pointer to shm structure
* @return negative value if there was an error
*/
-extern int dlt_shm_free_client(DltShm *buf);
+extern DltReturnValue dlt_shm_free_client(DltShm *buf);
/**
* Returns the total size of the shm.
diff --git a/include/dlt/dlt_types.h b/include/dlt/dlt_types.h
index 1e7c8e6..a0400ad 100644
--- a/include/dlt/dlt_types.h
+++ b/include/dlt/dlt_types.h
@@ -80,6 +80,99 @@ typedef unsigned int speed_t;
#include <stdint.h>
#endif
+/**
+ * Definitions of DLT return values
+ */
+typedef enum
+{
+ DLT_RETURN_WRONG_PARAMETER = -5,
+ DLT_RETURN_BUFFER_FULL = -4,
+ DLT_RETURN_PIPE_FULL = -3,
+ DLT_RETURN_PIPE_ERROR = -2,
+ DLT_RETURN_ERROR = -1,
+ DLT_RETURN_OK = 0,
+ DLT_RETURN_TRUE = 1
+} DltReturnValue;
+
+/**
+ * Definitions of DLT log level
+ */
+typedef enum
+{
+ DLT_LOG_DEFAULT = -1, /**< Default log level */
+ DLT_LOG_OFF = 0x00, /**< Log level off */
+ DLT_LOG_FATAL = 0x01, /**< fatal system error */
+ DLT_LOG_ERROR = 0x02, /**< error with impact to correct functionality */
+ DLT_LOG_WARN = 0x03, /**< warning, correct behaviour could not be ensured */
+ DLT_LOG_INFO = 0x04, /**< informational */
+ DLT_LOG_DEBUG = 0x05, /**< debug */
+ DLT_LOG_VERBOSE = 0x06, /**< highest grade of information */
+ DLT_LOG_MAX /**< maximum value, used for range check */
+} DltLogLevelType;
+
+/**
+ * Definitions of DLT Format
+ */
+typedef enum
+{
+ DLT_FORMAT_DEFAULT = 0x00, /**< no sepecial format */
+ DLT_FORMAT_HEX8 = 0x01, /**< Hex 8 */
+ DLT_FORMAT_HEX16 = 0x02, /**< Hex 16 */
+ DLT_FORMAT_HEX32 = 0x03, /**< Hex 32 */
+ DLT_FORMAT_HEX64 = 0x04, /**< Hex 64 */
+ DLT_FORMAT_BIN8 = 0x05, /**< Binary 8 */
+ DLT_FORMAT_BIN16 = 0x06, /**< Binary 16 */
+ DLT_FORMAT_MAX /**< maximum value, used for range check */
+} DltFormatType;
+
+/**
+ * Definitions of DLT trace status
+ */
+typedef enum
+{
+ DLT_TRACE_STATUS_DEFAULT = -1, /**< Default trace status */
+ DLT_TRACE_STATUS_OFF = 0x00, /**< Trace status: Off */
+ DLT_TRACE_STATUS_ON = 0x01, /**< Trace status: On */
+ DLT_TRACE_STATUS_MAX /**< maximum value, used for range check */
+} DltTraceStatusType;
+
+/**
+ * Definitions for dlt_user_trace_network/DLT_TRACE_NETWORK()
+ * as defined in the DLT protocol
+ */
+typedef enum
+{
+ DLT_NW_TRACE_IPC = 0x01, /**< Interprocess communication */
+ DLT_NW_TRACE_CAN = 0x02, /**< Controller Area Network Bus */
+ DLT_NW_TRACE_FLEXRAY = 0x03, /**< Flexray Bus */
+ DLT_NW_TRACE_MOST = 0x04, /**< Media Oriented System Transport Bus */
+ DLT_NW_TRACE_RESERVED0 = 0x05,
+ DLT_NW_TRACE_RESERVED1 = 0x06,
+ DLT_NW_TRACE_RESERVED2 = 0x07,
+ DLT_NW_TRACE_USER_DEFINED0 = 0x08,
+ DLT_NW_TRACE_USER_DEFINED1 = 0x09,
+ DLT_NW_TRACE_USER_DEFINED2 = 0x0A,
+ DLT_NW_TRACE_USER_DEFINED3 = 0x0B,
+ DLT_NW_TRACE_USER_DEFINED4 = 0x0C,
+ DLT_NW_TRACE_USER_DEFINED5 = 0x0D,
+ DLT_NW_TRACE_USER_DEFINED6 = 0x0E,
+ DLT_NW_TRACE_USER_DEFINED7 = 0x0F,
+ DLT_NW_TRACE_MAX /**< maximum value, used for range check */
+} DltNetworkTraceType;
+
+/**
+ * This are the log modes.
+ */
+typedef enum
+{
+ DLT_USER_MODE_UNDEFINED = -1,
+ DLT_USER_MODE_OFF = 0,
+ DLT_USER_MODE_EXTERNAL ,
+ DLT_USER_MODE_INTERNAL ,
+ DLT_USER_MODE_BOTH ,
+ DLT_USER_MODE_MAX /**< maximum value, used for range check */
+} DltUserLogMode;
+
typedef float float32_t;
typedef double float64_t;
diff --git a/include/dlt/dlt_user.h b/include/dlt/dlt_user.h
index df41259..d5d8ed7 100644
--- a/include/dlt/dlt_user.h
+++ b/include/dlt/dlt_user.h
@@ -75,94 +75,20 @@
\addtogroup userapi
\{
*/
-#include "dlt_types.h"
-#include "dlt_common.h"
-#include "dlt_user_macros.h"
-#include "dlt_shm.h"
#include <mqueue.h>
#if !defined (__WIN32__)
#include <semaphore.h>
#endif
+#include "dlt_types.h"
+#include "dlt_user_macros.h"
+#include "dlt_shm.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-/**
- * Definitions of DLT log level
- */
-typedef enum
-{
- DLT_LOG_DEFAULT = -1, /**< Default log level */
- DLT_LOG_OFF = 0x00, /**< Log level off */
- DLT_LOG_FATAL = 0x01, /**< fatal system error */
- DLT_LOG_ERROR = 0x02, /**< error with impact to correct functionality */
- DLT_LOG_WARN = 0x03, /**< warning, correct behaviour could not be ensured */
- DLT_LOG_INFO = 0x04, /**< informational */
- DLT_LOG_DEBUG = 0x05, /**< debug */
- DLT_LOG_VERBOSE = 0x06 /**< highest grade of information */
-} DltLogLevelType;
-
-/**
- * Definitions of DLT Format
- */
-typedef enum
-{
- DLT_FORMAT_DEFAULT = 0x00, /**< no sepecial format */
- DLT_FORMAT_HEX8 = 0x01, /**< Hex 8 */
- DLT_FORMAT_HEX16 = 0x02, /**< Hex 16 */
- DLT_FORMAT_HEX32 = 0x03, /**< Hex 32 */
- DLT_FORMAT_HEX64 = 0x04, /**< Hex 64 */
- DLT_FORMAT_BIN8 = 0x05, /**< Binary 8 */
- DLT_FORMAT_BIN16 = 0x06 /**< Binary 16 */
-} DltFormatType;
-
-/**
- * Definitions of DLT trace status
- */
-typedef enum
-{
- DLT_TRACE_STATUS_DEFAULT = -1, /**< Default trace status */
- DLT_TRACE_STATUS_OFF = 0x00, /**< Trace status: Off */
- DLT_TRACE_STATUS_ON = 0x01 /**< Trace status: On */
-} DltTraceStatusType;
-
-/**
- * Definitions for dlt_user_trace_network/DLT_TRACE_NETWORK()
- * as defined in the DLT protocol
- */
-typedef enum
-{
- DLT_NW_TRACE_IPC = 0x01, /**< Interprocess communication */
- DLT_NW_TRACE_CAN = 0x02, /**< Controller Area Network Bus */
- DLT_NW_TRACE_FLEXRAY = 0x03, /**< Flexray Bus */
- DLT_NW_TRACE_MOST = 0x04, /**< Media Oriented System Transport Bus */
- DLT_NW_TRACE_RESERVED0 = 0x05,
- DLT_NW_TRACE_RESERVED1 = 0x06,
- DLT_NW_TRACE_RESERVED2 = 0x07,
- DLT_NW_TRACE_USER_DEFINED0 = 0x08,
- DLT_NW_TRACE_USER_DEFINED1 = 0x09,
- DLT_NW_TRACE_USER_DEFINED2 = 0x0A,
- DLT_NW_TRACE_USER_DEFINED3 = 0x0B,
- DLT_NW_TRACE_USER_DEFINED4 = 0x0C,
- DLT_NW_TRACE_USER_DEFINED5 = 0x0D,
- DLT_NW_TRACE_USER_DEFINED6 = 0x0E,
- DLT_NW_TRACE_USER_DEFINED7 = 0x0F
-} DltNetworkTraceType;
-
-/**
- * This are the log modes.
- */
-typedef enum
-{
- DLT_USER_MODE_UNDEFINED = -1,
- DLT_USER_MODE_OFF = 0,
- DLT_USER_MODE_EXTERNAL ,
- DLT_USER_MODE_INTERNAL ,
- DLT_USER_MODE_BOTH
-} DltUserLogMode;
-
#define DLT_USER_BUF_MAX_SIZE 2048 /**< maximum size of each user buffer, also used for injection buffer */
#define DLT_USER_RESENDBUF_MAX_SIZE (DLT_USER_BUF_MAX_SIZE + 100) /**< Size of resend buffer; Max DLT message size is 2K plus some extra header space */
@@ -325,9 +251,9 @@ typedef struct
* @param handle pointer to an object containing information about one special logging context
* @param log pointer to an object containing information about logging context data
* @param loglevel this is the current log level of the log message to be sent
- * @return negative value if there was an error, zero if log level is below current log level, one if log level is matching
+ * @return Value from DltReturnValue enum, DLT_RETURN_TRUE if log level is matching
*/
-int dlt_user_log_write_start(DltContext *handle, DltContextData *log, DltLogLevelType loglevel);
+DltReturnValue dlt_user_log_write_start(DltContext *handle, DltContextData *log, DltLogLevelType loglevel);
/**
* Initialize the generation of a DLT log message (intended for usage in verbose mode)
@@ -338,17 +264,17 @@ int dlt_user_log_write_start(DltContext *handle, DltContextData *log, DltLogLeve
* @param log pointer to an object containing information about logging context data
* @param loglevel this is the current log level of the log message to be sent
* @param messageid message id of message
- * @return negative value if there was an error, zero if log level is below current log level, one if log level is matching
+ * @return Value from DltReturnValue enum, DLT_RETURN_TRUE if log level is matching
*/
-int dlt_user_log_write_start_id(DltContext *handle, DltContextData *log, DltLogLevelType loglevel, uint32_t messageid);
+DltReturnValue dlt_user_log_write_start_id(DltContext *handle, DltContextData *log, DltLogLevelType loglevel, uint32_t messageid);
/**
* Finishing the generation of a DLT log message and sending it to the DLT daemon.
* This function has to be called after writing all the log attributes of a log message.
* @param log pointer to an object containing information about logging context data
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_log_write_finish(DltContextData *log);
+DltReturnValue dlt_user_log_write_finish(DltContextData *log);
/**
* Write a boolean parameter into a DLT log message.
@@ -356,9 +282,9 @@ int dlt_user_log_write_finish(DltContextData *log);
* Finish sending log message by calling dlt_user_log_write_finish.
* @param log pointer to an object containing information about logging context data
* @param data boolean parameter written into log message (mapped to uint8)
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_log_write_bool(DltContextData *log, uint8_t data);
+DltReturnValue dlt_user_log_write_bool(DltContextData *log, uint8_t data);
/**
* Write a float parameter into a DLT log message.
@@ -366,9 +292,9 @@ int dlt_user_log_write_bool(DltContextData *log, uint8_t data);
* Finish sending log message by calling dlt_user_log_write_finish.
* @param log pointer to an object containing information about logging context data
* @param data float32_t parameter written into log message.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_log_write_float32(DltContextData *log, float32_t data);
+DltReturnValue dlt_user_log_write_float32(DltContextData *log, float32_t data);
/**
* Write a double parameter into a DLT log message.
@@ -376,9 +302,9 @@ int dlt_user_log_write_float32(DltContextData *log, float32_t data);
* Finish sending log message by calling dlt_user_log_write_finish.
* @param log pointer to an object containing information about logging context data
* @param data float64_t parameter written into log message.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_log_write_float64(DltContextData *log, double data);
+DltReturnValue dlt_user_log_write_float64(DltContextData *log, double data);
/**
* Write a uint parameter into a DLT log message.
@@ -386,13 +312,13 @@ int dlt_user_log_write_float64(DltContextData *log, double data);
* Finish sending log message by calling dlt_user_log_write_finish.
* @param log pointer to an object containing information about logging context data
* @param data unsigned int parameter written into log message.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_log_write_uint(DltContextData *log, unsigned int data);
-int dlt_user_log_write_uint8(DltContextData *log, uint8_t data);
-int dlt_user_log_write_uint16(DltContextData *log, uint16_t data);
-int dlt_user_log_write_uint32(DltContextData *log, uint32_t data);
-int dlt_user_log_write_uint64(DltContextData *log, uint64_t data);
+DltReturnValue dlt_user_log_write_uint(DltContextData *log, unsigned int data);
+DltReturnValue dlt_user_log_write_uint8(DltContextData *log, uint8_t data);
+DltReturnValue dlt_user_log_write_uint16(DltContextData *log, uint16_t data);
+DltReturnValue dlt_user_log_write_uint32(DltContextData *log, uint32_t data);
+DltReturnValue dlt_user_log_write_uint64(DltContextData *log, uint64_t data);
/**
* Write a uint parameter into a DLT log message. The output will be formatted as given by the parameter type.
@@ -401,12 +327,12 @@ int dlt_user_log_write_uint64(DltContextData *log, uint64_t data);
* @param log pointer to an object containing information about logging context data
* @param data unsigned int parameter written into log message.
* @param type The formatting type of the string output.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_log_write_uint8_formatted(DltContextData *log, uint8_t data, DltFormatType type);
-int dlt_user_log_write_uint16_formatted(DltContextData *log, uint16_t data, DltFormatType type);
-int dlt_user_log_write_uint32_formatted(DltContextData *log, uint32_t data, DltFormatType type);
-int dlt_user_log_write_uint64_formatted(DltContextData *log, uint64_t data, DltFormatType type);
+DltReturnValue dlt_user_log_write_uint8_formatted(DltContextData *log, uint8_t data, DltFormatType type);
+DltReturnValue dlt_user_log_write_uint16_formatted(DltContextData *log, uint16_t data, DltFormatType type);
+DltReturnValue dlt_user_log_write_uint32_formatted(DltContextData *log, uint32_t data, DltFormatType type);
+DltReturnValue dlt_user_log_write_uint64_formatted(DltContextData *log, uint64_t data, DltFormatType type);
/**
* Write a int parameter into a DLT log message.
@@ -414,22 +340,22 @@ int dlt_user_log_write_uint64_formatted(DltContextData *log, uint64_t data, DltF
* Finish sending log message by calling dlt_user_log_write_finish.
* @param log pointer to an object containing information about logging context data
* @param data int parameter written into log message.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_log_write_int(DltContextData *log, int data);
-int dlt_user_log_write_int8(DltContextData *log, int8_t data);
-int dlt_user_log_write_int16(DltContextData *log, int16_t data);
-int dlt_user_log_write_int32(DltContextData *log, int32_t data);
-int dlt_user_log_write_int64(DltContextData *log, int64_t data);
+DltReturnValue dlt_user_log_write_int(DltContextData *log, int data);
+DltReturnValue dlt_user_log_write_int8(DltContextData *log, int8_t data);
+DltReturnValue dlt_user_log_write_int16(DltContextData *log, int16_t data);
+DltReturnValue dlt_user_log_write_int32(DltContextData *log, int32_t data);
+DltReturnValue dlt_user_log_write_int64(DltContextData *log, int64_t data);
/**
* Write a null terminated ASCII string into a DLT log message.
* dlt_user_log_write_start has to be called before adding any attributes to the log message.
* Finish sending log message by calling dlt_user_log_write_finish.
* @param log pointer to an object containing information about logging context data
* @param text pointer to the parameter written into log message containing null termination.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_log_write_string( DltContextData *log, const char *text);
+DltReturnValue dlt_user_log_write_string( DltContextData *log, const char *text);
/**
* Write a constant null terminated ASCII string into a DLT log message.
@@ -438,9 +364,9 @@ int dlt_user_log_write_string( DltContextData *log, const char *text);
* Finish sending log message by calling dlt_user_log_write_finish.
* @param log pointer to an object containing information about logging context data
* @param text pointer to the parameter written into log message containing null termination.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_log_write_constant_string( DltContextData *log, const char *text);
+DltReturnValue dlt_user_log_write_constant_string( DltContextData *log, const char *text);
/**
* Write a null terminated UTF8 string into a DLT log message.
@@ -448,9 +374,9 @@ int dlt_user_log_write_constant_string( DltContextData *log, const char *text);
* Finish sending log message by calling dlt_user_log_write_finish.
* @param log pointer to an object containing information about logging context data
* @param text pointer to the parameter written into log message containing null termination.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_log_write_utf8_string(DltContextData *log, const char *text);
+DltReturnValue dlt_user_log_write_utf8_string(DltContextData *log, const char *text);
/**
* Write a binary memory block into a DLT log message.
@@ -459,9 +385,9 @@ int dlt_user_log_write_utf8_string(DltContextData *log, const char *text);
* @param log pointer to an object containing information about logging context data
* @param data pointer to the parameter written into log message.
* @param length length in bytes of the parameter written into log message.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_log_write_raw(DltContextData *log,void *data,uint16_t length);
+DltReturnValue dlt_user_log_write_raw(DltContextData *log,void *data,uint16_t length);
/**
* Write a binary memory block into a DLT log message.
@@ -471,9 +397,9 @@ int dlt_user_log_write_raw(DltContextData *log,void *data,uint16_t length);
* @param data pointer to the parameter written into log message.
* @param length length in bytes of the parameter written into log message.
* @param type the format information.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_log_write_raw_formatted(DltContextData *log,void *data,uint16_t length,DltFormatType type);
+DltReturnValue dlt_user_log_write_raw_formatted(DltContextData *log,void *data,uint16_t length,DltFormatType type);
/**
* Trace network message
@@ -483,9 +409,9 @@ int dlt_user_log_write_raw_formatted(DltContextData *log,void *data,uint16_t len
* @param header pointer to network message header
* @param payload_len length of network message payload
* @param payload pointer to network message payload
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_trace_network(DltContext *handle, DltNetworkTraceType nw_trace_type, uint16_t header_len, void *header, uint16_t payload_len, void *payload);
+DltReturnValue dlt_user_trace_network(DltContext *handle, DltNetworkTraceType nw_trace_type, uint16_t header_len, void *header, uint16_t payload_len, void *payload);
/**
* Trace network message, truncated if necessary.
@@ -496,9 +422,9 @@ int dlt_user_trace_network(DltContext *handle, DltNetworkTraceType nw_trace_type
* @param payload_len length of network message payload
* @param payload pointer to network message payload
* @param allow_truncate Set to > 0 to allow truncating of the message if it is too large.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_trace_network_truncated(DltContext *handle, DltNetworkTraceType nw_trace_type, uint16_t header_len, void *header, uint16_t payload_len, void *payload, int allow_truncate);
+DltReturnValue dlt_user_trace_network_truncated(DltContext *handle, DltNetworkTraceType nw_trace_type, uint16_t header_len, void *header, uint16_t payload_len, void *payload, int allow_truncate);
/**
* Trace network message in segmented asynchronous mode.
@@ -511,9 +437,9 @@ int dlt_user_trace_network_truncated(DltContext *handle, DltNetworkTraceType nw_
* @param header pointer to network message header
* @param payload_len length of network message payload
* @param payload pointer to network message payload
- * @return 0 on success, -1 on failure
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_trace_network_segmented(DltContext *handle, DltNetworkTraceType nw_trace_type, uint16_t header_len, void *header, uint16_t payload_len, void *payload);
+DltReturnValue dlt_user_trace_network_segmented(DltContext *handle, DltNetworkTraceType nw_trace_type, uint16_t header_len, void *header, uint16_t payload_len, void *payload);
/**************************************************************************************************
* The following API functions define a high level function interface for DLT
@@ -522,47 +448,47 @@ int dlt_user_trace_network_segmented(DltContext *handle, DltNetworkTraceType nw_
/**
* Initialize the user lib communication with daemon.
* This function has to be called first, before using any DLT user lib functions.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_init();
+DltReturnValue dlt_init();
/**
* Initialize the user lib writing only to file.
* This function has to be called first, before using any DLT user lib functions.
* @param name name of an optional log file
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_init_file(const char *name);
+DltReturnValue dlt_init_file(const char *name);
/**
* Terminate the user lib.
* This function has to be called when finishing using the DLT user lib.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_free();
+DltReturnValue dlt_free();
/**
* Check the library version of DLT library.
* @param user_major_version the major version to be compared
* @param user_minor_version the minor version to be compared
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum, DLT_RETURN_ERROR if there is a mismatch
*/
-int dlt_check_library_version(const char * user_major_version, const char * user_minor_version);
+DltReturnValue dlt_check_library_version(const char * user_major_version, const char * user_minor_version);
/**
* Register an application in the daemon.
* @param appid four byte long character array with the application id
* @param description long name of the application
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_register_app(const char *appid, const char * description);
+DltReturnValue dlt_register_app(const char *appid, const char * description);
/**
* Unregister an application in the daemon.
* This function has to be called when finishing using an application.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_unregister_app(void);
+DltReturnValue dlt_unregister_app(void);
/**
* Register a context in the daemon.
@@ -570,9 +496,9 @@ int dlt_unregister_app(void);
* @param handle pointer to an object containing information about one special logging context
* @param contextid four byte long character array with the context id
* @param description long name of the context
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_register_context(DltContext *handle, const char *contextid, const char * description);
+DltReturnValue dlt_register_context(DltContext *handle, const char *contextid, const char * description);
/**
* Register a context in the daemon with pre-defined log level and pre-defined trace status.
@@ -584,17 +510,17 @@ int dlt_register_context(DltContext *handle, const char *contextid, const char *
(DLT_LOG_DEFAULT is not allowed here)
* @param tracestatus This is the trace status to be pre-set for this context
(DLT_TRACE_STATUS_DEFAULT is not allowed here)
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_register_context_ll_ts(DltContext *handle, const char *contextid, const char * description, int loglevel, int tracestatus);
+DltReturnValue dlt_register_context_ll_ts(DltContext *handle, const char *contextid, const char * description, int loglevel, int tracestatus);
/**
* Unregister a context in the DLT daemon.
* This function has to be called when finishing using a context.
* @param handle pointer to an object containing information about one special logging context
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_unregister_context(DltContext *handle);
+DltReturnValue dlt_unregister_context(DltContext *handle);
/**
@@ -608,9 +534,9 @@ int dlt_set_resend_timeout_atexit(uint32_t timeout_in_milliseconds);
* The logging mode is stored persistantly by the daemon.
* @see DltUserLogMode
* @param mode the new logging mode used by the daemon: off, extern, internal, both.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_set_log_mode(DltUserLogMode mode);
+DltReturnValue dlt_set_log_mode(DltUserLogMode mode);
/**
* Get the state of the connected client to the daemon.
@@ -627,80 +553,80 @@ int dlt_get_log_state();
* @param handle pointer to an object containing information about one special logging context
* @param service_id the service id to be waited for
* @param (*dlt_injection_callback) function pointer to callback function
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_register_injection_callback(DltContext *handle, uint32_t service_id,
+DltReturnValue dlt_register_injection_callback(DltContext *handle, uint32_t service_id,
int (*dlt_injection_callback)(uint32_t service_id, void *data, uint32_t length));
/**
* Register callback function called when log level of context was changed
* @param handle pointer to an object containing information about one special logging context
* @param (*dlt_log_level_changed_callback) function pointer to callback function
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_register_log_level_changed_callback(DltContext *handle,
+DltReturnValue dlt_register_log_level_changed_callback(DltContext *handle,
void (*dlt_log_level_changed_callback)(char context_id[DLT_ID_SIZE],uint8_t log_level, uint8_t trace_status));
/**
* Switch to verbose mode
- *
+ * @return Value from DltReturnValue enum
*/
-int dlt_verbose_mode(void);
+DltReturnValue dlt_verbose_mode(void);
/**
* Check the version of dlt library with library version used of the application.
* @param Major version number of application - see dlt_version.h
* @param Minor version number of application - see dlt_version.h
- * @return negative value if there is a mismatch
+ * @return Value from DltReturnValue enum, DLT_RETURN_ERROR if there is a mismatch
*/
-int dlt_user_check_library_version(const char *user_major_version,const char *user_minor_version);
+DltReturnValue dlt_user_check_library_version(const char *user_major_version,const char *user_minor_version);
/**
* Switch to non-verbose mode
*
*/
-int dlt_nonverbose_mode(void);
+DltReturnValue dlt_nonverbose_mode(void);
/**
* Use extended header in non verbose mode.
* Enabled by default.
* @param use_extende_header_for_non_verbose Use extended header for non verbose mode if true
- * @return negative value if no success
+ * @return Value from DltReturnValue enum
*/
-int dlt_use_extended_header_for_non_verbose(int8_t use_extende_header_for_non_verbose);
+DltReturnValue dlt_use_extended_header_for_non_verbose(int8_t use_extende_header_for_non_verbose);
/**
* Send session id configuration.
* Enabled by default.
* @param with_session_id Send session id in each message if enabled
- * @return negative value if no success
+ * @return Value from DltReturnValue enum
*/
-int dlt_with_session_id(int8_t with_session_id);
+DltReturnValue dlt_with_session_id(int8_t with_session_id);
/**
* Send timestamp configuration.
* Enabled by default.
* @param with_timestamp Send timestamp id in each message if enabled
- * @return negative value if no success
+ * @return Value from DltReturnValue enum
*/
-int dlt_with_timestamp(int8_t with_timestamp);
+DltReturnValue dlt_with_timestamp(int8_t with_timestamp);
/**
* Send ecu id configuration.
* Enabled by default.
* @param with_ecu_id Send ecu id in each message if enabled
- * @return negative value if no success
+ * @return Value from DltReturnValue enum
*/
-int dlt_with_ecu_id(int8_t with_ecu_id);
+DltReturnValue dlt_with_ecu_id(int8_t with_ecu_id);
/**
* Set maximum logged log level and trace status of application
*
* @param loglevel This is the log level to be set for the whole application
* @param tracestatus This is the trace status to be set for the whole application
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_set_application_ll_ts_limit(DltLogLevelType loglevel, DltTraceStatusType tracestatus);
+DltReturnValue dlt_set_application_ll_ts_limit(DltLogLevelType loglevel, DltTraceStatusType tracestatus);
/**
@@ -738,24 +664,24 @@ void dlt_env_free_ll_set(dlt_env_ll_set * const ll_set);
/**
* Enable local printing of messages
- *
+ * @return Value from DltReturnValue enum
*/
-int dlt_enable_local_print(void);
+DltReturnValue dlt_enable_local_print(void);
/**
* Disable local printing of messages
- *
+ * @return Value from DltReturnValue enum
*/
-int dlt_disable_local_print(void);
+DltReturnValue dlt_disable_local_print(void);
/**
* Write a null terminated ASCII string into a DLT log message.
* @param handle pointer to an object containing information about one special logging context
* @param loglevel this is the current log level of the log message to be sent
* @param text pointer to the ASCII string written into log message containing null termination.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_log_string(DltContext *handle,DltLogLevelType loglevel, const char *text);
+DltReturnValue dlt_log_string(DltContext *handle,DltLogLevelType loglevel, const char *text);
/**
* Write a null terminated ASCII string and an integer value into a DLT log message.
@@ -763,9 +689,9 @@ int dlt_log_string(DltContext *handle,DltLogLevelType loglevel, const char *text
* @param loglevel this is the current log level of the log message to be sent
* @param text pointer to the ASCII string written into log message containing null termination.
* @param data integer value written into the log message
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_log_string_int(DltContext *handle,DltLogLevelType loglevel, const char *text, int data);
+DltReturnValue dlt_log_string_int(DltContext *handle,DltLogLevelType loglevel, const char *text, int data);
/**
* Write a null terminated ASCII string and an unsigned integer value into a DLT log message.
@@ -773,27 +699,27 @@ int dlt_log_string_int(DltContext *handle,DltLogLevelType loglevel, const char *
* @param loglevel this is the current log level of the log message to be sent
* @param text pointer to the ASCII string written into log message containing null termination.
* @param data unsigned integer value written into the log message
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_log_string_uint(DltContext *handle,DltLogLevelType loglevel, const char *text, unsigned int data);
+DltReturnValue dlt_log_string_uint(DltContext *handle,DltLogLevelType loglevel, const char *text, unsigned int data);
/**
* Write an integer value into a DLT log message.
* @param handle pointer to an object containing information about one special logging context
* @param loglevel this is the current log level of the log message to be sent
* @param data integer value written into the log message
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_log_int(DltContext *handle,DltLogLevelType loglevel, int data);
+DltReturnValue dlt_log_int(DltContext *handle,DltLogLevelType loglevel, int data);
/**
* Write an unsigned integer value into a DLT log message.
* @param handle pointer to an object containing information about one special logging context
* @param loglevel this is the current log level of the log message to be sent
* @param data unsigned integer value written into the log message
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_log_uint(DltContext *handle,DltLogLevelType loglevel, unsigned int data);
+DltReturnValue dlt_log_uint(DltContext *handle,DltLogLevelType loglevel, unsigned int data);
/**
* Write an unsigned integer value into a DLT log message.
@@ -801,23 +727,23 @@ int dlt_log_uint(DltContext *handle,DltLogLevelType loglevel, unsigned int data)
* @param loglevel this is the current log level of the log message to be sent
* @param data pointer to the parameter written into log message.
* @param length length in bytes of the parameter written into log message.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_log_raw(DltContext *handle,DltLogLevelType loglevel, void *data,uint16_t length);
+DltReturnValue dlt_log_raw(DltContext *handle,DltLogLevelType loglevel, void *data,uint16_t length);
/**
* Write marker message to DLT.
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_log_marker();
+DltReturnValue dlt_log_marker();
/**
* Forward a complete DLT message to the DLT daemon
* @param msgdata Message data of DLT message
* @param size Size of DLT message
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_forward_msg(void *msgdata,size_t size);
+DltReturnValue dlt_forward_msg(void *msgdata,size_t size);
/**
* Get the total size and available size of the shared memory buffer between daemon and applications.
@@ -825,9 +751,9 @@ int dlt_forward_msg(void *msgdata,size_t size);
* For example only 50% of the buffer should be used for file transfer.
* @param total_size total size of buffer in bytes
* @param used_size used size of buffer in bytes
- * @return negative value if there was an error
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_check_buffer(int *total_size, int *used_size);
+DltReturnValue dlt_user_check_buffer(int *total_size, int *used_size);
/**
* Try to resend log message in the user buffer. Stops if the dlt_uptime is bigger than
@@ -839,9 +765,9 @@ int dlt_user_atexit_blow_out_user_buffer(void);
/**
* Try to resend log message in the user buffer.
- * @return 0 on success, negative on failure.
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_log_resend_buffer(void);
+DltReturnValue dlt_user_log_resend_buffer(void);
#ifdef DLT_TEST_ENABLE
void dlt_user_test_corrupt_user_header(int enable);