summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt3
-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
-rw-r--r--src/console/dlt-control.c47
-rw-r--r--src/console/dlt-convert.c6
-rw-r--r--src/console/dlt-receive.c7
-rw-r--r--src/daemon/dlt-daemon.c1750
-rw-r--r--src/daemon/dlt-daemon.h26
-rw-r--r--src/daemon/dlt_daemon_client.c28
-rw-r--r--src/daemon/dlt_daemon_common.c636
-rw-r--r--src/daemon/dlt_daemon_common.h64
-rw-r--r--src/daemon/dlt_daemon_serial.c36
-rw-r--r--src/daemon/dlt_daemon_socket.c48
-rw-r--r--src/dbus/dlt-dbus-options.c360
-rw-r--r--src/dbus/dlt-dbus.c176
-rw-r--r--src/dbus/dlt-dbus.h24
-rw-r--r--src/examples/dlt-example-filetransfer.c82
-rw-r--r--src/examples/dlt-example-user-common-api.c68
-rw-r--r--src/examples/dlt-example-user-func.c60
-rw-r--r--src/examples/dlt-example-user.c84
-rw-r--r--src/lib/dlt_client.c609
-rw-r--r--src/lib/dlt_filetransfer.c432
-rw-r--r--src/lib/dlt_user.c2445
-rw-r--r--src/lib/dlt_user_cfg.h8
-rw-r--r--src/shared/dlt_common.c2073
-rw-r--r--src/shared/dlt_common_cfg.h2
-rw-r--r--src/shared/dlt_offline_trace.c266
-rw-r--r--src/shared/dlt_shm.c254
-rw-r--r--src/shared/dlt_user_shared.c20
-rw-r--r--src/shared/dlt_user_shared.h68
-rw-r--r--src/tests/dlt-test-client.c344
-rw-r--r--src/tests/dlt-test-filetransfer.c560
-rw-r--r--src/tests/dlt-test-multi-process-client.c340
-rw-r--r--src/tests/dlt-test-multi-process.c398
-rw-r--r--src/tests/dlt-test-stress-client.c214
-rw-r--r--src/tests/dlt-test-stress-user.c74
-rw-r--r--src/tests/dlt-test-stress.c10
-rw-r--r--src/tests/dlt-test-user.c1212
-rw-r--r--tests/CMakeLists.txt2
-rw-r--r--tests/dlt_test_receiver.c2
-rw-r--r--tests/gtest_dlt_common.cpp2535
-rw-r--r--tests/gtest_dlt_daemon_common.cpp62
-rw-r--r--tests/gtest_dlt_user.cpp2260
48 files changed, 9226 insertions, 9054 deletions
diff --git a/.gitignore b/.gitignore
index f276550..3e03b2d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ include/dlt/dlt_version.h
.cproject
+.settings
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 18eea73..9573a5f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -108,8 +108,11 @@ if(WITH_GPROF)
SET(CMAKE_C_FLAGS "-pg")
endif(WITH_GPROF)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wno-variadic-macros")
+
add_definitions( "-Wall" )
add_definitions( "-Wextra" )
+#add_definitions( "-pedantic" )
IF(${WITH_DOC} STREQUAL "OFF")
SET(PACKAGE_DOC "#")
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);
diff --git a/src/console/dlt-control.c b/src/console/dlt-control.c
index 92f841d..8db6467 100644
--- a/src/console/dlt-control.c
+++ b/src/console/dlt-control.c
@@ -396,7 +396,7 @@ int main(int argc, char* argv[])
}
/* Connect to TCP socket or open serial device */
- if (dlt_client_connect(&dltclient, dltdata.vflag)!=-1)
+ if (dlt_client_connect(&dltclient, dltdata.vflag) != DLT_RETURN_ERROR)
{
/* send injection message */
if(dltdata.mvalue && dltdata.avalue && dltdata.cvalue)
@@ -408,9 +408,8 @@ int main(int argc, char* argv[])
printf("ServiceId: %d\n",dltdata.svalue);
printf("Message: %s\n",dltdata.mvalue);
/* send control message in ascii */
- if (0 != dlt_client_send_inject_msg(&dltclient,dltdata.avalue,dltdata.cvalue,dltdata.svalue,(uint8_t*)dltdata.mvalue,strlen(dltdata.mvalue))) {
- fprintf (stderr, "ERROR: Could not send inject message\n");
- }
+ if (dlt_client_send_inject_msg(&dltclient,dltdata.avalue,dltdata.cvalue,dltdata.svalue,(uint8_t*)dltdata.mvalue,strlen(dltdata.mvalue)) != DLT_RETURN_OK)
+ fprintf (stderr, "ERROR: Could not send inject message\n");
}
else if(dltdata.xvalue && dltdata.avalue && dltdata.cvalue)
{
@@ -425,9 +424,8 @@ int main(int argc, char* argv[])
hexAsciiToBinary(dltdata.xvalue,buffer,&size);
printf("Size: %d\n",size);
/* send control message in hex */
- if (0 != dlt_client_send_inject_msg(&dltclient,dltdata.avalue,dltdata.cvalue,dltdata.svalue,buffer,size)) {
- fprintf (stderr, "ERROR: Could not send inject message\n");
- }
+ if (dlt_client_send_inject_msg(&dltclient,dltdata.avalue,dltdata.cvalue,dltdata.svalue,buffer,size) != DLT_RETURN_OK)
+ fprintf (stderr, "ERROR: Could not send inject message\n");
}
else if(dltdata.lvalue!=-1 && dltdata.avalue && dltdata.cvalue)
{
@@ -437,9 +435,8 @@ int main(int argc, char* argv[])
printf("ConId: %s\n",dltdata.cvalue);
printf("Loglevel: %d\n",dltdata.lvalue);
/* send control message*/
- if (0 != dlt_client_send_log_level(&dltclient,dltdata.avalue,dltdata.cvalue,dltdata.lvalue)) {
- fprintf (stderr, "ERROR: Could not send log level\n");
- }
+ if (dlt_client_send_log_level(&dltclient,dltdata.avalue,dltdata.cvalue,dltdata.lvalue) != DLT_RETURN_OK)
+ fprintf (stderr, "ERROR: Could not send log level\n");
}
else if(dltdata.rvalue!=-1 && dltdata.avalue && dltdata.cvalue)
{
@@ -449,9 +446,8 @@ int main(int argc, char* argv[])
printf("ConId: %s\n",dltdata.cvalue);
printf("TraceStatus: %d\n",dltdata.rvalue);
/* send control message in*/
- if (0 != dlt_client_send_trace_status(&dltclient,dltdata.avalue,dltdata.cvalue,dltdata.rvalue)) {
- fprintf (stderr, "ERROR: Could not send trace status\n");
- }
+ if (dlt_client_send_trace_status(&dltclient,dltdata.avalue,dltdata.cvalue,dltdata.rvalue) != DLT_RETURN_OK)
+ fprintf (stderr, "ERROR: Could not send trace status\n");
}
else if(dltdata.dvalue!=-1)
{
@@ -459,9 +455,8 @@ int main(int argc, char* argv[])
printf("Set default log level:\n");
printf("Loglevel: %d\n",dltdata.dvalue);
/* send control message in*/
- if (0 != dlt_client_send_default_log_level(&dltclient,dltdata.dvalue)) {
- fprintf (stderr, "ERROR: Could not send default log level\n");
- }
+ if (dlt_client_send_default_log_level(&dltclient,dltdata.dvalue) != DLT_RETURN_OK)
+ fprintf (stderr, "ERROR: Could not send default log level\n");
}
else if(dltdata.rvalue!=-1)
{
@@ -469,9 +464,8 @@ int main(int argc, char* argv[])
printf("Set default trace status:\n");
printf("TraceStatus: %d\n",dltdata.rvalue);
/* send control message in*/
- if (0 != dlt_client_send_default_trace_status(&dltclient,dltdata.rvalue)) {
- fprintf (stderr, "ERROR: Could not send default trace status\n");
- }
+ if (dlt_client_send_default_trace_status(&dltclient,dltdata.rvalue) != DLT_RETURN_OK)
+ fprintf (stderr, "ERROR: Could not send default trace status\n");
}
else if(dltdata.ivalue!=-1)
{
@@ -479,27 +473,24 @@ int main(int argc, char* argv[])
printf("Set timing pakets:\n");
printf("Timing packets: %d\n",dltdata.ivalue);
/* send control message in*/
- if (0 != dlt_client_send_timing_pakets(&dltclient,dltdata.ivalue)) {
- fprintf (stderr, "ERROR: Could not send timing packets\n");
- }
+ if (dlt_client_send_timing_pakets(&dltclient,dltdata.ivalue) != DLT_RETURN_OK)
+ fprintf (stderr, "ERROR: Could not send timing packets\n");
}
else if(dltdata.oflag!=-1)
{
/* default trace status */
printf("Store config\n");
/* send control message in*/
- if (0 != dlt_client_send_store_config(&dltclient)) {
- fprintf (stderr, "ERROR: Could not send store config\n");
- }
+ if (dlt_client_send_store_config(&dltclient) != DLT_RETURN_OK)
+ fprintf (stderr, "ERROR: Could not send store config\n");
}
else if(dltdata.gflag!=-1)
{
/* reset to factory default */
printf("Reset to factory default\n");
/* send control message in*/
- if (0 != dlt_client_send_reset_to_factory_default(&dltclient)) {
- fprintf (stderr, "ERROR: Could send reset to factory default\n");
- }
+ if (dlt_client_send_reset_to_factory_default(&dltclient) != DLT_RETURN_OK)
+ fprintf (stderr, "ERROR: Could send reset to factory default\n");
}
/* Dlt Client Main Loop */
diff --git a/src/console/dlt-convert.c b/src/console/dlt-convert.c
index 55143f6..8c5c901 100644
--- a/src/console/dlt-convert.c
+++ b/src/console/dlt-convert.c
@@ -249,7 +249,7 @@ int main(int argc, char* argv[])
/* first parse filter file if filter parameter is used */
if (fvalue)
{
- if (dlt_filter_load(&filter,fvalue,vflag)<0)
+ if (dlt_filter_load(&filter,fvalue,vflag) < DLT_RETURN_OK)
{
dlt_file_free(&file,vflag);
return -1;
@@ -273,9 +273,9 @@ int main(int argc, char* argv[])
for (index = optind; index < argc; index++)
{
/* load, analyse data file and create index list */
- if (dlt_file_open(&file,argv[index],vflag)>=0)
+ if (dlt_file_open(&file,argv[index],vflag) >= DLT_RETURN_OK)
{
- while (dlt_file_read(&file,vflag)>=0)
+ while (dlt_file_read(&file,vflag) >= DLT_RETURN_OK)
{
}
}
diff --git a/src/console/dlt-receive.c b/src/console/dlt-receive.c
index 99268e5..ef3ba20 100644
--- a/src/console/dlt-receive.c
+++ b/src/console/dlt-receive.c
@@ -479,7 +479,7 @@ int main(int argc, char* argv[])
if (dltdata.fvalue)
{
- if (dlt_filter_load(&(dltdata.filter),dltdata.fvalue,dltdata.vflag)<0)
+ if (dlt_filter_load(&(dltdata.filter),dltdata.fvalue,dltdata.vflag) < DLT_RETURN_OK)
{
dlt_file_free(&(dltdata.file),dltdata.vflag);
return -1;
@@ -521,7 +521,7 @@ int main(int argc, char* argv[])
}
/* Connect to TCP socket or open serial device */
- if (dlt_client_connect(&dltclient, dltdata.vflag)!=-1)
+ if (dlt_client_connect(&dltclient, dltdata.vflag) != DLT_RETURN_ERROR)
{
/* Dlt Client Main Loop */
@@ -571,7 +571,8 @@ int dlt_receive_message_callback(DltMessage *message, void *data)
dlt_set_storageheader(message->storageheader,dltdata->ecuid);
}
- if ((dltdata->fvalue==0) || (dltdata->fvalue && dlt_message_filter_check(message,&(dltdata->filter),dltdata->vflag)==1))
+ if ((dltdata->fvalue==0) ||
+ (dltdata->fvalue && dlt_message_filter_check(message,&(dltdata->filter),dltdata->vflag) == DLT_RETURN_TRUE))
{
/* if no filter set or filter is matching display message */
if (dltdata->xflag)
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index 02e3f05..c733e91 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -85,8 +85,8 @@ static uint32_t watchdog_trigger_interval; // watchdog trigger interval in [s]
*/
void usage()
{
- char version[DLT_DAEMON_TEXTBUFSIZE];
- dlt_get_version(version,DLT_DAEMON_TEXTBUFSIZE);
+ char version[DLT_DAEMON_TEXTBUFSIZE];
+ dlt_get_version(version,DLT_DAEMON_TEXTBUFSIZE);
//printf("DLT logging daemon %s %s\n", _DLT_PACKAGE_VERSION, _DLT_PACKAGE_VERSION_STATE);
//printf("Compile options: %s %s %s %s",_DLT_SYSTEMD_ENABLE, _DLT_SYSTEMD_WATCHDOG_ENABLE, _DLT_TEST_ENABLE, _DLT_SHM_ENABLE);
@@ -111,13 +111,13 @@ void usage()
*/
int option_handling(DltDaemonLocal *daemon_local,int argc, char* argv[])
{
- int c;
+ int c;
- if (daemon_local==0)
- {
- fprintf (stderr, "Invalid parameter passed to option_handling()\n");
- return -1;
- }
+ if (daemon_local==0)
+ {
+ fprintf (stderr, "Invalid parameter passed to option_handling()\n");
+ return -1;
+ }
/* Initialize flags */
memset(daemon_local,0,sizeof(DltDaemonLocal));
@@ -182,7 +182,7 @@ int option_handling(DltDaemonLocal *daemon_local,int argc, char* argv[])
}
default:
{
- fprintf (stderr, "Invalid option, this should never occur!\n");
+ fprintf (stderr, "Invalid option, this should never occur!\n");
return -1;
}
} /* switch() */
@@ -200,7 +200,7 @@ int option_handling(DltDaemonLocal *daemon_local,int argc, char* argv[])
*/
int option_file_parser(DltDaemonLocal *daemon_local)
{
- FILE * pFile;
+ FILE * pFile;
int value_length = 1024;
char line[value_length-1];
char token[value_length];
@@ -233,204 +233,204 @@ int option_file_parser(DltDaemonLocal *daemon_local)
else
filename = CONFIGURATION_FILES_DIR "/dlt.conf";
//printf("Load configuration from file: %s\n",filename);
- pFile = fopen (filename,"r");
+ pFile = fopen (filename,"r");
- if (pFile!=NULL)
- {
- while(1)
- {
- /* fetch line from configuration file */
+ if (pFile!=NULL)
+ {
+ while(1)
+ {
+ /* fetch line from configuration file */
if ( fgets (line , value_length - 1 , pFile) != NULL )
- {
- pch = strtok (line," =\r\n");
- token[0]=0;
- value[0]=0;
-
- while (pch != NULL)
- {
- if(strcmp(pch,"#")==0)
- break;
-
- if(token[0]==0)
- {
+ {
+ pch = strtok (line," =\r\n");
+ token[0]=0;
+ value[0]=0;
+
+ while (pch != NULL)
+ {
+ if(strcmp(pch,"#")==0)
+ break;
+
+ if(token[0]==0)
+ {
strncpy(token,pch,sizeof(token) - 1);
token[sizeof(token) - 1]=0;
- }
- else
- {
+ }
+ else
+ {
strncpy(value,pch,sizeof(value) - 1);
value[sizeof(value) - 1]=0;
- break;
- }
-
- pch = strtok (NULL, " =\r\n");
- }
-
- if(token[0] && value[0])
- {
- /* parse arguments here */
- if(strcmp(token,"Verbose")==0)
- {
- daemon_local->flags.vflag = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"PrintASCII")==0)
- {
- daemon_local->flags.aflag = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"PrintHex")==0)
- {
- daemon_local->flags.xflag = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"PrintHeadersOnly")==0)
- {
- daemon_local->flags.sflag = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"SendSerialHeader")==0)
- {
- daemon_local->flags.lflag = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"SendContextRegistration")==0)
- {
- daemon_local->flags.rflag = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"SendMessageTime")==0)
- {
- daemon_local->flags.sendMessageTime = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"RS232SyncSerialHeader")==0)
- {
- daemon_local->flags.mflag = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"TCPSyncSerialHeader")==0)
- {
- daemon_local->flags.nflag = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"RS232DeviceName")==0)
- {
+ break;
+ }
+
+ pch = strtok (NULL, " =\r\n");
+ }
+
+ if(token[0] && value[0])
+ {
+ /* parse arguments here */
+ if(strcmp(token,"Verbose")==0)
+ {
+ daemon_local->flags.vflag = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"PrintASCII")==0)
+ {
+ daemon_local->flags.aflag = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"PrintHex")==0)
+ {
+ daemon_local->flags.xflag = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"PrintHeadersOnly")==0)
+ {
+ daemon_local->flags.sflag = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"SendSerialHeader")==0)
+ {
+ daemon_local->flags.lflag = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"SendContextRegistration")==0)
+ {
+ daemon_local->flags.rflag = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"SendMessageTime")==0)
+ {
+ daemon_local->flags.sendMessageTime = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"RS232SyncSerialHeader")==0)
+ {
+ daemon_local->flags.mflag = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"TCPSyncSerialHeader")==0)
+ {
+ daemon_local->flags.nflag = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"RS232DeviceName")==0)
+ {
strncpy(daemon_local->flags.yvalue,value,NAME_MAX);
daemon_local->flags.yvalue[NAME_MAX]=0;
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"RS232Baudrate")==0)
- {
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"RS232Baudrate")==0)
+ {
strncpy(daemon_local->flags.bvalue,value,NAME_MAX);
daemon_local->flags.bvalue[NAME_MAX]=0;
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"ECUId")==0)
- {
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"ECUId")==0)
+ {
strncpy(daemon_local->flags.evalue,value,NAME_MAX);
daemon_local->flags.evalue[NAME_MAX]=0;
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"PersistanceStoragePath")==0)
- {
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"PersistanceStoragePath")==0)
+ {
strncpy(daemon_local->flags.ivalue,value,NAME_MAX);
daemon_local->flags.ivalue[NAME_MAX]=0;
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"LoggingMode")==0)
- {
- daemon_local->flags.loggingMode = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"LoggingLevel")==0)
- {
- daemon_local->flags.loggingLevel = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"LoggingFilename")==0)
- {
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"LoggingMode")==0)
+ {
+ daemon_local->flags.loggingMode = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"LoggingLevel")==0)
+ {
+ daemon_local->flags.loggingLevel = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"LoggingFilename")==0)
+ {
strncpy(daemon_local->flags.loggingFilename,value,sizeof(daemon_local->flags.loggingFilename) - 1);
daemon_local->flags.loggingFilename[sizeof(daemon_local->flags.loggingFilename) - 1]=0;
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"TimeOutOnSend")==0)
- {
- daemon_local->timeoutOnSend = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"RingbufferMinSize")==0)
- {
- sscanf(value,"%lu",&(daemon_local->RingbufferMinSize));
- }
- else if(strcmp(token,"RingbufferMaxSize")==0)
- {
- sscanf(value,"%lu",&(daemon_local->RingbufferMaxSize));
- }
- else if(strcmp(token,"RingbufferStepSize")==0)
- {
- sscanf(value,"%lu",&(daemon_local->RingbufferStepSize));
- }
- else if(strcmp(token,"SharedMemorySize")==0)
- {
- daemon_local->flags.sharedMemorySize = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"OfflineTraceDirectory")==0)
- {
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"TimeOutOnSend")==0)
+ {
+ daemon_local->timeoutOnSend = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"RingbufferMinSize")==0)
+ {
+ sscanf(value,"%lu",&(daemon_local->RingbufferMinSize));
+ }
+ else if(strcmp(token,"RingbufferMaxSize")==0)
+ {
+ sscanf(value,"%lu",&(daemon_local->RingbufferMaxSize));
+ }
+ else if(strcmp(token,"RingbufferStepSize")==0)
+ {
+ sscanf(value,"%lu",&(daemon_local->RingbufferStepSize));
+ }
+ else if(strcmp(token,"SharedMemorySize")==0)
+ {
+ daemon_local->flags.sharedMemorySize = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"OfflineTraceDirectory")==0)
+ {
strncpy(daemon_local->flags.offlineTraceDirectory,value,sizeof(daemon_local->flags.offlineTraceDirectory) - 1);
daemon_local->flags.offlineTraceDirectory[sizeof(daemon_local->flags.offlineTraceDirectory) - 1]=0;
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"OfflineTraceFileSize")==0)
- {
- daemon_local->flags.offlineTraceFileSize = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"OfflineTraceMaxSize")==0)
- {
- daemon_local->flags.offlineTraceMaxSize = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"SendECUSoftwareVersion")==0)
- {
- daemon_local->flags.sendECUSoftwareVersion = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"PathToECUSoftwareVersion")==0)
- {
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"OfflineTraceFileSize")==0)
+ {
+ daemon_local->flags.offlineTraceFileSize = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"OfflineTraceMaxSize")==0)
+ {
+ daemon_local->flags.offlineTraceMaxSize = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"SendECUSoftwareVersion")==0)
+ {
+ daemon_local->flags.sendECUSoftwareVersion = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"PathToECUSoftwareVersion")==0)
+ {
strncpy(daemon_local->flags.pathToECUSoftwareVersion,value,sizeof(daemon_local->flags.pathToECUSoftwareVersion) - 1);
daemon_local->flags.pathToECUSoftwareVersion[sizeof(daemon_local->flags.pathToECUSoftwareVersion) - 1]=0;
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token,"SendTimezone")==0)
- {
- daemon_local->flags.sendTimezone = atoi(value);
- //printf("Option: %s=%s\n",token,value);
- }
- else if(strcmp(token, "OfflineLogstorageMaxDevices")==0)
- {
- daemon_local->flags.offlineLogstorageMaxDevices = atoi(value);
- }
- else
- {
- fprintf(stderr, "Unknown option: %s=%s\n",token,value);
- }
- }
- }
- else
- {
- break;
- }
- }
- fclose (pFile);
- }
- else
- {
- fprintf(stderr, "Cannot open configuration file: %s\n",filename);
- }
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token,"SendTimezone")==0)
+ {
+ daemon_local->flags.sendTimezone = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
+ else if(strcmp(token, "OfflineLogstorageMaxDevices")==0)
+ {
+ daemon_local->flags.offlineLogstorageMaxDevices = atoi(value);
+ }
+ else
+ {
+ fprintf(stderr, "Unknown option: %s=%s\n",token,value);
+ }
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+ fclose (pFile);
+ }
+ else
+ {
+ fprintf(stderr, "Cannot open configuration file: %s\n",filename);
+ }
- return 0;
+ return 0;
}
/**
@@ -438,28 +438,28 @@ int option_file_parser(DltDaemonLocal *daemon_local)
*/
int main(int argc, char* argv[])
{
- char version[DLT_DAEMON_TEXTBUFSIZE];
+ char version[DLT_DAEMON_TEXTBUFSIZE];
DltDaemonLocal daemon_local;
DltDaemon daemon;
int i,back;
/* Command line option handling */
- if ((back = option_handling(&daemon_local,argc,argv))<0)
- {
- if(back!=-2) {
- fprintf (stderr, "option_handling() failed!\n");
- }
- return -1;
- }
+ if ((back = option_handling(&daemon_local,argc,argv))<0)
+ {
+ if(back!=-2) {
+ fprintf (stderr, "option_handling() failed!\n");
+ }
+ return -1;
+ }
/* Configuration file option handling */
- if ((back = option_file_parser(&daemon_local))<0)
- {
- if(back!=-2) {
- fprintf (stderr, "option_file_parser() failed!\n");
- }
- return -1;
- }
+ if ((back = option_file_parser(&daemon_local))<0)
+ {
+ if(back!=-2) {
+ fprintf (stderr, "option_file_parser() failed!\n");
+ }
+ return -1;
+ }
/* Initialize internal logging facility */
dlt_log_set_filename(daemon_local.flags.loggingFilename);
@@ -472,7 +472,7 @@ int main(int argc, char* argv[])
snprintf(str,DLT_DAEMON_TEXTBUFSIZE,"Starting DLT Daemon; %s\n", version );
dlt_log(LOG_NOTICE, str);
- PRINT_FUNCTION_VERBOSE(daemon_local.flags.vflag);
+ PRINT_FUNCTION_VERBOSE(daemon_local.flags.vflag);
/* Make sure the parent user directory is created */
if (dlt_mkdir_recursive(dltFifoBaseDir) != 0)
@@ -485,7 +485,7 @@ int main(int argc, char* argv[])
/* --- Daemon init phase 1 begin --- */
if (dlt_daemon_local_init_p1(&daemon, &daemon_local, daemon_local.flags.vflag)==-1)
{
- dlt_log(LOG_CRIT,"Initialization of phase 1 failed!\n");
+ dlt_log(LOG_CRIT,"Initialization of phase 1 failed!\n");
return -1;
}
/* --- Daemon init phase 1 end --- */
@@ -493,7 +493,7 @@ int main(int argc, char* argv[])
/* --- Daemon connection init begin */
if (dlt_daemon_local_connection_init(&daemon, &daemon_local, daemon_local.flags.vflag)==-1)
{
- dlt_log(LOG_CRIT,"Initialization of local connections failed!\n");
+ dlt_log(LOG_CRIT,"Initialization of local connections failed!\n");
return -1;
}
/* --- Daemon connection init end */
@@ -501,7 +501,7 @@ int main(int argc, char* argv[])
/* --- Daemon init phase 2 begin --- */
if (dlt_daemon_local_init_p2(&daemon, &daemon_local, daemon_local.flags.vflag)==-1)
{
- dlt_log(LOG_CRIT,"Initialization of phase 2 failed!\n");
+ dlt_log(LOG_CRIT,"Initialization of phase 2 failed!\n");
return -1;
}
/* --- Daemon init phase 2 end --- */
@@ -532,13 +532,13 @@ int main(int argc, char* argv[])
create_timer_fd(&daemon_local, 60, 60, &daemon_local.timer_sixty_s, "ECU version");
}
- // For offline tracing we still can use the same states
- // as for socket sending. Using this trick we see the traces
- // In the offline trace AND in the socket stream.
+ // For offline tracing we still can use the same states
+ // as for socket sending. Using this trick we see the traces
+ // In the offline trace AND in the socket stream.
if(daemon_local.flags.yvalue[0])
- dlt_daemon_change_state(&daemon,DLT_DAEMON_STATE_SEND_DIRECT);
+ dlt_daemon_change_state(&daemon,DLT_DAEMON_STATE_SEND_DIRECT);
else
- dlt_daemon_change_state(&daemon,DLT_DAEMON_STATE_BUFFER);
+ dlt_daemon_change_state(&daemon,DLT_DAEMON_STATE_BUFFER);
dlt_daemon_log_internal(&daemon, &daemon_local, "Daemon launched. Starting to output traces...", daemon_local.flags.vflag);
@@ -568,7 +568,7 @@ int main(int argc, char* argv[])
/* event from TCP server socket, new connection */
if (dlt_daemon_process_client_connect(&daemon, &daemon_local, daemon_local.flags.vflag)==-1)
{
- dlt_log(LOG_ERR,"Connect to dlt client failed!\n");
+ dlt_log(LOG_ERR,"Connect to dlt client failed!\n");
return -1;
}
}
@@ -577,7 +577,7 @@ int main(int argc, char* argv[])
/* event from the FIFO happened */
if (dlt_daemon_process_user_messages(&daemon, &daemon_local, daemon_local.flags.vflag)==-1)
{
- dlt_log(LOG_WARNING,"Processing of messages from user connection failed!\n");
+ dlt_log(LOG_WARNING,"Processing of messages from user connection failed!\n");
return -1;
}
}
@@ -586,7 +586,7 @@ int main(int argc, char* argv[])
/* event from serial connection to client received */
if (dlt_daemon_process_client_messages_serial(&daemon, &daemon_local, daemon_local.flags.vflag)==-1)
{
- dlt_log(LOG_WARNING,"Processing of messages from serial connection failed!\n");
+ dlt_log(LOG_WARNING,"Processing of messages from serial connection failed!\n");
return -1;
}
}
@@ -622,14 +622,14 @@ int main(int argc, char* argv[])
}
if(daemon.state == DLT_DAEMON_STATE_SEND_BUFFER || daemon.state == DLT_DAEMON_STATE_BUFFER_FULL)
{
- if (dlt_daemon_send_ringbuffer_to_client(&daemon, &daemon_local, daemon_local.flags.vflag))
- {
- dlt_log(LOG_DEBUG,"Can't send contents of ringbuffer to clients\n");
- }
+ if (dlt_daemon_send_ringbuffer_to_client(&daemon, &daemon_local, daemon_local.flags.vflag))
+ {
+ dlt_log(LOG_DEBUG,"Can't send contents of ringbuffer to clients\n");
+ }
}
if (daemon.timingpackets && daemon.state == DLT_DAEMON_STATE_SEND_DIRECT)
{
- dlt_daemon_control_message_time(DLT_DAEMON_SEND_TO_ALL, &daemon, &daemon_local, daemon_local.flags.vflag);
+ dlt_daemon_control_message_time(DLT_DAEMON_SEND_TO_ALL, &daemon, &daemon_local, daemon_local.flags.vflag);
}
dlt_log(LOG_DEBUG, "Timer timingpacket\n");
@@ -645,13 +645,13 @@ int main(int argc, char* argv[])
// Activity received on timer_wd, but unable to read the fd:
// let's go on sending notification
}
- if(daemon_local.flags.sendECUSoftwareVersion > 0)
- dlt_daemon_control_get_software_version(DLT_DAEMON_SEND_TO_ALL, &daemon,&daemon_local, daemon_local.flags.vflag);
+ if(daemon_local.flags.sendECUSoftwareVersion > 0)
+ dlt_daemon_control_get_software_version(DLT_DAEMON_SEND_TO_ALL, &daemon,&daemon_local, daemon_local.flags.vflag);
- if(daemon_local.flags.sendTimezone > 0)
- {
- dlt_daemon_control_message_timezone(DLT_DAEMON_SEND_TO_ALL,&daemon,&daemon_local,daemon_local.flags.vflag);
- }
+ if(daemon_local.flags.sendTimezone > 0)
+ {
+ dlt_daemon_control_message_timezone(DLT_DAEMON_SEND_TO_ALL,&daemon,&daemon_local,daemon_local.flags.vflag);
+ }
dlt_log(LOG_DEBUG, "Timer ecuversion\n");
}
@@ -661,8 +661,8 @@ int main(int argc, char* argv[])
daemon_local.receiverSock.fd = i;
if (dlt_daemon_process_client_messages(&daemon, &daemon_local, daemon_local.flags.vflag)==-1)
{
- dlt_log(LOG_WARNING,"Processing of messages from client connection failed!\n");
- return -1;
+ dlt_log(LOG_WARNING,"Processing of messages from client connection failed!\n");
+ return -1;
}
} /* else */
} /* if */
@@ -681,13 +681,13 @@ int main(int argc, char* argv[])
int dlt_daemon_local_init_p1(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
{
- int ret;
+ int ret;
PRINT_FUNCTION_VERBOSE(verbose);
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_local_init_p1()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_local_init_p1()\n");
return -1;
}
@@ -695,17 +695,17 @@ int dlt_daemon_local_init_p1(DltDaemon *daemon, DltDaemonLocal *daemon_local, in
ret = sd_booted();
if(ret == 0){
- dlt_log(LOG_CRIT, "System not booted with systemd!\n");
-// return -1;
+ dlt_log(LOG_CRIT, "System not booted with systemd!\n");
+// return -1;
}
else if(ret < 0)
{
- dlt_log(LOG_CRIT, "sd_booted failed!\n");
- return -1;
+ dlt_log(LOG_CRIT, "sd_booted failed!\n");
+ return -1;
}
else
{
- dlt_log(LOG_INFO, "System booted with systemd\n");
+ dlt_log(LOG_INFO, "System booted with systemd\n");
}
#endif
@@ -736,12 +736,12 @@ int dlt_daemon_local_init_p1(DltDaemon *daemon, DltDaemonLocal *daemon_local, in
}
/* initialise structure to use DLT file */
- if (dlt_file_init(&(daemon_local->file),daemon_local->flags.vflag)==-1)
+ if (dlt_file_init(&(daemon_local->file),daemon_local->flags.vflag) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_ERR,"Could not initialize file structure\n");
- /* Return value ignored, dlt daemon will exit */
- dlt_file_free(&(daemon_local->file),daemon_local->flags.vflag);
- return -1;
+ dlt_log(LOG_ERR,"Could not initialize file structure\n");
+ /* Return value ignored, dlt daemon will exit */
+ dlt_file_free(&(daemon_local->file),daemon_local->flags.vflag);
+ return -1;
}
signal(SIGPIPE,SIG_IGN);
@@ -760,26 +760,26 @@ int dlt_daemon_local_init_p2(DltDaemon *daemon, DltDaemonLocal *daemon_local, in
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_local_init_p2()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_local_init_p2()\n");
return -1;
}
/* Daemon data */
if (dlt_daemon_init(daemon,daemon_local->RingbufferMinSize,daemon_local->RingbufferMaxSize,daemon_local->RingbufferStepSize,daemon_local->flags.ivalue,daemon_local->flags.vflag)==-1)
{
- dlt_log(LOG_ERR,"Could not initialize daemon data\n");
- return -1;
+ dlt_log(LOG_ERR,"Could not initialize daemon data\n");
+ return -1;
}
- /* init offline trace */
- if(((daemon->mode == DLT_USER_MODE_INTERNAL) || (daemon->mode == DLT_USER_MODE_BOTH)) && daemon_local->flags.offlineTraceDirectory[0])
- {
- if (dlt_offline_trace_init(&(daemon_local->offlineTrace),daemon_local->flags.offlineTraceDirectory,daemon_local->flags.offlineTraceFileSize,daemon_local->flags.offlineTraceMaxSize)==-1)
- {
- dlt_log(LOG_ERR,"Could not initialize offline trace\n");
- return -1;
- }
- }
+ /* init offline trace */
+ if(((daemon->mode == DLT_USER_MODE_INTERNAL) || (daemon->mode == DLT_USER_MODE_BOTH)) && daemon_local->flags.offlineTraceDirectory[0])
+ {
+ if (dlt_offline_trace_init(&(daemon_local->offlineTrace),daemon_local->flags.offlineTraceDirectory,daemon_local->flags.offlineTraceFileSize,daemon_local->flags.offlineTraceMaxSize)==-1)
+ {
+ dlt_log(LOG_ERR,"Could not initialize offline trace\n");
+ return -1;
+ }
+ }
/* Init offline logstorage for MAX devices */
if(daemon_local->flags.offlineLogstorageMaxDevices > 0)
@@ -808,60 +808,60 @@ int dlt_daemon_local_init_p2(DltDaemon *daemon, DltDaemonLocal *daemon_local, in
daemon->sendserialheader = daemon_local->flags.lflag;
#ifdef DLT_SHM_ENABLE
- /* init shared memory */
+ /* init shared memory */
if (dlt_shm_init_server(&(daemon_local->dlt_shm),DLT_SHM_KEY,daemon_local->flags.sharedMemorySize)==-1)
{
- dlt_log(LOG_ERR,"Could not initialize shared memory\n");
- return -1;
+ dlt_log(LOG_ERR,"Could not initialize shared memory\n");
+ return -1;
}
#endif
/* prepare main loop */
- if (dlt_message_init(&(daemon_local->msg),daemon_local->flags.vflag)==-1)
+ if (dlt_message_init(&(daemon_local->msg),daemon_local->flags.vflag) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_ERR,"Could not initialize message\n");
- return -1;
+ dlt_log(LOG_ERR,"Could not initialize message\n");
+ return -1;
}
- if (dlt_receiver_init(&(daemon_local->receiver),daemon_local->fp,DLT_DAEMON_RCVBUFSIZE)==-1)
+ if (dlt_receiver_init(&(daemon_local->receiver),daemon_local->fp,DLT_DAEMON_RCVBUFSIZE) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_ERR,"Could not initialize receiver\n");
- return -1;
+ dlt_log(LOG_ERR,"Could not initialize receiver\n");
+ return -1;
}
- if (dlt_receiver_init(&(daemon_local->receiverSock),daemon_local->sock,DLT_DAEMON_RCVBUFSIZESOCK)==-1)
- {
- dlt_log(LOG_ERR,"Could not initialize receiver for socket\n");
- return -1;
+ if (dlt_receiver_init(&(daemon_local->receiverSock),daemon_local->sock,DLT_DAEMON_RCVBUFSIZESOCK) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_ERR,"Could not initialize receiver for socket\n");
+ return -1;
}
if (daemon_local->flags.yvalue[0])
{
- if (dlt_receiver_init(&(daemon_local->receiverSerial),daemon_local->fdserial,DLT_DAEMON_RCVBUFSIZESERIAL)==-1)
+ if (dlt_receiver_init(&(daemon_local->receiverSerial),daemon_local->fdserial,DLT_DAEMON_RCVBUFSIZESERIAL) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_ERR,"Could not initialize receiver for serial connection\n");
- return -1;
+ dlt_log(LOG_ERR,"Could not initialize receiver for serial connection\n");
+ return -1;
}
}
/* configure sending timing packets */
if (daemon_local->flags.sendMessageTime)
{
- daemon->timingpackets = 1;
- }
+ daemon->timingpackets = 1;
+ }
/* Binary semaphore for thread */
if (sem_init(&dlt_daemon_mutex, 0, 1)==-1)
{
- dlt_log(LOG_ERR,"Could not initialize binary semaphore\n");
+ dlt_log(LOG_ERR,"Could not initialize binary semaphore\n");
return -1;
}
/* Get ECU version info from a file. If it fails, use dlt_version as fallback. */
if(dlt_daemon_local_ecu_version_init(daemon, daemon_local, daemon_local->flags.vflag) < 0)
{
- daemon->ECUVersionString = malloc(DLT_DAEMON_TEXTBUFSIZE);
- if(daemon->ECUVersionString==0)
+ daemon->ECUVersionString = malloc(DLT_DAEMON_TEXTBUFSIZE);
+ if(daemon->ECUVersionString==0)
{
- dlt_log(LOG_WARNING,"Could not allocate memory for version string\n");
+ dlt_log(LOG_WARNING,"Could not allocate memory for version string\n");
return -1;
}
dlt_get_version(daemon->ECUVersionString,DLT_DAEMON_TEXTBUFSIZE);
@@ -878,7 +878,7 @@ int dlt_daemon_local_connection_init(DltDaemon *daemon, DltDaemonLocal *daemon_l
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_local_connection_init()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_local_connection_init()\n");
return -1;
}
@@ -949,7 +949,7 @@ int dlt_daemon_local_connection_init(DltDaemon *daemon, DltDaemonLocal *daemon_l
daemon_local->baudrate = dlt_convert_serial_speed(DLT_DAEMON_SERIAL_DEFAULT_BAUDRATE);
}
- if (dlt_setup_serial(daemon_local->fdserial,daemon_local->baudrate)<0)
+ if (dlt_setup_serial(daemon_local->fdserial,daemon_local->baudrate) < DLT_RETURN_OK)
{
close(daemon_local->fdserial);
snprintf(str,DLT_DAEMON_TEXTBUFSIZE,"Failed to configure serial device %s (%s) \n", daemon_local->flags.yvalue, strerror(errno));
@@ -984,74 +984,74 @@ int dlt_daemon_local_connection_init(DltDaemon *daemon, DltDaemonLocal *daemon_l
int dlt_daemon_local_ecu_version_init(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
{
- char *version = NULL;
- FILE *f = NULL;
-
- PRINT_FUNCTION_VERBOSE(verbose);
-
- /* By default, version string is null. */
- daemon->ECUVersionString = NULL;
-
- /* Open the file. Bail out if error occurs */
- f = fopen(daemon_local->flags.pathToECUSoftwareVersion, "r");
- if(f == NULL)
- {
- /* Error level notice, because this might be deliberate choice */
- dlt_log(LOG_NOTICE, "Failed to open ECU Software version file.\n");
- return -1;
- }
-
- /* Get the file size. Bail out if stat fails. */
- int fd = fileno(f);
- struct stat s_buf;
- if(fstat(fd, &s_buf) < 0)
- {
- dlt_log(LOG_WARNING, "Failed to stat ECU Software version file.\n");
- fclose(f);
- return -1;
- }
-
- /* Bail out if file is too large. Use DLT_DAEMON_TEXTBUFSIZE max.
- * Reserve one byte for trailing '\0' */
- off_t size = s_buf.st_size;
- if(size >= DLT_DAEMON_TEXTBUFSIZE)
- {
- dlt_log(LOG_WARNING, "Too large file for ECU version.\n");
- fclose(f);
- return -1;
- }
-
- /* Allocate permanent buffer for version info */
- version = malloc(size + 1);
- if(version==0)
- {
- dlt_log(LOG_WARNING, "Cannot allocate memory for ECU version.\n");
- fclose(f);
- return -1;
- }
- off_t offset = 0;
- while(!feof(f))
- {
- offset += fread(version + offset, 1, size, f);
- if(ferror(f))
- {
- dlt_log(LOG_WARNING, "Failed to read ECU Software version file.\n");
- free(version);
+ char *version = NULL;
+ FILE *f = NULL;
+
+ PRINT_FUNCTION_VERBOSE(verbose);
+
+ /* By default, version string is null. */
+ daemon->ECUVersionString = NULL;
+
+ /* Open the file. Bail out if error occurs */
+ f = fopen(daemon_local->flags.pathToECUSoftwareVersion, "r");
+ if(f == NULL)
+ {
+ /* Error level notice, because this might be deliberate choice */
+ dlt_log(LOG_NOTICE, "Failed to open ECU Software version file.\n");
+ return -1;
+ }
+
+ /* Get the file size. Bail out if stat fails. */
+ int fd = fileno(f);
+ struct stat s_buf;
+ if(fstat(fd, &s_buf) < 0)
+ {
+ dlt_log(LOG_WARNING, "Failed to stat ECU Software version file.\n");
+ fclose(f);
+ return -1;
+ }
+
+ /* Bail out if file is too large. Use DLT_DAEMON_TEXTBUFSIZE max.
+ * Reserve one byte for trailing '\0' */
+ off_t size = s_buf.st_size;
+ if(size >= DLT_DAEMON_TEXTBUFSIZE)
+ {
+ dlt_log(LOG_WARNING, "Too large file for ECU version.\n");
+ fclose(f);
+ return -1;
+ }
+
+ /* Allocate permanent buffer for version info */
+ version = malloc(size + 1);
+ if(version==0)
+ {
+ dlt_log(LOG_WARNING, "Cannot allocate memory for ECU version.\n");
+ fclose(f);
+ return -1;
+ }
+ off_t offset = 0;
+ while(!feof(f))
+ {
+ offset += fread(version + offset, 1, size, f);
+ if(ferror(f))
+ {
+ dlt_log(LOG_WARNING, "Failed to read ECU Software version file.\n");
+ free(version);
fclose(f);
- return -1;
- }
+ return -1;
+ }
if(offset > size)
- {
- dlt_log(LOG_WARNING, "Too long file for ECU Software version info.\n");
- free(version);
- fclose(f);
- return -1;
- }
- }
- version[offset] = '\0';//append null termination at end of version string
- daemon->ECUVersionString = version;
- fclose(f);
- return 0;
+ {
+ dlt_log(LOG_WARNING, "Too long file for ECU Software version info.\n");
+ free(version);
+ fclose(f);
+ return -1;
+ }
+ }
+ version[offset] = '\0';//append null termination at end of version string
+ daemon->ECUVersionString = version;
+ fclose(f);
+ return 0;
}
void dlt_daemon_local_cleanup(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
@@ -1060,22 +1060,22 @@ void dlt_daemon_local_cleanup(DltDaemon *daemon, DltDaemonLocal *daemon_local, i
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_local_cleanup()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_local_cleanup()\n");
return;
}
- /* Ignore result */
+ /* Ignore result */
dlt_receiver_free(&(daemon_local->receiver));
/* Ignore result */
dlt_receiver_free(&(daemon_local->receiverSock));
- /* Ignore result */
+ /* Ignore result */
dlt_message_free(&(daemon_local->msg),daemon_local->flags.vflag);
close(daemon_local->fp);
- /* free shared memory */
- if(daemon_local->flags.offlineTraceDirectory[0])
- dlt_offline_trace_free(&(daemon_local->offlineTrace));
+ /* free shared memory */
+ if(daemon_local->flags.offlineTraceDirectory[0])
+ dlt_offline_trace_free(&(daemon_local->offlineTrace));
#if 0
if (daemon_local->flags.ovalue[0])
{
@@ -1083,15 +1083,15 @@ void dlt_daemon_local_cleanup(DltDaemon *daemon, DltDaemonLocal *daemon_local, i
} /* if */
#endif
- /* Ignore result */
+ /* Ignore result */
dlt_file_free(&(daemon_local->file),daemon_local->flags.vflag);
/* Try to delete existing pipe, ignore result of unlink() */
unlink(daemon_local->flags.daemonFifoName);
#ifdef DLT_SHM_ENABLE
- /* free shared memory */
- dlt_shm_free_server(&(daemon_local->dlt_shm));
+ /* free shared memory */
+ dlt_shm_free_server(&(daemon_local->dlt_shm));
#endif
/* Try to delete lock file, ignore result of unlink() */
@@ -1123,14 +1123,14 @@ void dlt_daemon_signal_handler(int sig)
unlink(tmp);
- /* Terminate program */
+ /* Terminate program */
exit(0);
break;
}
default:
{
dlt_log(LOG_CRIT, "This case should never happen!");
- break;
+ break;
}
} /* switch */
} /* dlt_daemon_signal_handler() */
@@ -1148,7 +1148,7 @@ void dlt_daemon_daemonize(int verbose)
i=fork();
if (i<0)
{
- dlt_log(LOG_CRIT, "Unable to fork(), exiting DLT daemon\n");
+ dlt_log(LOG_CRIT, "Unable to fork(), exiting DLT daemon\n");
exit(-1); /* fork error */
}
@@ -1163,7 +1163,7 @@ void dlt_daemon_daemonize(int verbose)
/* obtain a new process group */
if (setsid()==-1)
{
- dlt_log(LOG_CRIT, "setsid() failed, exiting DLT daemon\n");
+ dlt_log(LOG_CRIT, "setsid() failed, exiting DLT daemon\n");
exit(-1); /* fork error */
}
@@ -1176,12 +1176,12 @@ void dlt_daemon_daemonize(int verbose)
/* Open standard descriptors stdin, stdout, stderr */
i=open("/dev/null",O_RDWR); /* open stdin */
if (-1 < i)
- {
- if(dup(i) < 0)
- dlt_log(LOG_WARNING, "Failed to direct stdout to /dev/null.\n");/* stdout */
- if(dup(i) < 0)
- dlt_log(LOG_WARNING, "Failed to direct stderr to /dev/null.\n"); /* stderr */
- }
+ {
+ if(dup(i) < 0)
+ dlt_log(LOG_WARNING, "Failed to direct stdout to /dev/null.\n");/* stdout */
+ if(dup(i) < 0)
+ dlt_log(LOG_WARNING, "Failed to direct stderr to /dev/null.\n"); /* stderr */
+ }
/* Set umask */
umask(DLT_DAEMON_UMASK);
@@ -1201,12 +1201,12 @@ void dlt_daemon_daemonize(int verbose)
lfp=open(dlt_daemon_lock_file,O_RDWR|O_CREAT,DLT_DAEMON_LOCK_FILE_PERM);
if (lfp<0)
{
- dlt_log(LOG_CRIT, "Can't open lock file, exiting DLT daemon\n");
+ dlt_log(LOG_CRIT, "Can't open lock file, exiting DLT daemon\n");
exit(-1); /* can not open */
}
if (lockf(lfp,F_TLOCK,0)<0)
{
- dlt_log(LOG_CRIT, "Can't lock lock file, exiting DLT daemon\n");
+ dlt_log(LOG_CRIT, "Can't lock lock file, exiting DLT daemon\n");
exit(-1); /* can not lock */
}
/* only first instance continues */
@@ -1272,12 +1272,12 @@ int dlt_daemon_log_internal(DltDaemon *daemon, DltDaemonLocal *daemon_local, cha
uiSize = strlen(str) + 1;
msg.datasize = sizeof(uint32_t) + sizeof(uint16_t) + uiSize;
- msg.databuffer = (uint8_t *) malloc(msg.datasize);
- msg.databuffersize = msg.datasize;
+ msg.databuffer = (uint8_t *) malloc(msg.datasize);
+ msg.databuffersize = msg.datasize;
if (msg.databuffer==0)
{
- dlt_log(LOG_WARNING,"Can't allocate buffer for get log info message\n");
- return -1;
+ dlt_log(LOG_WARNING,"Can't allocate buffer for get log info message\n");
+ return -1;
}
msg.datasize = 0;
@@ -1293,30 +1293,30 @@ int dlt_daemon_log_internal(DltDaemon *daemon, DltDaemonLocal *daemon_local, cha
// Sending data...
{
- /* check if overflow occurred */
- if(daemon->overflow_counter)
- {
- if(dlt_daemon_send_message_overflow(daemon,daemon_local,verbose)==0)
- {
- sprintf(str,"%u messages discarded!\n",daemon->overflow_counter);
- dlt_log(LOG_WARNING, str);
- daemon->overflow_counter=0;
- }
- }
-
- /* look if TCP connection to client is available */
- if((daemon->mode == DLT_USER_MODE_EXTERNAL) || (daemon->mode == DLT_USER_MODE_BOTH))
- {
-
- if((ret = dlt_daemon_client_send(DLT_DAEMON_SEND_TO_ALL,daemon,daemon_local,msg.headerbuffer,sizeof(DltStorageHeader),msg.headerbuffer+sizeof(DltStorageHeader),msg.headersize-sizeof(DltStorageHeader),
- msg.databuffer,msg.datasize,verbose)))
- {
- if(ret == DLT_DAEMON_ERROR_BUFFER_FULL)
- {
- daemon->overflow_counter++;
- }
- }
- }
+ /* check if overflow occurred */
+ if(daemon->overflow_counter)
+ {
+ if(dlt_daemon_send_message_overflow(daemon,daemon_local,verbose)==0)
+ {
+ sprintf(str,"%u messages discarded!\n",daemon->overflow_counter);
+ dlt_log(LOG_WARNING, str);
+ daemon->overflow_counter=0;
+ }
+ }
+
+ /* look if TCP connection to client is available */
+ if((daemon->mode == DLT_USER_MODE_EXTERNAL) || (daemon->mode == DLT_USER_MODE_BOTH))
+ {
+
+ if((ret = dlt_daemon_client_send(DLT_DAEMON_SEND_TO_ALL,daemon,daemon_local,msg.headerbuffer,sizeof(DltStorageHeader),msg.headerbuffer+sizeof(DltStorageHeader),msg.headersize-sizeof(DltStorageHeader),
+ msg.databuffer,msg.datasize,verbose)))
+ {
+ if(ret == DLT_DAEMON_ERROR_BUFFER_FULL)
+ {
+ daemon->overflow_counter++;
+ }
+ }
+ }
}
free(msg.databuffer);
@@ -1335,7 +1335,7 @@ int dlt_daemon_process_client_connect(DltDaemon *daemon, DltDaemonLocal *daemon_
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_client_connect()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_client_connect()\n");
return -1;
}
@@ -1385,13 +1385,13 @@ int dlt_daemon_process_client_connect(DltDaemon *daemon, DltDaemonLocal *daemon_
// send ecu version string
if(daemon_local->flags.sendECUSoftwareVersion > 0)
{
- if(daemon_local->flags.sendECUSoftwareVersion > 0)
- dlt_daemon_control_get_software_version(DLT_DAEMON_SEND_TO_ALL, daemon,daemon_local, daemon_local->flags.vflag);
+ if(daemon_local->flags.sendECUSoftwareVersion > 0)
+ dlt_daemon_control_get_software_version(DLT_DAEMON_SEND_TO_ALL, daemon,daemon_local, daemon_local->flags.vflag);
- if(daemon_local->flags.sendTimezone > 0)
- {
- dlt_daemon_control_message_timezone(DLT_DAEMON_SEND_TO_ALL,daemon,daemon_local,daemon_local->flags.vflag);
- }
+ if(daemon_local->flags.sendTimezone > 0)
+ {
+ dlt_daemon_control_message_timezone(DLT_DAEMON_SEND_TO_ALL,daemon,daemon_local,daemon_local->flags.vflag);
+ }
}
if (daemon_local->client_connections==1)
@@ -1400,16 +1400,16 @@ int dlt_daemon_process_client_connect(DltDaemon *daemon, DltDaemonLocal *daemon_
{
dlt_log(LOG_DEBUG, "Send ring-buffer to client\n");
}
- dlt_daemon_change_state(daemon, DLT_DAEMON_STATE_SEND_BUFFER);
+ dlt_daemon_change_state(daemon, DLT_DAEMON_STATE_SEND_BUFFER);
if (dlt_daemon_send_ringbuffer_to_client(daemon, daemon_local, verbose)==-1)
{
- dlt_log(LOG_WARNING,"Can't send contents of ringbuffer to clients\n");
- return -1;
+ dlt_log(LOG_WARNING,"Can't send contents of ringbuffer to clients\n");
+ return -1;
}
- /* send new log state to all applications */
- daemon->connectionState = 1;
- dlt_daemon_user_send_all_log_state(daemon,verbose);
+ /* send new log state to all applications */
+ daemon->connectionState = 1;
+ dlt_daemon_user_send_all_log_state(daemon,verbose);
}
return 0;
@@ -1423,14 +1423,14 @@ int dlt_daemon_process_client_messages(DltDaemon *daemon, DltDaemonLocal *daemon
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_client_messages()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_client_messages()\n");
return -1;
}
if (dlt_receiver_receive_socket(&(daemon_local->receiverSock))<=0)
{
- dlt_daemon_close_socket(daemon_local->receiverSock.fd, daemon, daemon_local, verbose);
- daemon_local->receiverSock.fd = -1;
+ dlt_daemon_close_socket(daemon_local->receiverSock.fd, daemon, daemon_local, verbose);
+ daemon_local->receiverSock.fd = -1;
/* check: return 0; */
}
@@ -1440,7 +1440,7 @@ int dlt_daemon_process_client_messages(DltDaemon *daemon, DltDaemonLocal *daemon
/* Check for control message */
if ( 0 < daemon_local->receiverSock.fd && DLT_MSG_IS_CONTROL_REQUEST(&(daemon_local->msg)) )
{
- dlt_daemon_client_process_control(daemon_local->receiverSock.fd, daemon,daemon_local, &(daemon_local->msg), daemon_local->flags.vflag);
+ dlt_daemon_client_process_control(daemon_local->receiverSock.fd, daemon,daemon_local, &(daemon_local->msg), daemon_local->flags.vflag);
}
bytes_to_be_removed = daemon_local->msg.headersize+daemon_local->msg.datasize-sizeof(DltStorageHeader);
@@ -1453,19 +1453,19 @@ int dlt_daemon_process_client_messages(DltDaemon *daemon, DltDaemonLocal *daemon
bytes_to_be_removed += daemon_local->msg.resync_offset;
}
- if (dlt_receiver_remove(&(daemon_local->receiverSock),bytes_to_be_removed)==-1)
+ if (dlt_receiver_remove(&(daemon_local->receiverSock),bytes_to_be_removed) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for sockets\n");
- return -1;
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for sockets\n");
+ return -1;
}
} /* while */
- if (dlt_receiver_move_to_begin(&(daemon_local->receiverSock))==-1)
+ if (dlt_receiver_move_to_begin(&(daemon_local->receiverSock)) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_WARNING,"Can't move bytes to beginning of receiver buffer for sockets\n");
- return -1;
+ dlt_log(LOG_WARNING,"Can't move bytes to beginning of receiver buffer for sockets\n");
+ return -1;
}
return 0;
@@ -1479,13 +1479,13 @@ int dlt_daemon_process_client_messages_serial(DltDaemon *daemon, DltDaemonLocal
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_client_messages_serial()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_client_messages_serial()\n");
return -1;
}
if (dlt_receiver_receive_fd(&(daemon_local->receiverSerial))<=0)
{
- dlt_log(LOG_WARNING, "dlt_receiver_receive_fd() for messages from serial interface failed!\n");
+ dlt_log(LOG_WARNING, "dlt_receiver_receive_fd() for messages from serial interface failed!\n");
return -1;
}
@@ -1497,8 +1497,8 @@ int dlt_daemon_process_client_messages_serial(DltDaemon *daemon, DltDaemonLocal
{
if (dlt_daemon_client_process_control(daemon_local->receiverSerial.fd, daemon,daemon_local, &(daemon_local->msg), daemon_local->flags.vflag)==-1)
{
- dlt_log(LOG_WARNING,"Can't process control messages\n");
- return -1;
+ dlt_log(LOG_WARNING,"Can't process control messages\n");
+ return -1;
}
}
@@ -1512,19 +1512,19 @@ int dlt_daemon_process_client_messages_serial(DltDaemon *daemon, DltDaemonLocal
bytes_to_be_removed += daemon_local->msg.resync_offset;
}
- if (dlt_receiver_remove(&(daemon_local->receiverSerial),bytes_to_be_removed)==-1)
- {
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for serial connection\n");
- return -1;
+ if (dlt_receiver_remove(&(daemon_local->receiverSerial),bytes_to_be_removed) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for serial connection\n");
+ return -1;
}
} /* while */
- if (dlt_receiver_move_to_begin(&(daemon_local->receiverSerial))==-1)
- {
- dlt_log(LOG_WARNING,"Can't move bytes to beginning of receiver buffer for serial connection\n");
- return -1;
+ if (dlt_receiver_move_to_begin(&(daemon_local->receiverSerial)) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't move bytes to beginning of receiver buffer for serial connection\n");
+ return -1;
}
return 0;
@@ -1540,7 +1540,7 @@ int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_l
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_messages()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_messages()\n");
return -1;
}
@@ -1595,7 +1595,7 @@ int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_l
{
if (dlt_daemon_process_user_message_overflow(daemon, daemon_local, daemon_local->flags.vflag)==-1)
{
- run_loop=0;
+ run_loop=0;
}
break;
}
@@ -1679,11 +1679,11 @@ int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_l
dlt_log(LOG_ERR,str);
/* remove user header */
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader))==-1)
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user messages\n");
- return -1;
- }
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user messages\n");
+ return -1;
+ }
/* In next invocation of do-while loop, a resync will be triggered if additional data was received */
run_loop=0;
@@ -1696,10 +1696,10 @@ int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_l
while (run_loop);
/* keep not read data in buffer */
- if (dlt_receiver_move_to_begin(&(daemon_local->receiver))==-1)
- {
- dlt_log(LOG_WARNING,"Can't move bytes to beginning of receiver buffer for user messages\n");
- return -1;
+ if (dlt_receiver_move_to_begin(&(daemon_local->receiver)) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't move bytes to beginning of receiver buffer for user messages\n");
+ return -1;
}
return 0;
@@ -1707,20 +1707,20 @@ int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_l
int dlt_daemon_process_user_message_overflow(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
{
- int ret;
+ int ret;
DltUserControlMsgBufferOverflow *userpayload;
PRINT_FUNCTION_VERBOSE(verbose);
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_WARNING, "Invalid function parameters used for function dlt_daemon_process_user_message_overflow()\n");
+ dlt_log(LOG_WARNING, "Invalid function parameters used for function dlt_daemon_process_user_message_overflow()\n");
return -1;
}
if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgBufferOverflow)))
{
- /* Not enough bytes received */
+ /* Not enough bytes received */
return -1;
}
@@ -1729,18 +1729,18 @@ int dlt_daemon_process_user_message_overflow(DltDaemon *daemon, DltDaemonLocal *
/* Store in daemon, that a message buffer overflow has occured */
/* look if TCP connection to client is available or it least message can be put into buffer */
- if((ret=dlt_daemon_control_message_buffer_overflow(DLT_DAEMON_SEND_TO_ALL, daemon,daemon_local, userpayload->overflow_counter,userpayload->apid,verbose)))
- {
- /* there was an error when storing message */
- /* add the counter of lost messages to the daemon counter */
- daemon->overflow_counter+=userpayload->overflow_counter;
- }
+ if((ret=dlt_daemon_control_message_buffer_overflow(DLT_DAEMON_SEND_TO_ALL, daemon,daemon_local, userpayload->overflow_counter,userpayload->apid,verbose)))
+ {
+ /* there was an error when storing message */
+ /* add the counter of lost messages to the daemon counter */
+ daemon->overflow_counter+=userpayload->overflow_counter;
+ }
/* keep not read data in buffer */
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgBufferOverflow))==-1)
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgBufferOverflow)) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message overflow\n");
- return -1;
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message overflow\n");
+ return -1;
}
return 0;
@@ -1748,20 +1748,20 @@ int dlt_daemon_process_user_message_overflow(DltDaemon *daemon, DltDaemonLocal *
int dlt_daemon_send_message_overflow(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
{
- int ret;
+ int ret;
PRINT_FUNCTION_VERBOSE(verbose);
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_overflow()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_overflow()\n");
return DLT_DAEMON_ERROR_UNKNOWN;
}
/* Store in daemon, that a message buffer overflow has occured */
- if((ret=dlt_daemon_control_message_buffer_overflow(DLT_DAEMON_SEND_TO_ALL, daemon,daemon_local,daemon->overflow_counter,"", verbose)))
- {
- return ret;
- }
+ if((ret=dlt_daemon_control_message_buffer_overflow(DLT_DAEMON_SEND_TO_ALL, daemon,daemon_local,daemon->overflow_counter,"", verbose)))
+ {
+ return ret;
+ }
return DLT_DAEMON_ERROR_OK;
}
@@ -1777,13 +1777,13 @@ int dlt_daemon_process_user_message_register_application(DltDaemon *daemon, DltD
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_register_application()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_register_application()\n");
return -1;
}
if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterApplication)))
{
- /* Not enough bytes received */
+ /* Not enough bytes received */
return -1;
}
@@ -1802,26 +1802,26 @@ int dlt_daemon_process_user_message_register_application(DltDaemon *daemon, DltD
application=dlt_daemon_application_add(daemon,usercontext->apid,usercontext->pid,description,verbose);
- /* send log state to new application */
- dlt_daemon_user_send_log_state(daemon,application,verbose);
+ /* send log state to new application */
+ dlt_daemon_user_send_log_state(daemon,application,verbose);
/* keep not read data in buffer */
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterApplication)+len)==-1)
- {
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register application\n");
- return -1;
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterApplication)+len) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register application\n");
+ return -1;
}
if (application==0)
{
- snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Can't add ApplicationID '%.4s' for PID %d\n", usercontext->apid, usercontext->pid);
- dlt_log(LOG_WARNING,str);
+ snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Can't add ApplicationID '%.4s' for PID %d\n", usercontext->apid, usercontext->pid);
+ dlt_log(LOG_WARNING,str);
return -1;
} else
{
snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "ApplicationID '%.4s' registered for PID %d, Description=%s\n", application->apid, application->pid, application->application_description);
dlt_daemon_log_internal(daemon, daemon_local, str, daemon_local->flags.vflag);
- dlt_log(LOG_DEBUG,str);
+ dlt_log(LOG_DEBUG,str);
}
return 0;
@@ -1833,23 +1833,23 @@ int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemo
int8_t loglevel, tracestatus;
DltUserControlMsgRegisterContext *usercontext;
char description[DLT_DAEMON_DESCSIZE+1];
- DltDaemonApplication *application;
- DltDaemonContext *context;
- DltServiceGetLogInfoRequest *req;
+ DltDaemonApplication *application;
+ DltDaemonContext *context;
+ DltServiceGetLogInfoRequest *req;
- DltMessage msg;
+ DltMessage msg;
PRINT_FUNCTION_VERBOSE(verbose);
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_register_context()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_register_context()\n");
return -1;
}
if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)))
{
- /* Not enough bytes received */
+ /* Not enough bytes received */
return -1;
}
@@ -1871,11 +1871,11 @@ int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemo
{
snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "ApplicationID '%.4s' not found while registering ContextID '%.4s' in dlt_daemon_process_user_message_register_context()\n", usercontext->apid, usercontext->ctid);
dlt_log(LOG_WARNING, str);
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len)==-1)
- {
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
- return -1;
- }
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
+ return -1;
+ }
return 0;
}
@@ -1890,10 +1890,10 @@ int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemo
/* Plausibility check */
if ((loglevel<DLT_LOG_DEFAULT) || (loglevel>DLT_LOG_VERBOSE))
{
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len)==-1)
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
- }
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
+ }
return -1;
}
}
@@ -1910,10 +1910,10 @@ int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemo
/* Plausibility check */
if ((tracestatus<DLT_TRACE_STATUS_DEFAULT) || (tracestatus>DLT_TRACE_STATUS_ON))
{
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len)==-1)
- {
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
- }
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
+ }
return -1;
}
}
@@ -1922,19 +1922,19 @@ int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemo
if (context==0)
{
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len)==-1)
- {
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
- }
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
+ }
- snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Can't add ContextID '%.4s' for ApplicationID '%.4s'\n", usercontext->ctid, usercontext->apid);
- dlt_log(LOG_WARNING,str);
+ snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Can't add ContextID '%.4s' for ApplicationID '%.4s'\n", usercontext->ctid, usercontext->apid);
+ dlt_log(LOG_WARNING,str);
return -1;
} else
{
- snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "ContextID '%.4s' registered for ApplicationID '%.4s', Description=%s\n", context->ctid, context->apid, context->context_description);
+ snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "ContextID '%.4s' registered for ApplicationID '%.4s', Description=%s\n", context->ctid, context->apid, context->context_description);
dlt_daemon_log_internal(daemon, daemon_local, str, daemon_local->flags.vflag);
- dlt_log(LOG_DEBUG,str);
+ dlt_log(LOG_DEBUG,str);
}
if(daemon_local->flags.offlineLogstorageMaxDevices)
{
@@ -1949,15 +1949,15 @@ int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemo
if (daemon_local->flags.rflag)
{
/* Prepare request for get log info with one application and one context */
- if (dlt_message_init(&msg, verbose)==-1)
+ if (dlt_message_init(&msg, verbose) == DLT_RETURN_ERROR)
{
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len)==-1)
- {
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
- return -1;
- }
- dlt_log(LOG_WARNING,"Can't initialize message");
- return -1;
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
+ return -1;
+ }
+ dlt_log(LOG_WARNING,"Can't initialize message");
+ return -1;
}
msg.datasize = sizeof(DltServiceGetLogInfoRequest);
@@ -1967,18 +1967,18 @@ int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemo
msg.databuffer=0;
}
if (msg.databuffer == 0){
- msg.databuffer = (uint8_t *) malloc(msg.datasize);
- msg.databuffersize = msg.datasize;
+ msg.databuffer = (uint8_t *) malloc(msg.datasize);
+ msg.databuffersize = msg.datasize;
}
if (msg.databuffer==0)
{
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len)==-1)
- {
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
- return -1;
- }
- dlt_log(LOG_WARNING,"Can't allocate buffer for get log info message\n");
- return -1;
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
+ return -1;
+ }
+ dlt_log(LOG_WARNING,"Can't allocate buffer for get log info message\n");
+ return -1;
}
req = (DltServiceGetLogInfoRequest*) msg.databuffer;
@@ -1999,23 +1999,23 @@ int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemo
/* This call also replaces the default values with the values defined for default */
if (dlt_daemon_user_send_log_level(daemon, context, verbose)==-1)
{
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len)==-1)
- {
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
- return -1;
- }
- snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Can't send current log level as response to user message register context for (%.4s;%.4s)\n", context->apid, context->ctid);
- dlt_log(LOG_WARNING,str);
- return -1;
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
+ return -1;
+ }
+ snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Can't send current log level as response to user message register context for (%.4s;%.4s)\n", context->apid, context->ctid);
+ dlt_log(LOG_WARNING,str);
+ return -1;
}
}
/* keep not read data in buffer */
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len)==-1)
- {
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
- return -1;
- }
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgRegisterContext)+len) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message register context\n");
+ return -1;
+ }
return 0;
}
@@ -2031,13 +2031,13 @@ int dlt_daemon_process_user_message_unregister_application(DltDaemon *daemon, Dl
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_unregister_application()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_unregister_application()\n");
return -1;
}
if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterApplication)))
{
- /* Not enough bytes received */
+ /* Not enough bytes received */
return -1;
}
@@ -2065,14 +2065,14 @@ int dlt_daemon_process_user_message_unregister_application(DltDaemon *daemon, Dl
/* Delete context */
if (dlt_daemon_context_del(daemon, context, verbose)==-1)
{
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterApplication))==-1)
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterApplication)) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message unregister application\n");
- return -1;
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message unregister application\n");
+ return -1;
}
- snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Can't delete ContextID '%.4s' in ApplicationID '%.4s' for user message unregister application\n", context->ctid, context->apid);
- dlt_log(LOG_WARNING,str);
- return -1;
+ snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Can't delete ContextID '%.4s' in ApplicationID '%.4s' for user message unregister application\n", context->ctid, context->apid);
+ dlt_log(LOG_WARNING,str);
+ return -1;
}
}
}
@@ -2080,28 +2080,28 @@ int dlt_daemon_process_user_message_unregister_application(DltDaemon *daemon, Dl
/* Delete this application entry from internal table*/
if (dlt_daemon_application_del(daemon, application, verbose)==-1)
{
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterApplication))==-1)
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterApplication)) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message unregister application\n");
- return -1;
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message unregister application\n");
+ return -1;
}
- snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Can't delete ApplicationID '%.4s' for user message unregister application\n", application->apid);
- dlt_log(LOG_WARNING,str);
- return -1;
+ snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Can't delete ApplicationID '%.4s' for user message unregister application\n", application->apid);
+ dlt_log(LOG_WARNING,str);
+ return -1;
} else
{
- snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Unregistered ApplicationID '%.4s'\n", usercontext->apid);
+ snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Unregistered ApplicationID '%.4s'\n", usercontext->apid);
dlt_daemon_log_internal(daemon, daemon_local, str, daemon_local->flags.vflag);
- dlt_log(LOG_DEBUG,str);
+ dlt_log(LOG_DEBUG,str);
}
}
}
/* keep not read data in buffer */
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterApplication))==-1)
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterApplication)) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message unregister application\n");
- return -1;
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message unregister application\n");
+ return -1;
}
return 0;
@@ -2109,20 +2109,20 @@ int dlt_daemon_process_user_message_unregister_application(DltDaemon *daemon, Dl
int dlt_daemon_process_user_message_unregister_context(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
{
- DltUserControlMsgUnregisterContext *usercontext;
- DltDaemonContext *context;
+ DltUserControlMsgUnregisterContext *usercontext;
+ DltDaemonContext *context;
PRINT_FUNCTION_VERBOSE(verbose);
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_unregister_context()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_unregister_context()\n");
return -1;
}
if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterContext)))
{
- /* Not enough bytes received */
+ /* Not enough bytes received */
return -1;
}
@@ -2134,33 +2134,33 @@ int dlt_daemon_process_user_message_unregister_context(DltDaemon *daemon, DltDae
/* Delete this connection entry from internal table*/
if (dlt_daemon_context_del(daemon, context, verbose)==-1)
{
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterContext))==-1)
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterContext)) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message unregister context\n");
- return -1;
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message unregister context\n");
+ return -1;
}
- snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Can't delete ContextID '%.4s' for ApplicationID '%.4s' for user message unregister context\n", usercontext->ctid, usercontext->apid);
- dlt_log(LOG_WARNING,str);
- return -1;
- } else
- {
- snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Unregistered ContextID '%.4s' for ApplicationID '%.4s'\n", usercontext->ctid, usercontext->apid);
+ snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Can't delete ContextID '%.4s' for ApplicationID '%.4s' for user message unregister context\n", usercontext->ctid, usercontext->apid);
+ dlt_log(LOG_WARNING,str);
+ return -1;
+ } else
+ {
+ snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "Unregistered ContextID '%.4s' for ApplicationID '%.4s'\n", usercontext->ctid, usercontext->apid);
dlt_daemon_log_internal(daemon, daemon_local, str, daemon_local->flags.vflag);
- dlt_log(LOG_DEBUG,str);
- }
+ dlt_log(LOG_DEBUG,str);
+ }
}
/* Create automatic unregister context response for unregistered context */
if (daemon_local->flags.rflag)
{
- dlt_daemon_control_message_unregister_context(DLT_DAEMON_SEND_TO_ALL,daemon,daemon_local,usercontext->apid, usercontext->ctid, "remo",verbose);
+ dlt_daemon_control_message_unregister_context(DLT_DAEMON_SEND_TO_ALL,daemon,daemon_local,usercontext->apid, usercontext->ctid, "remo",verbose);
}
/* keep not read data in buffer */
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterContext))==-1)
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgUnregisterContext)) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message unregister context\n");
- return -1;
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message unregister context\n");
+ return -1;
}
return 0;
@@ -2168,7 +2168,7 @@ int dlt_daemon_process_user_message_unregister_context(DltDaemon *daemon, DltDae
int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
{
- int ret;
+ int ret;
int bytes_to_be_removed;
static char text[DLT_DAEMON_TEXTSIZE];
@@ -2177,15 +2177,15 @@ int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemo
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_log()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_log()\n");
return DLT_DAEMON_ERROR_UNKNOWN;
}
ret=dlt_message_read(&(daemon_local->msg),(unsigned char*)daemon_local->receiver.buf+sizeof(DltUserHeader),daemon_local->receiver.bytesRcvd-sizeof(DltUserHeader),0,verbose);
if(ret!=DLT_MESSAGE_ERROR_OK)
{
- if(ret!=DLT_MESSAGE_ERROR_SIZE)
- {
+ if(ret!=DLT_MESSAGE_ERROR_SIZE)
+ {
/* This is a normal usecase: The daemon reads the data in 10kb chunks.
Thus the last trace in this chunk is probably not complete and will be completed
with the next chunk read. This happens always when the FIFO is filled with more than 10kb before
@@ -2193,105 +2193,105 @@ int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemo
Thus the loglevel of this message is set to DEBUG.
A cleaner solution would be to check more in detail whether the message is not complete (normal usecase)
or the headers are corrupted (error case). */
- dlt_log(LOG_DEBUG,"Can't read messages from receiver\n");
- }
- return DLT_DAEMON_ERROR_UNKNOWN;
- }
-
- /* set overwrite ecu id */
- if (daemon_local->flags.evalue!=0)
- {
- /* Set header extra parameters */
- dlt_set_id(daemon_local->msg.headerextra.ecu, daemon->ecuid );
- //msg.headerextra.seid = 0;
- if (dlt_message_set_extraparameters(&(daemon_local->msg),0)==-1)
- {
+ dlt_log(LOG_DEBUG,"Can't read messages from receiver\n");
+ }
+ return DLT_DAEMON_ERROR_UNKNOWN;
+ }
+
+ /* set overwrite ecu id */
+ if (daemon_local->flags.evalue!=0)
+ {
+ /* Set header extra parameters */
+ dlt_set_id(daemon_local->msg.headerextra.ecu, daemon->ecuid );
+ //msg.headerextra.seid = 0;
+ if (dlt_message_set_extraparameters(&(daemon_local->msg),0) == DLT_RETURN_ERROR)
+ {
dlt_log(LOG_WARNING,"Can't set message extra parameters in process user message log\n");
- return DLT_DAEMON_ERROR_UNKNOWN;
- }
-
- /* Correct value of timestamp, this was changed by dlt_message_set_extraparameters() */
- daemon_local->msg.headerextra.tmsp = DLT_BETOH_32(daemon_local->msg.headerextra.tmsp);
- }
-
- /* prepare storage header */
- if (DLT_IS_HTYP_WEID(daemon_local->msg.standardheader->htyp))
- {
- if (dlt_set_storageheader(daemon_local->msg.storageheader,daemon_local->msg.headerextra.ecu)==-1)
- {
- dlt_log(LOG_WARNING,"Can't set storage header in process user message log\n");
- return DLT_DAEMON_ERROR_UNKNOWN;
- }
- }
- else
- {
- if (dlt_set_storageheader(daemon_local->msg.storageheader,daemon->ecuid)==-1)
- {
- dlt_log(LOG_WARNING,"Can't set storage header in process user message log\n");
- return DLT_DAEMON_ERROR_UNKNOWN;
- }
- }
-
- {
- /* if no filter set or filter is matching display message */
- if (daemon_local->flags.xflag)
- {
- if (dlt_message_print_hex(&(daemon_local->msg),text,DLT_DAEMON_TEXTSIZE,verbose)==-1)
- {
- dlt_log(LOG_WARNING,"dlt_message_print_hex() failed!\n");
- }
- } /* if */
- else if (daemon_local->flags.aflag)
- {
- if (dlt_message_print_ascii(&(daemon_local->msg),text,DLT_DAEMON_TEXTSIZE,verbose)==-1)
- {
- dlt_log(LOG_WARNING,"dlt_message_print_ascii() failed!\n");
- }
- } /* if */
- else if (daemon_local->flags.sflag)
- {
- if (dlt_message_print_header(&(daemon_local->msg),text,DLT_DAEMON_TEXTSIZE,verbose)==-1)
- {
- dlt_log(LOG_WARNING,"dlt_message_print_header() failed!\n");
- }
- /* print message header only */
- } /* if */
-
-
- /* check if overflow occurred */
- if(daemon->overflow_counter)
- {
- if(dlt_daemon_send_message_overflow(daemon,daemon_local,verbose)==0)
- {
- snprintf(str,DLT_DAEMON_TEXTBUFSIZE,"%u messages discarded!\n",daemon->overflow_counter);
- dlt_log(LOG_WARNING, str);
- daemon->overflow_counter=0;
- }
- }
-
- /* send message to client or write to log file */
- if((ret = dlt_daemon_client_send(DLT_DAEMON_SEND_TO_ALL,daemon,daemon_local,daemon_local->msg.headerbuffer,sizeof(DltStorageHeader),daemon_local->msg.headerbuffer+sizeof(DltStorageHeader),daemon_local->msg.headersize-sizeof(DltStorageHeader),
- daemon_local->msg.databuffer,daemon_local->msg.datasize,verbose)))
- {
- if(ret == DLT_DAEMON_ERROR_BUFFER_FULL)
- {
- daemon->overflow_counter++;
- }
- }
-
- }
- /* keep not read data in buffer */
- bytes_to_be_removed = daemon_local->msg.headersize+daemon_local->msg.datasize-sizeof(DltStorageHeader)+sizeof(DltUserHeader);
- if (daemon_local->msg.found_serialheader)
- {
- bytes_to_be_removed += sizeof(dltSerialHeader);
- }
-
- if (dlt_receiver_remove(&(daemon_local->receiver),bytes_to_be_removed)==-1)
- {
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver\n");
- return DLT_DAEMON_ERROR_UNKNOWN;
- }
+ return DLT_DAEMON_ERROR_UNKNOWN;
+ }
+
+ /* Correct value of timestamp, this was changed by dlt_message_set_extraparameters() */
+ daemon_local->msg.headerextra.tmsp = DLT_BETOH_32(daemon_local->msg.headerextra.tmsp);
+ }
+
+ /* prepare storage header */
+ if (DLT_IS_HTYP_WEID(daemon_local->msg.standardheader->htyp))
+ {
+ if (dlt_set_storageheader(daemon_local->msg.storageheader,daemon_local->msg.headerextra.ecu) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't set storage header in process user message log\n");
+ return DLT_DAEMON_ERROR_UNKNOWN;
+ }
+ }
+ else
+ {
+ if (dlt_set_storageheader(daemon_local->msg.storageheader,daemon->ecuid) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't set storage header in process user message log\n");
+ return DLT_DAEMON_ERROR_UNKNOWN;
+ }
+ }
+
+ {
+ /* if no filter set or filter is matching display message */
+ if (daemon_local->flags.xflag)
+ {
+ if (dlt_message_print_hex(&(daemon_local->msg),text,DLT_DAEMON_TEXTSIZE,verbose) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"dlt_message_print_hex() failed!\n");
+ }
+ } /* if */
+ else if (daemon_local->flags.aflag)
+ {
+ if (dlt_message_print_ascii(&(daemon_local->msg),text,DLT_DAEMON_TEXTSIZE,verbose) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"dlt_message_print_ascii() failed!\n");
+ }
+ } /* if */
+ else if (daemon_local->flags.sflag)
+ {
+ if (dlt_message_print_header(&(daemon_local->msg),text,DLT_DAEMON_TEXTSIZE,verbose) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"dlt_message_print_header() failed!\n");
+ }
+ /* print message header only */
+ } /* if */
+
+
+ /* check if overflow occurred */
+ if(daemon->overflow_counter)
+ {
+ if(dlt_daemon_send_message_overflow(daemon,daemon_local,verbose)==0)
+ {
+ snprintf(str,DLT_DAEMON_TEXTBUFSIZE,"%u messages discarded!\n",daemon->overflow_counter);
+ dlt_log(LOG_WARNING, str);
+ daemon->overflow_counter=0;
+ }
+ }
+
+ /* send message to client or write to log file */
+ if((ret = dlt_daemon_client_send(DLT_DAEMON_SEND_TO_ALL,daemon,daemon_local,daemon_local->msg.headerbuffer,sizeof(DltStorageHeader),daemon_local->msg.headerbuffer+sizeof(DltStorageHeader),daemon_local->msg.headersize-sizeof(DltStorageHeader),
+ daemon_local->msg.databuffer,daemon_local->msg.datasize,verbose)))
+ {
+ if(ret == DLT_DAEMON_ERROR_BUFFER_FULL)
+ {
+ daemon->overflow_counter++;
+ }
+ }
+
+ }
+ /* keep not read data in buffer */
+ bytes_to_be_removed = daemon_local->msg.headersize+daemon_local->msg.datasize-sizeof(DltStorageHeader)+sizeof(DltUserHeader);
+ if (daemon_local->msg.found_serialheader)
+ {
+ bytes_to_be_removed += sizeof(dltSerialHeader);
+ }
+
+ if (dlt_receiver_remove(&(daemon_local->receiver),bytes_to_be_removed) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver\n");
+ return DLT_DAEMON_ERROR_UNKNOWN;
+ }
return DLT_DAEMON_ERROR_OK;
}
@@ -2312,172 +2312,172 @@ int dlt_daemon_process_user_message_log_shm(DltDaemon *daemon, DltDaemonLocal *d
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_log()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_log()\n");
return -1;
}
userheader = (DltUserHeader*) (daemon_local->receiver.buf);
- //dlt_shm_status(&(daemon_local->dlt_shm));
- while (1)
- {
- /* log message in SHM */
- if((size = dlt_shm_copy(&(daemon_local->dlt_shm),rcv_buffer,10000)) <= 0)
- break;
- if (dlt_message_read(&(daemon_local->msg),rcv_buffer,size,0,verbose)!=0) {
- break;
- dlt_log(LOG_WARNING,"Can't read messages from shm\n");
- return -1;
- }
- bytes_to_be_removed = daemon_local->msg.headersize+daemon_local->msg.datasize-sizeof(DltStorageHeader)+sizeof(DltUserHeader);
- if (daemon_local->msg.found_serialheader)
- {
- bytes_to_be_removed += sizeof(dltSerialHeader);
- }
-
- /* set overwrite ecu id */
- if (daemon_local->flags.evalue[0])
- {
- /* Set header extra parameters */
- dlt_set_id(daemon_local->msg.headerextra.ecu, daemon->ecuid );
- //msg.headerextra.seid = 0;
- if (dlt_message_set_extraparameters(&(daemon_local->msg),0)==-1)
- {
- dlt_log(LOG_WARNING,"Can't set message extra parameters in process user message log\n");
- dlt_shm_remove(&(daemon_local->dlt_shm));
- return -1;
- }
-
- /* Correct value of timestamp, this was changed by dlt_message_set_extraparameters() */
- daemon_local->msg.headerextra.tmsp = DLT_BETOH_32(daemon_local->msg.headerextra.tmsp);
- }
-
- /* prepare storage header */
- if (DLT_IS_HTYP_WEID(daemon_local->msg.standardheader->htyp))
- {
- if (dlt_set_storageheader(daemon_local->msg.storageheader,daemon_local->msg.headerextra.ecu)==-1)
- {
- dlt_log(LOG_WARNING,"Can't set storage header in process user message log\n");
- dlt_shm_remove(&(daemon_local->dlt_shm));
- return -1;
- }
- }
- else
- {
- if (dlt_set_storageheader(daemon_local->msg.storageheader,daemon->ecuid)==-1)
- {
- dlt_log(LOG_WARNING,"Can't set storage header in process user message log\n");
- dlt_shm_remove(&(daemon_local->dlt_shm));
- return -1;
- }
- }
-
- /* display message */
- if (daemon_local->flags.xflag)
- {
- if (dlt_message_print_hex(&(daemon_local->msg),text,DLT_DAEMON_TEXTSIZE,verbose)==-1)
- {
- dlt_log(LOG_WARNING,"dlt_message_print_hex() failed!\n");
- }
- } /* if */
- else if (daemon_local->flags.aflag)
- {
- if (dlt_message_print_ascii(&(daemon_local->msg),text,DLT_DAEMON_TEXTSIZE,verbose)==-1)
- {
- dlt_log(LOG_WARNING,"dlt_message_print_ascii() failed!\n");
- }
- } /* if */
- else if (daemon_local->flags.sflag)
- {
- if (dlt_message_print_header(&(daemon_local->msg),text,DLT_DAEMON_TEXTSIZE,verbose)==-1)
- {
- dlt_log(LOG_WARNING,"dlt_message_print_header() failed!\n");
- }
- /* print message header only */
- } /* if */
-
- sent=0;
-
- /* write message to offline trace */
- if(((daemon->mode == DLT_USER_MODE_INTERNAL) || (daemon->mode == DLT_USER_MODE_BOTH)) && daemon_local->flags.offlineTraceDirectory[0])
- {
- dlt_offline_trace_write(&(daemon_local->offlineTrace),daemon_local->msg.headerbuffer,daemon_local->msg.headersize,
- daemon_local->msg.databuffer,daemon_local->msg.datasize,0,0);
- sent = 1;
- }
-
- /* look if TCP connection to client is available */
- for (j = 0;((daemon->mode == DLT_USER_MODE_EXTERNAL) || (daemon->mode == DLT_USER_MODE_BOTH)) && (j <= daemon_local->fdmax); j++)
- {
- /* send to everyone! */
- if (FD_ISSET(j, &(daemon_local->master)))
- {
- /* except the listener and ourselves */
- if (daemon_local->flags.yvalue[0])
- {
- third_value = daemon_local->fdserial;
- }
- else
- {
- third_value = daemon_local->sock;
- }
-
- if ((j != daemon_local->fp) && (j != daemon_local->sock) && (j != third_value))
- {
- DLT_DAEMON_SEM_LOCK();
-
- if (daemon_local->flags.lflag)
- {
- send(j,dltSerialHeader,sizeof(dltSerialHeader),0);
- }
-
- send(j,daemon_local->msg.headerbuffer+sizeof(DltStorageHeader),daemon_local->msg.headersize-sizeof(DltStorageHeader),0);
- send(j,daemon_local->msg.databuffer,daemon_local->msg.datasize,0);
-
- DLT_DAEMON_SEM_FREE();
-
- sent=1;
- } /* if */
- else if ((j == daemon_local->fdserial) && (daemon_local->flags.yvalue[0]))
- {
- DLT_DAEMON_SEM_LOCK();
-
- if (daemon_local->flags.lflag)
- {
- ret=write(j,dltSerialHeader,sizeof(dltSerialHeader));
- }
-
- ret=write(j,daemon_local->msg.headerbuffer+sizeof(DltStorageHeader),daemon_local->msg.headersize-sizeof(DltStorageHeader));
- ret=write(j,daemon_local->msg.databuffer,daemon_local->msg.datasize);
-
- DLT_DAEMON_SEM_FREE();
-
- sent=1;
- }
- } /* if */
- } /* for */
-
- /* Message was not sent to client, so store it in client ringbuffer */
- if (sent==1 || (daemon->mode == DLT_USER_MODE_OFF))
- {
- if(userheader->message == DLT_USER_MESSAGE_LOG_SHM) {
- /* dlt message was sent, remove from buffer if log message from shm */
- dlt_shm_remove(&(daemon_local->dlt_shm));
- }
- }
- else
- {
- /* dlt message was not sent, keep in buffer */
- break;
- }
-
- }
+ //dlt_shm_status(&(daemon_local->dlt_shm));
+ while (1)
+ {
+ /* log message in SHM */
+ if((size = dlt_shm_copy(&(daemon_local->dlt_shm),rcv_buffer,10000)) <= 0)
+ break;
+ if (dlt_message_read(&(daemon_local->msg),rcv_buffer,size,0,verbose)!=0) {
+ break;
+ dlt_log(LOG_WARNING,"Can't read messages from shm\n");
+ return -1;
+ }
+ bytes_to_be_removed = daemon_local->msg.headersize+daemon_local->msg.datasize-sizeof(DltStorageHeader)+sizeof(DltUserHeader);
+ if (daemon_local->msg.found_serialheader)
+ {
+ bytes_to_be_removed += sizeof(dltSerialHeader);
+ }
+
+ /* set overwrite ecu id */
+ if (daemon_local->flags.evalue[0])
+ {
+ /* Set header extra parameters */
+ dlt_set_id(daemon_local->msg.headerextra.ecu, daemon->ecuid );
+ //msg.headerextra.seid = 0;
+ if (dlt_message_set_extraparameters(&(daemon_local->msg),0)==-1)
+ {
+ dlt_log(LOG_WARNING,"Can't set message extra parameters in process user message log\n");
+ dlt_shm_remove(&(daemon_local->dlt_shm));
+ return -1;
+ }
+
+ /* Correct value of timestamp, this was changed by dlt_message_set_extraparameters() */
+ daemon_local->msg.headerextra.tmsp = DLT_BETOH_32(daemon_local->msg.headerextra.tmsp);
+ }
+
+ /* prepare storage header */
+ if (DLT_IS_HTYP_WEID(daemon_local->msg.standardheader->htyp))
+ {
+ if (dlt_set_storageheader(daemon_local->msg.storageheader,daemon_local->msg.headerextra.ecu)==-1)
+ {
+ dlt_log(LOG_WARNING,"Can't set storage header in process user message log\n");
+ dlt_shm_remove(&(daemon_local->dlt_shm));
+ return -1;
+ }
+ }
+ else
+ {
+ if (dlt_set_storageheader(daemon_local->msg.storageheader,daemon->ecuid)==-1)
+ {
+ dlt_log(LOG_WARNING,"Can't set storage header in process user message log\n");
+ dlt_shm_remove(&(daemon_local->dlt_shm));
+ return -1;
+ }
+ }
+
+ /* display message */
+ if (daemon_local->flags.xflag)
+ {
+ if (dlt_message_print_hex(&(daemon_local->msg),text,DLT_DAEMON_TEXTSIZE,verbose)==-1)
+ {
+ dlt_log(LOG_WARNING,"dlt_message_print_hex() failed!\n");
+ }
+ } /* if */
+ else if (daemon_local->flags.aflag)
+ {
+ if (dlt_message_print_ascii(&(daemon_local->msg),text,DLT_DAEMON_TEXTSIZE,verbose)==-1)
+ {
+ dlt_log(LOG_WARNING,"dlt_message_print_ascii() failed!\n");
+ }
+ } /* if */
+ else if (daemon_local->flags.sflag)
+ {
+ if (dlt_message_print_header(&(daemon_local->msg),text,DLT_DAEMON_TEXTSIZE,verbose)==-1)
+ {
+ dlt_log(LOG_WARNING,"dlt_message_print_header() failed!\n");
+ }
+ /* print message header only */
+ } /* if */
+
+ sent=0;
+
+ /* write message to offline trace */
+ if(((daemon->mode == DLT_USER_MODE_INTERNAL) || (daemon->mode == DLT_USER_MODE_BOTH)) && daemon_local->flags.offlineTraceDirectory[0])
+ {
+ dlt_offline_trace_write(&(daemon_local->offlineTrace),daemon_local->msg.headerbuffer,daemon_local->msg.headersize,
+ daemon_local->msg.databuffer,daemon_local->msg.datasize,0,0);
+ sent = 1;
+ }
+
+ /* look if TCP connection to client is available */
+ for (j = 0;((daemon->mode == DLT_USER_MODE_EXTERNAL) || (daemon->mode == DLT_USER_MODE_BOTH)) && (j <= daemon_local->fdmax); j++)
+ {
+ /* send to everyone! */
+ if (FD_ISSET(j, &(daemon_local->master)))
+ {
+ /* except the listener and ourselves */
+ if (daemon_local->flags.yvalue[0])
+ {
+ third_value = daemon_local->fdserial;
+ }
+ else
+ {
+ third_value = daemon_local->sock;
+ }
+
+ if ((j != daemon_local->fp) && (j != daemon_local->sock) && (j != third_value))
+ {
+ DLT_DAEMON_SEM_LOCK();
+
+ if (daemon_local->flags.lflag)
+ {
+ send(j,dltSerialHeader,sizeof(dltSerialHeader),0);
+ }
+
+ send(j,daemon_local->msg.headerbuffer+sizeof(DltStorageHeader),daemon_local->msg.headersize-sizeof(DltStorageHeader),0);
+ send(j,daemon_local->msg.databuffer,daemon_local->msg.datasize,0);
+
+ DLT_DAEMON_SEM_FREE();
+
+ sent=1;
+ } /* if */
+ else if ((j == daemon_local->fdserial) && (daemon_local->flags.yvalue[0]))
+ {
+ DLT_DAEMON_SEM_LOCK();
+
+ if (daemon_local->flags.lflag)
+ {
+ ret=write(j,dltSerialHeader,sizeof(dltSerialHeader));
+ }
+
+ ret=write(j,daemon_local->msg.headerbuffer+sizeof(DltStorageHeader),daemon_local->msg.headersize-sizeof(DltStorageHeader));
+ ret=write(j,daemon_local->msg.databuffer,daemon_local->msg.datasize);
+
+ DLT_DAEMON_SEM_FREE();
+
+ sent=1;
+ }
+ } /* if */
+ } /* for */
+
+ /* Message was not sent to client, so store it in client ringbuffer */
+ if (sent==1 || (daemon->mode == DLT_USER_MODE_OFF))
+ {
+ if(userheader->message == DLT_USER_MESSAGE_LOG_SHM) {
+ /* dlt message was sent, remove from buffer if log message from shm */
+ dlt_shm_remove(&(daemon_local->dlt_shm));
+ }
+ }
+ else
+ {
+ /* dlt message was not sent, keep in buffer */
+ break;
+ }
+
+ }
/* keep not read data in buffer */
if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader))==-1)
{
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message overflow\n");
- return -1;
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message overflow\n");
+ return -1;
}
return 0;
@@ -2496,13 +2496,13 @@ int dlt_daemon_process_user_message_set_app_ll_ts(DltDaemon *daemon, DltDaemonLo
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_set_app_ll_ts()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_set_app_ll_ts()\n");
return -1;
}
if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgAppLogLevelTraceStatus )))
{
- /* Not enough bytes receeived */
+ /* Not enough bytes receeived */
return -1;
}
@@ -2544,46 +2544,46 @@ int dlt_daemon_process_user_message_set_app_ll_ts(DltDaemon *daemon, DltDaemonLo
}
/* keep not read data in buffer */
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgAppLogLevelTraceStatus))==-1)
- {
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver\n");
- return -1;
- }
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgAppLogLevelTraceStatus)) == DLT_RETURN_ERROR)
+ {
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver\n");
+ return -1;
+ }
return 0;
}
int dlt_daemon_process_user_message_log_mode(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
{
- DltUserControlMsgLogMode *logmode;
+ DltUserControlMsgLogMode *logmode;
PRINT_FUNCTION_VERBOSE(verbose);
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_log_mode()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_log_mode()\n");
return -1;
}
if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgLogMode)))
{
- /* Not enough bytes received */
+ /* Not enough bytes received */
return -1;
}
logmode = (DltUserControlMsgLogMode*) (daemon_local->receiver.buf+sizeof(DltUserHeader));
- /* set the new log mode */
- daemon->mode = logmode->log_mode;
+ /* set the new log mode */
+ daemon->mode = logmode->log_mode;
- /* write configuration persistantly */
- dlt_daemon_configuration_save(daemon, daemon->runtime_configuration, verbose);
+ /* write configuration persistantly */
+ dlt_daemon_configuration_save(daemon, daemon->runtime_configuration, verbose);
/* keep not read data in buffer */
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgLogMode))==-1)
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgLogMode)) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message log mode\n");
- return -1;
+ dlt_log(LOG_WARNING,"Can't remove bytes from receiver for user message log mode\n");
+ return -1;
}
return 0;
@@ -2595,13 +2595,13 @@ int dlt_daemon_process_user_message_marker(DltDaemon *daemon, DltDaemonLocal *da
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_marker()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_process_user_message_marker()\n");
return -1;
}
if (daemon_local->receiver.bytesRcvd < (int32_t)(sizeof(DltUserHeader)))
{
- /* Not enough bytes received */
+ /* Not enough bytes received */
return -1;
}
@@ -2609,10 +2609,10 @@ int dlt_daemon_process_user_message_marker(DltDaemon *daemon, DltDaemonLocal *da
dlt_daemon_control_message_marker(DLT_DAEMON_SEND_TO_ALL,daemon,daemon_local,verbose);
/* keep not read data in buffer */
- if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgLogMode))==-1)
+ if (dlt_receiver_remove(&(daemon_local->receiver),sizeof(DltUserHeader)+sizeof(DltUserControlMsgLogMode)) == DLT_RETURN_ERROR)
{
- dlt_log(LOG_ERR,"Can't remove bytes from receiver for user message log mode\n");
- return -1;
+ dlt_log(LOG_ERR,"Can't remove bytes from receiver for user message log mode\n");
+ return -1;
}
return 0;
@@ -2620,7 +2620,7 @@ int dlt_daemon_process_user_message_marker(DltDaemon *daemon, DltDaemonLocal *da
int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
{
- int ret;
+ int ret;
static uint8_t data[DLT_DAEMON_RCVBUFSIZE];
int length;
#ifdef DLT_SYSTEMD_WATCHDOG_ENABLE
@@ -2631,14 +2631,14 @@ int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daem
if ((daemon==0) || (daemon_local==0))
{
- dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_send_ringbuffer_to_client()\n");
+ dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_send_ringbuffer_to_client()\n");
return DLT_DAEMON_ERROR_UNKNOWN;
}
if(dlt_buffer_get_message_count(&(daemon->client_ringbuffer)) <= 0)
{
- dlt_daemon_change_state(daemon, DLT_DAEMON_STATE_SEND_DIRECT);
- return DLT_DAEMON_ERROR_OK;
+ dlt_daemon_change_state(daemon, DLT_DAEMON_STATE_SEND_DIRECT);
+ return DLT_DAEMON_ERROR_OK;
}
#ifdef DLT_SYSTEMD_WATCHDOG_ENABLE
@@ -2661,18 +2661,18 @@ int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daem
}
#endif
- if((ret = dlt_daemon_client_send(DLT_DAEMON_SEND_FORCE,daemon,daemon_local,0,0,data,length,0,0,verbose)))
- {
- return ret;
- }
- dlt_buffer_remove(&(daemon->client_ringbuffer));
- if(daemon->state != DLT_DAEMON_STATE_SEND_BUFFER)
- dlt_daemon_change_state(daemon,DLT_DAEMON_STATE_SEND_BUFFER);
+ if((ret = dlt_daemon_client_send(DLT_DAEMON_SEND_FORCE,daemon,daemon_local,0,0,data,length,0,0,verbose)))
+ {
+ return ret;
+ }
+ dlt_buffer_remove(&(daemon->client_ringbuffer));
+ if(daemon->state != DLT_DAEMON_STATE_SEND_BUFFER)
+ dlt_daemon_change_state(daemon,DLT_DAEMON_STATE_SEND_BUFFER);
if(dlt_buffer_get_message_count(&(daemon->client_ringbuffer)) <= 0)
{
- dlt_daemon_change_state(daemon,DLT_DAEMON_STATE_SEND_DIRECT);
- return DLT_DAEMON_ERROR_OK;
+ dlt_daemon_change_state(daemon,DLT_DAEMON_STATE_SEND_DIRECT);
+ return DLT_DAEMON_ERROR_OK;
}
}
@@ -2747,37 +2747,37 @@ int create_timer_fd(DltDaemonLocal *daemon_local, int period_sec, int starts_in,
/* Close connection function */
int dlt_daemon_close_socket(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
{
- dlt_daemon_socket_close(sock);
+ dlt_daemon_socket_close(sock);
- FD_CLR(sock, &(daemon_local->master));
+ FD_CLR(sock, &(daemon_local->master));
- if (daemon_local->client_connections)
- {
- daemon_local->client_connections--;
- }
+ if (daemon_local->client_connections)
+ {
+ daemon_local->client_connections--;
+ }
- if(daemon_local->client_connections==0)
- {
- /* send new log state to all applications */
- daemon->connectionState = 0;
- dlt_daemon_user_send_all_log_state(daemon,verbose);
+ if(daemon_local->client_connections==0)
+ {
+ /* send new log state to all applications */
+ daemon->connectionState = 0;
+ dlt_daemon_user_send_all_log_state(daemon,verbose);
- // For offline tracing we still can use the same states
- // as for socket sending. Using this trick we see the traces
- // In the offline trace AND in the socket stream.
+ // For offline tracing we still can use the same states
+ // as for socket sending. Using this trick we see the traces
+ // In the offline trace AND in the socket stream.
if(daemon_local->flags.yvalue[0] == 0)
- dlt_daemon_change_state(daemon,DLT_DAEMON_STATE_BUFFER);
- }
+ dlt_daemon_change_state(daemon,DLT_DAEMON_STATE_BUFFER);
+ }
- if (daemon_local->flags.vflag)
- {
- snprintf(str,DLT_DAEMON_TEXTBUFSIZE, "Connection to client lost, #connections: %d\n",daemon_local->client_connections);
- dlt_log(LOG_INFO, str);
- }
+ if (daemon_local->flags.vflag)
+ {
+ snprintf(str,DLT_DAEMON_TEXTBUFSIZE, "Connection to client lost, #connections: %d\n",daemon_local->client_connections);
+ dlt_log(LOG_INFO, str);
+ }
- dlt_daemon_control_message_connection_info(DLT_DAEMON_SEND_TO_ALL,daemon,daemon_local,DLT_CONNECTION_STATUS_DISCONNECTED,"",verbose);
+ dlt_daemon_control_message_connection_info(DLT_DAEMON_SEND_TO_ALL,daemon,daemon_local,DLT_CONNECTION_STATUS_DISCONNECTED,"",verbose);
- return 0;
+ return 0;
}
/**
diff --git a/src/daemon/dlt-daemon.h b/src/daemon/dlt-daemon.h
index 8edeead..25431d8 100644
--- a/src/daemon/dlt-daemon.h
+++ b/src/daemon/dlt-daemon.h
@@ -100,13 +100,13 @@ typedef struct
char yvalue[NAME_MAX + 1]; /**< (String: Devicename) Additional support for serial device */
char ivalue[NAME_MAX + 1]; /**< (String: Directory) Directory where to store the persistant configuration (Default: /tmp) */
char cvalue[NAME_MAX + 1]; /**< (String: Directory) Filename of DLT configuration file (Default: /etc/dlt.conf) */
- int sharedMemorySize; /**< (int) Size of shared memory (Default: 100000) */
- int sendMessageTime; /**< (Boolean) Send periodic Message Time if client is connected (Default: 0) */
+ int sharedMemorySize; /**< (int) Size of shared memory (Default: 100000) */
+ int sendMessageTime; /**< (Boolean) Send periodic Message Time if client is connected (Default: 0) */
char offlineTraceDirectory[256]; /**< (String: Directory) Store DLT messages to local directory (Default: /etc/dlt.conf) */
- int offlineTraceFileSize; /**< (int) Maximum size in bytes of one trace file (Default: 1000000) */
- int offlineTraceMaxSize; /**< (int) Maximum size of all trace files (Default: 4000000) */
- int loggingMode; /**< (int) The logging console for internal logging of dlt-daemon (Default: 0) */
- int loggingLevel; /**< (int) The logging level for internal logging of dlt-daemon (Default: 6) */
+ int offlineTraceFileSize; /**< (int) Maximum size in bytes of one trace file (Default: 1000000) */
+ int offlineTraceMaxSize; /**< (int) Maximum size of all trace files (Default: 4000000) */
+ int loggingMode; /**< (int) The logging console for internal logging of dlt-daemon (Default: 0) */
+ int loggingLevel; /**< (int) The logging level for internal logging of dlt-daemon (Default: 6) */
char loggingFilename[256]; /**< (String: Filename) The logging filename if internal logging mode is log to file (Default: /tmp/log) */
int sendECUSoftwareVersion; /**< (Boolean) Send ECU software version perdiodically */
char pathToECUSoftwareVersion[256]; /**< (String: Filename) The file from which to read the ECU version from. */
@@ -138,7 +138,7 @@ typedef struct
int client_connections; /**< counter for nr. of client connections */
size_t baudrate; /**< Baudrate of serial connection */
#ifdef DLT_SHM_ENABLE
- DltShm dlt_shm; /**< Shared memory handling */
+ DltShm dlt_shm; /**< Shared memory handling */
#endif
DltOfflineTrace offlineTrace; /**< Offline trace handling */
#if defined(DLT_SYSTEMD_WATCHDOG_ENABLE)
@@ -166,11 +166,11 @@ typedef struct
typedef DltDaemonTimingPacketThreadData DltDaemonECUVersionThreadData;
-#define DLT_DAEMON_ERROR_OK 0
-#define DLT_DAEMON_ERROR_UNKNOWN -1
-#define DLT_DAEMON_ERROR_BUFFER_FULL -2
-#define DLT_DAEMON_ERROR_SEND_FAILED -3
-#define DLT_DAEMON_ERROR_WRITE_FAILED -4
+#define DLT_DAEMON_ERROR_OK 0
+#define DLT_DAEMON_ERROR_UNKNOWN -1
+#define DLT_DAEMON_ERROR_BUFFER_FULL -2
+#define DLT_DAEMON_ERROR_SEND_FAILED -3
+#define DLT_DAEMON_ERROR_WRITE_FAILED -4
/* Function prototypes */
void dlt_daemon_local_cleanup(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
@@ -205,7 +205,7 @@ int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daem
void dlt_daemon_timingpacket_thread(void *ptr);
void dlt_daemon_ecu_version_thread(void *ptr);
#if defined(DLT_SYSTEMD_WATCHDOG_ENABLE)
- void dlt_daemon_systemd_watchdog_thread(void *ptr);
+ void dlt_daemon_systemd_watchdog_thread(void *ptr);
#endif
int create_timer_fd(DltDaemonLocal *daemon_local, int period_sec, int starts_in, int* fd, const char* timer_name);
diff --git a/src/daemon/dlt_daemon_client.c b/src/daemon/dlt_daemon_client.c
index b792e73..e6135e3 100644
--- a/src/daemon/dlt_daemon_client.c
+++ b/src/daemon/dlt_daemon_client.c
@@ -196,7 +196,7 @@ int dlt_daemon_client_send(int sock,DltDaemon *daemon,DltDaemonLocal *daemon_loc
DLT_DAEMON_SEM_LOCK();
/* Store message in history buffer */
- if (dlt_buffer_push3(&(daemon->client_ringbuffer),data1,size1,data2,size2,0, 0)<0)
+ if (dlt_buffer_push3(&(daemon->client_ringbuffer),data1,size1,data2,size2,0, 0) < DLT_RETURN_OK)
{
DLT_DAEMON_SEM_FREE();
dlt_log(LOG_DEBUG,"dlt_daemon_client_send: Buffer is full! Message discarded.\n");
@@ -225,7 +225,7 @@ int dlt_daemon_client_send_control_message( int sock, DltDaemon *daemon, DltDaem
/* prepare storage header */
msg->storageheader = (DltStorageHeader*)msg->headerbuffer;
- if (dlt_set_storageheader(msg->storageheader,daemon->ecuid)==-1)
+ if (dlt_set_storageheader(msg->storageheader,daemon->ecuid) == DLT_RETURN_ERROR)
{
return DLT_DAEMON_ERROR_UNKNOWN;
}
@@ -470,7 +470,7 @@ void dlt_daemon_control_get_software_version(int sock, DltDaemon *daemon, DltDae
}
/* initialise new message */
- if (dlt_message_init(&msg,0)==-1)
+ if (dlt_message_init(&msg,0) == DLT_RETURN_ERROR)
{
dlt_daemon_control_service_response(sock, daemon,daemon_local, DLT_SERVICE_ID_GET_SOFTWARE_VERSION, DLT_SERVICE_RESPONSE_ERROR, verbose);
return;
@@ -521,7 +521,7 @@ void dlt_daemon_control_get_default_log_level(int sock, DltDaemon *daemon, DltDa
}
/* initialise new message */
- if (dlt_message_init(&msg,0)==-1)
+ if (dlt_message_init(&msg,0) == DLT_RETURN_ERROR)
{
dlt_daemon_control_service_response(sock, daemon,daemon_local, DLT_SERVICE_ID_GET_DEFAULT_LOG_LEVEL, DLT_SERVICE_RESPONSE_ERROR, verbose);
return;
@@ -590,7 +590,7 @@ void dlt_daemon_control_get_log_info(int sock, DltDaemon *daemon, DltDaemonLocal
req = (DltServiceGetLogInfoRequest*) (msg->databuffer);
/* initialise new message */
- if (dlt_message_init(&resp,0)==-1)
+ if (dlt_message_init(&resp,0) == DLT_RETURN_ERROR)
{
dlt_daemon_control_service_response(sock, daemon,daemon_local, DLT_SERVICE_ID_GET_LOG_INFO, DLT_SERVICE_RESPONSE_ERROR, verbose);
return;
@@ -951,7 +951,7 @@ int dlt_daemon_control_message_buffer_overflow(int sock, DltDaemon *daemon, DltD
}
/* initialise new message */
- if (dlt_message_init(&msg,0)==-1)
+ if (dlt_message_init(&msg,0) == DLT_RETURN_ERROR)
{
dlt_daemon_control_service_response(sock, daemon,daemon_local, DLT_SERVICE_ID_MESSAGE_BUFFER_OVERFLOW, DLT_SERVICE_RESPONSE_ERROR, verbose);
return DLT_DAEMON_ERROR_UNKNOWN;
@@ -1005,7 +1005,7 @@ void dlt_daemon_control_service_response( int sock, DltDaemon *daemon, DltDaemon
}
/* initialise new message */
- if (dlt_message_init(&msg,0)==-1)
+ if (dlt_message_init(&msg,0) == DLT_RETURN_ERROR)
{
return;
}
@@ -1050,7 +1050,7 @@ int dlt_daemon_control_message_unregister_context(int sock, DltDaemon *daemon, D
}
/* initialise new message */
- if (dlt_message_init(&msg,0)==-1)
+ if (dlt_message_init(&msg,0) == DLT_RETURN_ERROR)
{
return -1;
}
@@ -1104,7 +1104,7 @@ int dlt_daemon_control_message_connection_info(int sock, DltDaemon *daemon, DltD
}
/* initialise new message */
- if (dlt_message_init(&msg,0)==-1)
+ if (dlt_message_init(&msg,0) == DLT_RETURN_ERROR)
{
return -1;
}
@@ -1157,7 +1157,7 @@ int dlt_daemon_control_message_timezone(int sock, DltDaemon *daemon, DltDaemonLo
}
/* initialise new message */
- if (dlt_message_init(&msg,0)==-1)
+ if (dlt_message_init(&msg,0) == DLT_RETURN_ERROR)
{
return -1;
}
@@ -1216,7 +1216,7 @@ int dlt_daemon_control_message_marker(int sock, DltDaemon *daemon, DltDaemonLoca
}
/* initialise new message */
- if (dlt_message_init(&msg,0)==-1)
+ if (dlt_message_init(&msg,0) == DLT_RETURN_ERROR)
{
return -1;
}
@@ -1321,7 +1321,7 @@ void dlt_daemon_control_callsw_cinjection(int sock, DltDaemon *daemon, DltDaemon
}
/* Send user message to handle, specified in context */
- if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_INJECTION)==-1)
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_INJECTION) < DLT_RETURN_OK)
{
dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
return;
@@ -1353,7 +1353,7 @@ void dlt_daemon_control_callsw_cinjection(int sock, DltDaemon *daemon, DltDaemon
dlt_user_log_out3(context->user_handle, &(userheader), sizeof(DltUserHeader),
&(usercontext), sizeof(DltUserControlMsgInjection),
userbuffer, data_length_inject);
- if (ret != DLT_RETURN_OK)
+ if (ret < DLT_RETURN_OK)
{
if (ret == DLT_RETURN_PIPE_ERROR)
{
@@ -1577,7 +1577,7 @@ void dlt_daemon_control_message_time(int sock, DltDaemon *daemon, DltDaemonLocal
}
/* initialise new message */
- if (dlt_message_init(&msg,0)==-1)
+ if (dlt_message_init(&msg,0) == DLT_RETURN_ERROR)
{
return;
}
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c
index af97b16..5353830 100644
--- a/src/daemon/dlt_daemon_common.c
+++ b/src/daemon/dlt_daemon_common.c
@@ -94,6 +94,9 @@ sem_t dlt_daemon_mutex;
static int dlt_daemon_cmp_apid(const void *m1, const void *m2)
{
+ if(m1 == NULL || m2 == NULL)
+ return -1;
+
DltDaemonApplication *mi1 = (DltDaemonApplication *) m1;
DltDaemonApplication *mi2 = (DltDaemonApplication *) m2;
@@ -102,6 +105,8 @@ static int dlt_daemon_cmp_apid(const void *m1, const void *m2)
static int dlt_daemon_cmp_apid_ctid(const void *m1, const void *m2)
{
+ if(m1 == NULL || m2 == NULL)
+ return -1;
int ret, cmp;
DltDaemonContext *mi1 = (DltDaemonContext *) m1;
@@ -124,21 +129,19 @@ static int dlt_daemon_cmp_apid_ctid(const void *m1, const void *m2)
return ret;
}
-int dlt_daemon_init(DltDaemon *daemon,unsigned long RingbufferMinSize,unsigned long RingbufferMaxSize,unsigned long RingbufferStepSize,const char *runtime_directory, int verbose)
+int dlt_daemon_init(DltDaemon *daemon, unsigned long RingbufferMinSize, unsigned long RingbufferMaxSize, unsigned long RingbufferStepSize, const char *runtime_directory, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (daemon==0)
- {
+ if (daemon == NULL || runtime_directory == NULL)
return -1;
- }
int append_length = 0;
daemon->num_contexts = 0;
- daemon->contexts = 0;
+ daemon->contexts = NULL;
daemon->num_applications = 0;
- daemon->applications = 0;
+ daemon->applications = NULL;
daemon->default_log_level = DLT_DAEMON_INITIAL_LOG_LEVEL ;
daemon->default_trace_status = DLT_DAEMON_INITIAL_TRACE_STATUS ;
@@ -163,7 +166,7 @@ int dlt_daemon_init(DltDaemon *daemon,unsigned long RingbufferMinSize,unsigned l
}
else
{
- strncpy(daemon->runtime_application_cfg,DLT_RUNTIME_DEFAULT_DIRECTORY,append_length);
+ strncpy(daemon->runtime_application_cfg,DLT_RUNTIME_DEFAULT_DIRECTORY,append_length);
daemon->runtime_application_cfg[append_length]=0;
}
strcat(daemon->runtime_application_cfg,DLT_RUNTIME_APPLICATION_CFG); /* strcat uncritical here, because max length already checked */
@@ -176,7 +179,7 @@ int dlt_daemon_init(DltDaemon *daemon,unsigned long RingbufferMinSize,unsigned l
}
else
{
- strncpy(daemon->runtime_context_cfg,DLT_RUNTIME_DEFAULT_DIRECTORY,append_length);
+ strncpy(daemon->runtime_context_cfg,DLT_RUNTIME_DEFAULT_DIRECTORY,append_length);
daemon->runtime_context_cfg[append_length]=0;
}
strcat(daemon->runtime_context_cfg,DLT_RUNTIME_CONTEXT_CFG); /* strcat uncritical here, because max length already checked */
@@ -189,7 +192,7 @@ int dlt_daemon_init(DltDaemon *daemon,unsigned long RingbufferMinSize,unsigned l
}
else
{
- strncpy(daemon->runtime_configuration,DLT_RUNTIME_DEFAULT_DIRECTORY,append_length);
+ strncpy(daemon->runtime_configuration,DLT_RUNTIME_DEFAULT_DIRECTORY,append_length);
daemon->runtime_configuration[append_length]=0;
}
strcat(daemon->runtime_configuration,DLT_RUNTIME_CONFIGURATION); /* strcat uncritical here, because max length already checked */
@@ -212,114 +215,104 @@ int dlt_daemon_init(DltDaemon *daemon,unsigned long RingbufferMinSize,unsigned l
/* initialize ring buffer for client connection */
snprintf(str,DLT_DAEMON_COMMON_TEXTBUFSIZE,"Ringbuffer configuration: %lu/%lu/%lu\n", RingbufferMinSize,RingbufferMaxSize,RingbufferStepSize );
dlt_log(LOG_INFO, str);
- if (dlt_buffer_init_dynamic(&(daemon->client_ringbuffer), RingbufferMinSize,RingbufferMaxSize,RingbufferStepSize)==-1)
+ if (dlt_buffer_init_dynamic(&(daemon->client_ringbuffer), RingbufferMinSize,RingbufferMaxSize,RingbufferStepSize) == DLT_RETURN_ERROR)
{
- return -1;
+ return -1;
}
daemon->storage_handle = NULL;
return 0;
}
-int dlt_daemon_free(DltDaemon *daemon,int verbose)
+int dlt_daemon_free(DltDaemon *daemon, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (daemon==0)
- {
+ if (daemon == NULL)
return -1;
- }
/* Free contexts */
if (dlt_daemon_contexts_clear(daemon, verbose)==-1)
- {
- return -1;
- }
+ return -1;
/* Free applications */
if (dlt_daemon_applications_clear(daemon, verbose)==-1)
- {
- return -1;
- }
+ return -1;
- /* free ringbuffer */
- dlt_buffer_free_dynamic(&(daemon->client_ringbuffer));
+ /* free ringbuffer */
+ dlt_buffer_free_dynamic(&(daemon->client_ringbuffer));
return 0;
}
-int dlt_daemon_applications_invalidate_fd(DltDaemon *daemon,int fd,int verbose)
+int dlt_daemon_applications_invalidate_fd(DltDaemon *daemon, int fd, int verbose)
{
int i;
PRINT_FUNCTION_VERBOSE(verbose);
- if (daemon==0)
- {
+ if (daemon == NULL)
return -1;
- }
for (i=0; i<daemon->num_applications; i++)
{
if (daemon->applications[i].user_handle==fd)
{
- daemon->applications[i].user_handle = DLT_FD_INIT;
+ daemon->applications[i].user_handle = DLT_FD_INIT;
}
}
return 0;
}
-int dlt_daemon_applications_clear(DltDaemon *daemon,int verbose)
+int dlt_daemon_applications_clear(DltDaemon *daemon, int verbose)
{
int i;
PRINT_FUNCTION_VERBOSE(verbose);
- if (daemon==0)
- {
+ if (daemon == NULL)
return -1;
- }
for (i=0; i<daemon->num_applications; i++)
{
- if (daemon->applications[i].application_description!=0)
+ if (daemon->applications[i].application_description != NULL)
{
free(daemon->applications[i].application_description);
- daemon->applications[i].application_description = 0;
+ daemon->applications[i].application_description = NULL;
}
}
- if (daemon->applications)
+ if (daemon->applications != NULL)
{
free(daemon->applications);
}
- daemon->applications = 0;
+ daemon->applications = NULL;
daemon->num_applications = 0;
return 0;
}
-DltDaemonApplication* dlt_daemon_application_add(DltDaemon *daemon,char *apid,pid_t pid,char *description, int verbose)
+DltDaemonApplication* dlt_daemon_application_add(DltDaemon *daemon, char *apid, pid_t pid, char *description, int verbose)
{
DltDaemonApplication *application;
- DltDaemonApplication *old;
+ DltDaemonApplication *old;
int new_application;
int dlt_user_handle;
- char filename[DLT_DAEMON_COMMON_TEXTBUFSIZE];
+ char filename[DLT_DAEMON_COMMON_TEXTBUFSIZE];
- if ((daemon==0) || (apid==0) || (apid[0]=='\0'))
+ if ((daemon == NULL) || (apid == NULL) || (apid[0]=='\0'))
{
- return (DltDaemonApplication*) 0;
+ return (DltDaemonApplication*) NULL;
}
- if (daemon->applications == 0)
+ if (daemon->applications == NULL)
{
daemon->applications = (DltDaemonApplication*) malloc(sizeof(DltDaemonApplication)*DLT_DAEMON_APPL_ALLOC_SIZE);
- if (daemon->applications==0)
+ if (daemon->applications == NULL)
{
- return (DltDaemonApplication*) 0;
+ return (DltDaemonApplication*) NULL;
}
}
@@ -327,7 +320,7 @@ DltDaemonApplication* dlt_daemon_application_add(DltDaemon *daemon,char *apid,pi
/* Check if application [apid] is already available */
application = dlt_daemon_application_find(daemon, apid, verbose);
- if (application==0)
+ if (application == NULL)
{
daemon->num_applications += 1;
@@ -339,12 +332,12 @@ DltDaemonApplication* dlt_daemon_application_add(DltDaemon *daemon,char *apid,pi
old = daemon->applications;
daemon->applications = (DltDaemonApplication*) malloc(sizeof(DltDaemonApplication)*
((daemon->num_applications/DLT_DAEMON_APPL_ALLOC_SIZE)+1)*DLT_DAEMON_APPL_ALLOC_SIZE);
- if (daemon->applications==0)
- {
- daemon->applications = old;
- daemon->num_applications -= 1;
- return (DltDaemonApplication*) 0;
- }
+ if (daemon->applications == NULL)
+ {
+ daemon->applications = old;
+ daemon->num_applications -= 1;
+ return (DltDaemonApplication*) NULL;
+ }
memcpy(daemon->applications,old,sizeof(DltDaemonApplication)*daemon->num_applications);
free(old);
}
@@ -354,7 +347,7 @@ DltDaemonApplication* dlt_daemon_application_add(DltDaemon *daemon,char *apid,pi
dlt_set_id(application->apid,apid);
application->pid = 0;
- application->application_description = 0;
+ application->application_description = NULL;
application->num_contexts = 0;
application->user_handle = DLT_FD_INIT;
@@ -362,8 +355,8 @@ DltDaemonApplication* dlt_daemon_application_add(DltDaemon *daemon,char *apid,pi
} else if (pid != application->pid) {
- snprintf(str,DLT_DAEMON_COMMON_TEXTBUFSIZE, "Duplicate registration of ApplicationID: '%.4s'; registering from PID %d, existing from PID %d\n",apid, pid, application->pid);
- dlt_log(LOG_WARNING, str);
+ snprintf(str,DLT_DAEMON_COMMON_TEXTBUFSIZE, "Duplicate registration of ApplicationID: '%.4s'; registering from PID %d, existing from PID %d\n",apid, pid, application->pid);
+ dlt_log(LOG_WARNING, str);
}
@@ -371,10 +364,10 @@ DltDaemonApplication* dlt_daemon_application_add(DltDaemon *daemon,char *apid,pi
if (application->application_description)
{
free(application->application_description);
- application->application_description=0;
+ application->application_description = NULL;
}
- if (description)
+ if (description != NULL)
{
application->application_description = malloc(strlen(description)+1);
if (application->application_description)
@@ -386,7 +379,7 @@ DltDaemonApplication* dlt_daemon_application_add(DltDaemon *daemon,char *apid,pi
if( application->user_handle != DLT_FD_INIT )
{
- if( application->pid != pid )
+ if( application->pid != pid )
{
if ( close(application->user_handle) < 0 )
{
@@ -400,7 +393,7 @@ DltDaemonApplication* dlt_daemon_application_add(DltDaemon *daemon,char *apid,pi
}
/* open user pipe only if it is not yet opened */
- if (application->user_handle==DLT_FD_INIT && pid!=0)
+ if (application->user_handle == DLT_FD_INIT && pid != 0)
{
snprintf(filename,DLT_DAEMON_COMMON_TEXTBUFSIZE,"%s/dltpipes/dlt%d",dltFifoBaseDir,pid);
@@ -438,25 +431,25 @@ int dlt_daemon_application_del(DltDaemon *daemon, DltDaemonApplication *applicat
PRINT_FUNCTION_VERBOSE(verbose);
- if ((daemon==0) || (application==0))
+ if ((daemon == NULL) || (application == NULL))
{
return -1;
}
- if (daemon->num_applications>0)
+ if (daemon->num_applications > 0)
{
/* Check if user handle is open; if yes, close it */
if (application->user_handle >= DLT_FD_MINIMUM)
{
close(application->user_handle);
- application->user_handle=DLT_FD_INIT;
+ application->user_handle = DLT_FD_INIT;
}
/* Free description of application to be deleted */
if (application->application_description)
{
free(application->application_description);
- application->application_description = 0;
+ application->application_description = NULL;
}
pos = application-(daemon->applications);
@@ -465,7 +458,7 @@ int dlt_daemon_application_del(DltDaemon *daemon, DltDaemonApplication *applicat
memmove(&(daemon->applications[pos]),&(daemon->applications[pos+1]), sizeof(DltDaemonApplication)*((daemon->num_applications-1)-pos));
/* Clear last application */
- memset(&(daemon->applications[daemon->num_applications-1]),0,sizeof(DltDaemonApplication));
+ memset(&(daemon->applications[daemon->num_applications-1]), 0, sizeof(DltDaemonApplication));
daemon->num_applications--;
@@ -474,29 +467,29 @@ int dlt_daemon_application_del(DltDaemon *daemon, DltDaemonApplication *applicat
return 0;
}
-DltDaemonApplication* dlt_daemon_application_find(DltDaemon *daemon,char *apid,int verbose)
+DltDaemonApplication* dlt_daemon_application_find(DltDaemon *daemon, char *apid, int verbose)
{
DltDaemonApplication application;
PRINT_FUNCTION_VERBOSE(verbose);
- if ((daemon==0) || (apid==0) || (apid[0]=='\0') || (daemon->num_applications==0))
+ if ((daemon == NULL) || (apid == NULL) || (apid[0]=='\0') || (daemon->num_applications==0))
{
- return (DltDaemonApplication*) 0;
+ return (DltDaemonApplication*) NULL;
}
/* Check, if apid is smaller than smallest apid or greater than greatest apid */
- if ((memcmp(apid,daemon->applications[0].apid,DLT_ID_SIZE)<0) ||
- (memcmp(apid,daemon->applications[daemon->num_applications-1].apid,DLT_ID_SIZE)>0))
+ if ((memcmp(apid,daemon->applications[0].apid, DLT_ID_SIZE) < 0) ||
+ (memcmp(apid,daemon->applications[daemon->num_applications-1].apid, DLT_ID_SIZE) > 0))
{
- return (DltDaemonApplication*) 0;
+ return (DltDaemonApplication*) NULL;
}
- dlt_set_id(application.apid,apid);
- return (DltDaemonApplication*)bsearch(&application,daemon->applications,daemon->num_applications,sizeof(DltDaemonApplication),dlt_daemon_cmp_apid);
+ dlt_set_id(application.apid, apid);
+ return (DltDaemonApplication*)bsearch(&application, daemon->applications, daemon->num_applications, sizeof(DltDaemonApplication), dlt_daemon_cmp_apid);
}
-int dlt_daemon_applications_load(DltDaemon *daemon,const char *filename, int verbose)
+int dlt_daemon_applications_load(DltDaemon *daemon, const char *filename, int verbose)
{
FILE *fd;
ID4 apid;
@@ -506,14 +499,12 @@ int dlt_daemon_applications_load(DltDaemon *daemon,const char *filename, int ver
PRINT_FUNCTION_VERBOSE(verbose);
- if ((daemon==0) || (filename==0) || (filename[0]=='\0'))
- {
+ if ((daemon == NULL) || (filename == NULL) || (filename[0]=='\0'))
return -1;
- }
fd=fopen(filename, "r");
- if (fd==0)
+ if (fd == NULL)
{
snprintf(str,DLT_DAEMON_COMMON_TEXTBUFSIZE, "DLT runtime-application load, cannot open file %s: %s\n", filename, strerror(errno));
dlt_log(LOG_WARNING, str);
@@ -553,25 +544,25 @@ int dlt_daemon_applications_load(DltDaemon *daemon,const char *filename, int ver
}
}
- if (strcmp(buf,"")!=0)
+ if (strcmp(buf,"") != 0)
{
/* Split line */
pb=strtok(buf,":");
- if( pb != 0 )
+ if(pb != NULL)
{
- dlt_set_id(apid,pb);
- pb=strtok(NULL,":");
- if( pb != 0 )
- {
- /* pb contains now the description */
- /* pid is unknown at loading time */
- if (dlt_daemon_application_add(daemon,apid,0,pb,verbose)==0)
- {
- dlt_log(LOG_WARNING, "dlt_daemon_applications_load dlt_daemon_application_add failed\n");
- fclose(fd);
- return -1;
- }
- }
+ dlt_set_id(apid,pb);
+ pb=strtok(NULL,":");
+ if(pb != NULL)
+ {
+ /* pb contains now the description */
+ /* pid is unknown at loading time */
+ if (dlt_daemon_application_add(daemon, apid, 0, pb, verbose) == 0)
+ {
+ dlt_log(LOG_WARNING, "dlt_daemon_applications_load dlt_daemon_application_add failed\n");
+ fclose(fd);
+ return -1;
+ }
+ }
}
}
}
@@ -580,7 +571,7 @@ int dlt_daemon_applications_load(DltDaemon *daemon,const char *filename, int ver
return 0;
}
-int dlt_daemon_applications_save(DltDaemon *daemon,const char *filename, int verbose)
+int dlt_daemon_applications_save(DltDaemon *daemon, const char *filename, int verbose)
{
FILE *fd;
int i;
@@ -589,17 +580,15 @@ int dlt_daemon_applications_save(DltDaemon *daemon,const char *filename, int ver
PRINT_FUNCTION_VERBOSE(verbose);
- if ((daemon==0) || (filename==0) || (filename[0]=='\0'))
- {
+ if ((daemon == NULL) || (filename == NULL) || (filename[0]=='\0'))
return -1;
- }
- memset(apid,0, sizeof(apid));
+ memset(apid, 0, sizeof(apid));
- if ((daemon->applications) && (daemon->num_applications>0))
+ if ((daemon->applications != NULL) && (daemon->num_applications > 0))
{
fd=fopen(filename, "w");
- if (fd!=0)
+ if (fd != NULL)
{
for (i=0; i<daemon->num_applications; i++)
{
@@ -622,7 +611,7 @@ int dlt_daemon_applications_save(DltDaemon *daemon,const char *filename, int ver
return 0;
}
-DltDaemonContext* dlt_daemon_context_add(DltDaemon *daemon,char *apid,char *ctid,int8_t log_level,int8_t trace_status,int log_level_pos, int user_handle,char *description,int verbose)
+DltDaemonContext* dlt_daemon_context_add(DltDaemon *daemon, char *apid, char *ctid,int8_t log_level, int8_t trace_status, int log_level_pos, int user_handle, char *description, int verbose)
{
DltDaemonApplication *application;
DltDaemonContext *context;
@@ -631,40 +620,40 @@ DltDaemonContext* dlt_daemon_context_add(DltDaemon *daemon,char *apid,char *ctid
PRINT_FUNCTION_VERBOSE(verbose);
- if ((daemon==0) || (apid==0) || (apid[0]=='\0') || (ctid==0) || (ctid[0]=='\0'))
+ if ((daemon == NULL) || (apid == NULL) || (apid[0]=='\0') || (ctid == NULL) || (ctid[0]=='\0'))
{
- return (DltDaemonContext*) 0;
+ return (DltDaemonContext*) NULL;
}
if ((log_level<DLT_LOG_DEFAULT) || (log_level>DLT_LOG_VERBOSE))
{
- return (DltDaemonContext*) 0;
+ return (DltDaemonContext*) NULL;
}
if ((trace_status<DLT_TRACE_STATUS_DEFAULT) || (trace_status>DLT_TRACE_STATUS_ON))
{
- return (DltDaemonContext*) 0;
+ return (DltDaemonContext*) NULL;
}
- if (daemon->contexts == 0)
+ if (daemon->contexts == NULL)
{
daemon->contexts = (DltDaemonContext*) malloc(sizeof(DltDaemonContext)*DLT_DAEMON_CONTEXT_ALLOC_SIZE);
- if (daemon->contexts==0)
+ if (daemon->contexts == NULL)
{
- return (DltDaemonContext*) 0;
+ return (DltDaemonContext*) NULL;
}
}
/* Check if application [apid] is available */
application = dlt_daemon_application_find(daemon, apid, verbose);
- if (application==0)
+ if (application == NULL)
{
- return (DltDaemonContext*) 0;
+ return (DltDaemonContext*) NULL;
}
/* Check if context [apid, ctid] is already available */
context = dlt_daemon_context_find(daemon, apid, ctid, verbose);
- if (context==0)
+ if (context == NULL)
{
daemon->num_contexts += 1;
@@ -676,12 +665,12 @@ DltDaemonContext* dlt_daemon_context_add(DltDaemon *daemon,char *apid,char *ctid
old = daemon->contexts;
daemon->contexts = (DltDaemonContext*) malloc(sizeof(DltDaemonContext)*
((daemon->num_contexts/DLT_DAEMON_CONTEXT_ALLOC_SIZE)+1)*DLT_DAEMON_CONTEXT_ALLOC_SIZE);
- if (daemon->contexts==0)
- {
- daemon->contexts = old;
- daemon->num_contexts -= 1;
- return (DltDaemonContext*) 0;
- }
+ if (daemon->contexts == NULL)
+ {
+ daemon->contexts = old;
+ daemon->num_contexts -= 1;
+ return (DltDaemonContext*) NULL;
+ }
memcpy(daemon->contexts,old,sizeof(DltDaemonContext)*daemon->num_contexts);
free(old);
}
@@ -691,7 +680,7 @@ DltDaemonContext* dlt_daemon_context_add(DltDaemon *daemon,char *apid,char *ctid
dlt_set_id(context->apid,apid);
dlt_set_id(context->ctid,ctid);
- context->context_description = 0;
+ context->context_description = NULL;
application->num_contexts++;
new_context =1;
@@ -701,10 +690,10 @@ DltDaemonContext* dlt_daemon_context_add(DltDaemon *daemon,char *apid,char *ctid
if (context->context_description)
{
free(context->context_description);
- context->context_description=0;
+ context->context_description = NULL;
}
- if (description)
+ if (description != NULL)
{
context->context_description = malloc(strlen(description)+1);
@@ -719,8 +708,8 @@ DltDaemonContext* dlt_daemon_context_add(DltDaemon *daemon,char *apid,char *ctid
if this is a new context, or
if this is an old context and the runtime cfg was not loaded */
- if ((new_context==1) ||
- ((new_context==0) && (daemon->runtime_context_cfg_loaded==0)))
+ if ((new_context == 1) ||
+ ((new_context == 0) && (daemon->runtime_context_cfg_loaded == 0)))
{
context->log_level = log_level;
context->trace_status = trace_status;
@@ -748,10 +737,8 @@ int dlt_daemon_context_del(DltDaemon *daemon, DltDaemonContext* context, int ver
PRINT_FUNCTION_VERBOSE(verbose);
- if ((daemon==0) || (context==0))
- {
+ if ((daemon == NULL) || (context == NULL))
return -1;
- }
if (daemon->num_contexts>0)
{
@@ -761,21 +748,21 @@ int dlt_daemon_context_del(DltDaemon *daemon, DltDaemonContext* context, int ver
if (context->context_description)
{
free(context->context_description);
- context->context_description = 0;
+ context->context_description = NULL;
}
pos = context-(daemon->contexts);
/* move all contexts above pos to pos */
- memmove(&(daemon->contexts[pos]),&(daemon->contexts[pos+1]), sizeof(DltDaemonContext)*((daemon->num_contexts-1)-pos));
+ memmove(&(daemon->contexts[pos]), &(daemon->contexts[pos+1]), sizeof(DltDaemonContext)*((daemon->num_contexts-1)-pos));
/* Clear last context */
- memset(&(daemon->contexts[daemon->num_contexts-1]),0,sizeof(DltDaemonContext));
+ memset(&(daemon->contexts[daemon->num_contexts-1]), 0, sizeof(DltDaemonContext));
daemon->num_contexts--;
/* Check if application [apid] is available */
- if (application)
+ if (application != NULL)
{
application->num_contexts--;
}
@@ -784,22 +771,22 @@ int dlt_daemon_context_del(DltDaemon *daemon, DltDaemonContext* context, int ver
return 0;
}
-DltDaemonContext* dlt_daemon_context_find(DltDaemon *daemon,char *apid,char *ctid,int verbose)
+DltDaemonContext* dlt_daemon_context_find(DltDaemon *daemon, char *apid, char *ctid, int verbose)
{
DltDaemonContext context;
PRINT_FUNCTION_VERBOSE(verbose);
- if ((daemon==0) || (apid==0) || (apid[0]=='\0') || (ctid==0) || (ctid[0]=='\0') || (daemon->num_contexts==0))
+ if ((daemon == NULL) || (apid == NULL) || (apid[0]=='\0') || (ctid == NULL) || (ctid[0]=='\0') || (daemon->num_contexts==0))
{
- return (DltDaemonContext*) 0;
+ return (DltDaemonContext*) NULL;
}
/* Check, if apid is smaller than smallest apid or greater than greatest apid */
if ((memcmp(apid,daemon->contexts[0].apid,DLT_ID_SIZE)<0) ||
(memcmp(apid,daemon->contexts[daemon->num_contexts-1].apid,DLT_ID_SIZE)>0))
{
- return (DltDaemonContext*) 0;
+ return (DltDaemonContext*) NULL;
}
dlt_set_id(context.apid,apid);
@@ -808,45 +795,41 @@ DltDaemonContext* dlt_daemon_context_find(DltDaemon *daemon,char *apid,char *cti
return (DltDaemonContext*)bsearch(&context,daemon->contexts,daemon->num_contexts,sizeof(DltDaemonContext),dlt_daemon_cmp_apid_ctid);
}
-int dlt_daemon_contexts_invalidate_fd(DltDaemon *daemon,int fd,int verbose)
+int dlt_daemon_contexts_invalidate_fd(DltDaemon *daemon, int fd, int verbose)
{
int i;
PRINT_FUNCTION_VERBOSE(verbose);
- if (daemon==0)
- {
+ if (daemon == NULL)
return -1;
- }
for (i=0; i<daemon->num_contexts; i++)
{
- if (daemon->contexts[i].user_handle==fd)
+ if (daemon->contexts[i].user_handle == fd)
{
- daemon->contexts[i].user_handle = DLT_FD_INIT;
+ daemon->contexts[i].user_handle = DLT_FD_INIT;
}
}
return 0;
}
-int dlt_daemon_contexts_clear(DltDaemon *daemon,int verbose)
+int dlt_daemon_contexts_clear(DltDaemon *daemon, int verbose)
{
int i;
PRINT_FUNCTION_VERBOSE(verbose);
- if (daemon==0)
- {
+ if (daemon == NULL)
return -1;
- }
for (i=0; i<daemon->num_contexts; i++)
{
- if (daemon->contexts[i].context_description!=0)
+ if (daemon->contexts[i].context_description != NULL)
{
free(daemon->contexts[i].context_description);
- daemon->contexts[i].context_description = 0;
+ daemon->contexts[i].context_description = NULL;
}
}
@@ -855,7 +838,7 @@ int dlt_daemon_contexts_clear(DltDaemon *daemon,int verbose)
free(daemon->contexts);
}
- daemon->contexts = 0;
+ daemon->contexts = NULL;
for (i=0; i<daemon->num_applications; i++)
{
@@ -867,7 +850,7 @@ int dlt_daemon_contexts_clear(DltDaemon *daemon,int verbose)
return 0;
}
-int dlt_daemon_contexts_load(DltDaemon *daemon,const char *filename, int verbose)
+int dlt_daemon_contexts_load(DltDaemon *daemon, const char *filename, int verbose)
{
FILE *fd;
ID4 apid, ctid;
@@ -878,14 +861,12 @@ int dlt_daemon_contexts_load(DltDaemon *daemon,const char *filename, int verbose
PRINT_FUNCTION_VERBOSE(verbose);
- if ((daemon==0) || (filename==0) ||( filename[0]=='\0'))
- {
+ if ((daemon == NULL) || (filename == NULL) ||( filename[0]=='\0'))
return -1;
- }
fd=fopen(filename, "r");
- if (fd==0)
+ if (fd == NULL)
{
snprintf(str,DLT_DAEMON_COMMON_TEXTBUFSIZE, "DLT runtime-context load, cannot open file %s: %s\n", filename, strerror(errno));
dlt_log(LOG_WARNING, str);
@@ -929,37 +910,37 @@ int dlt_daemon_contexts_load(DltDaemon *daemon,const char *filename, int verbose
{
/* Split line */
pb=strtok(buf,":");
- if(pb!=0)
+ if(pb != NULL)
{
- dlt_set_id(apid,pb);
- pb=strtok(NULL,":");
- if(pb!=0)
- {
- dlt_set_id(ctid,pb);
- pb=strtok(NULL,":");
- if(pb!=0)
- {
- sscanf(pb,"%d",&ll);
- pb=strtok(NULL,":");
- if(pb!=0)
- {
- sscanf(pb,"%d",&ts);
- pb=strtok(NULL,":");
- if(pb!=0)
- {
- /* pb contains now the description */
-
- /* log_level_pos, and user_handle are unknown at loading time */
- if (dlt_daemon_context_add(daemon,apid,ctid,(int8_t)ll,(int8_t)ts,0,0,pb,verbose)==0)
- {
- dlt_log(LOG_WARNING, "dlt_daemon_contexts_load dlt_daemon_context_add failed\n");
- fclose(fd);
- return -1;
- }
- }
- }
- }
- }
+ dlt_set_id(apid,pb);
+ pb=strtok(NULL,":");
+ if(pb != NULL)
+ {
+ dlt_set_id(ctid,pb);
+ pb=strtok(NULL,":");
+ if(pb != NULL)
+ {
+ sscanf(pb,"%d",&ll);
+ pb=strtok(NULL,":");
+ if(pb != NULL)
+ {
+ sscanf(pb,"%d",&ts);
+ pb=strtok(NULL,":");
+ if(pb != NULL)
+ {
+ /* pb contains now the description */
+
+ /* log_level_pos, and user_handle are unknown at loading time */
+ if (dlt_daemon_context_add(daemon, apid, ctid, (int8_t)ll, (int8_t)ts, 0, 0, pb, verbose) == NULL)
+ {
+ dlt_log(LOG_WARNING, "dlt_daemon_contexts_load dlt_daemon_context_add failed\n");
+ fclose(fd);
+ return -1;
+ }
+ }
+ }
+ }
+ }
}
}
}
@@ -977,18 +958,16 @@ int dlt_daemon_contexts_save(DltDaemon *daemon,const char *filename, int verbose
PRINT_FUNCTION_VERBOSE(verbose);
- if ((daemon==0) || (filename==0) ||( filename[0]=='\0'))
- {
+ if ((daemon == NULL) || (filename == NULL) || (filename[0]=='\0'))
return -1;
- }
- memset(apid,0, sizeof(apid));
- memset(ctid,0, sizeof(ctid));
+ memset(apid, 0, sizeof(apid));
+ memset(ctid, 0, sizeof(ctid));
- if ((daemon->contexts) && (daemon->num_contexts>0))
+ if ((daemon->contexts) && (daemon->num_contexts > 0))
{
fd=fopen(filename, "w");
- if (fd!=0)
+ if (fd != NULL)
{
for (i=0; i<daemon->num_contexts; i++)
{
@@ -1017,105 +996,106 @@ int dlt_daemon_contexts_save(DltDaemon *daemon,const char *filename, int verbose
return 0;
}
-int dlt_daemon_configuration_save(DltDaemon *daemon,const char *filename, int verbose)
+int dlt_daemon_configuration_save(DltDaemon *daemon, const char *filename, int verbose)
{
FILE *fd;
PRINT_FUNCTION_VERBOSE(verbose);
- if ((daemon==0) || (filename==0) ||( filename[0]=='\0'))
- {
+ if ((daemon == NULL) || (filename == NULL) || (filename[0] == '\0'))
return -1;
- }
- fd=fopen(filename, "w");
- if (fd!=0)
- {
- fprintf(fd,"# 0 = off, 1 = external, 2 = internal, 3 = both\n");
- fprintf(fd,"LoggingMode = %d\n",daemon->mode);
+ fd=fopen(filename, "w");
+ if (fd != NULL)
+ {
+ fprintf(fd,"# 0 = off, 1 = external, 2 = internal, 3 = both\n");
+ fprintf(fd,"LoggingMode = %d\n",daemon->mode);
- fclose(fd);
- }
+ fclose(fd);
+ }
return 0;
}
-int dlt_daemon_configuration_load(DltDaemon *daemon,const char *filename, int verbose)
+int dlt_daemon_configuration_load(DltDaemon *daemon, const char *filename, int verbose)
{
- FILE * pFile;
- char line[1024];
- char token[1024];
- char value[1024];
+ if(daemon == NULL || filename == NULL)
+ return -1;
+
+ FILE * pFile;
+ char line[1024];
+ char token[1024];
+ char value[1024];
char *pch;
PRINT_FUNCTION_VERBOSE(verbose);
- pFile = fopen (filename,"r");
-
- if (pFile!=NULL)
- {
- while(1)
- {
- /* fetch line from configuration file */
- if ( fgets (line , 1024 , pFile) != NULL )
- {
- pch = strtok (line," =\r\n");
- token[0]=0;
- value[0]=0;
-
- while (pch != NULL)
- {
- if(strcmp(pch,"#")==0)
- break;
-
- if(token[0]==0)
- {
- strncpy(token,pch,sizeof(token)-1);
- token[sizeof(token)-1]=0;
- }
- else
- {
- strncpy(value,pch,sizeof(value)-1);
- value[sizeof(value)-1]=0;
- break;
- }
-
- pch = strtok (NULL, " =\r\n");
- }
-
- if(token[0] && value[0])
- {
- /* parse arguments here */
- if(strcmp(token,"LoggingMode")==0)
- {
- daemon->mode = atoi(value);
- snprintf(str,DLT_DAEMON_COMMON_TEXTBUFSIZE,"Runtime Option: %s=%d\n",token,daemon->mode);
- dlt_log(LOG_INFO, str);
- }
- else
- {
- snprintf(str,DLT_DAEMON_COMMON_TEXTBUFSIZE,"Unknown option: %s=%s\n",token,value);
- dlt_log(LOG_WARNING, str);
- }
- }
- }
- else
- {
- break;
- }
- }
- fclose (pFile);
- }
- else
- {
+ pFile = fopen (filename,"r");
+
+ if (pFile != NULL)
+ {
+ while(1)
+ {
+ /* fetch line from configuration file */
+ if ( fgets (line , 1024 , pFile) != NULL )
+ {
+ pch = strtok (line," =\r\n");
+ token[0]=0;
+ value[0]=0;
+
+ while (pch != NULL)
+ {
+ if(strcmp(pch,"#")==0)
+ break;
+
+ if(token[0]==0)
+ {
+ strncpy(token,pch,sizeof(token)-1);
+ token[sizeof(token)-1]=0;
+ }
+ else
+ {
+ strncpy(value,pch,sizeof(value)-1);
+ value[sizeof(value)-1]=0;
+ break;
+ }
+
+ pch = strtok (NULL, " =\r\n");
+ }
+
+ if(token[0] && value[0])
+ {
+ /* parse arguments here */
+ if(strcmp(token, "LoggingMode") == 0)
+ {
+ daemon->mode = atoi(value);
+ snprintf(str,DLT_DAEMON_COMMON_TEXTBUFSIZE,"Runtime Option: %s=%d\n",token,daemon->mode);
+ dlt_log(LOG_INFO, str);
+ }
+ else
+ {
+ snprintf(str,DLT_DAEMON_COMMON_TEXTBUFSIZE,"Unknown option: %s=%s\n",token,value);
+ dlt_log(LOG_WARNING, str);
+ }
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+ fclose (pFile);
+ }
+ else
+ {
snprintf(str,DLT_DAEMON_COMMON_TEXTBUFSIZE,"Cannot open configuration file: %s\n",filename);
dlt_log(LOG_WARNING, str);
- }
+ }
return 0;
}
-int dlt_daemon_user_send_log_level(DltDaemon *daemon,DltDaemonContext *context,int verbose)
+int dlt_daemon_user_send_log_level(DltDaemon *daemon, DltDaemonContext *context, int verbose)
{
DltUserHeader userheader;
DltUserControlMsgLogLevel usercontext;
@@ -1123,15 +1103,12 @@ int dlt_daemon_user_send_log_level(DltDaemon *daemon,DltDaemonContext *context,i
PRINT_FUNCTION_VERBOSE(verbose);
- if ((daemon==0) || (context==0))
- {
+ if ((daemon == NULL) || (context == NULL))
+ return -1;
+
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_LOG_LEVEL) < DLT_RETURN_OK)
return -1;
- }
- if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_LOG_LEVEL)==-1)
- {
- return -1;
- }
if(context->storage_log_level != DLT_LOG_DEFAULT)
{
usercontext.log_level = context->log_level > context->storage_log_level ? context->log_level:context->storage_log_level;
@@ -1146,9 +1123,11 @@ int dlt_daemon_user_send_log_level(DltDaemon *daemon,DltDaemonContext *context,i
usercontext.log_level_pos = context->log_level_pos;
/* log to FIFO */
- ret = dlt_user_log_out2(context->user_handle, &(userheader), sizeof(DltUserHeader), &(usercontext), sizeof(DltUserControlMsgLogLevel));
+ ret = dlt_user_log_out2(context->user_handle,
+ &(userheader), sizeof(DltUserHeader),
+ &(usercontext), sizeof(DltUserControlMsgLogLevel));
- if (ret!=DLT_RETURN_OK)
+ if (ret < DLT_RETURN_OK)
{
if (errno==EPIPE)
{
@@ -1158,10 +1137,10 @@ int dlt_daemon_user_send_log_level(DltDaemon *daemon,DltDaemonContext *context,i
}
}
- return ((ret==DLT_RETURN_OK)?0:-1);
+ return ((ret == DLT_RETURN_OK) ? DLT_RETURN_OK : DLT_RETURN_ERROR);
}
-int dlt_daemon_user_send_log_state(DltDaemon *daemon,DltDaemonApplication *app,int verbose)
+int dlt_daemon_user_send_log_state(DltDaemon *daemon, DltDaemonApplication *app, int verbose)
{
DltUserHeader userheader;
DltUserControlMsgLogState logstate;
@@ -1169,22 +1148,20 @@ int dlt_daemon_user_send_log_state(DltDaemon *daemon,DltDaemonApplication *app,i
PRINT_FUNCTION_VERBOSE(verbose);
- if ((daemon==0) || (app==0))
- {
+ if ((daemon == NULL) || (app == NULL))
return -1;
- }
- if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_LOG_STATE)==-1)
- {
- return -1;
- }
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_LOG_STATE) < DLT_RETURN_OK)
+ return -1;
logstate.log_state = daemon->connectionState;
/* log to FIFO */
- ret = dlt_user_log_out2(app->user_handle, &(userheader), sizeof(DltUserHeader), &(logstate), sizeof(DltUserControlMsgLogState));
+ ret = dlt_user_log_out2(app->user_handle,
+ &(userheader), sizeof(DltUserHeader),
+ &(logstate), sizeof(DltUserControlMsgLogState));
- if (ret!=DLT_RETURN_OK)
+ if (ret < DLT_RETURN_OK)
{
if (errno==EPIPE)
{
@@ -1194,24 +1171,31 @@ int dlt_daemon_user_send_log_state(DltDaemon *daemon,DltDaemonApplication *app,i
}
}
- return ((ret==DLT_RETURN_OK)?0:-1);
+ return ((ret == DLT_RETURN_OK) ? DLT_RETURN_OK : DLT_RETURN_ERROR);
}
-void dlt_daemon_control_reset_to_factory_default(DltDaemon *daemon,const char *filename, const char *filename1, int verbose)
+void dlt_daemon_control_reset_to_factory_default(DltDaemon *daemon, const char *filename, const char *filename1, int verbose)
{
FILE *fd;
PRINT_FUNCTION_VERBOSE(verbose);
- if ((daemon==0) || (filename==0) || (filename1==0) || (filename[0]=='\0') || (filename1[0]=='\0'))
+ if ((daemon == NULL) || (filename == NULL) || (filename1 == NULL))
+ {
+ dlt_log(LOG_WARNING, "Wrong parameter: Null pointer\n");
+ return;
+ }
+
+ if ((filename[0] == '\0') || (filename1[0] == '\0'))
{
+ dlt_log(LOG_WARNING, "Wrong parameter: Empty string\n");
return;
}
/* Check for runtime cfg file and delete it, if available */
fd=fopen(filename, "r");
- if (fd!=0)
+ if (fd != NULL)
{
/* Close and delete file */
fclose(fd);
@@ -1220,7 +1204,7 @@ void dlt_daemon_control_reset_to_factory_default(DltDaemon *daemon,const char *f
fd=fopen(filename1, "r");
- if (fd!=0)
+ if (fd != NULL)
{
/* Close and delete file */
fclose(fd);
@@ -1231,7 +1215,7 @@ void dlt_daemon_control_reset_to_factory_default(DltDaemon *daemon,const char *f
daemon->default_trace_status = DLT_DAEMON_INITIAL_TRACE_STATUS ;
/* Reset all other things (log level, trace status, etc.
- to default values */
+ to default values */
/* Inform user libraries about changed default log level/trace status */
dlt_daemon_user_send_default_update(daemon, verbose);
@@ -1244,16 +1228,17 @@ void dlt_daemon_user_send_default_update(DltDaemon *daemon, int verbose)
PRINT_FUNCTION_VERBOSE(verbose);
- if (daemon==0)
+ if (daemon == NULL)
{
+ dlt_log(LOG_WARNING, "Wrong parameter: Null pointer\n");
return;
}
- for (count=0;count<daemon->num_contexts; count ++)
+ for (count=0; count<daemon->num_contexts; count ++)
{
context = &(daemon->contexts[count]);
- if (context)
+ if (context != NULL)
{
if ((context->log_level == DLT_LOG_DEFAULT) ||
(context->trace_status == DLT_TRACE_STATUS_DEFAULT))
@@ -1262,7 +1247,7 @@ void dlt_daemon_user_send_default_update(DltDaemon *daemon, int verbose)
{
if (dlt_daemon_user_send_log_level(daemon, context, verbose)==-1)
{
- return;
+ return;
}
}
}
@@ -1277,53 +1262,54 @@ void dlt_daemon_user_send_all_log_state(DltDaemon *daemon, int verbose)
PRINT_FUNCTION_VERBOSE(verbose);
- if (daemon==0)
+ if (daemon == NULL)
{
+ dlt_log(LOG_WARNING, "Wrong parameter: Null pointer\n");
return;
}
- for (count=0;count<daemon->num_applications; count ++)
+ for (count=0; count<daemon->num_applications; count ++)
{
app = &(daemon->applications[count]);
- if (app)
+ if (app != NULL)
{
- if (app->user_handle >= DLT_FD_MINIMUM)
- {
- if (dlt_daemon_user_send_log_state(daemon, app, verbose)==-1)
- {
- return;
- }
- }
+ if (app->user_handle >= DLT_FD_MINIMUM)
+ {
+ if (dlt_daemon_user_send_log_state(daemon, app, verbose)==-1)
+ {
+ return;
+ }
+ }
}
}
}
void dlt_daemon_change_state(DltDaemon *daemon, DltDaemonState newState)
{
- switch(newState)
- {
- case DLT_DAEMON_STATE_INIT:
- dlt_log(LOG_INFO,"Switched to init state.\n");
- daemon->state = DLT_DAEMON_STATE_INIT;
- break;
- case DLT_DAEMON_STATE_BUFFER:
- dlt_log(LOG_INFO,"Switched to buffer state for socket connections.\n");
- daemon->state = DLT_DAEMON_STATE_BUFFER;
- break;
- case DLT_DAEMON_STATE_BUFFER_FULL:
- dlt_log(LOG_INFO,"Switched to buffer full state.\n");
- daemon->state = DLT_DAEMON_STATE_BUFFER_FULL;
- break;
- case DLT_DAEMON_STATE_SEND_BUFFER:
- dlt_log(LOG_INFO,"Switched to send buffer state for socket connections.\n");
- daemon->state = DLT_DAEMON_STATE_SEND_BUFFER;
- break;
- case DLT_DAEMON_STATE_SEND_DIRECT:
- dlt_log(LOG_INFO,"Switched to send direct state.\n");
- daemon->state = DLT_DAEMON_STATE_SEND_DIRECT;
- break;
- }
+ switch(newState)
+ {
+ case DLT_DAEMON_STATE_INIT:
+ dlt_log(LOG_INFO,"Switched to init state.\n");
+ daemon->state = DLT_DAEMON_STATE_INIT;
+ break;
+ case DLT_DAEMON_STATE_BUFFER:
+ dlt_log(LOG_INFO,"Switched to buffer state for socket connections.\n");
+ daemon->state = DLT_DAEMON_STATE_BUFFER;
+ break;
+ case DLT_DAEMON_STATE_BUFFER_FULL:
+ dlt_log(LOG_INFO,"Switched to buffer full state.\n");
+ daemon->state = DLT_DAEMON_STATE_BUFFER_FULL;
+ break;
+ case DLT_DAEMON_STATE_SEND_BUFFER:
+ dlt_log(LOG_INFO,"Switched to send buffer state for socket connections.\n");
+ daemon->state = DLT_DAEMON_STATE_SEND_BUFFER;
+ break;
+ case DLT_DAEMON_STATE_SEND_DIRECT:
+ dlt_log(LOG_INFO,"Switched to send direct state.\n");
+ daemon->state = DLT_DAEMON_STATE_SEND_DIRECT;
+ break;
+ }
}
diff --git a/src/daemon/dlt_daemon_common.h b/src/daemon/dlt_daemon_common.h
index 1ad1ce6..e93d0d7 100644
--- a/src/daemon/dlt_daemon_common.h
+++ b/src/daemon/dlt_daemon_common.h
@@ -105,11 +105,11 @@ extern sem_t dlt_daemon_mutex;
*/
typedef enum
{
- DLT_DAEMON_STATE_INIT = 0, /**< Initial state */
- DLT_DAEMON_STATE_BUFFER = 1, /**< logging is buffered until external logger is connected or internal logging is activated */
- DLT_DAEMON_STATE_BUFFER_FULL = 2, /**< then internal buffer is full, wait for connect from client */
- DLT_DAEMON_STATE_SEND_BUFFER = 3, /**< external logger is connected, but buffer is still not empty or external logger queue is full */
- DLT_DAEMON_STATE_SEND_DIRECT = 4 /**< External logger is connected or internal logging is active, and buffer is empty */
+ DLT_DAEMON_STATE_INIT = 0, /**< Initial state */
+ DLT_DAEMON_STATE_BUFFER = 1, /**< logging is buffered until external logger is connected or internal logging is activated */
+ DLT_DAEMON_STATE_BUFFER_FULL = 2, /**< then internal buffer is full, wait for connect from client */
+ DLT_DAEMON_STATE_SEND_BUFFER = 3, /**< external logger is connected, but buffer is still not empty or external logger queue is full */
+ DLT_DAEMON_STATE_SEND_DIRECT = 4 /**< External logger is connected or internal logging is active, and buffer is empty */
} DltDaemonState;
/**
@@ -117,11 +117,11 @@ typedef enum
*/
typedef struct
{
- char apid[DLT_ID_SIZE]; /**< application id */
- pid_t pid; /**< process id of user application */
- int user_handle; /**< connection handle for connection to user application */
- char *application_description; /**< context description */
- int num_contexts; /**< number of contexts for this application */
+ char apid[DLT_ID_SIZE]; /**< application id */
+ pid_t pid; /**< process id of user application */
+ int user_handle; /**< connection handle for connection to user application */
+ char *application_description; /**< context description */
+ int num_contexts; /**< number of contexts for this application */
} DltDaemonApplication;
/**
@@ -129,14 +129,14 @@ typedef struct
*/
typedef struct
{
- char apid[DLT_ID_SIZE]; /**< application id */
- char ctid[DLT_ID_SIZE]; /**< context id */
- int8_t log_level; /**< the current log level of the context */
- int8_t trace_status; /**< the current trace status of the context */
- int log_level_pos; /**< offset of context in context field on user application */
- int user_handle; /**< connection handle for connection to user application */
- char *context_description; /**< context description */
- int8_t storage_log_level; /**< log level set for offline logstorage */
+ char apid[DLT_ID_SIZE]; /**< application id */
+ char ctid[DLT_ID_SIZE]; /**< context id */
+ int8_t log_level; /**< the current log level of the context */
+ int8_t trace_status; /**< the current trace status of the context */
+ int log_level_pos; /**< offset of context in context field on user application */
+ int user_handle; /**< connection handle for connection to user application */
+ char *context_description; /**< context description */
+ int8_t storage_log_level; /**< log level set for offline logstorage */
} DltDaemonContext;
/**
@@ -144,23 +144,23 @@ typedef struct
*/
typedef struct
{
- int num_contexts; /**< Total number of all contexts in all applications */
- DltDaemonContext *contexts; /**< Pointer to contexts */
- int num_applications; /**< Number of available application */
- DltDaemonApplication *applications; /**< Pointer to applications */
- int8_t default_log_level; /**< Default log level (of daemon) */
- int8_t default_trace_status; /**< Default trace status (of daemon) */
- unsigned int overflow_counter; /**< counts the number of lost messages. */
- int runtime_context_cfg_loaded; /**< Set to one, if runtime context configuration has been loaded, zero otherwise */
- char ecuid[DLT_ID_SIZE]; /**< ECU ID of daemon */
- int sendserialheader; /**< 1: send serial header; 0 don't send serial header */
- int timingpackets; /**< 1: send continous timing packets; 0 don't send continous timing packets */
- DltBuffer client_ringbuffer; /**< Ring-buffer for storing received logs while no client connection is available */
+ int num_contexts; /**< Total number of all contexts in all applications */
+ DltDaemonContext *contexts; /**< Pointer to contexts */
+ int num_applications; /**< Number of available application */
+ DltDaemonApplication *applications; /**< Pointer to applications */
+ int8_t default_log_level; /**< Default log level (of daemon) */
+ int8_t default_trace_status; /**< Default trace status (of daemon) */
+ unsigned int overflow_counter; /**< counts the number of lost messages. */
+ int runtime_context_cfg_loaded; /**< Set to one, if runtime context configuration has been loaded, zero otherwise */
+ char ecuid[DLT_ID_SIZE]; /**< ECU ID of daemon */
+ int sendserialheader; /**< 1: send serial header; 0 don't send serial header */
+ int timingpackets; /**< 1: send continous timing packets; 0 don't send continous timing packets */
+ DltBuffer client_ringbuffer; /**< Ring-buffer for storing received logs while no client connection is available */
char runtime_application_cfg[PATH_MAX + 1]; /**< Path and filename of persistent application configuration. Set to path max, as it specifies a full path*/
char runtime_context_cfg[PATH_MAX + 1]; /**< Path and filename of persistent context configuration */
char runtime_configuration[PATH_MAX + 1]; /**< Path and filename of persistent configuration */
- DltUserLogMode mode; /**< Mode used for tracing: off, external, internal, both */
- char connectionState; /**< state for tracing: 0 = no client connected, 1 = client connected */
+ DltUserLogMode mode; /**< Mode used for tracing: off, external, internal, both */
+ char connectionState; /**< state for tracing: 0 = no client connected, 1 = client connected */
char *ECUVersionString; /**< Version string to send to client. Loaded from a file at startup. May be null. */
DltDaemonState state; /**< the current logging state of dlt daemon. */
DltLogStorage *storage_handle;
diff --git a/src/daemon/dlt_daemon_serial.c b/src/daemon/dlt_daemon_serial.c
index 1f304eb..cafcf80 100644
--- a/src/daemon/dlt_daemon_serial.c
+++ b/src/daemon/dlt_daemon_serial.c
@@ -72,26 +72,26 @@
int dlt_daemon_serial_send(int sock,void* data1,int size1,void* data2,int size2,char serialheader)
{
- /* Optional: Send serial header, if requested */
- if (serialheader)
- {
- if ( 0 > write(sock, dltSerialHeader,sizeof(dltSerialHeader)) )
- return DLT_DAEMON_ERROR_SEND_FAILED;
+ /* Optional: Send serial header, if requested */
+ if (serialheader)
+ {
+ if ( 0 > write(sock, dltSerialHeader,sizeof(dltSerialHeader)) )
+ return DLT_DAEMON_ERROR_SEND_FAILED;
- }
+ }
- /* Send data */
- if(data1 && size1>0)
- {
- if (0 > write(sock, data1,size1))
- return DLT_DAEMON_ERROR_SEND_FAILED;
- }
+ /* Send data */
+ if(data1 && size1>0)
+ {
+ if (0 > write(sock, data1,size1))
+ return DLT_DAEMON_ERROR_SEND_FAILED;
+ }
- if(data2 && size2>0)
- {
- if (0 > write(sock, data2,size2))
- return DLT_DAEMON_ERROR_SEND_FAILED;
- }
+ if(data2 && size2>0)
+ {
+ if (0 > write(sock, data2,size2))
+ return DLT_DAEMON_ERROR_SEND_FAILED;
+ }
- return DLT_DAEMON_ERROR_OK;
+ return DLT_DAEMON_ERROR_OK;
}
diff --git a/src/daemon/dlt_daemon_socket.c b/src/daemon/dlt_daemon_socket.c
index fa91485..1054e9a 100644
--- a/src/daemon/dlt_daemon_socket.c
+++ b/src/daemon/dlt_daemon_socket.c
@@ -133,35 +133,35 @@ int dlt_daemon_socket_open(int *sock, unsigned int servPort)
int dlt_daemon_socket_close(int sock)
{
- close(sock);
+ close(sock);
- return 0;
+ return 0;
}
int dlt_daemon_socket_send(int sock,void* data1,int size1,void* data2,int size2,char serialheader)
{
- /* Optional: Send serial header, if requested */
- if (serialheader)
- {
- if ( 0 > send(sock, dltSerialHeader,sizeof(dltSerialHeader),0) )
- return DLT_DAEMON_ERROR_SEND_FAILED;
-
- }
-
- /* Send data */
- if(data1 && size1>0)
- {
- if (0 > send(sock, data1,size1,0))
- return DLT_DAEMON_ERROR_SEND_FAILED;
- }
-
- if(data2 && size2>0)
- {
- if (0 > send(sock, data2,size2,0))
- return DLT_DAEMON_ERROR_SEND_FAILED;
- }
-
- return DLT_DAEMON_ERROR_OK;
+ /* Optional: Send serial header, if requested */
+ if (serialheader)
+ {
+ if ( 0 > send(sock, dltSerialHeader,sizeof(dltSerialHeader),0) )
+ return DLT_DAEMON_ERROR_SEND_FAILED;
+
+ }
+
+ /* Send data */
+ if(data1 && size1>0)
+ {
+ if (0 > send(sock, data1,size1,0))
+ return DLT_DAEMON_ERROR_SEND_FAILED;
+ }
+
+ if(data2 && size2>0)
+ {
+ if (0 > send(sock, data2,size2,0))
+ return DLT_DAEMON_ERROR_SEND_FAILED;
+ }
+
+ return DLT_DAEMON_ERROR_OK;
}
int dlt_daemon_socket_get_send_qeue_max_size(int sock)
diff --git a/src/dbus/dlt-dbus-options.c b/src/dbus/dlt-dbus-options.c
index 3c75c62..27bf4f4 100644
--- a/src/dbus/dlt-dbus-options.c
+++ b/src/dbus/dlt-dbus-options.c
@@ -36,20 +36,20 @@
*/
void usage(char *prog_name)
{
- char version[255];
- dlt_get_version(version,255);
-
- printf("Usage: %s [options]\n", prog_name);
- printf("Application to forward dbus messages to DLT.\n");
- printf("%s\n", version);
- printf("Options:\n");
- printf(" -d Daemonize. Detach from terminal and run in background.\n");
- printf(" -c filename Use configuration file. \n");
- printf(" -a appid Used application id. \n");
- printf(" Default: %s\n", DEFAULT_CONF_FILE);
- printf(" -b type Used bus type. \n");
- printf(" Session = 0, System = 1.\n");
- printf(" -h This help message.\n");
+ char version[255];
+ dlt_get_version(version,255);
+
+ printf("Usage: %s [options]\n", prog_name);
+ printf("Application to forward dbus messages to DLT.\n");
+ printf("%s\n", version);
+ printf("Options:\n");
+ printf(" -d Daemonize. Detach from terminal and run in background.\n");
+ printf(" -c filename Use configuration file. \n");
+ printf(" -a appid Used application id. \n");
+ printf(" Default: %s\n", DEFAULT_CONF_FILE);
+ printf(" -b type Used bus type. \n");
+ printf(" Session = 0, System = 1.\n");
+ printf(" -h This help message.\n");
}
/**
@@ -57,10 +57,10 @@ void usage(char *prog_name)
*/
void init_cli_options(DltDBusCliOptions *options)
{
- options->ConfigurationFileName = DEFAULT_CONF_FILE;
- options->ApplicationId = 0;
- options->BusType = 0;
- options->Daemonize = 0;
+ options->ConfigurationFileName = DEFAULT_CONF_FILE;
+ options->ApplicationId = 0;
+ options->BusType = 0;
+ options->Daemonize = 0;
}
/**
@@ -68,53 +68,53 @@ void init_cli_options(DltDBusCliOptions *options)
*/
int read_command_line(DltDBusCliOptions *options, int argc, char *argv[])
{
- init_cli_options(options);
- int opt;
-
- while((opt = getopt(argc, argv, "c:b:a:hd")) != -1)
- {
- switch(opt) {
- case 'd':
- {
- options->Daemonize = 1;
- break;
- }
- case 'b':
- {
- options->BusType = malloc(strlen(optarg)+1);
- MALLOC_ASSERT(options->BusType);
- strcpy(options->BusType, optarg); /* strcpy unritical here, because size matches exactly the size to be copied */
- break;
- }
- case 'a':
- {
- options->ApplicationId = malloc(strlen(optarg)+1);
- MALLOC_ASSERT(options->ApplicationId);
- strcpy(options->ApplicationId, optarg); /* strcpy unritical here, because size matches exactly the size to be copied */
- break;
- }
- case 'c':
- {
- options->ConfigurationFileName = malloc(strlen(optarg)+1);
- MALLOC_ASSERT(options->ConfigurationFileName);
- strcpy(options->ConfigurationFileName, optarg); /* strcpy unritical here, because size matches exactly the size to be copied */
- break;
- }
- case 'h':
- {
- usage(argv[0]);
- exit(0);
+ init_cli_options(options);
+ int opt;
+
+ while((opt = getopt(argc, argv, "c:b:a:hd")) != -1)
+ {
+ switch(opt) {
+ case 'd':
+ {
+ options->Daemonize = 1;
+ break;
+ }
+ case 'b':
+ {
+ options->BusType = malloc(strlen(optarg)+1);
+ MALLOC_ASSERT(options->BusType);
+ strcpy(options->BusType, optarg); /* strcpy unritical here, because size matches exactly the size to be copied */
+ break;
+ }
+ case 'a':
+ {
+ options->ApplicationId = malloc(strlen(optarg)+1);
+ MALLOC_ASSERT(options->ApplicationId);
+ strcpy(options->ApplicationId, optarg); /* strcpy unritical here, because size matches exactly the size to be copied */
+ break;
+ }
+ case 'c':
+ {
+ options->ConfigurationFileName = malloc(strlen(optarg)+1);
+ MALLOC_ASSERT(options->ConfigurationFileName);
+ strcpy(options->ConfigurationFileName, optarg); /* strcpy unritical here, because size matches exactly the size to be copied */
+ break;
+ }
+ case 'h':
+ {
+ usage(argv[0]);
+ exit(0);
return -1;//for parasoft
- }
- default:
- {
- fprintf(stderr, "Unknown option '%c'\n", optopt);
- usage(argv[0]);
- return -1;
- }
- }
- }
- return 0;
+ }
+ default:
+ {
+ fprintf(stderr, "Unknown option '%c'\n", optopt);
+ usage(argv[0]);
+ return -1;
+ }
+ }
+ }
+ return 0;
}
/**
@@ -122,13 +122,13 @@ int read_command_line(DltDBusCliOptions *options, int argc, char *argv[])
*/
void init_configuration(DltDBusConfiguration *config)
{
- // Common
- config->ApplicationId = "IPC0";
+ // Common
+ config->ApplicationId = "IPC0";
- // DBus
- config->DBus.ContextId = "ALL";
- config->DBus.BusType = 0;
- config->DBus.FilterCount = 0;
+ // DBus
+ config->DBus.ContextId = "ALL";
+ config->DBus.BusType = 0;
+ config->DBus.FilterCount = 0;
}
@@ -137,114 +137,114 @@ void init_configuration(DltDBusConfiguration *config)
*/
int read_configuration_file(DltDBusConfiguration *config, char *file_name)
{
- FILE *file;
- char *line, *token, *value, *filter, *pch;
- int ret = 0;
- char *filterBegin,*filterEnd;
-
- init_configuration(config);
-
- file = fopen(file_name, "r");
-
- if(file == NULL)
- {
- fprintf(stderr, "dlt-dbus-options, could not open configuration file.\n");
- return -1;
- }
-
- line = malloc(MAX_LINE);
- token = malloc(MAX_LINE);
- value = malloc(MAX_LINE);
- filter = malloc(MAX_LINE);
-
- MALLOC_ASSERT(line);
- MALLOC_ASSERT(token);
- MALLOC_ASSERT(value);
- MALLOC_ASSERT(filter);
-
- while(fgets(line, MAX_LINE, file) != NULL)
- {
- token[0] = 0;
- value[0] = 0;
- filter[0] = 0;
-
- filterBegin = strchr(line,'=');
- filterEnd = strpbrk (line,"\r\n");
-
- if(filterBegin)
- {
- if(filterEnd && (filterEnd>filterBegin))
- {
- strncpy(filter,filterBegin+1,filterEnd-filterBegin-1);
- filter[filterEnd-filterBegin-1]=0;
- }
- else
- {
- strcpy(filter,filterBegin+1);
- }
- }
-
- pch = strtok (line, " =\r\n");
- while(pch != NULL)
- {
- if(pch[0] == '#')
- break;
-
- if(token[0] == 0)
- {
- strncpy(token, pch, MAX_LINE-1);
- token[MAX_LINE-1]=0;
- }
- else
- {
- strncpy(value, pch, MAX_LINE);
- value[MAX_LINE-1]=0;
- break;
- }
-
- pch = strtok (NULL, " =\r\n");
- }
-
- if(token[0] && value[0])
- {
- // Common
- if(strcmp(token, "ApplicationId") == 0)
- {
- config->ApplicationId = malloc(strlen(value)+1);
- MALLOC_ASSERT(config->ApplicationId);
- strcpy(config->ApplicationId, value); /* strcpy unritical here, because size matches exactly the size to be copied */
- }
- // ContextId
- else if(strcmp(token, "ContextId") == 0)
- {
- config->DBus.ContextId = malloc(strlen(value)+1);
- MALLOC_ASSERT(config->DBus.ContextId);
- strcpy(config->DBus.ContextId, value); /* strcpy unritical here, because size matches exactly the size to be copied */
- }
- // BusType
- else if(strcmp(token, "BusType") == 0)
- {
- config->DBus.BusType = malloc(strlen(value)+1);
- MALLOC_ASSERT(config->DBus.BusType);
- strcpy(config->DBus.BusType, value); /* strcpy unritical here, because size matches exactly the size to be copied */
- }
- // BusType
- else if(strcmp(token, "FilterMatch") == 0)
- {
- if(config->DBus.FilterCount<DLT_DBUS_FILTER_MAX)
- {
- config->DBus.FilterMatch[config->DBus.FilterCount]= malloc(strlen(filter)+1);
- MALLOC_ASSERT(config->DBus.FilterMatch[config->DBus.FilterCount]);
- strcpy(config->DBus.FilterMatch[config->DBus.FilterCount], filter);
- config->DBus.FilterCount++;
- }
- }
- }
- }
- fclose(file);
- free(value);
- free(token);
- free(filter);
- free(line);
- return ret;
+ FILE *file;
+ char *line, *token, *value, *filter, *pch;
+ int ret = 0;
+ char *filterBegin,*filterEnd;
+
+ init_configuration(config);
+
+ file = fopen(file_name, "r");
+
+ if(file == NULL)
+ {
+ fprintf(stderr, "dlt-dbus-options, could not open configuration file.\n");
+ return -1;
+ }
+
+ line = malloc(MAX_LINE);
+ token = malloc(MAX_LINE);
+ value = malloc(MAX_LINE);
+ filter = malloc(MAX_LINE);
+
+ MALLOC_ASSERT(line);
+ MALLOC_ASSERT(token);
+ MALLOC_ASSERT(value);
+ MALLOC_ASSERT(filter);
+
+ while(fgets(line, MAX_LINE, file) != NULL)
+ {
+ token[0] = 0;
+ value[0] = 0;
+ filter[0] = 0;
+
+ filterBegin = strchr(line,'=');
+ filterEnd = strpbrk (line,"\r\n");
+
+ if(filterBegin)
+ {
+ if(filterEnd && (filterEnd>filterBegin))
+ {
+ strncpy(filter,filterBegin+1,filterEnd-filterBegin-1);
+ filter[filterEnd-filterBegin-1]=0;
+ }
+ else
+ {
+ strcpy(filter,filterBegin+1);
+ }
+ }
+
+ pch = strtok (line, " =\r\n");
+ while(pch != NULL)
+ {
+ if(pch[0] == '#')
+ break;
+
+ if(token[0] == 0)
+ {
+ strncpy(token, pch, MAX_LINE-1);
+ token[MAX_LINE-1]=0;
+ }
+ else
+ {
+ strncpy(value, pch, MAX_LINE);
+ value[MAX_LINE-1]=0;
+ break;
+ }
+
+ pch = strtok (NULL, " =\r\n");
+ }
+
+ if(token[0] && value[0])
+ {
+ // Common
+ if(strcmp(token, "ApplicationId") == 0)
+ {
+ config->ApplicationId = malloc(strlen(value)+1);
+ MALLOC_ASSERT(config->ApplicationId);
+ strcpy(config->ApplicationId, value); /* strcpy unritical here, because size matches exactly the size to be copied */
+ }
+ // ContextId
+ else if(strcmp(token, "ContextId") == 0)
+ {
+ config->DBus.ContextId = malloc(strlen(value)+1);
+ MALLOC_ASSERT(config->DBus.ContextId);
+ strcpy(config->DBus.ContextId, value); /* strcpy unritical here, because size matches exactly the size to be copied */
+ }
+ // BusType
+ else if(strcmp(token, "BusType") == 0)
+ {
+ config->DBus.BusType = malloc(strlen(value)+1);
+ MALLOC_ASSERT(config->DBus.BusType);
+ strcpy(config->DBus.BusType, value); /* strcpy unritical here, because size matches exactly the size to be copied */
+ }
+ // BusType
+ else if(strcmp(token, "FilterMatch") == 0)
+ {
+ if(config->DBus.FilterCount<DLT_DBUS_FILTER_MAX)
+ {
+ config->DBus.FilterMatch[config->DBus.FilterCount]= malloc(strlen(filter)+1);
+ MALLOC_ASSERT(config->DBus.FilterMatch[config->DBus.FilterCount]);
+ strcpy(config->DBus.FilterMatch[config->DBus.FilterCount], filter);
+ config->DBus.FilterCount++;
+ }
+ }
+ }
+ }
+ fclose(file);
+ free(value);
+ free(token);
+ free(filter);
+ free(line);
+ return ret;
}
diff --git a/src/dbus/dlt-dbus.c b/src/dbus/dlt-dbus.c
index 2b99a4e..f85252f 100644
--- a/src/dbus/dlt-dbus.c
+++ b/src/dbus/dlt-dbus.c
@@ -80,96 +80,96 @@ filter_func (DBusConnection *con,
int main (int argc, char *argv[])
{
- DltDBusCliOptions options;
- DltDBusConfiguration config;
-
- DBusConnection *connection;
- DBusError error;
- DBusBusType type;
-
- int num;
-
- if(read_command_line(&options, argc, argv) < 0)
- {
- fprintf(stderr, "Failed to read command line!\n");
- return -1;
- }
-
- if(read_configuration_file(&config, options.ConfigurationFileName) < 0)
- {
- fprintf(stderr, "Failed to read configuration file!\n");
- return -1;
- }
-
- // register application
- if(options.ApplicationId)
- DLT_REGISTER_APP (options.ApplicationId, "DBus Logging");
- else
- DLT_REGISTER_APP (config.ApplicationId, "DBus Logging");
-
- // register context
- DLT_REGISTER_CONTEXT_LL_TS(dbusContext, config.DBus.ContextId, "DBus Context for Logging",DLT_LOG_INFO,DLT_TRACE_STATUS_ON);
- DLT_REGISTER_CONTEXT(dbusLog, "Log", "DBus Context for Logging Generic information");
-
- // initialise error handler
- dbus_error_init (&error);
-
- // set DBus bus type
- if(options.BusType)
- type = (DBusBusType) atoi(options.BusType);
- else
- type = (DBusBusType) atoi(config.DBus.BusType);
-
- // get connection
- connection = dbus_bus_get (type, &error);
-
- if(type==0)
- DLT_LOG(dbusLog,DLT_LOG_INFO,DLT_STRING("BusType"),DLT_STRING("Session Bus"));
- else if(type==1)
- DLT_LOG(dbusLog,DLT_LOG_INFO,DLT_STRING("BusType"),DLT_STRING("System Bus"));
- else
- DLT_LOG(dbusLog,DLT_LOG_INFO,DLT_STRING("BusType"),DLT_INT(type));
-
- if (NULL == connection)
- {
- fprintf (stderr, "Failed to open connection to %d: %s\n",
- DBUS_BUS_SYSTEM,
- error.message);
- dbus_error_free (&error);
- exit (1);
- }
-
- for(num=0;num<config.DBus.FilterCount;num++)
- {
- dbus_bus_add_match (connection,
- config.DBus.FilterMatch[num],
- &error);
- printf("Added FilterMatch: %s\n",config.DBus.FilterMatch[num]);
- DLT_LOG(dbusLog,DLT_LOG_INFO,DLT_STRING("FilterMatch"),DLT_UINT(num+1),DLT_STRING(config.DBus.FilterMatch[num]));
- if (dbus_error_is_set (&error))
- goto fail;
- }
-
- if (!dbus_connection_add_filter (connection, filter_func, NULL, NULL)) {
- fprintf (stderr, "Couldn't add filter!\n");
- exit (1);
- }
-
- while (dbus_connection_read_write_dispatch(connection, -1))
- ;
-
- DLT_UNREGISTER_CONTEXT (dbusContext);
- DLT_UNREGISTER_CONTEXT (dbusLog);
- DLT_UNREGISTER_APP ();
- exit(1);
+ DltDBusCliOptions options;
+ DltDBusConfiguration config;
+
+ DBusConnection *connection;
+ DBusError error;
+ DBusBusType type;
+
+ int num;
+
+ if(read_command_line(&options, argc, argv) < 0)
+ {
+ fprintf(stderr, "Failed to read command line!\n");
+ return -1;
+ }
+
+ if(read_configuration_file(&config, options.ConfigurationFileName) < 0)
+ {
+ fprintf(stderr, "Failed to read configuration file!\n");
+ return -1;
+ }
+
+ // register application
+ if(options.ApplicationId)
+ DLT_REGISTER_APP (options.ApplicationId, "DBus Logging");
+ else
+ DLT_REGISTER_APP (config.ApplicationId, "DBus Logging");
+
+ // register context
+ DLT_REGISTER_CONTEXT_LL_TS(dbusContext, config.DBus.ContextId, "DBus Context for Logging",DLT_LOG_INFO,DLT_TRACE_STATUS_ON);
+ DLT_REGISTER_CONTEXT(dbusLog, "Log", "DBus Context for Logging Generic information");
+
+ // initialise error handler
+ dbus_error_init (&error);
+
+ // set DBus bus type
+ if(options.BusType)
+ type = (DBusBusType) atoi(options.BusType);
+ else
+ type = (DBusBusType) atoi(config.DBus.BusType);
+
+ // get connection
+ connection = dbus_bus_get (type, &error);
+
+ if(type==0)
+ DLT_LOG(dbusLog,DLT_LOG_INFO,DLT_STRING("BusType"),DLT_STRING("Session Bus"));
+ else if(type==1)
+ DLT_LOG(dbusLog,DLT_LOG_INFO,DLT_STRING("BusType"),DLT_STRING("System Bus"));
+ else
+ DLT_LOG(dbusLog,DLT_LOG_INFO,DLT_STRING("BusType"),DLT_INT(type));
+
+ if (NULL == connection)
+ {
+ fprintf (stderr, "Failed to open connection to %d: %s\n",
+ DBUS_BUS_SYSTEM,
+ error.message);
+ dbus_error_free (&error);
+ exit (1);
+ }
+
+ for(num=0;num<config.DBus.FilterCount;num++)
+ {
+ dbus_bus_add_match (connection,
+ config.DBus.FilterMatch[num],
+ &error);
+ printf("Added FilterMatch: %s\n",config.DBus.FilterMatch[num]);
+ DLT_LOG(dbusLog,DLT_LOG_INFO,DLT_STRING("FilterMatch"),DLT_UINT(num+1),DLT_STRING(config.DBus.FilterMatch[num]));
+ if (dbus_error_is_set (&error))
+ goto fail;
+ }
+
+ if (!dbus_connection_add_filter (connection, filter_func, NULL, NULL)) {
+ fprintf (stderr, "Couldn't add filter!\n");
+ exit (1);
+ }
+
+ while (dbus_connection_read_write_dispatch(connection, -1))
+ ;
+
+ DLT_UNREGISTER_CONTEXT (dbusContext);
+ DLT_UNREGISTER_CONTEXT (dbusLog);
+ DLT_UNREGISTER_APP ();
+ exit(1);
fail:
- /* fail */
- fprintf (stderr, "Error: %s\n", error.message);
- DLT_UNREGISTER_CONTEXT (dbusContext);
- DLT_UNREGISTER_CONTEXT (dbusLog);
- DLT_UNREGISTER_APP ();
- exit(1);
+ /* fail */
+ fprintf (stderr, "Error: %s\n", error.message);
+ DLT_UNREGISTER_CONTEXT (dbusContext);
+ DLT_UNREGISTER_CONTEXT (dbusLog);
+ DLT_UNREGISTER_APP ();
+ exit(1);
}
diff --git a/src/dbus/dlt-dbus.h b/src/dbus/dlt-dbus.h
index 13ace05..50a26e8 100644
--- a/src/dbus/dlt-dbus.h
+++ b/src/dbus/dlt-dbus.h
@@ -38,30 +38,30 @@
// Macros
#define UNUSED(x) (void)(x)
#define MALLOC_ASSERT(x) if(x == NULL) {\
- fprintf(stderr, "Out of memory\n");\
- abort();}
+ fprintf(stderr, "Out of memory\n");\
+ abort();}
#define MAX_LINE 1024
// Command line options
typedef struct {
- char *ConfigurationFileName;
- char *ApplicationId;
- char *BusType;
- int Daemonize;
+ char *ConfigurationFileName;
+ char *ApplicationId;
+ char *BusType;
+ int Daemonize;
} DltDBusCliOptions;
// Configuration dbus options
typedef struct {
- char *ContextId;
- char *BusType;
- int FilterCount;
- char *FilterMatch[DLT_DBUS_FILTER_MAX];
+ char *ContextId;
+ char *BusType;
+ int FilterCount;
+ char *FilterMatch[DLT_DBUS_FILTER_MAX];
} DBusOptions;
typedef struct {
- char *ApplicationId;
- DBusOptions DBus;
+ char *ApplicationId;
+ DBusOptions DBus;
} DltDBusConfiguration;
diff --git a/src/examples/dlt-example-filetransfer.c b/src/examples/dlt-example-filetransfer.c
index a56e09d..4fc10e2 100644
--- a/src/examples/dlt-example-filetransfer.c
+++ b/src/examples/dlt-example-filetransfer.c
@@ -58,8 +58,8 @@
#include <stdio.h>
#include <ctype.h>
-#include <dlt_filetransfer.h> /*Needed for transferring files with the dlt protocol*/
-#include <dlt.h> /*Needed for dlt logging*/
+#include <dlt_filetransfer.h> /*Needed for transferring files with the dlt protocol*/
+#include <dlt.h> /*Needed for dlt logging*/
#define MAXSTRLEN 1024
@@ -81,9 +81,9 @@ DLT_DECLARE_CONTEXT(fileContext);
*/
void usage()
{
- char version[255];
+ char version[255];
- dlt_get_version(version,255);
+ dlt_get_version(version,255);
printf("Usage: dlt-example-filetransfer [options] absolute-path-to-file\n");
printf("Simple filetransfer example");
@@ -102,7 +102,7 @@ void usage()
//!Main program dlt-test-filestransfer starts here
int main(int argc, char* argv[])
{
- //char str[MAXSTRLEN];
+ //char str[MAXSTRLEN];
int opt, timeout;
char apid[DLT_ID_SIZE];
@@ -110,19 +110,19 @@ int main(int argc, char* argv[])
//char version[255];
int index;
- int dflag = 0;
- int iflag = 0;
- char *file = 0;
- char *tvalue = 0;
+ int dflag = 0;
+ int iflag = 0;
+ char *file = 0;
+ char *tvalue = 0;
dlt_set_id(apid, FLTR_APP);
dlt_set_id(ctid, FLTR_CONTEXT);
- while ((opt = getopt(argc, argv, "idf:t:a:c:h")) != -1)
+ while ((opt = getopt(argc, argv, "idf:t:a:c:h")) != -1)
{
switch (opt)
{
- case 'd':
+ case 'd':
{
dflag = 1;
break;
@@ -173,21 +173,21 @@ int main(int argc, char* argv[])
}
}
- for (index = optind; index < argc; index++)
- {
- file = argv[index];
- }
+ for (index = optind; index < argc; index++)
+ {
+ file = argv[index];
+ }
- if (file == 0)
- {
- /* no message, show usage and terminate */
- fprintf(stderr,"ERROR: No absolute path to file specified\n");
- usage();
- return -1;
- }
+ if (file == 0)
+ {
+ /* no message, show usage and terminate */
+ fprintf(stderr,"ERROR: No absolute path to file specified\n");
+ usage();
+ return -1;
+ }
- if (tvalue)
+ if (tvalue)
{
timeout = atoi(tvalue);
}
@@ -196,27 +196,27 @@ int main(int argc, char* argv[])
timeout = TIMEOUT;
}
- //Register the application at the dlt-daemon
- DLT_REGISTER_APP(apid,FLTR_APP_DESC);
+ //Register the application at the dlt-daemon
+ DLT_REGISTER_APP(apid,FLTR_APP_DESC);
- //Register the context of the main program at the dlt-daemon
- DLT_REGISTER_CONTEXT(fileContext,ctid,FLTR_CONTEXT_DESC);
+ //Register the context of the main program at the dlt-daemon
+ DLT_REGISTER_CONTEXT(fileContext,ctid,FLTR_CONTEXT_DESC);
- //More details in corresponding methods
- if( iflag )
- {
- dlt_user_log_file_infoAbout(&fileContext,file);
- }
+ //More details in corresponding methods
+ if( iflag )
+ {
+ dlt_user_log_file_infoAbout(&fileContext,file);
+ }
- if( dlt_user_log_file_complete(&fileContext,file,dflag,timeout) < 0 )
- {
- printf("File couldn't be transferred. Please check the dlt log messages.\n");
- }
+ if( dlt_user_log_file_complete(&fileContext,file,dflag,timeout) < 0 )
+ {
+ printf("File couldn't be transferred. Please check the dlt log messages.\n");
+ }
- //Unregister the context in which the file transfer happened from the dlt-daemon
- DLT_UNREGISTER_CONTEXT(fileContext);
- //Unregister the context of the main program from the dlt-daemon
- DLT_UNREGISTER_APP();
+ //Unregister the context in which the file transfer happened from the dlt-daemon
+ DLT_UNREGISTER_CONTEXT(fileContext);
+ //Unregister the context of the main program from the dlt-daemon
+ DLT_UNREGISTER_APP();
- return 0;
+ return 0;
}
diff --git a/src/examples/dlt-example-user-common-api.c b/src/examples/dlt-example-user-common-api.c
index dba4897..ee6370c 100644
--- a/src/examples/dlt-example-user-common-api.c
+++ b/src/examples/dlt-example-user-common-api.c
@@ -85,9 +85,9 @@ void usage()
printf(" -a Enable local printing of DLT messages (Default: disabled)\n");
printf(" -m mode Set log mode 0=off,1=external,2=internal,3=both\n");
#ifdef DLT_TEST_ENABLE
- printf(" -c Corrupt user header\n");
+ printf(" -c Corrupt user header\n");
printf(" -s size Corrupt message size\n");
- printf(" -z size Size of message\n");
+ printf(" -z size Size of message\n");
#endif /* DLT_TEST_ENABLE */
}
@@ -109,11 +109,11 @@ int main(int argc, char* argv[])
int index;
int c;
- char *text;
- int num,maxnum;
- int delay;
+ char *text;
+ int num,maxnum;
+ int delay;
- int state=-1,newstate;
+ int state=-1,newstate;
opterr = 0;
#ifdef DLT_TEST_ENABLE
@@ -207,7 +207,7 @@ int main(int argc, char* argv[])
}
else
{
- maxnum = 10;
+ maxnum = 10;
}
if (dvalue)
@@ -232,44 +232,44 @@ int main(int argc, char* argv[])
#ifdef DLT_TEST_ENABLE
if (cflag)
{
- dlt_user_test_corrupt_user_header(1);
+ dlt_user_test_corrupt_user_header(1);
}
if (svalue)
{
- dlt_user_test_corrupt_message_size(1,atoi(svalue));
+ dlt_user_test_corrupt_message_size(1,atoi(svalue));
}
- if (zvalue)
- {
- char* buffer = malloc(atoi(zvalue));
- if(buffer==0)
- {
- /* no message, show usage and terminate */
- fprintf(stderr,"Cannot allocate buffer memory!\n");
- return -1;
- }
+ if (zvalue)
+ {
+ char* buffer = malloc(atoi(zvalue));
+ if(buffer==0)
+ {
+ /* no message, show usage and terminate */
+ fprintf(stderr,"Cannot allocate buffer memory!\n");
+ return -1;
+ }
DLT_LOG2(mycontext,DLT_LOG_WARN,DLT_STRING(text),DLT_RAW(buffer,atoi(zvalue)));
- free(buffer);
- }
+ free(buffer);
+ }
#endif /* DLT_TEST_ENABLE */
for (num=0;num<maxnum;num++)
{
printf("Send %d %s\n",num,text);
- newstate = dlt_get_log_state();
- if(state!=newstate)
- {
- state = newstate;
- if(state == -1) {
- printf("Client unknown state!\n");
- }
- else if(state == 0) {
- printf("Client disconnected!\n");
- }
- else if(state == 1) {
- printf("Client connected!\n");
- }
- }
+ newstate = dlt_get_log_state();
+ if(state!=newstate)
+ {
+ state = newstate;
+ if(state == -1) {
+ printf("Client unknown state!\n");
+ }
+ else if(state == 0) {
+ printf("Client disconnected!\n");
+ }
+ else if(state == 1) {
+ printf("Client connected!\n");
+ }
+ }
if (gflag)
{
diff --git a/src/examples/dlt-example-user-func.c b/src/examples/dlt-example-user-func.c
index 777f340..68b3397 100644
--- a/src/examples/dlt-example-user-func.c
+++ b/src/examples/dlt-example-user-func.c
@@ -116,8 +116,8 @@ int main(int argc, char* argv[])
int index;
int c;
char *text;
- int num,maxnum;
- int delay;
+ int num,maxnum;
+ int delay;
opterr = 0;
@@ -223,7 +223,7 @@ int main(int argc, char* argv[])
}
else
{
- maxnum = 10;
+ maxnum = 10;
}
if (dvalue)
@@ -235,35 +235,35 @@ int main(int argc, char* argv[])
delay = 500 * 1000;
}
- if (gflag)
+ if (gflag)
{
/* DLT messages to test Fibex non-verbose description: dlt-example-non-verbose.xml */
- if (dlt_user_log_write_start_id(&mycontext,&mycontextdata,DLT_LOG_INFO,10)>0)
- {
- dlt_user_log_write_finish(&mycontextdata);
- }
- if (dlt_user_log_write_start_id(&mycontext,&mycontextdata,DLT_LOG_INFO,11)>0)
- {
- dlt_user_log_write_uint16(&mycontextdata,1011);
- dlt_user_log_write_finish(&mycontextdata);
- }
- if (dlt_user_log_write_start_id(&mycontext,&mycontextdata,DLT_LOG_INFO,12)>0)
- {
- dlt_user_log_write_uint32(&mycontextdata,1012);
- dlt_user_log_write_uint32(&mycontextdata,1013);
- dlt_user_log_write_finish(&mycontextdata);
- }
- if (dlt_user_log_write_start_id(&mycontext,&mycontextdata,DLT_LOG_INFO,13)>0)
- {
- dlt_user_log_write_uint8(&mycontextdata,123);
- dlt_user_log_write_float32(&mycontextdata,1.12);
- dlt_user_log_write_finish(&mycontextdata);
- }
- if (dlt_user_log_write_start_id(&mycontext,&mycontextdata,DLT_LOG_INFO,14)>0)
- {
- dlt_user_log_write_string(&mycontextdata,"DEAD BEEF");
- dlt_user_log_write_finish(&mycontextdata);
- }
+ if (dlt_user_log_write_start_id(&mycontext,&mycontextdata,DLT_LOG_INFO,10)>0)
+ {
+ dlt_user_log_write_finish(&mycontextdata);
+ }
+ if (dlt_user_log_write_start_id(&mycontext,&mycontextdata,DLT_LOG_INFO,11)>0)
+ {
+ dlt_user_log_write_uint16(&mycontextdata,1011);
+ dlt_user_log_write_finish(&mycontextdata);
+ }
+ if (dlt_user_log_write_start_id(&mycontext,&mycontextdata,DLT_LOG_INFO,12)>0)
+ {
+ dlt_user_log_write_uint32(&mycontextdata,1012);
+ dlt_user_log_write_uint32(&mycontextdata,1013);
+ dlt_user_log_write_finish(&mycontextdata);
+ }
+ if (dlt_user_log_write_start_id(&mycontext,&mycontextdata,DLT_LOG_INFO,13)>0)
+ {
+ dlt_user_log_write_uint8(&mycontextdata,123);
+ dlt_user_log_write_float32(&mycontextdata,1.12);
+ dlt_user_log_write_finish(&mycontextdata);
+ }
+ if (dlt_user_log_write_start_id(&mycontext,&mycontextdata,DLT_LOG_INFO,14)>0)
+ {
+ dlt_user_log_write_string(&mycontextdata,"DEAD BEEF");
+ dlt_user_log_write_finish(&mycontextdata);
+ }
}
for (num=0;num<maxnum;num++)
diff --git a/src/examples/dlt-example-user.c b/src/examples/dlt-example-user.c
index 5822fde..3479ee8 100644
--- a/src/examples/dlt-example-user.c
+++ b/src/examples/dlt-example-user.c
@@ -106,7 +106,7 @@ void usage()
#ifdef DLT_TEST_ENABLE
printf(" -c Corrupt user header\n");
printf(" -s size Corrupt message size\n");
- printf(" -z size Size of message\n");
+ printf(" -z size Size of message\n");
#endif /* DLT_TEST_ENABLE */
}
@@ -134,11 +134,11 @@ int main(int argc, char* argv[])
int index;
int c;
- char *text;
- int num,maxnum;
- int delay;
+ char *text;
+ int num,maxnum;
+ int delay;
- int state=-1,newstate;
+ int state=-1,newstate;
opterr = 0;
#ifdef DLT_TEST_ENABLE
@@ -273,11 +273,11 @@ int main(int argc, char* argv[])
text = message;
- if(mvalue)
- {
+ if(mvalue)
+ {
printf("Set log mode to %d\n",atoi(mvalue));
- dlt_set_log_mode(atoi(mvalue));
- }
+ dlt_set_log_mode(atoi(mvalue));
+ }
if (gflag)
@@ -292,7 +292,7 @@ int main(int argc, char* argv[])
if (kflag)
{
- DLT_LOG_MARKER();
+ DLT_LOG_MARKER();
}
if (nvalue)
@@ -301,7 +301,7 @@ int main(int argc, char* argv[])
}
else
{
- maxnum = 10;
+ maxnum = 10;
}
if (dvalue)
@@ -331,44 +331,44 @@ int main(int argc, char* argv[])
#ifdef DLT_TEST_ENABLE
if (cflag)
{
- dlt_user_test_corrupt_user_header(1);
+ dlt_user_test_corrupt_user_header(1);
}
if (svalue)
{
- dlt_user_test_corrupt_message_size(1,atoi(svalue));
+ dlt_user_test_corrupt_message_size(1,atoi(svalue));
+ }
+ if (zvalue)
+ {
+ char* buffer = malloc(atoi(zvalue));
+ if(buffer==0)
+ {
+ /* no message, show usage and terminate */
+ fprintf(stderr,"Cannot allocate buffer memory!\n");
+ return -1;
+ }
+ DLT_LOG(mycontext,DLT_LOG_WARN,DLT_STRING(text),DLT_RAW(buffer,atoi(zvalue)));
+ free(buffer);
}
- if (zvalue)
- {
- char* buffer = malloc(atoi(zvalue));
- if(buffer==0)
- {
- /* no message, show usage and terminate */
- fprintf(stderr,"Cannot allocate buffer memory!\n");
- return -1;
- }
- DLT_LOG(mycontext,DLT_LOG_WARN,DLT_STRING(text),DLT_RAW(buffer,atoi(zvalue)));
- free(buffer);
- }
#endif /* DLT_TEST_ENABLE */
for (num=0;num<maxnum;num++)
{
printf("Send %d %s\n",num,text);
- newstate = dlt_get_log_state();
- if(state!=newstate)
- {
- state = newstate;
- if(state == -1) {
- printf("Client unknown state!\n");
- }
- else if(state == 0) {
- printf("Client disconnected!\n");
- }
- else if(state == 1) {
- printf("Client connected!\n");
- }
- }
+ newstate = dlt_get_log_state();
+ if(state!=newstate)
+ {
+ state = newstate;
+ if(state == -1) {
+ printf("Client unknown state!\n");
+ }
+ else if(state == 0) {
+ printf("Client disconnected!\n");
+ }
+ else if(state == 1) {
+ printf("Client connected!\n");
+ }
+ }
if (gflag)
{
@@ -414,10 +414,10 @@ int dlt_user_injection_callback(uint32_t service_id, void *data, uint32_t length
void dlt_user_log_level_changed_callback(char context_id[DLT_ID_SIZE],uint8_t log_level,uint8_t trace_status)
{
- char text[5];
- text[4]=0;
+ char text[5];
+ text[4]=0;
- memcpy(text,context_id,DLT_ID_SIZE);
+ memcpy(text,context_id,DLT_ID_SIZE);
printf("Log level changed of context %s, LogLevel=%u, TraceState=%u \n",text,log_level,trace_status);
}
diff --git a/src/lib/dlt_client.c b/src/lib/dlt_client.c
index b77556d..186a984 100644
--- a/src/lib/dlt_client.c
+++ b/src/lib/dlt_client.c
@@ -104,29 +104,25 @@ void dlt_client_register_message_callback(int (*registerd_callback) (DltMessage
message_callback_function = registerd_callback;
}
-int dlt_client_init(DltClient *client, int verbose)
+DltReturnValue dlt_client_init(DltClient *client, int verbose)
{
if (verbose)
- {
- printf("Init dlt client struct\n");
- }
+ printf("Init dlt client struct\n");
- if (client==0)
- {
- return -1;
- }
+ if (client == NULL)
+ return DLT_RETURN_ERROR;
- client->sock=-1;
- client->servIP=0;
- client->serialDevice=0;
- client->baudrate=DLT_CLIENT_INITIAL_BAUDRATE;
- client->serial_mode=0;
- client->receiver.buffer=0;
+ client->sock = -1;
+ client->servIP = 0;
+ client->serialDevice = 0;
+ client->baudrate = DLT_CLIENT_INITIAL_BAUDRATE;
+ client->serial_mode = 0;
+ client->receiver.buffer = 0;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_client_connect(DltClient *client, int verbose)
+DltReturnValue dlt_client_connect(DltClient *client, int verbose)
{
char portnumbuffer[33];
struct addrinfo hints, *servinfo, *p;
@@ -139,7 +135,7 @@ int dlt_client_connect(DltClient *client, int verbose)
if (client==0)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* the port may be specified by an environment variable */
@@ -158,7 +154,7 @@ int dlt_client_connect(DltClient *client, int verbose)
snprintf(portnumbuffer, 32, "%d", servPort);
if ((rv = getaddrinfo(client->servIP, portnumbuffer, &hints, &servinfo)) != 0) {
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
- return -1;
+ return DLT_RETURN_ERROR;
}
for(p = servinfo; p != NULL; p = p->ai_next) {
@@ -179,13 +175,13 @@ int dlt_client_connect(DltClient *client, int verbose)
if (p == NULL) {
fprintf(stderr, "ERROR: failed to connect - %s\n", str);
- return -1;
+ return DLT_RETURN_ERROR;
}
if (verbose)
- {
- printf("Connected to DLT daemon (%s)\n",client->servIP);
- }
+ {
+ printf("Connected to DLT daemon (%s)\n",client->servIP);
+ }
}
else
{
@@ -194,55 +190,55 @@ int dlt_client_connect(DltClient *client, int verbose)
if (client->sock<0)
{
fprintf(stderr,"ERROR: Failed to open device %s\n", client->serialDevice);
- return -1;
+ return DLT_RETURN_ERROR;
}
if (isatty(client->sock))
{
- #if !defined (__WIN32__)
- if (dlt_setup_serial(client->sock,client->baudrate)<0)
+ #if !defined (__WIN32__)
+ if (dlt_setup_serial(client->sock,client->baudrate) < DLT_RETURN_OK)
{
fprintf(stderr,"ERROR: Failed to configure serial device %s (%s) \n", client->serialDevice, strerror(errno));
- return -1;
+ return DLT_RETURN_ERROR;
}
- #else
- return -1;
- #endif
+ #else
+ return DLT_RETURN_ERROR;
+ #endif
}
else
{
if (verbose)
{
- fprintf(stderr,"ERROR: Device is not a serial device, device = %s (%s) \n", client->serialDevice, strerror(errno));
+ fprintf(stderr,"ERROR: Device is not a serial device, device = %s (%s) \n", client->serialDevice, strerror(errno));
}
- return -1;
+ return DLT_RETURN_ERROR;
}
if (verbose)
{
- printf("Connected to %s\n", client->serialDevice);
+ printf("Connected to %s\n", client->serialDevice);
}
}
- if (dlt_receiver_init(&(client->receiver),client->sock,DLT_CLIENT_RCVBUFSIZE)!=0)
+ if (dlt_receiver_init(&(client->receiver),client->sock,DLT_CLIENT_RCVBUFSIZE) != DLT_RETURN_OK)
{
fprintf(stderr, "ERROR initializing receiver\n");
- return -1;
+ return DLT_RETURN_ERROR;
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_client_cleanup(DltClient *client, int verbose)
+DltReturnValue dlt_client_cleanup(DltClient *client, int verbose)
{
if (verbose)
- {
- printf("Cleanup dlt client\n");
- }
+ {
+ printf("Cleanup dlt client\n");
+ }
if (client==0)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (client->sock!=-1)
@@ -250,27 +246,27 @@ int dlt_client_cleanup(DltClient *client, int verbose)
close(client->sock);
}
- if (dlt_receiver_free(&(client->receiver))==-1)
+ if (dlt_receiver_free(&(client->receiver)) == DLT_RETURN_ERROR)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_client_main_loop(DltClient *client, void *data, int verbose)
+DltReturnValue dlt_client_main_loop(DltClient *client, void *data, int verbose)
{
- DltMessage msg;
+ DltMessage msg;
int ret;
- if (client==0)
- {
- return -1;
- }
+ if (client==0)
+ {
+ return DLT_RETURN_ERROR;
+ }
- if (dlt_message_init(&msg,verbose)==-1)
+ if (dlt_message_init(&msg,verbose) == DLT_RETURN_ERROR)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
while (1)
@@ -289,15 +285,15 @@ int dlt_client_main_loop(DltClient *client, void *data, int verbose)
if (ret<=0)
{
/* No more data to be received */
- if (dlt_message_free(&msg,verbose)==-1)
+ if (dlt_message_free(&msg,verbose) == DLT_RETURN_ERROR)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- return 1;
+ return DLT_RETURN_TRUE;
}
- while (dlt_message_read(&msg,(unsigned char*)(client->receiver.buf),client->receiver.bytesRcvd,0,verbose)==DLT_MESSAGE_ERROR_OK)
+ while (dlt_message_read(&msg,(unsigned char*)(client->receiver.buf),client->receiver.bytesRcvd,0,verbose) == DLT_MESSAGE_ERROR_OK)
{
/* Call callback function */
if (message_callback_function)
@@ -307,121 +303,121 @@ int dlt_client_main_loop(DltClient *client, void *data, int verbose)
if (msg.found_serialheader)
{
- if (dlt_receiver_remove(&(client->receiver),msg.headersize+msg.datasize-sizeof(DltStorageHeader)+sizeof(dltSerialHeader))==-1)
+ if (dlt_receiver_remove(&(client->receiver),msg.headersize+msg.datasize-sizeof(DltStorageHeader)+sizeof(dltSerialHeader)) == DLT_RETURN_ERROR)
{
- /* Return value ignored */
- dlt_message_free(&msg,verbose);
- return -1;
+ /* Return value ignored */
+ dlt_message_free(&msg,verbose);
+ return DLT_RETURN_ERROR;
}
}
else
{
- if (dlt_receiver_remove(&(client->receiver),msg.headersize+msg.datasize-sizeof(DltStorageHeader))==-1)
+ if (dlt_receiver_remove(&(client->receiver),msg.headersize+msg.datasize-sizeof(DltStorageHeader)) == DLT_RETURN_ERROR)
{
- /* Return value ignored */
- dlt_message_free(&msg,verbose);
- return -1;
+ /* Return value ignored */
+ dlt_message_free(&msg,verbose);
+ return DLT_RETURN_ERROR;
}
}
}
- if (dlt_receiver_move_to_begin(&(client->receiver))==-1)
- {
- /* Return value ignored */
- dlt_message_free(&msg,verbose);
- return -1;
- }
+ if (dlt_receiver_move_to_begin(&(client->receiver)) == DLT_RETURN_ERROR)
+ {
+ /* Return value ignored */
+ dlt_message_free(&msg,verbose);
+ return DLT_RETURN_ERROR;
+ }
}
- if (dlt_message_free(&msg,verbose)==-1)
+ if (dlt_message_free(&msg,verbose) == DLT_RETURN_ERROR)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
- DltMessage msg;
+ DltMessage msg;
int ret;
- int32_t len;
-
- if ((client==0) || (client->sock<0) || (apid==0) || (ctid==0))
- {
- return -1;
- }
-
- /* initialise new message */
- if (dlt_message_init(&msg,0)==-1)
- {
- return -1;
- }
-
- /* prepare payload of data */
- msg.datasize = size;
- if (msg.databuffer && (msg.databuffersize < msg.datasize))
- {
- free(msg.databuffer);
- msg.databuffer=0;
- }
- if (msg.databuffer == 0){
- msg.databuffer = (uint8_t *) malloc(msg.datasize);
- msg.databuffersize = msg.datasize;
- }
- if(msg.databuffer == 0)
- {
- dlt_message_free(&msg,0);
- return -1;
- }
-
- /* copy data */
- memcpy(msg.databuffer,payload,size);
-
- /* prepare storage header */
+ int32_t len;
+
+ if ((client==0) || (client->sock<0) || (apid==0) || (ctid==0))
+ {
+ return DLT_RETURN_ERROR;
+ }
+
+ /* initialise new message */
+ if (dlt_message_init(&msg,0) == DLT_RETURN_ERROR)
+ {
+ return DLT_RETURN_ERROR;
+ }
+
+ /* prepare payload of data */
+ msg.datasize = size;
+ if (msg.databuffer && (msg.databuffersize < msg.datasize))
+ {
+ free(msg.databuffer);
+ msg.databuffer=0;
+ }
+ if (msg.databuffer == 0){
+ msg.databuffer = (uint8_t *) malloc(msg.datasize);
+ msg.databuffersize = msg.datasize;
+ }
+ if(msg.databuffer == 0)
+ {
+ dlt_message_free(&msg,0);
+ return DLT_RETURN_ERROR;
+ }
+
+ /* copy data */
+ memcpy(msg.databuffer,payload,size);
+
+ /* prepare storage header */
msg.storageheader = (DltStorageHeader*)msg.headerbuffer;
- if (dlt_set_storageheader(msg.storageheader,"")==-1)
- {
- dlt_message_free(&msg,0);
- return -1;
- }
+ if (dlt_set_storageheader(msg.storageheader,"") == DLT_RETURN_ERROR)
+ {
+ dlt_message_free(&msg,0);
+ return DLT_RETURN_ERROR;
+ }
/* prepare standard header */
msg.standardheader = (DltStandardHeader*)(msg.headerbuffer + sizeof(DltStorageHeader));
msg.standardheader->htyp = DLT_HTYP_WEID | DLT_HTYP_WTMS | DLT_HTYP_UEH | DLT_HTYP_PROTOCOL_VERSION1 ;
- #if (BYTE_ORDER==BIG_ENDIAN)
- msg.standardheader->htyp = (msg.standardheader->htyp | DLT_HTYP_MSBF);
- #endif
+ #if (BYTE_ORDER==BIG_ENDIAN)
+ msg.standardheader->htyp = (msg.standardheader->htyp | DLT_HTYP_MSBF);
+ #endif
msg.standardheader->mcnt = 0;
/* Set header extra parameters */
- dlt_set_id(msg.headerextra.ecu,"");
+ dlt_set_id(msg.headerextra.ecu,"");
//msg.headerextra.seid = 0;
msg.headerextra.tmsp = dlt_uptime();
/* Copy header extra parameters to headerbuffer */
- if (dlt_message_set_extraparameters(&msg,0)==-1)
- {
- dlt_message_free(&msg,0);
- return -1;
- }
+ if (dlt_message_set_extraparameters(&msg,0) == DLT_RETURN_ERROR)
+ {
+ dlt_message_free(&msg,0);
+ return DLT_RETURN_ERROR;
+ }
/* prepare extended header */
msg.extendedheader = (DltExtendedHeader*)(msg.headerbuffer +
- sizeof(DltStorageHeader) +
- sizeof(DltStandardHeader) +
- DLT_STANDARD_HEADER_EXTRA_SIZE(msg.standardheader->htyp) );
+ sizeof(DltStorageHeader) +
+ sizeof(DltStandardHeader) +
+ DLT_STANDARD_HEADER_EXTRA_SIZE(msg.standardheader->htyp) );
msg.extendedheader->msin = DLT_MSIN_CONTROL_REQUEST;
msg.extendedheader->noar = 1; /* number of arguments */
dlt_set_id(msg.extendedheader->apid,(apid[0]=='\0')?DLT_CLIENT_DUMMY_APP_ID:apid);
- dlt_set_id(msg.extendedheader->ctid,(ctid[0]=='\0')?DLT_CLIENT_DUMMY_CON_ID:ctid);
+ dlt_set_id(msg.extendedheader->ctid,(ctid[0]=='\0')?DLT_CLIENT_DUMMY_CON_ID:ctid);
/* prepare length information */
msg.headersize = sizeof(DltStorageHeader) +
@@ -429,271 +425,272 @@ int dlt_client_send_ctrl_msg(DltClient *client, char *apid, char *ctid, uint8_t
sizeof(DltExtendedHeader) +
DLT_STANDARD_HEADER_EXTRA_SIZE(msg.standardheader->htyp);
- len=msg.headersize - sizeof(DltStorageHeader) + msg.datasize;
- if (len>UINT16_MAX)
- {
- fprintf(stderr,"Critical: Huge injection message discarded!\n");
- dlt_message_free(&msg,0);
+ len=msg.headersize - sizeof(DltStorageHeader) + msg.datasize;
+ if (len>UINT16_MAX)
+ {
+ fprintf(stderr,"Critical: Huge injection message discarded!\n");
+ dlt_message_free(&msg,0);
- return -1;
- }
+ return DLT_RETURN_ERROR;
+ }
msg.standardheader->len = DLT_HTOBE_16(len);
- /* Send data (without storage header) */
- if (client->serial_mode)
- {
- /* via FileDescriptor */
- ret=write(client->sock, msg.headerbuffer+sizeof(DltStorageHeader),msg.headersize-sizeof(DltStorageHeader));
+ /* Send data (without storage header) */
+ if (client->serial_mode)
+ {
+ /* via FileDescriptor */
+ ret=write(client->sock, msg.headerbuffer+sizeof(DltStorageHeader),msg.headersize-sizeof(DltStorageHeader));
if (0 > ret){
dlt_message_free(&msg,0);
- return -1;
+ return DLT_RETURN_ERROR;
}
- ret=write(client->sock, msg.databuffer,msg.datasize);
+ ret=write(client->sock, msg.databuffer,msg.datasize);
if (0 > ret){
dlt_message_free(&msg,0);
- return -1;
+ return DLT_RETURN_ERROR;
}
- }
- else
- {
- /* via Socket */
- send(client->sock, (const char *)(msg.headerbuffer+sizeof(DltStorageHeader)),msg.headersize-sizeof(DltStorageHeader),0);
- send(client->sock, (const char *)msg.databuffer,msg.datasize,0);
- }
-
- /* free message */
- if (dlt_message_free(&msg,0)==-1)
- {
- return -1;
- }
-
- return 0;
+ }
+ else
+ {
+ /* via Socket */
+ send(client->sock, (const char *)(msg.headerbuffer+sizeof(DltStorageHeader)),msg.headersize-sizeof(DltStorageHeader),0);
+ send(client->sock, (const char *)msg.databuffer,msg.datasize,0);
+ }
+
+ /* free message */
+ if (dlt_message_free(&msg,0) == DLT_RETURN_ERROR)
+ {
+ return DLT_RETURN_ERROR;
+ }
+
+ return DLT_RETURN_OK;
}
-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)
{
- uint8_t *payload;
- int offset;
+ uint8_t *payload;
+ int offset;
- payload = (uint8_t *) malloc(sizeof(uint32_t) + sizeof(uint32_t) + size);
+ payload = (uint8_t *) malloc(sizeof(uint32_t) + sizeof(uint32_t) + size);
- if(payload==0)
- {
- return -1;
- }
+ if(payload==0)
+ {
+ return DLT_RETURN_ERROR;
+ }
+
+ offset = 0;
+ memcpy(payload , &serviceID,sizeof(serviceID));
+ offset+=sizeof(uint32_t);
+ memcpy(payload+offset, &size, sizeof(size));
+ offset+=sizeof(uint32_t);
+ memcpy(payload+offset, buffer, size);
- offset = 0;
- memcpy(payload , &serviceID,sizeof(serviceID));
- offset+=sizeof(uint32_t);
- memcpy(payload+offset, &size, sizeof(size));
- offset+=sizeof(uint32_t);
- memcpy(payload+offset, buffer, size);
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,apid,ctid,payload,sizeof(uint32_t) + sizeof(uint32_t) + size) == DLT_RETURN_ERROR)
+ {
+ free(payload);
+ return DLT_RETURN_ERROR;
+ }
- /* free message */
- if (dlt_client_send_ctrl_msg(client,apid,ctid,payload,sizeof(uint32_t) + sizeof(uint32_t) + size)==-1)
- {
- free(payload);
- return -1;
- }
+ free(payload);
- free(payload);
+ return DLT_RETURN_OK;
- return 0;
}
-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)
{
- DltServiceSetLogLevel *req;
- uint8_t *payload;
+ DltServiceSetLogLevel *req;
+ uint8_t *payload;
- payload = (uint8_t *) malloc(sizeof(DltServiceSetLogLevel));
+ payload = (uint8_t *) malloc(sizeof(DltServiceSetLogLevel));
- if(payload==0)
- {
- return -1;
- }
+ if(payload==0)
+ {
+ return DLT_RETURN_ERROR;
+ }
- req = (DltServiceSetLogLevel *) payload;
+ req = (DltServiceSetLogLevel *) payload;
- req->service_id = DLT_SERVICE_ID_SET_LOG_LEVEL;
- dlt_set_id(req->apid,apid);
- dlt_set_id(req->ctid,ctid);
- req->log_level=logLevel;
- dlt_set_id(req->com,"remo");
+ req->service_id = DLT_SERVICE_ID_SET_LOG_LEVEL;
+ dlt_set_id(req->apid,apid);
+ dlt_set_id(req->ctid,ctid);
+ req->log_level=logLevel;
+ dlt_set_id(req->com,"remo");
- /* free message */
- if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetLogLevel))==-1)
- {
- free(payload);
- return -1;
- }
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetLogLevel)) == DLT_RETURN_ERROR)
+ {
+ free(payload);
+ return DLT_RETURN_ERROR;
+ }
- free(payload);
+ free(payload);
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
- DltServiceSetLogLevel *req;
- uint8_t *payload;
+ DltServiceSetLogLevel *req;
+ uint8_t *payload;
- payload = (uint8_t *) malloc(sizeof(DltServiceSetLogLevel));
+ payload = (uint8_t *) malloc(sizeof(DltServiceSetLogLevel));
- if(payload==0)
- {
- return -1;
- }
+ if(payload==0)
+ {
+ return DLT_RETURN_ERROR;
+ }
- req = (DltServiceSetLogLevel *) payload;
+ req = (DltServiceSetLogLevel *) payload;
- req->service_id = DLT_SERVICE_ID_SET_TRACE_STATUS;
- dlt_set_id(req->apid,apid);
- dlt_set_id(req->ctid,ctid);
- req->log_level=traceStatus;
- dlt_set_id(req->com,"remo");
+ req->service_id = DLT_SERVICE_ID_SET_TRACE_STATUS;
+ dlt_set_id(req->apid,apid);
+ dlt_set_id(req->ctid,ctid);
+ req->log_level=traceStatus;
+ dlt_set_id(req->com,"remo");
- /* free message */
- if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetLogLevel))==-1)
- {
- free(payload);
- return -1;
- }
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetLogLevel)) == DLT_RETURN_ERROR)
+ {
+ free(payload);
+ return DLT_RETURN_ERROR;
+ }
- free(payload);
+ free(payload);
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_client_send_default_log_level(DltClient *client, uint8_t defaultLogLevel)
+DltReturnValue dlt_client_send_default_log_level(DltClient *client, uint8_t defaultLogLevel)
{
- DltServiceSetDefaultLogLevel *req;
- uint8_t *payload;
+ DltServiceSetDefaultLogLevel *req;
+ uint8_t *payload;
- payload = (uint8_t *) malloc(sizeof(DltServiceSetDefaultLogLevel));
+ payload = (uint8_t *) malloc(sizeof(DltServiceSetDefaultLogLevel));
- if(payload==0)
- {
- return -1;
- }
+ if(payload==0)
+ {
+ return DLT_RETURN_ERROR;
+ }
- req = (DltServiceSetDefaultLogLevel *) payload;
+ req = (DltServiceSetDefaultLogLevel *) payload;
- req->service_id = DLT_SERVICE_ID_SET_DEFAULT_LOG_LEVEL;
- req->log_level=defaultLogLevel;
- dlt_set_id(req->com,"remo");
+ req->service_id = DLT_SERVICE_ID_SET_DEFAULT_LOG_LEVEL;
+ req->log_level=defaultLogLevel;
+ dlt_set_id(req->com,"remo");
- /* free message */
- if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetDefaultLogLevel))==-1)
- {
- free(payload);
- return -1;
- }
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetDefaultLogLevel)) == DLT_RETURN_ERROR)
+ {
+ free(payload);
+ return DLT_RETURN_ERROR;
+ }
- free(payload);
+ free(payload);
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_client_send_default_trace_status(DltClient *client, uint8_t defaultTraceStatus)
+DltReturnValue dlt_client_send_default_trace_status(DltClient *client, uint8_t defaultTraceStatus)
{
- DltServiceSetDefaultLogLevel *req;
- uint8_t *payload;
+ DltServiceSetDefaultLogLevel *req;
+ uint8_t *payload;
- payload = (uint8_t *) malloc(sizeof(DltServiceSetDefaultLogLevel));
+ payload = (uint8_t *) malloc(sizeof(DltServiceSetDefaultLogLevel));
- if(payload==0)
- {
- return -1;
- }
+ if(payload==0)
+ {
+ return DLT_RETURN_ERROR;
+ }
- req = (DltServiceSetDefaultLogLevel *) payload;
+ req = (DltServiceSetDefaultLogLevel *) payload;
- req->service_id = DLT_SERVICE_ID_SET_DEFAULT_TRACE_STATUS;
- req->log_level=defaultTraceStatus;
- dlt_set_id(req->com,"remo");
+ req->service_id = DLT_SERVICE_ID_SET_DEFAULT_TRACE_STATUS;
+ req->log_level=defaultTraceStatus;
+ dlt_set_id(req->com,"remo");
- /* free message */
- if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetDefaultLogLevel))==-1)
- {
- free(payload);
- return -1;
- }
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetDefaultLogLevel)) == DLT_RETURN_ERROR)
+ {
+ free(payload);
+ return DLT_RETURN_ERROR;
+ }
- free(payload);
+ free(payload);
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_client_send_timing_pakets(DltClient *client, uint8_t timingPakets)
+DltReturnValue dlt_client_send_timing_pakets(DltClient *client, uint8_t timingPakets)
{
- DltServiceSetVerboseMode *req;
- uint8_t *payload;
+ DltServiceSetVerboseMode *req;
+ uint8_t *payload;
- payload = (uint8_t *) malloc(sizeof(DltServiceSetVerboseMode));
+ payload = (uint8_t *) malloc(sizeof(DltServiceSetVerboseMode));
- if(payload==0)
- {
- return -1;
- }
+ if(payload==0)
+ {
+ return DLT_RETURN_ERROR;
+ }
- req = (DltServiceSetVerboseMode *) payload;
+ req = (DltServiceSetVerboseMode *) payload;
- req->service_id = DLT_SERVICE_ID_SET_TIMING_PACKETS;
- req->new_status=timingPakets;
+ req->service_id = DLT_SERVICE_ID_SET_TIMING_PACKETS;
+ req->new_status=timingPakets;
- /* free message */
- if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetVerboseMode))==-1)
- {
- free(payload);
- return -1;
- }
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,"APP","CON",payload,sizeof(DltServiceSetVerboseMode)) == DLT_RETURN_ERROR)
+ {
+ free(payload);
+ return DLT_RETURN_ERROR;
+ }
- free(payload);
+ free(payload);
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_client_send_store_config(DltClient *client)
+DltReturnValue dlt_client_send_store_config(DltClient *client)
{
- uint32_t service_id;
+ uint32_t service_id;
- service_id = DLT_SERVICE_ID_STORE_CONFIG;
+ service_id = DLT_SERVICE_ID_STORE_CONFIG;
- /* free message */
- if (dlt_client_send_ctrl_msg(client,"APP","CON",(uint8_t*)&service_id,sizeof(uint32_t))==-1)
- {
- return -1;
- }
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,"APP","CON",(uint8_t*)&service_id,sizeof(uint32_t)) == DLT_RETURN_ERROR)
+ {
+ return DLT_RETURN_ERROR;
+ }
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_client_send_reset_to_factory_default(DltClient *client)
+DltReturnValue dlt_client_send_reset_to_factory_default(DltClient *client)
{
- uint32_t service_id;
+ uint32_t service_id;
- service_id = DLT_SERVICE_ID_RESET_TO_FACTORY_DEFAULT;
+ service_id = DLT_SERVICE_ID_RESET_TO_FACTORY_DEFAULT;
- /* free message */
- if (dlt_client_send_ctrl_msg(client,"APP","CON",(uint8_t*)&service_id,sizeof(uint32_t))==-1)
- {
- return -1;
- }
+ /* free message */
+ if (dlt_client_send_ctrl_msg(client,"APP","CON",(uint8_t*)&service_id,sizeof(uint32_t)) == DLT_RETURN_ERROR)
+ {
+ return DLT_RETURN_ERROR;
+ }
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_client_setbaudrate(DltClient *client, int baudrate)
+DltReturnValue dlt_client_setbaudrate(DltClient *client, int baudrate)
{
- if (client==0)
- {
- return -1;
- }
+ if (client==0)
+ {
+ return DLT_RETURN_ERROR;
+ }
- client->baudrate = dlt_convert_serial_speed(baudrate);
+ client->baudrate = dlt_convert_serial_speed(baudrate);
- return 0;
+ return DLT_RETURN_OK;
}
diff --git a/src/lib/dlt_filetransfer.c b/src/lib/dlt_filetransfer.c
index 8dc6e8f..13de07c 100644
--- a/src/lib/dlt_filetransfer.c
+++ b/src/lib/dlt_filetransfer.c
@@ -79,7 +79,7 @@ unsigned char buffer[BUFFER_SIZE];
* @return Returns the size of the file (if it is a regular file or a symbolic link) in bytes.
*/
unsigned long getFilesize(const char* file, int *ok){
- struct stat st;
+ struct stat st;
if ( -1 == stat(file, &st))
{
@@ -88,7 +88,7 @@ unsigned long getFilesize(const char* file, int *ok){
return 0;
}
*ok = 1;
- return (unsigned long)st.st_size;
+ return (unsigned long)st.st_size;
}
/** A simple Hash function for C-strings
@@ -122,8 +122,8 @@ void stringHash(const char* str, unsigned long *hash )
* @return Returns a unique number associated with each filename
*/
unsigned long getFileSerialNumber(const char* file, int *ok){
- struct stat st;
- unsigned long ret;
+ struct stat st;
+ unsigned long ret;
if ( -1 == stat(file, &st))
{
*ok = 0;
@@ -138,7 +138,7 @@ unsigned long getFileSerialNumber(const char* file, int *ok){
ret ^= st.st_ctime;
stringHash(file, &ret);
}
- return ret;
+ return ret;
}
//!Returns the creation date of a file
@@ -147,7 +147,7 @@ unsigned long getFileSerialNumber(const char* file, int *ok){
* @return Returns the creation date of a file
*/
time_t getFileCreationDate(const char* file,int *ok){
- struct stat st;
+ struct stat st;
if (-1 == stat(file, &st))
{
*ok = 0;
@@ -163,15 +163,15 @@ time_t getFileCreationDate(const char* file,int *ok){
* @return Returns the creation date of a file
*/
char* getFileCreationDate2(const char* file,int *ok){
- struct stat st;
+ struct stat st;
if (-1 == stat(file, &st))
{
*ok = 0;
return 0;
}
*ok = 1;
- struct tm *ts= localtime(&st.st_ctime);
- return asctime(ts);
+ struct tm *ts= localtime(&st.st_ctime);
+ return asctime(ts);
}
//!Checks if the file exists
@@ -180,8 +180,8 @@ char* getFileCreationDate2(const char* file,int *ok){
*/
int isFile (const char* file)
{
- struct stat st;
- return (stat (file, &st) == 0);
+ struct stat st;
+ return (stat (file, &st) == 0);
}
//!Waits a period of time
@@ -190,7 +190,7 @@ int isFile (const char* file)
*/
void doTimeout(int timeout)
{
- usleep(timeout * 1000);
+ usleep(timeout * 1000);
}
//!Checks free space of the user buffer
@@ -199,15 +199,15 @@ void doTimeout(int timeout)
*/
int checkUserBufferForFreeSpace()
{
- int total_size, used_size;
+ int total_size, used_size;
- dlt_user_check_buffer(&total_size, &used_size);
+ dlt_user_check_buffer(&total_size, &used_size);
- if((total_size - used_size) < (total_size/2))
- {
- return -1;
- }
- return 1;
+ if((total_size - used_size) < (total_size/2))
+ {
+ return -1;
+ }
+ return 1;
}
//!Deletes the given file
@@ -216,13 +216,13 @@ int checkUserBufferForFreeSpace()
* @return If the file is successfully deleted, a zero value is returned.If the file can not be deleted a nonzero value is returned.
*/
int doRemoveFile(const char*filename){
- return remove( filename);
+ return remove( filename);
}
void dlt_user_log_file_errorMessage(DltContext *fileContext, const char *filename, int errorCode){
- if(errno != ENOENT)
- {
+ if(errno != ENOENT)
+ {
int ok = 0;
unsigned long fserial = getFileSerialNumber(filename,&ok);
if (!ok)
@@ -236,27 +236,27 @@ void dlt_user_log_file_errorMessage(DltContext *fileContext, const char *filenam
int package_count = dlt_user_log_file_packagesCount(fileContext,filename);
- DLT_LOG(*fileContext,DLT_LOG_ERROR,
- DLT_STRING("FLER"),
- DLT_INT(errorCode),
- DLT_INT(-errno),
+ DLT_LOG(*fileContext,DLT_LOG_ERROR,
+ DLT_STRING("FLER"),
+ DLT_INT(errorCode),
+ DLT_INT(-errno),
DLT_UINT(fserial),
- DLT_STRING(filename),
+ DLT_STRING(filename),
DLT_UINT(fsize),
DLT_STRING(fcreationdate),
DLT_INT(package_count),
- DLT_UINT(BUFFER_SIZE),
- DLT_STRING("FLER")
- );
- } else {
- DLT_LOG(*fileContext,DLT_LOG_ERROR,
- DLT_STRING("FLER"),
- DLT_INT(errorCode),
- DLT_INT(-errno),
- DLT_STRING(filename),
- DLT_STRING("FLER")
- );
- }
+ DLT_UINT(BUFFER_SIZE),
+ DLT_STRING("FLER")
+ );
+ } else {
+ DLT_LOG(*fileContext,DLT_LOG_ERROR,
+ DLT_STRING("FLER"),
+ DLT_INT(errorCode),
+ DLT_INT(-errno),
+ DLT_STRING(filename),
+ DLT_STRING("FLER")
+ );
+ }
}
@@ -269,8 +269,8 @@ void dlt_user_log_file_errorMessage(DltContext *fileContext, const char *filenam
*/
int dlt_user_log_file_infoAbout(DltContext *fileContext, const char *filename){
- if(isFile(filename))
- {
+ if(isFile(filename))
+ {
int ok;
unsigned long fsize = getFilesize(filename,&ok);
@@ -286,20 +286,20 @@ int dlt_user_log_file_infoAbout(DltContext *fileContext, const char *filename){
if (!ok)
DLT_LOG(*fileContext,DLT_LOG_ERROR,DLT_STRING("dlt_user_log_file_infoAbout, Error getting creation date of file:"),DLT_STRING(filename));
- DLT_LOG(*fileContext,DLT_LOG_INFO,
- DLT_STRING("FLIF"),
+ DLT_LOG(*fileContext,DLT_LOG_INFO,
+ DLT_STRING("FLIF"),
DLT_STRING("file serialnumber"),DLT_UINT(fserialnumber),
- DLT_STRING("filename"),DLT_STRING(filename),
+ DLT_STRING("filename"),DLT_STRING(filename),
DLT_STRING("file size in bytes"),DLT_UINT(fsize),
DLT_STRING("file creation date"),DLT_STRING(creationdate),
- DLT_STRING("number of packages"),DLT_UINT(dlt_user_log_file_packagesCount(fileContext, filename)),
- DLT_STRING("FLIF")
- );
- return 0;
- } else {
- dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_INFO_ABOUT);
- return DLT_FILETRANSFER_ERROR_INFO_ABOUT;
- }
+ DLT_STRING("number of packages"),DLT_UINT(dlt_user_log_file_packagesCount(fileContext, filename)),
+ DLT_STRING("FLIF")
+ );
+ return 0;
+ } else {
+ dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_INFO_ABOUT);
+ return DLT_FILETRANSFER_ERROR_INFO_ABOUT;
+ }
}
//!Transfer the complete file as several dlt logs.
@@ -316,28 +316,28 @@ int dlt_user_log_file_infoAbout(DltContext *fileContext, const char *filename){
*/
int dlt_user_log_file_complete(DltContext *fileContext, const char *filename, int deleteFlag, int timeout)
{
- if(!isFile(filename))
- {
- dlt_user_log_file_errorMessage(fileContext,filename, DLT_FILETRANSFER_ERROR_FILE_COMPLETE);
- return DLT_FILETRANSFER_ERROR_FILE_COMPLETE;
- }
-
- if(dlt_user_log_file_header(fileContext,filename) != 0)
- {
- return DLT_FILETRANSFER_ERROR_FILE_COMPLETE1;
- }
-
- if(dlt_user_log_file_data(fileContext, filename,DLT_FILETRANSFER_TRANSFER_ALL_PACKAGES,timeout) != 0)
- {
- return DLT_FILETRANSFER_ERROR_FILE_COMPLETE2;
- }
-
- if(dlt_user_log_file_end(fileContext,filename, deleteFlag) != 0)
- {
- return DLT_FILETRANSFER_ERROR_FILE_COMPLETE3;
- }
-
- return 0;
+ if(!isFile(filename))
+ {
+ dlt_user_log_file_errorMessage(fileContext,filename, DLT_FILETRANSFER_ERROR_FILE_COMPLETE);
+ return DLT_FILETRANSFER_ERROR_FILE_COMPLETE;
+ }
+
+ if(dlt_user_log_file_header(fileContext,filename) != 0)
+ {
+ return DLT_FILETRANSFER_ERROR_FILE_COMPLETE1;
+ }
+
+ if(dlt_user_log_file_data(fileContext, filename,DLT_FILETRANSFER_TRANSFER_ALL_PACKAGES,timeout) != 0)
+ {
+ return DLT_FILETRANSFER_ERROR_FILE_COMPLETE2;
+ }
+
+ if(dlt_user_log_file_end(fileContext,filename, deleteFlag) != 0)
+ {
+ return DLT_FILETRANSFER_ERROR_FILE_COMPLETE3;
+ }
+
+ return 0;
}
//!This method gives information about the number of packages the file have
@@ -350,12 +350,12 @@ int dlt_user_log_file_complete(DltContext *fileContext, const char *filename, in
* @return Returns the number of packages if everything was okey. If there was a failure a value < 0 will be returned.
*/
int dlt_user_log_file_packagesCount(DltContext *fileContext, const char *filename){
- int packages;
- long filesize;
+ int packages;
+ long filesize;
- if(isFile(filename))
- {
- packages = 1;
+ if(isFile(filename))
+ {
+ packages = 1;
int ok;
filesize = getFilesize(filename,&ok);
if (!ok){
@@ -363,26 +363,26 @@ int dlt_user_log_file_packagesCount(DltContext *fileContext, const char *filenam
return -1;
}
if(filesize < BUFFER_SIZE)
- {
- return packages;
- }
- else
- {
- packages = filesize/BUFFER_SIZE;
-
- if(filesize%BUFFER_SIZE == 0)
- {
- return packages;
- }
- else
- {
- return packages+1;
- }
- }
- } else {
+ {
+ return packages;
+ }
+ else
+ {
+ packages = filesize/BUFFER_SIZE;
+
+ if(filesize%BUFFER_SIZE == 0)
+ {
+ return packages;
+ }
+ else
+ {
+ return packages+1;
+ }
+ }
+ } else {
DLT_LOG(*fileContext,DLT_LOG_ERROR,DLT_STRING("Error in: dlt_user_log_file_packagesCount, !isFile"),DLT_STRING(filename),DLT_INT(DLT_FILETRANSFER_ERROR_PACKAGE_COUNT));
- return -1;
- }
+ return -1;
+ }
}
//!Transfer the head of the file as a dlt logs.
@@ -397,7 +397,7 @@ int dlt_user_log_file_packagesCount(DltContext *fileContext, const char *filenam
*/
int dlt_user_log_file_header_alias(DltContext *fileContext,const char *filename, const char *alias){
- if(isFile(filename))
+ if(isFile(filename))
{
int ok;
@@ -426,13 +426,13 @@ int dlt_user_log_file_header_alias(DltContext *fileContext,const char *filename,
DLT_STRING("FLST")
);
- return 0;
- }
- else
- {
- dlt_user_log_file_errorMessage(fileContext,filename, DLT_FILETRANSFER_ERROR_FILE_HEAD);
- return DLT_FILETRANSFER_ERROR_FILE_HEAD;
- }
+ return 0;
+ }
+ else
+ {
+ dlt_user_log_file_errorMessage(fileContext,filename, DLT_FILETRANSFER_ERROR_FILE_HEAD);
+ return DLT_FILETRANSFER_ERROR_FILE_HEAD;
+ }
}
//!Transfer the head of the file as a dlt logs.
@@ -446,8 +446,8 @@ int dlt_user_log_file_header_alias(DltContext *fileContext,const char *filename,
*/
int dlt_user_log_file_header(DltContext *fileContext,const char *filename){
- if(isFile(filename))
- {
+ if(isFile(filename))
+ {
int ok;
unsigned long fserialnumber = getFileSerialNumber(filename,&ok);
@@ -465,24 +465,24 @@ int dlt_user_log_file_header(DltContext *fileContext,const char *filename){
- DLT_LOG(*fileContext,DLT_LOG_INFO,
- DLT_STRING("FLST"),
+ DLT_LOG(*fileContext,DLT_LOG_INFO,
+ DLT_STRING("FLST"),
DLT_UINT(fserialnumber),
- DLT_STRING(filename),
+ DLT_STRING(filename),
DLT_UINT(fsize),
DLT_STRING(fcreationdate);
- DLT_UINT(dlt_user_log_file_packagesCount(fileContext,filename)),
- DLT_UINT(BUFFER_SIZE),
- DLT_STRING("FLST")
- );
-
- return 0;
- }
- else
- {
- dlt_user_log_file_errorMessage(fileContext,filename, DLT_FILETRANSFER_ERROR_FILE_HEAD);
- return DLT_FILETRANSFER_ERROR_FILE_HEAD;
- }
+ DLT_UINT(dlt_user_log_file_packagesCount(fileContext,filename)),
+ DLT_UINT(BUFFER_SIZE),
+ DLT_STRING("FLST")
+ );
+
+ return 0;
+ }
+ else
+ {
+ dlt_user_log_file_errorMessage(fileContext,filename, DLT_FILETRANSFER_ERROR_FILE_HEAD);
+ return DLT_FILETRANSFER_ERROR_FILE_HEAD;
+ }
}
//!Transfer the content data of a file.
@@ -494,42 +494,42 @@ int dlt_user_log_file_header(DltContext *fileContext,const char *filename){
* @return Returns 0 if everything was okey. If there was a failure a value < 0 will be returned.
*/
int dlt_user_log_file_data(DltContext *fileContext,const char *filename, int packageToTransfer, int timeout){
- FILE *file;
- int pkgNumber;
- long readBytes;
-
- if(isFile(filename))
- {
-
- file = fopen (filename,"rb");
- if (file == NULL)
- {
- dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_FILE_DATA);
- return DLT_FILETRANSFER_ERROR_FILE_DATA;
- }
-
- if( (packageToTransfer != DLT_FILETRANSFER_TRANSFER_ALL_PACKAGES && packageToTransfer > dlt_user_log_file_packagesCount(fileContext,filename)) || packageToTransfer <= 0)
- {
- DLT_LOG(*fileContext,DLT_LOG_ERROR,
- DLT_STRING("Error at dlt_user_log_file_data: packageToTransfer out of scope"),
- DLT_STRING("packageToTransfer:"),
- DLT_UINT(packageToTransfer),
- DLT_STRING("numberOfMaximalPackages:"),
- DLT_UINT(dlt_user_log_file_packagesCount(fileContext,filename)),
- DLT_STRING("for File:"),
- DLT_STRING(filename)
- );
- fclose(file);
- return DLT_FILETRANSFER_ERROR_FILE_DATA;
- }
-
- readBytes = 0;
-
- if(packageToTransfer != DLT_FILETRANSFER_TRANSFER_ALL_PACKAGES)
- {
-// If a single package should be transferred. The user has to check that the free space in the user buffer > 50%
-// if(checkUserBufferForFreeSpace()<0)
-// return DLT_FILETRANSFER_ERROR_FILE_DATA_USER_BUFFER_FAILED;
+ FILE *file;
+ int pkgNumber;
+ long readBytes;
+
+ if(isFile(filename))
+ {
+
+ file = fopen (filename,"rb");
+ if (file == NULL)
+ {
+ dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_FILE_DATA);
+ return DLT_FILETRANSFER_ERROR_FILE_DATA;
+ }
+
+ if( (packageToTransfer != DLT_FILETRANSFER_TRANSFER_ALL_PACKAGES && packageToTransfer > dlt_user_log_file_packagesCount(fileContext,filename)) || packageToTransfer <= 0)
+ {
+ DLT_LOG(*fileContext,DLT_LOG_ERROR,
+ DLT_STRING("Error at dlt_user_log_file_data: packageToTransfer out of scope"),
+ DLT_STRING("packageToTransfer:"),
+ DLT_UINT(packageToTransfer),
+ DLT_STRING("numberOfMaximalPackages:"),
+ DLT_UINT(dlt_user_log_file_packagesCount(fileContext,filename)),
+ DLT_STRING("for File:"),
+ DLT_STRING(filename)
+ );
+ fclose(file);
+ return DLT_FILETRANSFER_ERROR_FILE_DATA;
+ }
+
+ readBytes = 0;
+
+ if(packageToTransfer != DLT_FILETRANSFER_TRANSFER_ALL_PACKAGES)
+ {
+// If a single package should be transferred. The user has to check that the free space in the user buffer > 50%
+// if(checkUserBufferForFreeSpace()<0)
+// return DLT_FILETRANSFER_ERROR_FILE_DATA_USER_BUFFER_FAILED;
if ( 0 != fseek ( file , (packageToTransfer-1)*BUFFER_SIZE , SEEK_SET ) )
{
@@ -544,7 +544,7 @@ int dlt_user_log_file_data(DltContext *fileContext,const char *filename, int pac
return -1;
}
- readBytes = fread(buffer, sizeof(char), BUFFER_SIZE, file);
+ readBytes = fread(buffer, sizeof(char), BUFFER_SIZE, file);
int ok;
unsigned long fserial = getFileSerialNumber(filename,&ok);
@@ -556,27 +556,27 @@ int dlt_user_log_file_data(DltContext *fileContext,const char *filename, int pac
DLT_STRING(filename));
}
- DLT_LOG(*fileContext,DLT_LOG_INFO,
- DLT_STRING("FLDA"),
+ DLT_LOG(*fileContext,DLT_LOG_INFO,
+ DLT_STRING("FLDA"),
DLT_UINT(fserial),
- DLT_UINT(packageToTransfer),
- DLT_RAW(buffer,readBytes),
- DLT_STRING("FLDA")
- );
-
- doTimeout(timeout);
-
- } else {
- pkgNumber = 0;
- while( !feof( file ) )
- {
-// If the complete file should be transferred, the user buffer will be checked.
-// If free space < 50% the package won't be transferred.
- if(checkUserBufferForFreeSpace()>0)
- {
- pkgNumber++;
- readBytes = fread(buffer, sizeof(char), BUFFER_SIZE, file);
- int ok;
+ DLT_UINT(packageToTransfer),
+ DLT_RAW(buffer,readBytes),
+ DLT_STRING("FLDA")
+ );
+
+ doTimeout(timeout);
+
+ } else {
+ pkgNumber = 0;
+ while( !feof( file ) )
+ {
+// If the complete file should be transferred, the user buffer will be checked.
+// If free space < 50% the package won't be transferred.
+ if(checkUserBufferForFreeSpace()>0)
+ {
+ pkgNumber++;
+ readBytes = fread(buffer, sizeof(char), BUFFER_SIZE, file);
+ int ok;
unsigned long fserial = getFileSerialNumber(filename,&ok);
@@ -587,26 +587,26 @@ int dlt_user_log_file_data(DltContext *fileContext,const char *filename, int pac
DLT_STRING(filename));
}
- DLT_LOG(*fileContext,DLT_LOG_INFO,
- DLT_STRING("FLDA"),
+ DLT_LOG(*fileContext,DLT_LOG_INFO,
+ DLT_STRING("FLDA"),
DLT_UINT(fserial),
- DLT_UINT(pkgNumber),
- DLT_RAW(buffer,readBytes),
- DLT_STRING("FLDA")
- );
- }
- doTimeout(timeout);
- }
- }
+ DLT_UINT(pkgNumber),
+ DLT_RAW(buffer,readBytes),
+ DLT_STRING("FLDA")
+ );
+ }
+ doTimeout(timeout);
+ }
+ }
- fclose(file);
+ fclose(file);
- return 0;
+ return 0;
- } else {
- dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_FILE_DATA);
- return DLT_FILETRANSFER_ERROR_FILE_DATA;
- }
+ } else {
+ dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_FILE_DATA);
+ return DLT_FILETRANSFER_ERROR_FILE_DATA;
+ }
}
//!Transfer the end of the file as a dlt logs.
@@ -620,10 +620,10 @@ int dlt_user_log_file_data(DltContext *fileContext,const char *filename, int pac
*/
int dlt_user_log_file_end(DltContext *fileContext,const char *filename,int deleteFlag){
- if(isFile(filename))
- {
+ if(isFile(filename))
+ {
- int ok;
+ int ok;
unsigned long fserial = getFileSerialNumber(filename,&ok);
if (1 != ok)
@@ -633,22 +633,22 @@ int dlt_user_log_file_end(DltContext *fileContext,const char *filename,int delet
DLT_STRING(filename));
}
- DLT_LOG(*fileContext,DLT_LOG_INFO,
- DLT_STRING("FLFI"),
+ DLT_LOG(*fileContext,DLT_LOG_INFO,
+ DLT_STRING("FLFI"),
DLT_UINT(fserial),
- DLT_STRING("FLFI")
- );
-
- if(deleteFlag){
- if( doRemoveFile(filename) != 0 ){
- dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_FILE_END);
- return -1;
- }
- }
-
- return 0;
- }else{
- dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_FILE_END);
- return DLT_FILETRANSFER_ERROR_FILE_END;
- }
+ DLT_STRING("FLFI")
+ );
+
+ if(deleteFlag){
+ if( doRemoveFile(filename) != 0 ){
+ dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_FILE_END);
+ return -1;
+ }
+ }
+
+ return 0;
+ }else{
+ dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_FILE_END);
+ return DLT_FILETRANSFER_ERROR_FILE_END;
+ }
}
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c
index 2164768..2823208 100644
--- a/src/lib/dlt_user.c
+++ b/src/lib/dlt_user.c
@@ -54,14 +54,17 @@
#include <sys/types.h> /* needed for getpid() */
#include <unistd.h>
+#include <stdbool.h>
+
#include "dlt_user.h"
+#include "dlt_common.h"
#include "dlt_user_shared.h"
#include "dlt_user_shared_cfg.h"
#include "dlt_user_cfg.h"
static DltUser dlt_user;
-static int dlt_user_initialised = 0;
+static bool dlt_user_initialised = false;
static int dlt_user_freeing = 0;
static char dlt_user_dir[NAME_MAX + 1];
@@ -105,35 +108,36 @@ inline void dlt_unlock_mutex(pthread_mutex_t *mutex)
}
/* Structure to pass data to segmented thread */
-typedef struct {
- DltContext *handle;
- uint32_t id;
- DltNetworkTraceType nw_trace_type;
- uint32_t header_len;
- void *header;
- uint32_t payload_len;
- void *payload;
+typedef struct
+{
+ DltContext *handle;
+ uint32_t id;
+ DltNetworkTraceType nw_trace_type;
+ uint32_t header_len;
+ void *header;
+ uint32_t payload_len;
+ void *payload;
} s_segmented_data;
/* Function prototypes for internally used functions */
static void dlt_user_receiverthread_function(void *ptr);
static void dlt_user_atexit_handler(void);
-static int dlt_user_log_init(DltContext *handle, DltContextData *log);
+static DltReturnValue dlt_user_log_init(DltContext *handle, DltContextData *log);
static DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype);
-static int dlt_user_log_send_register_application(void);
-static int dlt_user_log_send_unregister_application(void);
-static int dlt_user_log_send_register_context(DltContextData *log);
-static int dlt_user_log_send_unregister_context(DltContextData *log);
-static int dlt_send_app_ll_ts_limit(const char *appid, DltLogLevelType loglevel, DltTraceStatusType tracestatus);
-static int dlt_user_log_send_log_mode(DltUserLogMode mode);
-static int dlt_user_log_send_marker();
-static int dlt_user_print_msg(DltMessage *msg, DltContextData *log);
-static int dlt_user_log_check_user_message(void);
+static DltReturnValue dlt_user_log_send_register_application(void);
+static DltReturnValue dlt_user_log_send_unregister_application(void);
+static DltReturnValue dlt_user_log_send_register_context(DltContextData *log);
+static DltReturnValue dlt_user_log_send_unregister_context(DltContextData *log);
+static DltReturnValue dlt_send_app_ll_ts_limit(const char *appid, DltLogLevelType loglevel, DltTraceStatusType tracestatus);
+static DltReturnValue dlt_user_log_send_log_mode(DltUserLogMode mode);
+static DltReturnValue dlt_user_log_send_marker();
+static DltReturnValue dlt_user_print_msg(DltMessage *msg, DltContextData *log);
+static DltReturnValue dlt_user_log_check_user_message(void);
static void dlt_user_log_reattach_to_daemon(void);
-static int dlt_user_log_send_overflow(void);
+static DltReturnValue dlt_user_log_send_overflow(void);
static void dlt_user_trace_network_segmented_thread(void *unused);
static void dlt_user_trace_network_segmented_thread_segmenter(s_segmented_data *data);
-static int dlt_user_queue_resend(void);
+static DltReturnValue dlt_user_queue_resend(void);
static int dlt_start_threads();
static void dlt_stop_threads();
@@ -142,25 +146,30 @@ static void dlt_fork_parent_fork_handler();
static void dlt_fork_child_fork_handler();
-int dlt_user_check_library_version(const char *user_major_version,const char *user_minor_version){
-
- char str[DLT_USER_BUFFER_LENGTH];
+DltReturnValue dlt_user_check_library_version(const char *user_major_version,const char *user_minor_version)
+{
char lib_major_version[DLT_USER_MAX_LIB_VERSION_LENGTH];
char lib_minor_version[DLT_USER_MAX_LIB_VERSION_LENGTH];
- dlt_get_major_version( lib_major_version,DLT_USER_MAX_LIB_VERSION_LENGTH);
- dlt_get_minor_version( lib_minor_version,DLT_USER_MAX_LIB_VERSION_LENGTH);
+ dlt_get_major_version( lib_major_version,DLT_USER_MAX_LIB_VERSION_LENGTH);
+ dlt_get_minor_version( lib_minor_version,DLT_USER_MAX_LIB_VERSION_LENGTH);
- if( (strcmp(lib_major_version,user_major_version)!=0) || (strcmp(lib_minor_version,user_minor_version)!=0))
- {
- snprintf(str,DLT_USER_BUFFER_LENGTH,"DLT Library version check failed! Installed DLT library version is %s.%s - Application using DLT library version %s.%s\n",lib_major_version,lib_minor_version,user_major_version,user_minor_version);
- dlt_log(LOG_WARNING, str);
- return -1;
- }
- return 0;
+ if( (strcmp(lib_major_version,user_major_version) != 0) || (strcmp(lib_minor_version,user_minor_version) != 0))
+ {
+ dlt_vnlog(LOG_WARNING, DLT_USER_BUFFER_LENGTH,
+ "DLT Library version check failed! Installed DLT library version is %s.%s - Application using DLT library version %s.%s\n",
+ lib_major_version,
+ lib_minor_version,
+ user_major_version,
+ user_minor_version);
+
+ return DLT_RETURN_ERROR;
+ }
+
+ return DLT_RETURN_OK;
}
-int dlt_init(void)
+DltReturnValue dlt_init(void)
{
char filename[DLT_USER_MAX_FILENAME_LENGTH];
int ret;
@@ -169,18 +178,18 @@ int dlt_init(void)
if (dlt_user_freeing != 0)
{
// return negative value, to stop the current log
- return -1;
+ return DLT_RETURN_ERROR;
}
// WARNING: multithread unsafe !
// Another thread will check that dlt_user_initialised != 0, but the lib is not initialised !
- dlt_user_initialised = 1;
+ dlt_user_initialised = true;
/* Initialize common part of dlt_init()/dlt_init_file() */
- if (dlt_init_common()==-1)
+ if (dlt_init_common() == DLT_RETURN_ERROR)
{
- dlt_user_initialised = 0;
- return -1;
+ dlt_user_initialised = false;
+ return DLT_RETURN_ERROR;
}
/* check environment variables */
@@ -193,37 +202,34 @@ int dlt_init(void)
dlt_user.overflow = 0;
dlt_user.overflow_counter = 0;
#ifdef DLT_SHM_ENABLE
- memset(&(dlt_user.dlt_shm),0,sizeof(DltShm));
+ memset(&(dlt_user.dlt_shm),0,sizeof(DltShm));
#endif
/* create dlt pipes directory */
/* Make sure the parent user directory is created */
if (dlt_mkdir_recursive(dltFifoBaseDir) != 0)
{
- snprintf(str,DLT_USER_BUFFER_LENGTH, "Base dir %s cannot be created!\n", dltFifoBaseDir);
- dlt_log(LOG_ERR, str);
- return -1;
+ dlt_vnlog(LOG_ERR,DLT_USER_BUFFER_LENGTH, "Base dir %s cannot be created!\n", dltFifoBaseDir);
+ return DLT_RETURN_ERROR;
}
ret=mkdir(dlt_user_dir, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH | S_ISVTX );
if (ret==-1 && errno != EEXIST)
{
- snprintf(str,DLT_USER_BUFFER_LENGTH,"FIFO user dir %s cannot be created!\n", dlt_user_dir);
- dlt_log(LOG_ERR, str);
- return -1;
+ dlt_vnlog(LOG_ERR, DLT_USER_BUFFER_LENGTH, "FIFO user dir %s cannot be created!\n", dlt_user_dir);
+ return DLT_RETURN_ERROR;
}
/* if dlt pipes directory is created by the application also chmod the directory */
if(ret == 0)
{
- // S_ISGID cannot be set by mkdir, let's reassign right bits
- ret=chmod(dlt_user_dir, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH | S_ISGID | S_ISVTX );
- if (ret==-1)
- {
- snprintf(str,DLT_USER_BUFFER_LENGTH,"FIFO user dir %s cannot be chmoded!\n", dlt_user_dir);
- dlt_log(LOG_ERR, str);
- return -1;
- }
+ // S_ISGID cannot be set by mkdir, let's reassign right bits
+ ret=chmod(dlt_user_dir, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH | S_ISGID | S_ISVTX );
+ if (ret==-1)
+ {
+ dlt_vnlog(LOG_ERR, DLT_USER_BUFFER_LENGTH, "FIFO user dir %s cannot be chmoded!\n", dlt_user_dir);
+ return DLT_RETURN_ERROR;
+ }
}
/* create and open DLT user FIFO */
@@ -235,27 +241,24 @@ int dlt_init(void)
ret=mkfifo(filename, S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP );
if (ret==-1)
{
- snprintf(str,DLT_USER_BUFFER_LENGTH,"Logging disabled, FIFO user %s cannot be created!\n",filename);
- dlt_log(LOG_WARNING, str);
- /* return 0; */ /* removed to prevent error, when FIFO already exists */
+ dlt_vnlog(LOG_WARNING, DLT_USER_BUFFER_LENGTH, "Loging disabled, FIFO user %s cannot be created!\n", filename);
+ /* return DLT_RETURN_OK; */ /* removed to prevent error, when FIFO already exists */
}
// S_IWGRP cannot be set by mkfifo (???), let's reassign right bits
ret=chmod(filename, S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP );
if (ret==-1)
{
- snprintf(str,DLT_USER_BUFFER_LENGTH,"FIFO user %s cannot be chmoded!\n", dlt_user_dir);
- dlt_log(LOG_WARNING, str);
- return -1;
+ dlt_vnlog(LOG_WARNING, DLT_USER_BUFFER_LENGTH, "FIFO user %s cannot be chmoded!\n", dlt_user_dir);
+ return DLT_RETURN_ERROR;
}
dlt_user.dlt_user_handle = open(filename, O_RDWR | O_CLOEXEC);
if (dlt_user.dlt_user_handle == DLT_FD_INIT)
{
- snprintf(str,DLT_USER_BUFFER_LENGTH,"Logging disabled, FIFO user %s cannot be opened!\n",filename);
- dlt_log(LOG_WARNING, str);
+ dlt_vnlog(LOG_WARNING, DLT_USER_BUFFER_LENGTH, "Logging disabled, FIFO user %s cannot be opened!\n", filename);
unlink(filename);
- return 0;
+ return DLT_RETURN_OK;
}
/* open DLT output FIFO */
@@ -265,31 +268,29 @@ int dlt_init(void)
/* This is a normal usecase. It is OK that the daemon (and thus the FIFO /tmp/dlt)
starts later and some DLT users have already been started before.
Thus it is OK if the FIFO can't be opened. */
- snprintf(str,DLT_USER_BUFFER_LENGTH,"FIFO %s cannot be opened. Retrying later...\n",dlt_daemon_fifo);
- dlt_log(LOG_INFO, str);
- //return 0;
+ dlt_vnlog(LOG_INFO, DLT_USER_BUFFER_LENGTH, "FIFO %s cannot be opened. Retrying later...\n",dlt_daemon_fifo);
+ //return DLT_RETURN_OK;
}
- else
- {
+ else
+ {
#ifdef DLT_SHM_ENABLE
- /* init shared memory */
- if (dlt_shm_init_client(&(dlt_user.dlt_shm),DLT_SHM_KEY) < 0)
- {
+ /* init shared memory */
+ if (dlt_shm_init_client(&(dlt_user.dlt_shm),DLT_SHM_KEY) < 0)
+ {
/* This is a normal usecase. It is OK that the daemon (and thus the FIFO /tmp/dlt)
starts later and some DLT users have already been started before.
Thus it is OK if the FIFO can't be opened. */
- snprintf(str,DLT_USER_BUFFER_LENGTH,"Shared memory %d cannot be created. Retrying later...\n",DLT_SHM_KEY);
- dlt_log(LOG_INFO, str);
- //return 0;
- }
+ dlt_vnlog(LOG_INFO, DLT_USER_BUFFER_LENGTH, "Shared memory %d cannot be created. Retrying later...\n", DLT_SHM_KEY);
+ //return DLT_RETURN_OK;
+ }
#endif
- }
+ }
- if (dlt_receiver_init(&(dlt_user.receiver),dlt_user.dlt_user_handle, DLT_USER_RCVBUF_MAX_SIZE)==-1)
- {
- dlt_user_initialised = 0;
- return -1;
+ if (dlt_receiver_init(&(dlt_user.receiver),dlt_user.dlt_user_handle, DLT_USER_RCVBUF_MAX_SIZE) == DLT_RETURN_ERROR)
+ {
+ dlt_user_initialised = false;
+ return DLT_RETURN_ERROR;
}
/* These will be lazy initialized only when needed */
@@ -300,14 +301,14 @@ int dlt_init(void)
pthread_mutexattr_t attr;
if (pthread_mutexattr_init(&attr) != 0)
{
- dlt_user_initialised = 0;
- return -1;
+ dlt_user_initialised = false;
+ return DLT_RETURN_ERROR;
}
/* make mutex robust to prevent from deadlock when the segmented thread was cancelled, but held the mutex */
if ( pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST) != 0 )
{
- dlt_user_initialised = 0;
- return -1;
+ dlt_user_initialised = false;
+ return DLT_RETURN_ERROR;
}
pthread_mutex_init(&mq_mutex, &attr);
@@ -316,25 +317,29 @@ int dlt_init(void)
if (dlt_start_threads() < 0)
{
- dlt_user_initialised = 0;
- return -1;
+ dlt_user_initialised = false;
+ return DLT_RETURN_ERROR;
}
// prepare for fork() call
pthread_atfork(&dlt_fork_pre_fork_handler, &dlt_fork_parent_fork_handler, &dlt_fork_child_fork_handler);
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_init_file(const char *name)
+DltReturnValue dlt_init_file(const char *name)
{
- dlt_user_initialised = 1;
+ // check null pointer
+ if(!name)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ dlt_user_initialised = true;
/* Initialize common part of dlt_init()/dlt_init_file() */
- if (dlt_init_common()==-1)
+ if (dlt_init_common() == DLT_RETURN_ERROR)
{
- dlt_user_initialised = 0;
- return -1;
+ dlt_user_initialised = false;
+ return DLT_RETURN_ERROR;
}
dlt_user.dlt_is_file = 1;
@@ -343,15 +348,14 @@ int dlt_init_file(const char *name)
dlt_user.dlt_log_handle = open(name,O_WRONLY|O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); /* mode: wb */
if (dlt_user.dlt_log_handle == -1)
{
- snprintf(str,DLT_USER_BUFFER_LENGTH,"Log file %s cannot be opened!\n",name);
- dlt_log(LOG_ERR, str);
- return -1;
+ dlt_vnlog(LOG_ERR, DLT_USER_BUFFER_LENGTH, "Log file %s cannot be opened!\n", name);
+ return DLT_RETURN_ERROR;
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_init_message_queue(void)
+DltReturnValue dlt_init_message_queue(void)
{
dlt_lock_mutex(&mq_mutex);
if(dlt_user.dlt_segmented_queue_read_handle >= 0 &&
@@ -359,7 +363,7 @@ int dlt_init_message_queue(void)
{
// Already intialized
dlt_unlock_mutex(&mq_mutex);
- return 0;
+ return DLT_RETURN_OK;
}
/* Generate per process name for queue */
@@ -368,17 +372,17 @@ int dlt_init_message_queue(void)
/* Maximum queue size is 10, limit to size of pointers */
struct mq_attr mqatr;
- mqatr.mq_flags = 0;
- mqatr.mq_maxmsg = 10;
- mqatr.mq_msgsize = sizeof(s_segmented_data *);
- mqatr.mq_curmsgs = 0;
+ mqatr.mq_flags = 0;
+ mqatr.mq_maxmsg = 10;
+ mqatr.mq_msgsize = sizeof(s_segmented_data *);
+ mqatr.mq_curmsgs = 0;
/**
* Create the message queue. It must be newly created
* if old one was left by a crashing process.
* */
dlt_user.dlt_segmented_queue_read_handle = mq_open(queue_name, O_CREAT| O_RDONLY | O_EXCL,
- S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, &mqatr);
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, &mqatr);
if(dlt_user.dlt_segmented_queue_read_handle < 0)
{
if(errno == EEXIST)
@@ -386,9 +390,7 @@ int dlt_init_message_queue(void)
dlt_log(LOG_WARNING, "Old message queue exists, trying to delete.\n");
if(mq_unlink(queue_name) < 0)
{
- char str[256];
- snprintf(str,255,"Could not delete existing message queue!: %s \n",strerror(errno));
- dlt_log(LOG_CRIT, str);
+ dlt_vnlog(LOG_CRIT, 256, "Could not delete existing message queue!: %s \n", strerror(errno));
}
else // Retry
{
@@ -398,11 +400,9 @@ int dlt_init_message_queue(void)
}
if(dlt_user.dlt_segmented_queue_read_handle < 0)
{
- char str[256];
- snprintf(str,255,"Can't create message queue read handle!: %s \n",strerror(errno));
- dlt_log(LOG_CRIT, str);
- dlt_unlock_mutex(&mq_mutex);
- return -1;
+ dlt_vnlog(LOG_CRIT, 256, "Can't create message queue read handle!: %s \n", strerror(errno));
+ dlt_unlock_mutex(&mq_mutex);
+ return DLT_RETURN_ERROR;
}
}
@@ -410,19 +410,17 @@ int dlt_init_message_queue(void)
if(dlt_user.dlt_segmented_queue_write_handle < 0)
{
- char str[256];
- snprintf(str,255,"Can't open message queue write handle!: %s \n",strerror(errno));
- dlt_log(LOG_CRIT, str);
+ dlt_vnlog(LOG_CRIT, 256, "Can't open message queue write handle!: %s \n", strerror(errno));
dlt_unlock_mutex(&mq_mutex);
- return -1;
+ return DLT_RETURN_ERROR;
}
pthread_cond_signal(&mq_init_condition);
dlt_unlock_mutex(&mq_mutex);
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_init_common(void)
+DltReturnValue dlt_init_common(void)
{
char *env_local_print;
char * env_initial_log_level;
@@ -430,12 +428,12 @@ int dlt_init_common(void)
/* Binary semaphore for threads */
if (sem_init(&dlt_mutex, 0, 1)==-1)
{
- dlt_user_initialised = 0;
- return -1;
+ dlt_user_initialised = false;
+ return DLT_RETURN_ERROR;
}
- /* set to unknown state of connected client */
- dlt_user.log_state = -1;
+ /* set to unknown state of connected client */
+ dlt_user.log_state = -1;
dlt_user.dlt_log_handle=-1;
dlt_user.dlt_user_handle=DLT_FD_INIT;
@@ -443,7 +441,7 @@ int dlt_init_common(void)
dlt_set_id(dlt_user.ecuID,DLT_USER_DEFAULT_ECU_ID);
dlt_set_id(dlt_user.appID,"");
- dlt_user.application_description = 0;
+ dlt_user.application_description = NULL;
/* Verbose mode is enabled by default */
dlt_user.verbose_mode = 1;
@@ -496,15 +494,15 @@ int dlt_init_common(void)
/* Initialize LogLevel/TraceStatus field */
DLT_SEM_LOCK();
- dlt_user.dlt_ll_ts = 0;
+ dlt_user.dlt_ll_ts = NULL;
dlt_user.dlt_ll_ts_max_num_entries = 0;
dlt_user.dlt_ll_ts_num_entries = 0;
- if (dlt_buffer_init_dynamic(&(dlt_user.startup_buffer), DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE)==-1)
+ if (dlt_buffer_init_dynamic(&(dlt_user.startup_buffer), DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE) == DLT_RETURN_ERROR)
{
- dlt_user_initialised = 0;
+ dlt_user_initialised = false;
DLT_SEM_FREE();
- return -1;
+ return DLT_RETURN_ERROR;
}
DLT_SEM_FREE();
@@ -522,27 +520,24 @@ int dlt_init_common(void)
dlt_user.corrupt_message_size_size = 0;
#endif
- return 0;
+ return DLT_RETURN_OK;
}
void dlt_user_atexit_handler(void)
{
- if (dlt_user_initialised==0)
+ if (!dlt_user_initialised)
{
- dlt_log(LOG_WARNING, "dlt_user_atexit_handler dlt_user_initialised==0\n");
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
// close file
dlt_log_free();
return;
}
- /* Try to resend potential log messages in the user buffer */
- int count = dlt_user_atexit_blow_out_user_buffer();
+ /* Try to resend potential log messages in the user buffer */
+ int count = dlt_user_atexit_blow_out_user_buffer();
- if(count != 0){
- char tmp[256];
- snprintf(tmp,256,"Lost log messages in user buffer when exiting: %i\n",count);
- dlt_log(LOG_WARNING, tmp);
- }
+ if(count != 0)
+ dlt_vnlog(LOG_WARNING, 128, "Lost log messages in user buffer when exiting: %i\n", count);
/* Unregister app (this also unregisters all contexts in daemon) */
/* Ignore return value */
@@ -555,14 +550,14 @@ void dlt_user_atexit_handler(void)
int dlt_user_atexit_blow_out_user_buffer(void){
- int count,ret;
+ int count,ret;
uint32_t exitTime = dlt_uptime() + dlt_user.timeout_at_exit_handler;
- /* Send content of ringbuffer */
- DLT_SEM_LOCK();
- count = dlt_buffer_get_message_count(&(dlt_user.startup_buffer));
- DLT_SEM_FREE();
+ /* Send content of ringbuffer */
+ DLT_SEM_LOCK();
+ count = dlt_buffer_get_message_count(&(dlt_user.startup_buffer));
+ DLT_SEM_FREE();
if (count > 0)
{
@@ -577,8 +572,7 @@ int dlt_user_atexit_blow_out_user_buffer(void){
{
if (dlt_user_log_send_overflow()==0)
{
- snprintf(str,DLT_USER_BUFFER_LENGTH,"%u messages discarded!\n",dlt_user.overflow_counter);
- dlt_log(LOG_WARNING, str);
+ dlt_vnlog(LOG_WARNING, DLT_USER_BUFFER_LENGTH, "%u messages discarded!\n", dlt_user.overflow_counter);
dlt_user.overflow_counter=0;
}
}
@@ -586,43 +580,43 @@ int dlt_user_atexit_blow_out_user_buffer(void){
if (dlt_user.dlt_log_handle != -1)
{
- ret = dlt_user_log_resend_buffer();
+ ret = dlt_user_log_resend_buffer();
- if(ret == 0)
- {
- return 0;
- }
- }
+ if(ret == 0)
+ {
+ return -1;
+ }
+ }
- usleep(DLT_USER_ATEXIT_RESEND_BUFFER_SLEEP);
- }
+ usleep(DLT_USER_ATEXIT_RESEND_BUFFER_SLEEP);
+ }
- DLT_SEM_LOCK();
- count = dlt_buffer_get_message_count(&(dlt_user.startup_buffer));
- DLT_SEM_FREE();
+ DLT_SEM_LOCK();
+ count = dlt_buffer_get_message_count(&(dlt_user.startup_buffer));
+ DLT_SEM_FREE();
}
- return count;
+ return count;
}
-int dlt_free(void)
+DltReturnValue dlt_free(void)
{
uint32_t i;
- char filename[DLT_USER_MAX_FILENAME_LENGTH];
+ char filename[DLT_USER_MAX_FILENAME_LENGTH];
if( dlt_user_freeing != 0 )
// resources are already being freed. Do nothing and return.
- return -1;
+ return DLT_RETURN_ERROR;
// library is freeing its resources. Avoid to allocate it in dlt_init()
dlt_user_freeing = 1;
- if (dlt_user_initialised==0)
+ if (!dlt_user_initialised)
{
dlt_user_freeing = 0;
- return -1;
+ return DLT_RETURN_ERROR;
}
- dlt_user_initialised = 0;
+ dlt_user_initialised = false;
dlt_stop_threads();
@@ -637,8 +631,8 @@ int dlt_free(void)
}
#ifdef DLT_SHM_ENABLE
- /* free shared memory */
- dlt_shm_free_client(&dlt_user.dlt_shm);
+ /* free shared memory */
+ dlt_shm_free_client(&dlt_user.dlt_shm);
#endif
if (dlt_user.dlt_log_handle!=-1)
@@ -648,12 +642,12 @@ int dlt_free(void)
dlt_user.dlt_log_handle = -1;
}
- /* Ignore return value */
+ /* Ignore return value */
DLT_SEM_LOCK();
dlt_receiver_free(&(dlt_user.receiver));
DLT_SEM_FREE();
- /* Ignore return value */
+ /* Ignore return value */
DLT_SEM_LOCK();
dlt_buffer_free_dynamic(&(dlt_user.startup_buffer));
DLT_SEM_FREE();
@@ -663,17 +657,17 @@ int dlt_free(void)
{
for (i=0;i<dlt_user.dlt_ll_ts_max_num_entries;i++)
{
- if (dlt_user.dlt_ll_ts[i].injection_table!=0)
+ if (dlt_user.dlt_ll_ts[i].injection_table != NULL)
{
free(dlt_user.dlt_ll_ts[i].injection_table);
- dlt_user.dlt_ll_ts[i].injection_table = 0;
+ dlt_user.dlt_ll_ts[i].injection_table = NULL;
}
dlt_user.dlt_ll_ts[i].nrcallbacks = 0;
dlt_user.dlt_ll_ts[i].log_level_changed_callback = 0;
}
free(dlt_user.dlt_ll_ts);
- dlt_user.dlt_ll_ts = 0;
+ dlt_user.dlt_ll_ts = NULL;
dlt_user.dlt_ll_ts_max_num_entries = 0;
dlt_user.dlt_ll_ts_num_entries = 0;
}
@@ -703,58 +697,57 @@ int dlt_free(void)
// This should be removed for other projects (see documentation of dlt_free()
dlt_user_freeing = 0;
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
- return dlt_user_check_library_version(user_major_version, user_minor_version);
+ return dlt_user_check_library_version(user_major_version, user_minor_version);
}
-int dlt_register_app(const char *appid, const char * description)
+DltReturnValue dlt_register_app(const char *appid, const char * description)
{
- int ret;
+ DltReturnValue ret = DLT_RETURN_OK;
- if (dlt_user_initialised==0)
+ if (!dlt_user_initialised)
{
- if (dlt_init()<0)
+ if (dlt_init() < 0)
{
- return -1;
+ dlt_vlog(LOG_ERR, "%s Failed to initialise dlt", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
}
- if ((appid==0) || (appid[0]=='\0'))
- {
- return -1;
- }
+ if ((appid == NULL) || (appid[0] == '\0'))
+ return DLT_RETURN_WRONG_PARAMETER;
/* check if application already registered */
/* if yes do not register again */
- if(appid[1]==0)
+ if (appid[1] == 0)
{
- if(appid[0]==dlt_user.appID[0])
- return 0;
+ if (appid[0] == dlt_user.appID[0])
+ return DLT_RETURN_OK;
}
- else if(appid[2]==0)
+ else if (appid[2] == 0)
{
- if(appid[0]==dlt_user.appID[0] &&
- appid[1]==dlt_user.appID[1])
- return 0;
+ if (appid[0] == dlt_user.appID[0] &&
+ appid[1] == dlt_user.appID[1])
+ return DLT_RETURN_OK;
}
- else if(appid[3]==0)
+ else if (appid[3] == 0)
{
- if(appid[0]==dlt_user.appID[0] &&
- appid[1]==dlt_user.appID[1] &&
- appid[2]==dlt_user.appID[2])
- return 0;
+ if (appid[0] == dlt_user.appID[0] &&
+ appid[1] == dlt_user.appID[1] &&
+ appid[2] == dlt_user.appID[2])
+ return DLT_RETURN_OK;
}
else
{
- if(appid[0]==dlt_user.appID[0] &&
- appid[1]==dlt_user.appID[1] &&
- appid[2]==dlt_user.appID[2] &&
- appid[3]==dlt_user.appID[3])
- return 0;
+ if (appid[0] == dlt_user.appID[0] &&
+ appid[1] == dlt_user.appID[1] &&
+ appid[2] == dlt_user.appID[2] &&
+ appid[3] == dlt_user.appID[3])
+ return DLT_RETURN_OK;
}
DLT_SEM_LOCK();
@@ -762,25 +755,24 @@ int dlt_register_app(const char *appid, const char * description)
/* Store locally application id and application description */
dlt_set_id(dlt_user.appID, appid);
- if (dlt_user.application_description!=0)
- {
+ if (dlt_user.application_description != NULL)
free(dlt_user.application_description);
- }
- dlt_user.application_description = 0;
+ dlt_user.application_description = NULL;
- if (description!=0)
+ if (description != NULL)
{
size_t desc_len = strlen(description);
- dlt_user.application_description= malloc(desc_len+1);
- if (dlt_user.application_description){
+ dlt_user.application_description = malloc(desc_len + 1);
+ if (dlt_user.application_description)
+ {
strncpy(dlt_user.application_description, description, desc_len);
- dlt_user.application_description[desc_len]='\0';
+ dlt_user.application_description[desc_len] = '\0';
}
else
{
- DLT_SEM_FREE();
- return -1;
+ DLT_SEM_FREE();
+ return DLT_RETURN_ERROR;
}
}
@@ -795,26 +787,36 @@ int dlt_register_app(const char *appid, const char * description)
return ret;
}
-int dlt_register_context(DltContext *handle, const char *contextid, const char * description)
+
+DltReturnValue dlt_register_context(DltContext *handle, const char *contextid, const char * description)
{
// check nullpointer
- if(!handle)
- return -1;
+ if(handle == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
- if (dlt_user_initialised==0)
+ if (!dlt_user_initialised)
{
- if (dlt_init()<0)
+ if (dlt_init() < 0)
{
- return -1;
+ dlt_vlog(LOG_ERR, "%s Failed to initialise dlt", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
}
DLT_SEM_LOCK();
- if ((contextid==0) || (contextid[0]=='\0'))
+ if (dlt_user.appID[0]=='\0')
{
+ dlt_vnlog(LOG_WARNING, DLT_USER_BUFFER_LENGTH, "No application registered while trying to register ContextID %4s!\n", contextid);
+
DLT_SEM_FREE();
- return -1;
+ return DLT_RETURN_ERROR;
+ }
+
+ if ((contextid == NULL) || (contextid[0] == '\0'))
+ {
+ DLT_SEM_FREE();
+ return DLT_RETURN_WRONG_PARAMETER;
}
DLT_SEM_FREE();
@@ -822,41 +824,36 @@ int dlt_register_context(DltContext *handle, const char *contextid, const char *
return dlt_register_context_ll_ts(handle, contextid, description, DLT_USER_LOG_LEVEL_NOT_SET, DLT_USER_TRACE_STATUS_NOT_SET);
}
-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)
{
DltContextData log;
uint32_t i;
//check nullpointer
if(!handle)
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
- if (dlt_user_initialised==0)
+ if ((contextid == NULL) || (contextid[0]=='\0'))
{
- if (dlt_init()<0)
- {
- return -1;
- }
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if ((contextid==0) || (contextid[0]=='\0'))
+ if (loglevel < DLT_USER_LOG_LEVEL_NOT_SET || loglevel >= DLT_LOG_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Loglevel %d is outside valid range", loglevel);
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if ((loglevel<DLT_USER_LOG_LEVEL_NOT_SET) || (loglevel>DLT_LOG_VERBOSE) || (loglevel==DLT_LOG_DEFAULT))
+ if (tracestatus < DLT_USER_TRACE_STATUS_NOT_SET || tracestatus >= DLT_TRACE_STATUS_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Tracestatus %d is outside valid range", tracestatus);
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if ((tracestatus<DLT_USER_TRACE_STATUS_NOT_SET) || (tracestatus>DLT_TRACE_STATUS_ON) || (tracestatus==DLT_TRACE_STATUS_DEFAULT))
- {
- return -1;
- }
if (dlt_user_log_init(handle, &log)==-1)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* Reset message counter */
@@ -877,7 +874,7 @@ int dlt_register_context_ll_ts(DltContext *handle, const char *contextid, const
if (dlt_user.dlt_ll_ts==0)
{
DLT_SEM_FREE();
- return -1;
+ return DLT_RETURN_ERROR;
}
dlt_user.dlt_ll_ts_max_num_entries = DLT_USER_CONTEXT_ALLOC_SIZE;
@@ -922,7 +919,7 @@ int dlt_register_context_ll_ts(DltContext *handle, const char *contextid, const
dlt_user.dlt_ll_ts = old_ll_ts;
dlt_user.dlt_ll_ts_max_num_entries = old_max_entries;
DLT_SEM_FREE();
- return -1;
+ return DLT_RETURN_ERROR;
}
memcpy(dlt_user.dlt_ll_ts,old_ll_ts,sizeof(dlt_ll_ts_type)*dlt_user.dlt_ll_ts_num_entries);
@@ -967,7 +964,7 @@ int dlt_register_context_ll_ts(DltContext *handle, const char *contextid, const
if(dlt_user.dlt_ll_ts[dlt_user.dlt_ll_ts_num_entries].context_description == 0)
{
DLT_SEM_FREE();
- return -1;
+ return DLT_RETURN_ERROR;
}
strncpy(dlt_user.dlt_ll_ts[dlt_user.dlt_ll_ts_num_entries].context_description, description, desc_len);
@@ -980,7 +977,7 @@ int dlt_register_context_ll_ts(DltContext *handle, const char *contextid, const
if(dlt_user.dlt_ll_ts[dlt_user.dlt_ll_ts_num_entries].log_level_ptr == 0)
{
DLT_SEM_FREE();
- return -1;
+ return DLT_RETURN_ERROR;
}
}
if(dlt_user.dlt_ll_ts[dlt_user.dlt_ll_ts_num_entries].trace_status_ptr == 0)
@@ -989,7 +986,7 @@ int dlt_register_context_ll_ts(DltContext *handle, const char *contextid, const
if(dlt_user.dlt_ll_ts[dlt_user.dlt_ll_ts_num_entries].trace_status_ptr == 0)
{
DLT_SEM_FREE();
- return -1;
+ return DLT_RETURN_ERROR;
}
}
@@ -1030,13 +1027,14 @@ int dlt_register_context_ll_ts(DltContext *handle, const char *contextid, const
return dlt_user_log_send_register_context(&log);
}
-int dlt_unregister_app(void)
+DltReturnValue dlt_unregister_app(void)
{
- int ret;
+ DltReturnValue ret = DLT_RETURN_OK;
- if (dlt_user_initialised==0)
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
/* Inform daemon to unregister application and all of its contexts */
@@ -1047,43 +1045,32 @@ int dlt_unregister_app(void)
/* Clear and free local stored application information */
dlt_set_id(dlt_user.appID, "");
- if (dlt_user.application_description!=0)
+ if (dlt_user.application_description != NULL)
{
free(dlt_user.application_description);
}
- dlt_user.application_description = 0;
+ dlt_user.application_description = NULL;
DLT_SEM_FREE();
return ret;
}
-int dlt_unregister_context(DltContext *handle)
+DltReturnValue dlt_unregister_context(DltContext *handle)
{
DltContextData log;
- int ret;
-
- // check nullpointer
- if(!handle)
- return -1;
-
- if (dlt_user_initialised==0)
- {
- return -1;
- }
+ DltReturnValue ret = DLT_RETURN_OK;
- if (dlt_user_log_init(handle, &log) == -1)
- {
- return -1;
- }
+ if (dlt_user_log_init(handle, &log) <= DLT_RETURN_ERROR)
+ return DLT_RETURN_ERROR;
DLT_SEM_LOCK();
- handle->log_level_ptr = 0;
- handle->trace_status_ptr = 0;
+ handle->log_level_ptr = NULL;
+ handle->trace_status_ptr = NULL;
- if (dlt_user.dlt_ll_ts)
+ if (dlt_user.dlt_ll_ts != NULL)
{
/* Clear and free local stored context information */
dlt_set_id(dlt_user.dlt_ll_ts[handle->log_level_pos].contextID, "");
@@ -1091,33 +1078,33 @@ int dlt_unregister_context(DltContext *handle)
dlt_user.dlt_ll_ts[handle->log_level_pos].log_level = DLT_USER_INITIAL_LOG_LEVEL;
dlt_user.dlt_ll_ts[handle->log_level_pos].trace_status = DLT_USER_INITIAL_TRACE_STATUS;
- if (dlt_user.dlt_ll_ts[handle->log_level_pos].context_description!=0)
+ if (dlt_user.dlt_ll_ts[handle->log_level_pos].context_description != NULL)
{
free(dlt_user.dlt_ll_ts[handle->log_level_pos].context_description);
}
- if (dlt_user.dlt_ll_ts[handle->log_level_pos].log_level_ptr!=0)
+ if (dlt_user.dlt_ll_ts[handle->log_level_pos].log_level_ptr != NULL)
{
free(dlt_user.dlt_ll_ts[handle->log_level_pos].log_level_ptr);
- dlt_user.dlt_ll_ts[handle->log_level_pos].log_level_ptr = 0;
+ dlt_user.dlt_ll_ts[handle->log_level_pos].log_level_ptr = NULL;
}
- if (dlt_user.dlt_ll_ts[handle->log_level_pos].trace_status_ptr!=0)
+ if (dlt_user.dlt_ll_ts[handle->log_level_pos].trace_status_ptr != NULL)
{
free(dlt_user.dlt_ll_ts[handle->log_level_pos].trace_status_ptr);
- dlt_user.dlt_ll_ts[handle->log_level_pos].trace_status_ptr = 0;
+ dlt_user.dlt_ll_ts[handle->log_level_pos].trace_status_ptr = NULL;
}
- dlt_user.dlt_ll_ts[handle->log_level_pos].context_description = 0;
+ dlt_user.dlt_ll_ts[handle->log_level_pos].context_description = NULL;
- if (dlt_user.dlt_ll_ts[handle->log_level_pos].injection_table)
+ if (dlt_user.dlt_ll_ts[handle->log_level_pos].injection_table != NULL)
{
free(dlt_user.dlt_ll_ts[handle->log_level_pos].injection_table);
- dlt_user.dlt_ll_ts[handle->log_level_pos].injection_table = 0;
+ dlt_user.dlt_ll_ts[handle->log_level_pos].injection_table = NULL;
}
dlt_user.dlt_ll_ts[handle->log_level_pos].nrcallbacks = 0;
- dlt_user.dlt_ll_ts[handle->log_level_pos].log_level_changed_callback = 0;
+ dlt_user.dlt_ll_ts[handle->log_level_pos].log_level_changed_callback = 0;
}
DLT_SEM_FREE();
@@ -1128,16 +1115,28 @@ int dlt_unregister_context(DltContext *handle)
return ret;
}
-int dlt_set_application_ll_ts_limit(DltLogLevelType loglevel, DltTraceStatusType tracestatus)
+DltReturnValue dlt_set_application_ll_ts_limit(DltLogLevelType loglevel, DltTraceStatusType tracestatus)
{
uint32_t i;
- int ret;
- if (dlt_user_initialised==0)
+ if (loglevel < DLT_USER_LOG_LEVEL_NOT_SET || loglevel >= DLT_LOG_MAX)
+ {
+ dlt_vlog(LOG_ERR, "Loglevel %d is outside valid range", loglevel);
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ if (tracestatus < DLT_USER_TRACE_STATUS_NOT_SET || tracestatus >= DLT_TRACE_STATUS_MAX)
{
- if (dlt_init()<0)
+ dlt_vlog(LOG_ERR, "Tracestatus %d is outside valid range", tracestatus);
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ if (!dlt_user_initialised)
+ {
+ if (dlt_init() < 0)
{
- return -1;
+ dlt_vlog(LOG_ERR, "%s Failed to initialise dlt", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
}
@@ -1145,26 +1144,26 @@ int dlt_set_application_ll_ts_limit(DltLogLevelType loglevel, DltTraceStatusType
if ((loglevel<DLT_LOG_DEFAULT) || (loglevel>DLT_LOG_VERBOSE))
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if ((tracestatus<DLT_TRACE_STATUS_DEFAULT) || (tracestatus>DLT_TRACE_STATUS_ON))
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.dlt_ll_ts==0)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
*/
DLT_SEM_LOCK();
- if (dlt_user.dlt_ll_ts==0)
+ if (dlt_user.dlt_ll_ts == NULL)
{
DLT_SEM_FREE();
- return -1;
+ return DLT_RETURN_ERROR;
}
/* Update local structures */
@@ -1173,35 +1172,40 @@ int dlt_set_application_ll_ts_limit(DltLogLevelType loglevel, DltTraceStatusType
dlt_user.dlt_ll_ts[i].log_level = loglevel;
dlt_user.dlt_ll_ts[i].trace_status = tracestatus;
if(dlt_user.dlt_ll_ts[i].log_level_ptr)
- *(dlt_user.dlt_ll_ts[i].log_level_ptr) = loglevel;
+ *(dlt_user.dlt_ll_ts[i].log_level_ptr) = loglevel;
if(dlt_user.dlt_ll_ts[i].trace_status_ptr)
- *(dlt_user.dlt_ll_ts[i].trace_status_ptr) = tracestatus;
+ *(dlt_user.dlt_ll_ts[i].trace_status_ptr) = tracestatus;
}
DLT_SEM_FREE();
/* Inform DLT server about update */
- ret = dlt_send_app_ll_ts_limit(dlt_user.appID, loglevel, tracestatus);
-
- return ret;
+ return dlt_send_app_ll_ts_limit(dlt_user.appID, loglevel, tracestatus);
}
int dlt_get_log_state()
{
- return dlt_user.log_state;
+ return dlt_user.log_state;
}
-int dlt_set_log_mode(DltUserLogMode mode)
+DltReturnValue dlt_set_log_mode(DltUserLogMode mode)
{
- if (dlt_user_initialised==0)
+ if (mode < DLT_USER_MODE_UNDEFINED || mode >= DLT_USER_MODE_MAX)
+ {
+ dlt_vlog(LOG_ERR, "User log mode %d is outside valid range", mode);
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ if (!dlt_user_initialised)
{
- if (dlt_init()<0)
+ if (dlt_init() < 0)
{
- return -1;
+ dlt_vlog(LOG_ERR, "%s Failed to initialise dlt", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
}
- return dlt_user_log_send_log_mode(mode);
+ return dlt_user_log_send_log_mode(mode);
}
int dlt_set_resend_timeout_atexit(uint32_t timeout_in_milliseconds)
@@ -1218,27 +1222,26 @@ int dlt_set_resend_timeout_atexit(uint32_t timeout_in_milliseconds)
}
-int dlt_forward_msg(void *msgdata,size_t size)
+DltReturnValue dlt_forward_msg(void *msgdata,size_t size)
{
DltUserHeader userheader;
DltReturnValue ret;
- if ((msgdata==0) || (size==0))
+ if ((msgdata == NULL) || (size == 0))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_LOG)==-1)
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_LOG) < DLT_RETURN_OK)
{
- /* Type of internal user message; same value for Trace messages */
- return -1;
+ /* Type of internal user message; same value for Trace messages */
+ return DLT_RETURN_ERROR;
}
if (dlt_user.dlt_is_file)
{
/* log to file */
- ret = dlt_user_log_out2(dlt_user.dlt_log_handle, msgdata, size, 0, 0);
- return ((ret==DLT_RETURN_OK)?0:-1);
+ return dlt_user_log_out2(dlt_user.dlt_log_handle, msgdata, size, 0, 0);
}
else
{
@@ -1249,8 +1252,7 @@ int dlt_forward_msg(void *msgdata,size_t size)
{
if (dlt_user_log_send_overflow()==0)
{
- snprintf(str,DLT_USER_BUFFER_LENGTH,"Buffer full! %u messages discarded!\n",dlt_user.overflow_counter);
- dlt_log(LOG_WARNING, str);
+ dlt_vnlog(LOG_WARNING, DLT_USER_BUFFER_LENGTH, "Buffer full! %u messages discarded!\n", dlt_user.overflow_counter);
dlt_user.overflow_counter=0;
}
}
@@ -1261,24 +1263,25 @@ int dlt_forward_msg(void *msgdata,size_t size)
msgdata, size, 0, 0);
/* store message in ringbuffer, if an error has occured */
- if (ret!=DLT_RETURN_OK)
+ if (ret < DLT_RETURN_OK)
{
DLT_SEM_LOCK();
if (dlt_buffer_push3(&(dlt_user.startup_buffer),
(unsigned char *)&(userheader), sizeof(DltUserHeader),
- msgdata, size, 0, 0)==-1)
- {
+ msgdata, size, 0, 0) == DLT_RETURN_ERROR)
+ {
if(dlt_user.overflow_counter==0)
{
- dlt_log(LOG_WARNING,"Buffer full! First message discarded!\n");
+ dlt_log(LOG_WARNING,"Buffer full! First message discarded!\n");
}
+
ret = DLT_RETURN_BUFFER_FULL;
- }
+ }
DLT_SEM_FREE();
- if(dlt_user_queue_resend() < 0 && dlt_user.dlt_log_handle >= 0)
+ if(dlt_user_queue_resend() < DLT_RETURN_OK && dlt_user.dlt_log_handle >= 0)
{
;//dlt_log(LOG_WARNING, "dlt_forward_msg: Failed to queue resending.\n");
}
@@ -1286,152 +1289,148 @@ int dlt_forward_msg(void *msgdata,size_t size)
switch (ret)
{
- case DLT_RETURN_BUFFER_FULL:
- {
- /* Buffer full */
- dlt_user.overflow_counter += 1;
- return -1;
- }
- case DLT_RETURN_PIPE_FULL:
- {
- /* data could not be written */
- return -1;
- }
- case DLT_RETURN_PIPE_ERROR:
- {
- /* handle not open or pipe error */
- close(dlt_user.dlt_log_handle);
- dlt_user.dlt_log_handle = -1;
+ case DLT_RETURN_WRONG_PARAMETER:
+ {
+ /* wrong parameters */
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+ case DLT_RETURN_BUFFER_FULL:
+ {
+ /* Buffer full */
+ dlt_user.overflow_counter += 1;
+ return DLT_RETURN_ERROR;
+ }
+ case DLT_RETURN_PIPE_FULL:
+ {
+ /* data could not be written */
+ return DLT_RETURN_ERROR;
+ }
+ case DLT_RETURN_PIPE_ERROR:
+ {
+ /* handle not open or pipe error */
+ close(dlt_user.dlt_log_handle);
+ dlt_user.dlt_log_handle = -1;
- return -1;
- }
- case DLT_RETURN_ERROR:
- {
- /* other error condition */
- return -1;
- }
- case DLT_RETURN_OK:
- {
- return 0;
- }
- default:
- {
- /* This case should not occur */
- return -1;
- }
+ return DLT_RETURN_ERROR;
+ }
+ case DLT_RETURN_ERROR:
+ {
+ /* other error condition */
+ return DLT_RETURN_ERROR;
+ }
+ case DLT_RETURN_OK:
+ {
+ return DLT_RETURN_OK;
+ }
+ default:
+ {
+ /* This case should not occur */
+ return DLT_RETURN_ERROR;
+ }
}
}
- return 0;
+ return DLT_RETURN_OK;
}
/* ********************************************************************************************* */
-inline int dlt_user_log_write_start(DltContext *handle, DltContextData *log,DltLogLevelType loglevel)
+inline DltReturnValue dlt_user_log_write_start(DltContext *handle, DltContextData *log,DltLogLevelType loglevel)
{
return dlt_user_log_write_start_id(handle,log,loglevel,DLT_USER_DEFAULT_MSGID);
}
-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)
{
// check nullpointer
- if(!handle)
- return -1;
+ if (handle == NULL || log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
- if(dlt_user_initialised==0)
- {
- if (dlt_init()<0)
- {
- return -1;
- }
- }
- if (log==0)
+ if (loglevel < DLT_USER_LOG_LEVEL_NOT_SET || loglevel >= DLT_LOG_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Loglevel %d is outside valid range", loglevel);
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if (dlt_user_log_init(handle, log)==-1)
- {
- return -1;
- }
-
- if (dlt_user.dlt_ll_ts==0)
- {
- return -1;
- }
+ if (dlt_user_log_init(handle, log) < DLT_RETURN_OK || dlt_user.dlt_ll_ts == NULL)
+ return DLT_RETURN_ERROR;
/* initialize values */
- log->args_num = 0;
- log->log_level = loglevel;
+ log->args_num = 0;
+ log->log_level = loglevel;
log->size = 0;
/* check log levels */
- if (handle->log_level_ptr && (loglevel<=(int)*(handle->log_level_ptr) ) && (loglevel!=0))
+ if (handle->log_level_ptr != NULL && (loglevel <= (int) *(handle->log_level_ptr)) && (loglevel != DLT_LOG_OFF))
{
-
/* In non-verbose mode, insert message id */
- if (dlt_user.verbose_mode==0)
+ if (dlt_user.verbose_mode == 0)
{
- if ((sizeof(uint32_t))>DLT_USER_BUF_MAX_SIZE)
- {
- return -1;
- }
+ if ((sizeof(uint32_t)) > DLT_USER_BUF_MAX_SIZE)
+ return DLT_RETURN_ERROR;
+
/* Write message id */
- memcpy(log->buffer,&(messageid),sizeof(uint32_t));
+ memcpy(log->buffer, &(messageid), sizeof(uint32_t));
log->size = sizeof(uint32_t);
/* as the message id is part of each message in non-verbose mode,
- it doesn't increment the argument counter in extended header (if used) */
+ it doesn't increment the argument counter in extended header (if used) */
}
- return 1;
+
+ return DLT_RETURN_TRUE;
}
else
{
- return 0;
+ return DLT_RETURN_OK;
}
- return -1;
+ return DLT_RETURN_ERROR;
}
-int dlt_user_log_write_finish(DltContextData *log)
+DltReturnValue dlt_user_log_write_finish(DltContextData *log)
{
- if (log==0)
- {
- return -1;
- }
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
- return dlt_user_log_send_log(log, DLT_TYPE_LOG) < 0 ? -1 : 0;
+ return dlt_user_log_send_log(log, DLT_TYPE_LOG);
}
-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)
{
- return dlt_user_log_write_raw_formatted(log,data,length,DLT_FORMAT_DEFAULT);
+ return dlt_user_log_write_raw_formatted(log, data, length, DLT_FORMAT_DEFAULT);
}
-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)
{
uint16_t arg_size;
uint32_t type_info;
// check nullpointer
- if(!log || !data)
- return -1;
+ if (log == NULL || data == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
- if (log==0)
+ if (type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Format type %d is outside valid range", type);
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ if (!dlt_user_initialised)
+ {
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+length+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+length+sizeof(uint32_t)+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* Transmit type information */
@@ -1439,13 +1438,13 @@ int dlt_user_log_write_raw_formatted(DltContextData *log,void *data,uint16_t len
if(type>=DLT_FORMAT_HEX8 && type<=DLT_FORMAT_HEX64)
{
- type_info |= DLT_SCOD_HEX;
- type_info += type;
+ type_info |= DLT_SCOD_HEX;
+ type_info += type;
}
else if(type>=DLT_FORMAT_BIN8 && type<=DLT_FORMAT_BIN16)
{
- type_info |= DLT_SCOD_BIN;
- type_info += type - DLT_FORMAT_BIN8 + 1;
+ type_info |= DLT_SCOD_BIN;
+ type_info += type - DLT_FORMAT_BIN8 + 1;
}
memcpy((log->buffer)+log->size,&(type_info),sizeof(uint32_t));
@@ -1464,33 +1463,37 @@ int dlt_user_log_write_raw_formatted(DltContextData *log,void *data,uint16_t len
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_float32(DltContextData *log, float32_t data)
+DltReturnValue dlt_user_log_write_float32(DltContextData *log, float32_t data)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if (sizeof(float32_t)!=4)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(float32_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(float32_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_FLOA | DLT_TYLE_32BIT;
@@ -1504,33 +1507,37 @@ int dlt_user_log_write_float32(DltContextData *log, float32_t data)
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_float64(DltContextData *log, float64_t data)
+DltReturnValue dlt_user_log_write_float64(DltContextData *log, float64_t data)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if (sizeof(float64_t)!=8)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(float64_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(float64_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_FLOA | DLT_TYLE_64BIT;
@@ -1544,14 +1551,18 @@ int dlt_user_log_write_float64(DltContextData *log, float64_t data)
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_uint( DltContextData *log, unsigned int data)
+DltReturnValue dlt_user_log_write_uint( DltContextData *log, unsigned int data)
{
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
switch (sizeof(unsigned int))
@@ -1574,37 +1585,41 @@ int dlt_user_log_write_uint( DltContextData *log, unsigned int data)
case 8:
{
return dlt_user_log_write_uint64(log, (uint64_t)data);
- break;
+ break;
}
default:
{
- return -1;
+ return DLT_RETURN_ERROR;
break;
}
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_uint8(DltContextData *log, uint8_t data)
+DltReturnValue dlt_user_log_write_uint8(DltContextData *log, uint8_t data)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(uint8_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(uint8_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_UINT | DLT_TYLE_8BIT;
@@ -1618,28 +1633,32 @@ int dlt_user_log_write_uint8(DltContextData *log, uint8_t data)
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_uint16(DltContextData *log, uint16_t data)
+DltReturnValue dlt_user_log_write_uint16(DltContextData *log, uint16_t data)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_UINT | DLT_TYLE_16BIT;
@@ -1653,28 +1672,32 @@ int dlt_user_log_write_uint16(DltContextData *log, uint16_t data)
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_uint32(DltContextData *log, uint32_t data)
+DltReturnValue dlt_user_log_write_uint32(DltContextData *log, uint32_t data)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(uint32_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(uint32_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_UINT | DLT_TYLE_32BIT;
@@ -1688,28 +1711,32 @@ int dlt_user_log_write_uint32(DltContextData *log, uint32_t data)
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_uint64(DltContextData *log, uint64_t data)
+DltReturnValue dlt_user_log_write_uint64(DltContextData *log, uint64_t data)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(uint64_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(uint64_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_UINT | DLT_TYLE_64BIT;
@@ -1723,28 +1750,38 @@ int dlt_user_log_write_uint64(DltContextData *log, uint64_t data)
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_uint8_formatted(DltContextData *log, uint8_t data, DltFormatType type)
+DltReturnValue dlt_user_log_write_uint8_formatted(DltContextData *log, uint8_t data, DltFormatType type)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Format type %d is outside valid range", type);
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ if (!dlt_user_initialised)
+ {
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_UINT | DLT_TYLE_8BIT;
@@ -1768,28 +1805,38 @@ int dlt_user_log_write_uint8_formatted(DltContextData *log, uint8_t data, DltFor
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_uint16_formatted(DltContextData *log, uint16_t data, DltFormatType type)
+DltReturnValue dlt_user_log_write_uint16_formatted(DltContextData *log, uint16_t data, DltFormatType type)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Format type %d is outside valid range", type);
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ if (!dlt_user_initialised)
+ {
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_UINT | DLT_TYLE_16BIT;
@@ -1813,28 +1860,38 @@ int dlt_user_log_write_uint16_formatted(DltContextData *log, uint16_t data, DltF
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_uint32_formatted(DltContextData *log, uint32_t data, DltFormatType type)
+DltReturnValue dlt_user_log_write_uint32_formatted(DltContextData *log, uint32_t data, DltFormatType type)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Format type %d is outside valid range", type);
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ if (!dlt_user_initialised)
+ {
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_UINT | DLT_TYLE_32BIT;
@@ -1858,28 +1915,38 @@ int dlt_user_log_write_uint32_formatted(DltContextData *log, uint32_t data, DltF
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_uint64_formatted(DltContextData *log, uint64_t data, DltFormatType type)
+DltReturnValue dlt_user_log_write_uint64_formatted(DltContextData *log, uint64_t data, DltFormatType type)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Format type %d is outside valid range", type);
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ if (!dlt_user_initialised)
+ {
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_UINT | DLT_TYLE_64BIT;
@@ -1903,14 +1970,18 @@ int dlt_user_log_write_uint64_formatted(DltContextData *log, uint64_t data, DltF
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_int(DltContextData *log, int data)
+DltReturnValue dlt_user_log_write_int(DltContextData *log, int data)
{
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
switch (sizeof(int))
@@ -1933,37 +2004,41 @@ int dlt_user_log_write_int(DltContextData *log, int data)
case 8:
{
return dlt_user_log_write_int64(log, (int64_t)data);
- break;
+ break;
}
default:
{
- return -1;
+ return DLT_RETURN_ERROR;
break;
}
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_int8(DltContextData *log, int8_t data)
+DltReturnValue dlt_user_log_write_int8(DltContextData *log, int8_t data)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(int8_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(int8_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_SINT | DLT_TYLE_8BIT;
@@ -1977,29 +2052,33 @@ int dlt_user_log_write_int8(DltContextData *log, int8_t data)
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_int16(DltContextData *log, int16_t data)
+DltReturnValue dlt_user_log_write_int16(DltContextData *log, int16_t data)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(int16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(int16_t))>DLT_USER_BUF_MAX_SIZE)
- {
- return -1;
- }
+ {
+ return DLT_RETURN_ERROR;
+ }
type_info = DLT_TYPE_INFO_SINT | DLT_TYLE_16BIT;
@@ -2012,28 +2091,32 @@ int dlt_user_log_write_int16(DltContextData *log, int16_t data)
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_int32(DltContextData *log, int32_t data)
+DltReturnValue dlt_user_log_write_int32(DltContextData *log, int32_t data)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(int32_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(int32_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_SINT | DLT_TYLE_32BIT;
@@ -2047,28 +2130,32 @@ int dlt_user_log_write_int32(DltContextData *log, int32_t data)
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_int64(DltContextData *log, int64_t data)
+DltReturnValue dlt_user_log_write_int64(DltContextData *log, int64_t data)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(int64_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(int64_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_SINT | DLT_TYLE_64BIT;
@@ -2082,28 +2169,32 @@ int dlt_user_log_write_int64(DltContextData *log, int64_t data)
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_bool(DltContextData *log, uint8_t data)
+DltReturnValue dlt_user_log_write_bool(DltContextData *log, uint8_t data)
{
uint32_t type_info;
- if (log==0)
+ if (log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+sizeof(uint8_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+sizeof(uint32_t)+sizeof(uint8_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_BOOL;
@@ -2117,29 +2208,33 @@ int dlt_user_log_write_bool(DltContextData *log, uint8_t data)
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_string(DltContextData *log, const char *text)
+DltReturnValue dlt_user_log_write_string(DltContextData *log, const char *text)
{
uint16_t arg_size;
uint32_t type_info;
- if ((log==0) || (text==0))
+ if (log == NULL || text == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
if ((log->size+(strlen(text)+1)+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+(strlen(text)+1)+sizeof(uint32_t)+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_STRG | DLT_SCOD_ASCII;
@@ -2158,42 +2253,41 @@ int dlt_user_log_write_string(DltContextData *log, const char *text)
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_write_constant_string(DltContextData *log, const char *text)
+DltReturnValue dlt_user_log_write_constant_string(DltContextData *log, const char *text)
{
/* Send parameter only in verbose mode */
- if (dlt_user.verbose_mode)
- {
- return dlt_user_log_write_string(log,text);
- }
-
- return 0;
+ return dlt_user.verbose_mode ? dlt_user_log_write_string(log, text) : DLT_RETURN_OK;
}
-int dlt_user_log_write_utf8_string(DltContextData *log, const char *text)
+DltReturnValue dlt_user_log_write_utf8_string(DltContextData *log, const char *text)
{
uint16_t arg_size;
uint32_t type_info;
- if ((log==0) || (text==0))
+ if (log == NULL || text == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- return -1;
+ dlt_vlog(LOG_WARNING, "%s dlt_user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
arg_size = strlen(text)+1;
if ((log->size+arg_size+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.verbose_mode)
{
if ((log->size+arg_size+sizeof(uint32_t)+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
type_info = DLT_TYPE_INFO_STRG | DLT_SCOD_UTF8;
@@ -2212,45 +2306,35 @@ int dlt_user_log_write_utf8_string(DltContextData *log, const char *text)
log->args_num ++;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_register_injection_callback(DltContext *handle, uint32_t service_id,
- int (*dlt_injection_callback)(uint32_t service_id, void *data, uint32_t length))
+DltReturnValue dlt_register_injection_callback(DltContext *handle, uint32_t service_id,
+ int (*dlt_injection_callback)(uint32_t service_id, void *data, uint32_t length))
{
DltContextData log;
uint32_t i,j,k;
int found = 0;
- DltUserInjectionCallback *old;
+ DltUserInjectionCallback *old;
- if (handle==0)
- {
- return -1;
- }
-
- if (dlt_user_log_init(handle, &log)==-1)
- {
- return -1;
- }
+ if (dlt_user_log_init(handle, &log) < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
if (service_id<DLT_USER_INJECTION_MIN)
- {
- return -1;
- }
+ return DLT_RETURN_WRONG_PARAMETER;
+
/* This function doesn't make sense storing to local file is choosen;
so terminate this function */
if (dlt_user.dlt_is_file)
- {
- return 0;
- }
+ return DLT_RETURN_OK;
DLT_SEM_LOCK();
- if (dlt_user.dlt_ll_ts==0)
+ if (dlt_user.dlt_ll_ts == NULL)
{
DLT_SEM_FREE();
- return 0;
+ return DLT_RETURN_OK;
}
/* Insert callback in corresponding table */
@@ -2276,24 +2360,24 @@ int dlt_register_injection_callback(DltContext *handle, uint32_t service_id,
j=dlt_user.dlt_ll_ts[i].nrcallbacks;
/* Allocate or expand injection table */
- if (dlt_user.dlt_ll_ts[i].injection_table == 0)
+ if (dlt_user.dlt_ll_ts[i].injection_table == NULL)
{
dlt_user.dlt_ll_ts[i].injection_table = (DltUserInjectionCallback*) malloc(sizeof(DltUserInjectionCallback));
- if(dlt_user.dlt_ll_ts[i].injection_table == 0)
+ if(dlt_user.dlt_ll_ts[i].injection_table == NULL)
{
- DLT_SEM_FREE();
- return -1;
+ DLT_SEM_FREE();
+ return DLT_RETURN_ERROR;
}
}
else
{
old = dlt_user.dlt_ll_ts[i].injection_table;
dlt_user.dlt_ll_ts[i].injection_table = (DltUserInjectionCallback*) malloc(sizeof(DltUserInjectionCallback)*(j+1));
- if(dlt_user.dlt_ll_ts[i].injection_table == 0)
+ if(dlt_user.dlt_ll_ts[i].injection_table == NULL)
{
- dlt_user.dlt_ll_ts[i].injection_table = old;
- DLT_SEM_FREE();
- return -1;
+ dlt_user.dlt_ll_ts[i].injection_table = old;
+ DLT_SEM_FREE();
+ return DLT_RETURN_ERROR;
}
memcpy(dlt_user.dlt_ll_ts[i].injection_table,old,sizeof(DltUserInjectionCallback)*j);
free(old);
@@ -2307,38 +2391,30 @@ int dlt_register_injection_callback(DltContext *handle, uint32_t service_id,
dlt_user.dlt_ll_ts[i].injection_table[j].injection_callback = dlt_injection_callback;
DLT_SEM_FREE();
- return 0;
+
+ return DLT_RETURN_OK;
}
-int 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))
+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))
{
DltContextData log;
uint32_t i;
- if (handle==0)
- {
- return -1;
- }
-
- if (dlt_user_log_init(handle, &log)==-1)
- {
- return -1;
- }
+ if (dlt_user_log_init(handle, &log) < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
/* This function doesn't make sense storing to local file is choosen;
so terminate this function */
if (dlt_user.dlt_is_file)
- {
- return 0;
- }
+ return DLT_RETURN_OK;
DLT_SEM_LOCK();
- if (dlt_user.dlt_ll_ts==0)
+ if (dlt_user.dlt_ll_ts == NULL)
{
DLT_SEM_FREE();
- return 0;
+ return DLT_RETURN_OK;
}
/* Insert callback in corresponding table */
@@ -2349,7 +2425,7 @@ int dlt_register_log_level_changed_callback(DltContext *handle,
DLT_SEM_FREE();
- return 0;
+ return DLT_RETURN_OK;
}
/**
@@ -2357,130 +2433,109 @@ int dlt_register_log_level_changed_callback(DltContext *handle,
*/
-int check_buffer()
+int check_buffer(void)
{
- int total_size, used_size;
- dlt_user_check_buffer(&total_size, &used_size);
+ int total_size, used_size;
+ dlt_user_check_buffer(&total_size, &used_size);
- if((total_size - used_size) < (total_size/2))
- {
- return -1;
- }
- return 1;
+ return (total_size - used_size < total_size / 2) ? -1 : 1;
}
/**
* Send the start of a segment chain.
- * Returns -1 on failure
+ * Returns DLT_RETURN_ERROR on failure
*/
-int dlt_user_trace_network_segmented_start(uint32_t *id, DltContext *handle, DltNetworkTraceType nw_trace_type, uint16_t header_len, void *header, uint16_t payload_len)
+DltReturnValue dlt_user_trace_network_segmented_start(uint32_t *id, DltContext *handle, DltNetworkTraceType nw_trace_type, uint16_t header_len, void *header, uint16_t payload_len)
{
-
DltContextData log;
- struct timeval tv;
+ struct timeval tv;
- if (handle==NULL)
- {
- return -1;
- }
+ // check null pointer
+ if(id == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
- if (dlt_user_log_init(handle, &log)==-1)
+ if (nw_trace_type < DLT_NW_TRACE_IPC || nw_trace_type >= DLT_NW_TRACE_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Network trace type %d is outside valid range", nw_trace_type);
+ return DLT_RETURN_WRONG_PARAMETER;
}
+ if (dlt_user_log_init(handle, &log) < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
- if (dlt_user.dlt_ll_ts==0)
- {
- return -1;
- }
+ if (dlt_user.dlt_ll_ts == NULL)
+ return DLT_RETURN_ERROR;
- if (handle->trace_status_ptr && *(handle->trace_status_ptr)==DLT_TRACE_STATUS_ON)
+ if (handle->trace_status_ptr && *(handle->trace_status_ptr) == DLT_TRACE_STATUS_ON)
{
log.args_num = 0;
log.trace_status = nw_trace_type;
log.size = 0;
- gettimeofday(&tv, NULL);
- *id = tv.tv_usec;
+ gettimeofday(&tv, NULL);
+ *id = tv.tv_usec;
- /* Write identifier */
+ /* Write identifier */
if(dlt_user_log_write_string(&log, "NWST") < 0)
- {
- return -1;
- }
+ return DLT_RETURN_ERROR;
/* Write stream handle */
if(dlt_user_log_write_uint32(&log, *id) < 0)
- {
- return -1;
- }
+ return DLT_RETURN_ERROR;
/* Write header */
if(dlt_user_log_write_raw(&log, header, header_len) < 0)
- {
- return -1;
- }
+ return DLT_RETURN_ERROR;
/* Write size of payload */
if(dlt_user_log_write_uint32(&log, payload_len) < 0)
- {
- return -1;
- }
+ return DLT_RETURN_ERROR;
/* Write expected segment count */
uint16_t segment_count = payload_len/DLT_MAX_TRACE_SEGMENT_SIZE+1;
/* If segments align perfectly with segment size, avoid sending empty segment */
if((payload_len % DLT_MAX_TRACE_SEGMENT_SIZE) == 0)
- {
- segment_count--;
- }
+ segment_count--;
if(dlt_user_log_write_uint16(&log, segment_count) < 0)
- {
- return -1;
- }
+ return DLT_RETURN_ERROR;
/* Write length of one segment */
if(dlt_user_log_write_uint16(&log, DLT_MAX_TRACE_SEGMENT_SIZE) < 0)
- {
- return -1;
- }
+ return DLT_RETURN_ERROR;
/* Send log */
return dlt_user_log_send_log(&log, DLT_TYPE_NW_TRACE);
}
- return 0;
+
+ return DLT_RETURN_OK;
}
-int dlt_user_trace_network_segmented_segment(uint32_t id, DltContext *handle, DltNetworkTraceType nw_trace_type, int sequence, uint16_t payload_len, void *payload)
+DltReturnValue dlt_user_trace_network_segmented_segment(uint32_t id, DltContext *handle, DltNetworkTraceType nw_trace_type, int sequence, uint16_t payload_len, void *payload)
{
- while(check_buffer() < 0)
- {
- usleep(1000*50); // Wait 50ms
- dlt_user_log_resend_buffer();
- }
+ if (nw_trace_type < DLT_NW_TRACE_IPC || nw_trace_type >= DLT_NW_TRACE_MAX)
+ {
+ dlt_vlog(LOG_ERR, "Network trace type %d is outside valid range", nw_trace_type);
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
- if (handle==NULL)
+ while(check_buffer() < 0)
{
- return -1;
+ usleep(1000*50); // Wait 50ms
+ dlt_user_log_resend_buffer();
}
DltContextData log;
- if (dlt_user_log_init(handle, &log)==-1)
- {
- return -1;
- }
+ if (dlt_user_log_init(handle, &log) < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
- if (dlt_user.dlt_ll_ts==0)
- {
- return -1;
- }
+ if (dlt_user.dlt_ll_ts == NULL)
+ return DLT_RETURN_ERROR;
- if (handle->trace_status_ptr && *(handle->trace_status_ptr)==DLT_TRACE_STATUS_ON)
+ if (handle->trace_status_ptr && *(handle->trace_status_ptr) == DLT_TRACE_STATUS_ON)
{
log.args_num = 0;
@@ -2488,94 +2543,77 @@ int dlt_user_trace_network_segmented_segment(uint32_t id, DltContext *handle, Dl
log.size = 0;
/* Write identifier */
- if(dlt_user_log_write_string(&log, "NWCH") < 0)
- {
- return -1;
- }
+ if(dlt_user_log_write_string(&log, "NWCH") < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
/* Write stream handle */
- if(dlt_user_log_write_uint32(&log, id) < 0)
- {
- return -1;
- }
+ if(dlt_user_log_write_uint32(&log, id) < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
/* Write segment sequence number */
- if(dlt_user_log_write_uint16(&log, sequence) < 0)
- {
- return -1;
- }
+ if(dlt_user_log_write_uint16(&log, sequence) < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
/* Write data */
- if(dlt_user_log_write_raw(&log, payload, payload_len) < 0)
- {
- return -1;
- }
+ if(dlt_user_log_write_raw(&log, payload, payload_len) < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
/* Send log */
return dlt_user_log_send_log(&log, DLT_TYPE_NW_TRACE);
}
/* Allow other threads to log between chunks */
- pthread_yield();
- return 0;
+ pthread_yield();
+ return DLT_RETURN_OK;
}
-int dlt_user_trace_network_segmented_end(uint32_t id, DltContext *handle, DltNetworkTraceType nw_trace_type)
+DltReturnValue dlt_user_trace_network_segmented_end(uint32_t id, DltContext *handle, DltNetworkTraceType nw_trace_type)
{
DltContextData log;
- if (handle==0)
- {
- return -1;
- }
-
- if (dlt_user_log_init(handle, &log)==-1)
+ if (nw_trace_type < DLT_NW_TRACE_IPC || nw_trace_type >= DLT_NW_TRACE_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Network trace type %d is outside valid range", nw_trace_type);
+ return DLT_RETURN_WRONG_PARAMETER;
}
+ if (dlt_user_log_init(handle, &log) < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
+ if (dlt_user.dlt_ll_ts == NULL)
+ return DLT_RETURN_ERROR;
- if (dlt_user.dlt_ll_ts==0)
- {
- return -1;
- }
-
- if (handle->trace_status_ptr && *(handle->trace_status_ptr)==DLT_TRACE_STATUS_ON)
+ if (handle->trace_status_ptr && *(handle->trace_status_ptr) == DLT_TRACE_STATUS_ON)
{
-
log.args_num = 0;
log.trace_status = nw_trace_type;
log.size = 0;
/* Write identifier */
- if(dlt_user_log_write_string(&log, "NWEN") < 0)
- {
- return -1;
- }
+ if(dlt_user_log_write_string(&log, "NWEN") < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
/* Write stream handle */
- if(dlt_user_log_write_uint32(&log, id) < 0)
- {
- return -1;
- }
+ if(dlt_user_log_write_uint32(&log, id) < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
/* Send log */
return dlt_user_log_send_log(&log, DLT_TYPE_NW_TRACE);
}
- return 0;
+
+ return DLT_RETURN_OK;
}
void dlt_user_trace_network_segmented_thread(void *unused)
{
- /* Unused on purpose. */
- (void) unused;
+ /* Unused on purpose. */
+ (void) unused;
#ifdef linux
prctl(PR_SET_NAME, "dlt_segmented", 0, 0, 0);
#endif
- s_segmented_data *data;
+ s_segmented_data *data;
while(1)
{
@@ -2592,11 +2630,8 @@ void dlt_user_trace_network_segmented_thread(void *unused)
if(read != sizeof(s_segmented_data *))
{
-
- char str[255];
- snprintf(str,254,"NWTSegmented: Error while reading queue: %s \n",strerror(errno));
- dlt_log(LOG_WARNING, str);
- continue;
+ dlt_log(LOG_WARNING,"NWTSegmented: Could not send end segment.\n");
+ continue;
}
/* Indicator just to try to flush the buffer */
@@ -2667,7 +2702,7 @@ void dlt_user_trace_network_segmented_thread_segmenter(s_segmented_data *data)
}
-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)
{
/* Send as normal trace if possible */
if(header_len+payload_len+sizeof(uint16_t) < DLT_USER_BUF_MAX_SIZE) {
@@ -2678,20 +2713,20 @@ int dlt_user_trace_network_segmented(DltContext *handle, DltNetworkTraceType nw_
s_segmented_data *thread_data = malloc(sizeof(s_segmented_data));
if(thread_data == NULL)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
thread_data->header = malloc(header_len);
if(thread_data->header == NULL)
{
free(thread_data);
- return -1;
+ return DLT_RETURN_ERROR;
}
thread_data->payload = malloc(payload_len);
if(thread_data->payload == NULL)
{
free(thread_data->header);
free(thread_data);
- return -1;
+ return DLT_RETURN_ERROR;
}
/* Copy data */
@@ -2713,7 +2748,7 @@ int dlt_user_trace_network_segmented(DltContext *handle, DltNetworkTraceType nw_
free(thread_data->header);
free(thread_data->payload);
free(thread_data);
- return -1;
+ return DLT_RETURN_ERROR;
}
/* Open queue if it is not open */
@@ -2724,7 +2759,7 @@ int dlt_user_trace_network_segmented(DltContext *handle, DltNetworkTraceType nw_
free(thread_data->payload);
free(thread_data);
- return -1;
+ return DLT_RETURN_ERROR;
}
/* Add to queue */
@@ -2738,450 +2773,469 @@ int dlt_user_trace_network_segmented(DltContext *handle, DltNetworkTraceType nw_
free(thread_data->header);
free(thread_data->payload);
free(thread_data);
- char str[256];
- snprintf(str,255,"NWTSegmented: Could not write into queue: %s \n",strerror(errno));
- dlt_log(LOG_WARNING, str);
- return -1;
+ dlt_vnlog(LOG_WARNING, 256,"NWTSegmented: Could not write into queue: %s \n",strerror(errno));
+ return DLT_RETURN_ERROR;
}
//thread_data will be freed by the receiver function
//coverity[leaked_storage]
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
- return dlt_user_trace_network_truncated(handle, nw_trace_type, header_len, header, payload_len, payload, 1);
+ return dlt_user_trace_network_truncated(handle, nw_trace_type, header_len, header, payload_len, payload, 1);
}
-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)
{
- DltContextData log;
+ if(payload == NULL && payload_len > 0)
+ return DLT_RETURN_WRONG_PARAMETER;
- if (dlt_user_initialised==0)
- {
- if (dlt_init()<0)
- {
- return -1;
- }
- }
+ DltContextData log;
- if (dlt_user_log_init(handle, &log)==-1)
+ if (nw_trace_type < DLT_NW_TRACE_IPC || nw_trace_type >= DLT_NW_TRACE_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Network trace type %d is outside valid range", nw_trace_type);
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if (handle==0)
- {
- return -1;
- }
+ if (dlt_user_log_init(handle, &log) < DLT_RETURN_OK || dlt_user.dlt_ll_ts == NULL)
+ return DLT_RETURN_ERROR;
/* Commented out because of DltNetworkTraceType:
if ((nw_trace_type<=0) || (nw_trace_type>0x15))
{
- return -1;
+ return DLT_RETURN_ERROR;
}
*/
if (dlt_user.dlt_ll_ts==0)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (handle->trace_status_ptr && *(handle->trace_status_ptr)==DLT_TRACE_STATUS_ON)
{
-
log.args_num = 0;
log.trace_status = nw_trace_type;
log.size = 0;
- if (header==0)
- {
- header_len=0;
- }
+ if (header == NULL)
+ header_len = 0;
/* If truncation is allowed, check if we must do it */
if(allow_truncate > 0 && (header_len+payload_len+sizeof(uint16_t))>DLT_USER_BUF_MAX_SIZE)
{
- /* Identify as truncated */
- if(dlt_user_log_write_string(&log, "NWTR") < 0)
- {
- return -1;
- }
+ /* Identify as truncated */
+ if(dlt_user_log_write_string(&log, "NWTR") < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
/* Write header and its length */
- if (dlt_user_log_write_raw(&log, header, header_len) < 0)
- {
- return -1;
- }
+ if (dlt_user_log_write_raw(&log, header, header_len) < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
- /* Write original size of payload */
- if(dlt_user_log_write_uint32(&log, payload_len) < 0)
- {
- return -1;
- }
+ /* Write original size of payload */
+ if(dlt_user_log_write_uint32(&log, payload_len) < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
- /**
- * Calculate maximum available space in sending buffer after headers.
- */
+ /**
+ * Calculate maximum available space in sending buffer after headers.
+ */
- int truncated_payload_len = DLT_USER_BUF_MAX_SIZE -
- log.size - sizeof(uint16_t) - sizeof(uint32_t);
+ int truncated_payload_len = DLT_USER_BUF_MAX_SIZE - log.size - sizeof(uint16_t) - sizeof(uint32_t);
/* Write truncated payload */
- if (dlt_user_log_write_raw(&log, payload, truncated_payload_len) < 0)
- {
- return -1;
- }
+ if (dlt_user_log_write_raw(&log, payload, truncated_payload_len) < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
}
else /* Truncation not allowed or data short enough */
{
/* Write header and its length */
- if (dlt_user_log_write_raw(&log, header, header_len)==-1)
- {
- return -1;
- }
+ if (dlt_user_log_write_raw(&log, header, header_len) < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
- if (payload==0)
- {
- payload_len=0;
- }
+ if (payload == NULL)
+ payload_len = 0;
/* Write payload and its length */
- if (dlt_user_log_write_raw(&log, payload, payload_len)==-1)
- {
- return -1;
- }
+ if (dlt_user_log_write_raw(&log, payload, payload_len) < DLT_RETURN_OK)
+ return DLT_RETURN_ERROR;
}
/* Send log */
return dlt_user_log_send_log(&log, DLT_TYPE_NW_TRACE);
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_log_string(DltContext *handle,DltLogLevelType loglevel, const char *text)
+DltReturnValue dlt_log_string(DltContext *handle, DltLogLevelType loglevel, const char *text)
{
DltContextData log;
if (dlt_user.verbose_mode==0)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if ((handle==0) || (text==0))
+ if (loglevel < DLT_USER_LOG_LEVEL_NOT_SET || loglevel >= DLT_LOG_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Loglevel %d is outside valid range", loglevel);
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if (dlt_user_log_write_start(handle,&log,loglevel)>0)
+ if ((handle == NULL) || (text == NULL))
{
- if (dlt_user_log_write_string(&log,text)==-1)
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ if (dlt_user_log_write_start(handle,&log,loglevel) > 0)
+ {
+ if (dlt_user_log_write_string(&log,text) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if (dlt_user_log_write_finish(&log)==-1)
+ if (dlt_user_log_write_finish(&log) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
}
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
DltContextData log;
if (dlt_user.verbose_mode==0)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if ((handle==0) || (text==0))
+ if (loglevel < DLT_USER_LOG_LEVEL_NOT_SET || loglevel >= DLT_LOG_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Loglevel %d is outside valid range", loglevel);
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ if ((handle == NULL) || (text == NULL))
+ {
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if (dlt_user_log_write_start(handle,&log,loglevel)>0)
+ if (dlt_user_log_write_start(handle, &log, loglevel) > 0)
{
- if (dlt_user_log_write_string(&log,text)==-1)
+ if (dlt_user_log_write_string(&log, text) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if (dlt_user_log_write_int(&log,data)==-1)
+ if (dlt_user_log_write_int(&log, data) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if (dlt_user_log_write_finish(&log)==-1)
+ if (dlt_user_log_write_finish(&log) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
}
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
DltContextData log;
if (dlt_user.verbose_mode==0)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if ((handle==0) || (text==0))
+ if (loglevel < DLT_USER_LOG_LEVEL_NOT_SET || loglevel >= DLT_LOG_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Loglevel %d is outside valid range", loglevel);
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ if ((handle == NULL) || (text == NULL))
+ {
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if (dlt_user_log_write_start(handle,&log,loglevel)>0)
+ if (dlt_user_log_write_start(handle,&log,loglevel) > 0)
{
- if (dlt_user_log_write_string(&log,text)==-1)
+ if (dlt_user_log_write_string(&log,text) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if (dlt_user_log_write_uint(&log,data)==-1)
+ if (dlt_user_log_write_uint(&log,data) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if (dlt_user_log_write_finish(&log)==-1)
+ if (dlt_user_log_write_finish(&log) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_log_int(DltContext *handle,DltLogLevelType loglevel, int data)
+DltReturnValue dlt_log_int(DltContext *handle, DltLogLevelType loglevel, int data)
{
DltContextData log;
if (dlt_user.verbose_mode==0)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if (handle==0)
+ if (loglevel < DLT_USER_LOG_LEVEL_NOT_SET || loglevel >= DLT_LOG_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Loglevel %d is outside valid range", loglevel);
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if (dlt_user_log_write_start(handle,&log,loglevel)>0)
+ if (handle == NULL)
{
- if (dlt_user_log_write_int(&log,data)==-1)
+ return DLT_RETURN_ERROR;
+ }
+
+ if (dlt_user_log_write_start(handle,&log,loglevel) > 0)
+ {
+ if (dlt_user_log_write_int(&log,data) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if (dlt_user_log_write_finish(&log)==-1)
+ if (dlt_user_log_write_finish(&log) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_log_uint(DltContext *handle,DltLogLevelType loglevel, unsigned int data)
+DltReturnValue dlt_log_uint(DltContext *handle, DltLogLevelType loglevel, unsigned int data)
{
DltContextData log;
if (dlt_user.verbose_mode==0)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if (handle==0)
+ if (loglevel < DLT_USER_LOG_LEVEL_NOT_SET || loglevel >= DLT_LOG_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Loglevel %d is outside valid range", loglevel);
+ return DLT_RETURN_ERROR;
}
- if (dlt_user_log_write_start(handle,&log,loglevel)>0)
+ if (handle == NULL)
{
- if (dlt_user_log_write_uint(&log,data)==-1)
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ if (dlt_user_log_write_start(handle,&log,loglevel) > 0)
+ {
+ if (dlt_user_log_write_uint(&log,data) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if (dlt_user_log_write_finish(&log)==-1)
+ if (dlt_user_log_write_finish(&log) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
}
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
DltContextData log;
if (dlt_user.verbose_mode==0)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if (handle==0)
+ if (loglevel < DLT_USER_LOG_LEVEL_NOT_SET || loglevel >= DLT_LOG_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Loglevel %d is outside valid range", loglevel);
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if (dlt_user_log_write_start(handle,&log,loglevel)>0)
+ if (handle == NULL)
{
- if (dlt_user_log_write_raw(&log,data,length)==-1)
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ if (dlt_user_log_write_start(handle,&log,loglevel) > 0)
+ {
+ if (dlt_user_log_write_raw(&log,data,length) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if (dlt_user_log_write_finish(&log)==-1)
+ if (dlt_user_log_write_finish(&log) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_log_marker()
+DltReturnValue dlt_log_marker()
{
- if (dlt_user_initialised==0)
+ if (!dlt_user_initialised)
{
- if (dlt_init()<0)
+ if (dlt_init() < DLT_RETURN_OK)
{
- return -1;
+ dlt_vlog(LOG_ERR, "%s Failed to initialise dlt", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
}
return dlt_user_log_send_marker();
}
-int dlt_verbose_mode(void)
+DltReturnValue dlt_verbose_mode(void)
{
- if (dlt_user_initialised==0)
+ if (!dlt_user_initialised)
{
- if (dlt_init()<0)
+ if (dlt_init() < DLT_RETURN_OK)
{
- return -1;
+ dlt_vlog(LOG_ERR, "%s Failed to initialise dlt", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
}
/* Switch to verbose mode */
dlt_user.verbose_mode = 1;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_nonverbose_mode(void)
+DltReturnValue dlt_nonverbose_mode(void)
{
- if (dlt_user_initialised==0)
+ if (!dlt_user_initialised)
{
- if (dlt_init()<0)
+ if (dlt_init() < DLT_RETURN_OK)
{
- return -1;
+ dlt_vlog(LOG_ERR, "%s Failed to initialise dlt", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
}
/* Switch to non-verbose mode */
dlt_user.verbose_mode = 0;
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
- if (dlt_user_initialised==0)
+ if (!dlt_user_initialised)
{
- if (dlt_init()<0)
+ if (dlt_init() < DLT_RETURN_OK)
{
- return -1;
+ dlt_vlog(LOG_ERR, "%s Failed to initialise dlt", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
}
/* Set use_extende_header_for_non_verbose */
dlt_user.use_extende_header_for_non_verbose = use_extende_header_for_non_verbose;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_with_session_id(int8_t with_session_id)
+DltReturnValue dlt_with_session_id(int8_t with_session_id)
{
- if (dlt_user_initialised==0)
+ if (!dlt_user_initialised)
{
- if (dlt_init()<0)
+ if (dlt_init() < DLT_RETURN_OK)
{
- return -1;
+ dlt_vlog(LOG_ERR, "%s Failed to initialise dlt", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
}
/* Set use_extende_header_for_non_verbose */
dlt_user.with_session_id = with_session_id;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_with_timestamp(int8_t with_timestamp)
+DltReturnValue dlt_with_timestamp(int8_t with_timestamp)
{
- if (dlt_user_initialised==0)
+ if (!dlt_user_initialised)
{
- if (dlt_init()<0)
+ if (dlt_init() < DLT_RETURN_OK)
{
- return -1;
+ dlt_vlog(LOG_ERR, "%s Failed to initialise dlt", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
}
/* Set with_timestamp */
dlt_user.with_timestamp = with_timestamp;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_with_ecu_id(int8_t with_ecu_id)
+DltReturnValue dlt_with_ecu_id(int8_t with_ecu_id)
{
- if (dlt_user_initialised==0)
+ if (!dlt_user_initialised)
{
- if (dlt_init()<0)
+ if (dlt_init() < DLT_RETURN_OK)
{
- return -1;
+ dlt_vlog(LOG_ERR, "%s Failed to initialise dlt", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
}
/* Set with_timestamp */
dlt_user.with_ecu_id = with_ecu_id;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_enable_local_print(void)
+DltReturnValue dlt_enable_local_print(void)
{
- if (dlt_user_initialised==0)
+ if (!dlt_user_initialised)
{
- if (dlt_init()<0)
+ if (dlt_init() < DLT_RETURN_OK)
{
- return -1;
+ dlt_vlog(LOG_ERR, "%s Failed to initialise dlt", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
}
dlt_user.enable_local_print = 1;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_disable_local_print(void)
+DltReturnValue dlt_disable_local_print(void)
{
- if (dlt_user_initialised==0)
+ if (!dlt_user_initialised)
{
- if (dlt_init()<0)
+ if (dlt_init() < DLT_RETURN_OK)
{
- return -1;
+ dlt_vlog(LOG_ERR, "%s Failed to initialise dlt", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
}
dlt_user.enable_local_print = 0;
- return 0;
+ return DLT_RETURN_OK;
}
void dlt_user_receiverthread_function(__attribute__((unused)) void *ptr)
@@ -3192,10 +3246,10 @@ void dlt_user_receiverthread_function(__attribute__((unused)) void *ptr)
while (1)
{
/* Check for new messages from DLT daemon */
- if (dlt_user_log_check_user_message()==-1)
+ if (dlt_user_log_check_user_message() < DLT_RETURN_OK)
{
- /* Critical error */
- dlt_log(LOG_CRIT,"Receiver thread encountered error condition\n");
+ /* Critical error */
+ dlt_log(LOG_CRIT,"Receiver thread encountered error condition\n");
}
usleep(DLT_USER_RECEIVE_DELAY); /* delay */
@@ -3204,39 +3258,43 @@ void dlt_user_receiverthread_function(__attribute__((unused)) void *ptr)
/* Private functions of user library */
-int dlt_user_log_init(DltContext *handle, DltContextData *log)
+DltReturnValue dlt_user_log_init(DltContext *handle, DltContextData *log)
{
- if (dlt_user_initialised==0)
+ if (handle == NULL || log == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (!dlt_user_initialised)
{
- if (dlt_init()<0)
+ if (dlt_init() < DLT_RETURN_OK)
{
- return -1;
+ dlt_vlog(LOG_ERR, "%s Failed to initialise dlt", __FUNCTION__);
+ return DLT_RETURN_ERROR;
}
}
log->handle = handle;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_queue_resend(void)
+DltReturnValue dlt_user_queue_resend(void)
{
- static unsigned char dlt_user_queue_resend_error_counter = 0;
+ static unsigned char dlt_user_queue_resend_error_counter = 0;
- if(dlt_user.dlt_log_handle < 0)
- {
- // Fail silenty. FIFO is not open yet
- return -1;
- }
+ if(dlt_user.dlt_log_handle < 0)
+ {
+ // Fail silenty. FIFO is not open yet
+ return DLT_RETURN_ERROR;
+ }
/**
* Ask segmented thread to try emptying the buffer soon.
* This will be freed in dlt_user_trace_network_segmented_thread
* */
s_segmented_data *resend_data = malloc(sizeof(s_segmented_data));
- if (NULL == resend_data)
+ if (resend_data == NULL)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
resend_data->payload_len = DLT_DELAYED_RESEND_INDICATOR_PATTERN;
@@ -3244,37 +3302,35 @@ int dlt_user_queue_resend(void)
/* Open queue if it is not open */
- if(dlt_init_message_queue() < 0)
- {
- if(!dlt_user_queue_resend_error_counter)
- {
- // log error only when problem occurred first time
- dlt_log(LOG_WARNING, "NWTSegmented: Could not open queue.\n");
- }
- dlt_user_queue_resend_error_counter = 1;
- free(resend_data);
- return -1;
- }
+ if(dlt_init_message_queue() < DLT_RETURN_OK)
+ {
+ if(!dlt_user_queue_resend_error_counter)
+ {
+ // log error only when problem occurred first time
+ dlt_log(LOG_WARNING, "NWTSegmented: Could not open queue.\n");
+ }
+ dlt_user_queue_resend_error_counter = 1;
+ free(resend_data);
+ return DLT_RETURN_ERROR;
+ }
if(mq_send(dlt_user.dlt_segmented_queue_write_handle, (char *)&resend_data, sizeof(s_segmented_data *), 1) < 0)
{
- if(!dlt_user_queue_resend_error_counter)
- {
- // log error only when problem occurred first time
- char str[255];
- snprintf(str,254,"Could not request resending.: %s \n",strerror(errno));
- dlt_log(LOG_DEBUG, str);
- }
- dlt_user_queue_resend_error_counter = 1;
- free(resend_data);
- return -1;
+ if(!dlt_user_queue_resend_error_counter)
+ {
+ // log error only when problem occurred first time
+ dlt_vnlog(LOG_DEBUG, 256,"Could not request resending.: %s \n",strerror(errno));
+ }
+ dlt_user_queue_resend_error_counter = 1;
+ free(resend_data);
+ return DLT_RETURN_ERROR;
}
dlt_user_queue_resend_error_counter = 0;
//thread_data will be freed by the receiver function
//coverity[leaked_storage]
- return 0;
+ return DLT_RETURN_OK;
}
DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
@@ -3285,51 +3341,42 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
DltReturnValue ret = DLT_RETURN_OK;
- if (log==0)
- {
- return DLT_RETURN_ERROR;
- }
-
- if (log->handle==0)
+ if (!dlt_user_initialised)
{
+ dlt_vlog(LOG_ERR, "%s dlt_user_initialised false\n", __FUNCTION__);
return DLT_RETURN_ERROR;
}
- if (dlt_user.appID[0]=='\0')
+ if (log == NULL ||
+ log->handle == NULL ||
+ dlt_user.appID[0] == '\0' ||
+ log->handle->contextID[0] == '\0' ||
+ (mtype < DLT_TYPE_LOG) || (mtype > DLT_TYPE_CONTROL)
+ )
{
- return DLT_RETURN_ERROR;
- }
-
- if (log->handle->contextID[0]=='\0')
- {
- return DLT_RETURN_ERROR;
- }
-
- if ((mtype<DLT_TYPE_LOG) || (mtype>DLT_TYPE_CONTROL))
- {
- return DLT_RETURN_ERROR;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* also for Trace messages */
#ifdef DLT_SHM_ENABLE
- if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_LOG_SHM)==-1)
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_LOG_SHM) < DLT_RETURN_OK)
#else
- if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_LOG)==-1)
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_LOG) < DLT_RETURN_OK)
#endif
{
- return DLT_RETURN_ERROR;
+ return DLT_RETURN_ERROR;
}
- if (dlt_message_init(&msg,0)==-1)
+ if (dlt_message_init(&msg, 0) == DLT_RETURN_ERROR)
{
- return DLT_RETURN_ERROR;
+ return DLT_RETURN_ERROR;
}
msg.storageheader = (DltStorageHeader*)msg.headerbuffer;
- if (dlt_set_storageheader(msg.storageheader,dlt_user.ecuID)==-1)
+ if (dlt_set_storageheader(msg.storageheader,dlt_user.ecuID) == DLT_RETURN_ERROR)
{
- return DLT_RETURN_ERROR;
+ return DLT_RETURN_ERROR;
}
msg.standardheader = (DltStandardHeader*)(msg.headerbuffer + sizeof(DltStorageHeader));
@@ -3338,20 +3385,20 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
/* send ecu id */
if(dlt_user.with_ecu_id)
{
- msg.standardheader->htyp |= DLT_HTYP_WEID;
+ msg.standardheader->htyp |= DLT_HTYP_WEID;
}
/* send timestamp */
if(dlt_user.with_timestamp)
{
- msg.standardheader->htyp |= DLT_HTYP_WTMS;
+ msg.standardheader->htyp |= DLT_HTYP_WTMS;
}
/* send session id */
if(dlt_user.with_session_id)
{
- msg.standardheader->htyp |= DLT_HTYP_WSID;
- msg.headerextra.seid = getpid();
+ msg.standardheader->htyp |= DLT_HTYP_WSID;
+ msg.headerextra.seid = getpid();
}
if (dlt_user.verbose_mode)
@@ -3362,8 +3409,8 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
else
{
/* In non-verbose, send extended header if desired */
- if(dlt_user.use_extende_header_for_non_verbose)
- msg.standardheader->htyp = (msg.standardheader->htyp | DLT_HTYP_UEH );
+ if(dlt_user.use_extende_header_for_non_verbose)
+ msg.standardheader->htyp = (msg.standardheader->htyp | DLT_HTYP_UEH );
}
#if (BYTE_ORDER==BIG_ENDIAN)
@@ -3377,9 +3424,9 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
//msg.headerextra.seid = 0;
msg.headerextra.tmsp = dlt_uptime();
- if (dlt_message_set_extraparameters(&msg,0)==-1)
+ if (dlt_message_set_extraparameters(&msg, 0) == DLT_RETURN_ERROR)
{
- return DLT_RETURN_ERROR;
+ return DLT_RETURN_ERROR;
}
/* Fill out extended header, if extended header should be provided */
@@ -3402,7 +3449,7 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
}
default:
{
- /* This case should not occur */
+ /* This case should not occur */
return DLT_RETURN_ERROR;
break;
}
@@ -3441,9 +3488,9 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
{
if ((dlt_user.enable_local_print) || (dlt_user.local_print_mode == DLT_PM_FORCE_ON))
{
- if (dlt_user_print_msg(&msg, log)==-1)
+ if (dlt_user_print_msg(&msg, log) == DLT_RETURN_ERROR)
{
- return DLT_RETURN_ERROR;
+ return DLT_RETURN_ERROR;
}
}
}
@@ -3461,11 +3508,10 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
if (dlt_user.overflow_counter)
{
- if (dlt_user_log_send_overflow()==0)
+ if (dlt_user_log_send_overflow() == DLT_RETURN_OK)
{
- snprintf(str,DLT_USER_BUFFER_LENGTH,"%u messages discarded!\n",dlt_user.overflow_counter);
- dlt_log(LOG_WARNING, str);
- dlt_user.overflow_counter=0;
+ dlt_vnlog(LOG_WARNING, DLT_USER_BUFFER_LENGTH, "%u messages discarded!\n", dlt_user.overflow_counter);
+ dlt_user.overflow_counter = 0;
}
}
@@ -3479,34 +3525,34 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
{
/* resend ok or nothing to resent */
#ifdef DLT_SHM_ENABLE
- if(dlt_user.dlt_log_handle!=-1)
- dlt_shm_push(&dlt_user.dlt_shm,msg.headerbuffer+sizeof(DltStorageHeader), msg.headersize-sizeof(DltStorageHeader),
- log->buffer, log->size,0,0);
-
- /* log to FIFO */
- ret = dlt_user_log_out3(dlt_user.dlt_log_handle,
- &(userheader), sizeof(DltUserHeader),
- 0, 0,
- 0, 0);
+ if(dlt_user.dlt_log_handle!=-1)
+ dlt_shm_push(&dlt_user.dlt_shm,msg.headerbuffer+sizeof(DltStorageHeader), msg.headersize-sizeof(DltStorageHeader),
+ log->buffer, log->size, 0, 0);
+
+ /* log to FIFO */
+ ret = dlt_user_log_out3(dlt_user.dlt_log_handle,
+ &(userheader), sizeof(DltUserHeader),
+ 0, 0,
+ 0, 0);
#else
- /* log to FIFO */
+ /* log to FIFO */
#ifdef DLT_TEST_ENABLE
- if(dlt_user.corrupt_user_header) {
- userheader.pattern[0]=0xff;
- userheader.pattern[1]=0xff;
- userheader.pattern[2]=0xff;
- userheader.pattern[3]=0xff;
- }
- if(dlt_user.corrupt_message_size) {
- msg.standardheader->len = DLT_HTOBE_16(dlt_user.corrupt_message_size_size);
- }
+ if(dlt_user.corrupt_user_header) {
+ userheader.pattern[0]=0xff;
+ userheader.pattern[1]=0xff;
+ userheader.pattern[2]=0xff;
+ userheader.pattern[3]=0xff;
+ }
+ if(dlt_user.corrupt_message_size) {
+ msg.standardheader->len = DLT_HTOBE_16(dlt_user.corrupt_message_size_size);
+ }
#endif
- ret = dlt_user_log_out3(dlt_user.dlt_log_handle,
- &(userheader), sizeof(DltUserHeader),
- msg.headerbuffer+sizeof(DltStorageHeader), msg.headersize-sizeof(DltStorageHeader),
- log->buffer, log->size);
+ ret = dlt_user_log_out3(dlt_user.dlt_log_handle,
+ &(userheader), sizeof(DltUserHeader),
+ msg.headerbuffer+sizeof(DltStorageHeader), msg.headersize-sizeof(DltStorageHeader),
+ log->buffer, log->size);
#endif
- }
+ }
/* store message in ringbuffer, if an error has occured */
if ((ret!=DLT_RETURN_OK) || (dlt_user.appID[0] == '\0'))
@@ -3516,15 +3562,15 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
if (dlt_buffer_push3(&(dlt_user.startup_buffer),
(unsigned char *)&(userheader), sizeof(DltUserHeader),
msg.headerbuffer+sizeof(DltStorageHeader), msg.headersize-sizeof(DltStorageHeader),
- log->buffer, log->size)==-1)
- {
- if(dlt_user.overflow_counter==0)
+ log->buffer, log->size) == DLT_RETURN_ERROR)
+ {
+ if(dlt_user.overflow_counter == 0)
{
- dlt_log(LOG_WARNING,"Buffer full! Messages will be discarded.\n");
+ dlt_log(LOG_WARNING,"Buffer full! Messages will be discarded.\n");
}
ret = DLT_RETURN_BUFFER_FULL;
- }
+ }
DLT_SEM_FREE();
@@ -3537,56 +3583,56 @@ DltReturnValue dlt_user_log_send_log(DltContextData *log, int mtype)
switch (ret)
{
- case DLT_RETURN_BUFFER_FULL:
- {
- /* Buffer full */
- dlt_user.overflow_counter += 1;
- return DLT_RETURN_BUFFER_FULL;
- }
- case DLT_RETURN_PIPE_FULL:
- {
- /* data could not be written */
- return DLT_RETURN_PIPE_FULL;
- }
- case DLT_RETURN_PIPE_ERROR:
- {
- /* handle not open or pipe error */
- close(dlt_user.dlt_log_handle);
- dlt_user.dlt_log_handle = -1;
+ case DLT_RETURN_BUFFER_FULL:
+ {
+ /* Buffer full */
+ dlt_user.overflow_counter += 1;
+ return DLT_RETURN_BUFFER_FULL;
+ }
+ case DLT_RETURN_PIPE_FULL:
+ {
+ /* data could not be written */
+ return DLT_RETURN_PIPE_FULL;
+ }
+ case DLT_RETURN_PIPE_ERROR:
+ {
+ /* handle not open or pipe error */
+ close(dlt_user.dlt_log_handle);
+ dlt_user.dlt_log_handle = -1;
-#ifdef DLT_SHM_ENABLE
- /* free shared memory */
- dlt_shm_free_client(&dlt_user.dlt_shm);
-#endif
+ #ifdef DLT_SHM_ENABLE
+ /* free shared memory */
+ dlt_shm_free_client(&dlt_user.dlt_shm);
+ #endif
+
+ if (dlt_user.local_print_mode == DLT_PM_AUTOMATIC)
+ {
+ dlt_user_print_msg(&msg, log);
+ }
- if (dlt_user.local_print_mode == DLT_PM_AUTOMATIC)
+ return DLT_RETURN_PIPE_ERROR;
+ }
+ case DLT_RETURN_ERROR:
{
- dlt_user_print_msg(&msg, log);
+ /* other error condition */
+ return DLT_RETURN_ERROR;
+ }
+ case DLT_RETURN_OK:
+ {
+ return DLT_RETURN_OK;
+ }
+ default:
+ {
+ /* This case should never occur. */
+ return DLT_RETURN_ERROR;
}
-
- return DLT_RETURN_PIPE_ERROR;
- }
- case DLT_RETURN_ERROR:
- {
- /* other error condition */
- return DLT_RETURN_ERROR;
- }
- case DLT_RETURN_OK:
- {
- return DLT_RETURN_OK;
- }
- default:
- {
- /* This case should never occur. */
- return DLT_RETURN_ERROR;
- }
}
}
return DLT_RETURN_OK;
}
-int dlt_user_log_send_register_application(void)
+DltReturnValue dlt_user_log_send_register_application(void)
{
DltUserHeader userheader;
DltUserControlMsgRegisterApplication usercontext;
@@ -3595,20 +3641,20 @@ int dlt_user_log_send_register_application(void)
if (dlt_user.appID[0]=='\0')
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* set userheader */
- if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_REGISTER_APPLICATION)==-1)
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_REGISTER_APPLICATION) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* set usercontext */
dlt_set_id(usercontext.apid,dlt_user.appID); /* application id */
usercontext.pid = getpid();
- if (dlt_user.application_description!=0)
+ if (dlt_user.application_description != NULL)
{
usercontext.description_length = strlen(dlt_user.application_description);
}
@@ -3619,54 +3665,55 @@ int dlt_user_log_send_register_application(void)
if (dlt_user.dlt_is_file)
{
- return 0;
+ return DLT_RETURN_OK;
}
/* log to FIFO */
- ret=dlt_user_log_out3(dlt_user.dlt_log_handle, &(userheader), sizeof(DltUserHeader), &(usercontext), sizeof(DltUserControlMsgRegisterApplication),dlt_user.application_description,usercontext.description_length);
+ ret = dlt_user_log_out3(dlt_user.dlt_log_handle,
+ &(userheader), sizeof(DltUserHeader),
+ &(usercontext), sizeof(DltUserControlMsgRegisterApplication),
+ dlt_user.application_description, usercontext.description_length);
/* store message in ringbuffer, if an error has occured */
- if (ret!=DLT_RETURN_OK)
+ if (ret < DLT_RETURN_OK)
{
DLT_SEM_LOCK();
if (dlt_buffer_push3(&(dlt_user.startup_buffer),
(unsigned char *)&(userheader), sizeof(DltUserHeader),
(const unsigned char*)&(usercontext), sizeof(DltUserControlMsgRegisterApplication),
- (const unsigned char*)dlt_user.application_description, usercontext.description_length)==-1)
+ (const unsigned char*)dlt_user.application_description, usercontext.description_length) == DLT_RETURN_ERROR)
{
dlt_log(LOG_WARNING,"Storing message to history buffer failed! Message discarded.\n");
DLT_SEM_FREE();
- return -1;
+ return DLT_RETURN_ERROR;
}
DLT_SEM_FREE();
- if(dlt_user_queue_resend() < 0 && dlt_user.dlt_log_handle >= 0)
+ if(dlt_user_queue_resend() < DLT_RETURN_OK && dlt_user.dlt_log_handle >= 0)
{
;//dlt_log(LOG_WARNING, "dlt_user_log_send_register_application: Failed to queue resending.\n");
}
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_send_unregister_application(void)
+DltReturnValue dlt_user_log_send_unregister_application(void)
{
DltUserHeader userheader;
DltUserControlMsgUnregisterApplication usercontext;
- DltReturnValue ret;
-
if (dlt_user.appID[0]=='\0')
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* set userheader */
- if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_UNREGISTER_APPLICATION)==-1)
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_UNREGISTER_APPLICATION) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* set usercontext */
@@ -3675,39 +3722,40 @@ int dlt_user_log_send_unregister_application(void)
if (dlt_user.dlt_is_file)
{
- return 0;
+ return DLT_RETURN_OK;
}
/* log to FIFO */
- ret=dlt_user_log_out2(dlt_user.dlt_log_handle, &(userheader), sizeof(DltUserHeader), &(usercontext), sizeof(DltUserControlMsgUnregisterApplication));
- return ((ret==DLT_RETURN_OK)?0:-1);
+ return dlt_user_log_out2(dlt_user.dlt_log_handle,
+ &(userheader), sizeof(DltUserHeader),
+ &(usercontext), sizeof(DltUserControlMsgUnregisterApplication));
}
-int dlt_user_log_send_register_context(DltContextData *log)
+DltReturnValue dlt_user_log_send_register_context(DltContextData *log)
{
DltUserHeader userheader;
DltUserControlMsgRegisterContext usercontext;
DltReturnValue ret = DLT_RETURN_ERROR;
- if (log==0)
+ if (log == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if (log->handle==0)
+ if (log->handle == NULL)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (log->handle->contextID=='\0')
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* set userheader */
- if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_REGISTER_CONTEXT)==-1)
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_REGISTER_CONTEXT) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* set usercontext */
@@ -3719,18 +3767,18 @@ int dlt_user_log_send_register_context(DltContextData *log)
usercontext.log_level = (int8_t)log->log_level;
usercontext.trace_status = (int8_t)log->trace_status;
- if (log->context_description!=0)
+ if (log->context_description != NULL)
{
- usercontext.description_length = strlen(log->context_description);
+ usercontext.description_length = strlen(log->context_description);
}
else
{
- usercontext.description_length = 0;
+ usercontext.description_length = 0;
}
if (dlt_user.dlt_is_file)
{
- return 0;
+ return DLT_RETURN_OK;
}
/* log to FIFO */
@@ -3748,11 +3796,11 @@ int dlt_user_log_send_register_context(DltContextData *log)
if (dlt_buffer_push3(&(dlt_user.startup_buffer),
(unsigned char *)&(userheader), sizeof(DltUserHeader),
(const unsigned char*)&(usercontext), sizeof(DltUserControlMsgRegisterContext),
- (const unsigned char*)log->context_description, usercontext.description_length)==-1)
+ (const unsigned char*)log->context_description, usercontext.description_length) == DLT_RETURN_ERROR)
{
dlt_log(LOG_WARNING,"Storing message to history buffer failed! Message discarded.\n");
DLT_SEM_FREE();
- return -1;
+ return DLT_RETURN_ERROR;
}
DLT_SEM_FREE();
@@ -3763,35 +3811,34 @@ int dlt_user_log_send_register_context(DltContextData *log)
}
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_send_unregister_context(DltContextData *log)
+DltReturnValue dlt_user_log_send_unregister_context(DltContextData *log)
{
DltUserHeader userheader;
DltUserControlMsgUnregisterContext usercontext;
- DltReturnValue ret;
- if (log==0)
+ if (log == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if (log->handle==0)
+ if (log->handle == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
if (log->handle->contextID=='\0')
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* set userheader */
- if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_UNREGISTER_CONTEXT)==-1)
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_UNREGISTER_CONTEXT) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* set usercontext */
@@ -3801,43 +3848,55 @@ int dlt_user_log_send_unregister_context(DltContextData *log)
if (dlt_user.dlt_is_file)
{
- return 0;
+ return DLT_RETURN_OK;
}
/* log to FIFO */
- ret=dlt_user_log_out2(dlt_user.dlt_log_handle, &(userheader), sizeof(DltUserHeader), &(usercontext), sizeof(DltUserControlMsgUnregisterContext));
- return ((ret==DLT_RETURN_OK)?0:-1);
+ return dlt_user_log_out2(dlt_user.dlt_log_handle,
+ &(userheader), sizeof(DltUserHeader),
+ &(usercontext), sizeof(DltUserControlMsgUnregisterContext));
}
-int dlt_send_app_ll_ts_limit(const char *appid, DltLogLevelType loglevel, DltTraceStatusType tracestatus)
+DltReturnValue dlt_send_app_ll_ts_limit(const char *appid, DltLogLevelType loglevel, DltTraceStatusType tracestatus)
{
DltUserHeader userheader;
DltUserControlMsgAppLogLevelTraceStatus usercontext;
- DltReturnValue ret;
- if ((appid==0) || (appid[0]=='\0'))
+ if (loglevel < DLT_USER_LOG_LEVEL_NOT_SET || loglevel >= DLT_LOG_MAX)
{
- return -1;
+ dlt_vlog(LOG_ERR, "Loglevel %d is outside valid range", loglevel);
+ return DLT_RETURN_ERROR;
+ }
+
+ if (tracestatus < DLT_USER_TRACE_STATUS_NOT_SET || tracestatus >= DLT_TRACE_STATUS_MAX)
+ {
+ dlt_vlog(LOG_ERR, "Tracestatus %d is outside valid range", tracestatus);
+ return DLT_RETURN_ERROR;
+ }
+
+ if ((appid == NULL) || (appid[0]=='\0'))
+ {
+ return DLT_RETURN_ERROR;
}
/* Removed because of DltLogLevelType and DltTraceStatusType
if ((loglevel<DLT_LOG_DEFAULT) || (loglevel>DLT_LOG_VERBOSE))
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if ((tracestatus<DLT_TRACE_STATUS_DEFAULT) || (tracestatus>DLT_TRACE_STATUS_ON))
{
- return -1;
+ return DLT_RETURN_ERROR;
}
*/
/* set userheader */
- if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_APP_LL_TS)==-1)
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_APP_LL_TS) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* set usercontext */
@@ -3847,25 +3906,30 @@ int dlt_send_app_ll_ts_limit(const char *appid, DltLogLevelType loglevel, DltTra
if (dlt_user.dlt_is_file)
{
- return 0;
+ return DLT_RETURN_OK;
}
/* log to FIFO */
- ret=dlt_user_log_out2(dlt_user.dlt_log_handle, &(userheader), sizeof(DltUserHeader), &(usercontext), sizeof(DltUserControlMsgAppLogLevelTraceStatus));
- return ((ret==DLT_RETURN_OK)?0:-1);
+ return dlt_user_log_out2(dlt_user.dlt_log_handle,
+ &(userheader), sizeof(DltUserHeader),
+ &(usercontext), sizeof(DltUserControlMsgAppLogLevelTraceStatus));
}
-int dlt_user_log_send_log_mode(DltUserLogMode mode)
+DltReturnValue dlt_user_log_send_log_mode(DltUserLogMode mode)
{
DltUserHeader userheader;
DltUserControlMsgLogMode logmode;
- DltReturnValue ret;
+ if (mode < DLT_USER_MODE_UNDEFINED || mode >= DLT_USER_MODE_MAX)
+ {
+ dlt_vlog(LOG_ERR, "User log mode %d is outside valid range", mode);
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
/* set userheader */
- if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_LOG_MODE)==-1)
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_LOG_MODE) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* set data */
@@ -3873,46 +3937,45 @@ int dlt_user_log_send_log_mode(DltUserLogMode mode)
if (dlt_user.dlt_is_file)
{
- return 0;
+ return DLT_RETURN_OK;
}
/* log to FIFO */
- ret=dlt_user_log_out2(dlt_user.dlt_log_handle, &(userheader), sizeof(DltUserHeader), &(logmode), sizeof(DltUserControlMsgLogMode));
- return ((ret==DLT_RETURN_OK)?0:-1);
+ return dlt_user_log_out2(dlt_user.dlt_log_handle,
+ &(userheader), sizeof(DltUserHeader),
+ &(logmode), sizeof(DltUserControlMsgLogMode));
}
-int dlt_user_log_send_marker()
+DltReturnValue dlt_user_log_send_marker()
{
DltUserHeader userheader;
- DltReturnValue ret;
-
/* set userheader */
- if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_MARKER)==-1)
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_MARKER) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.dlt_is_file)
{
- return 0;
+ return DLT_RETURN_OK;
}
/* log to FIFO */
- ret=dlt_user_log_out2(dlt_user.dlt_log_handle, &(userheader), sizeof(DltUserHeader), 0, 0);
- return ((ret==DLT_RETURN_OK)?0:-1);
+ return dlt_user_log_out2(dlt_user.dlt_log_handle,
+ &(userheader), sizeof(DltUserHeader), 0, 0);
}
-int dlt_user_print_msg(DltMessage *msg, DltContextData *log)
+DltReturnValue dlt_user_print_msg(DltMessage *msg, DltContextData *log)
{
uint8_t *databuffer_tmp;
int32_t datasize_tmp;
int32_t databuffersize_tmp;
static char text[DLT_USER_TEXT_LENGTH];
- if ((msg==0) || (log==0))
+ if ((msg == NULL) || (log == NULL))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* Save variables before print */
@@ -3922,16 +3985,16 @@ int dlt_user_print_msg(DltMessage *msg, DltContextData *log)
/* Act like a receiver, convert header back to host format */
msg->standardheader->len = DLT_BETOH_16(msg->standardheader->len);
- dlt_message_get_extraparameters(msg,0);
+ dlt_message_get_extraparameters(msg, 0);
msg->databuffer = log->buffer;
msg->datasize = log->size;
msg->databuffersize = log->size;
/* Print message as ASCII */
- if (dlt_message_print_ascii(msg,text,DLT_USER_TEXT_LENGTH,0)==-1)
+ if (dlt_message_print_ascii(msg,text,DLT_USER_TEXT_LENGTH, 0) == DLT_RETURN_ERROR)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* Restore variables and set len to BE*/
@@ -3941,10 +4004,10 @@ int dlt_user_print_msg(DltMessage *msg, DltContextData *log)
msg->standardheader->len = DLT_HTOBE_16(msg->standardheader->len);
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_user_log_check_user_message(void)
+DltReturnValue dlt_user_log_check_user_message(void)
{
int offset=0;
int leave_while=0;
@@ -3960,10 +4023,10 @@ int dlt_user_log_check_user_message(void)
unsigned char *userbuffer;
/* For delayed calling of injection callback, to avoid deadlock */
- DltUserInjectionCallback delayed_injection_callback;
+ DltUserInjectionCallback delayed_injection_callback;
DltUserLogLevelChangedCallback delayed_log_level_changed_callback;
- unsigned char *delayed_inject_buffer = 0;
- uint32_t delayed_inject_data_length = 0;
+ unsigned char *delayed_inject_buffer = 0;
+ uint32_t delayed_inject_data_length = 0;
/* Ensure that callback is null before searching for it */
delayed_injection_callback.injection_callback = 0;
@@ -3977,7 +4040,7 @@ int dlt_user_log_check_user_message(void)
if (dlt_receiver_receive_fd(receiver)<=0)
{
/* No new message available */
- return 0;
+ return DLT_RETURN_OK;
}
/* look through buffer as long as data is in there */
@@ -4031,11 +4094,12 @@ int dlt_user_log_check_user_message(void)
usercontextll = (DltUserControlMsgLogLevel*) (receiver->buf+sizeof(DltUserHeader));
/* Update log level and trace status */
- if (usercontextll!=0)
+ if (usercontextll != NULL)
{
DLT_SEM_LOCK();
- if ((usercontextll->log_level_pos >= 0) && (usercontextll->log_level_pos < (int32_t)dlt_user.dlt_ll_ts_num_entries))
+ if ((usercontextll->log_level_pos >= 0) &&
+ (usercontextll->log_level_pos < (int32_t)dlt_user.dlt_ll_ts_num_entries))
{
// printf("Store ll, ts\n");
if (dlt_user.dlt_ll_ts)
@@ -4043,9 +4107,9 @@ int dlt_user_log_check_user_message(void)
dlt_user.dlt_ll_ts[usercontextll->log_level_pos].log_level = usercontextll->log_level;
dlt_user.dlt_ll_ts[usercontextll->log_level_pos].trace_status = usercontextll->trace_status;
if(dlt_user.dlt_ll_ts[usercontextll->log_level_pos].log_level_ptr)
- *(dlt_user.dlt_ll_ts[usercontextll->log_level_pos].log_level_ptr) = usercontextll->log_level;
+ *(dlt_user.dlt_ll_ts[usercontextll->log_level_pos].log_level_ptr) = usercontextll->log_level;
if(dlt_user.dlt_ll_ts[usercontextll->log_level_pos].trace_status_ptr)
- *(dlt_user.dlt_ll_ts[usercontextll->log_level_pos].trace_status_ptr) = usercontextll->trace_status;
+ *(dlt_user.dlt_ll_ts[usercontextll->log_level_pos].trace_status_ptr) = usercontextll->trace_status;
delayed_log_level_changed_callback.log_level_changed_callback = dlt_user.dlt_ll_ts[usercontextll->log_level_pos].log_level_changed_callback;
memcpy(delayed_log_level_changed_callback.contextID,dlt_user.dlt_ll_ts[usercontextll->log_level_pos].contextID,DLT_ID_SIZE);
@@ -4060,15 +4124,15 @@ int dlt_user_log_check_user_message(void)
/* call callback outside of semaphore */
if(delayed_log_level_changed_callback.log_level_changed_callback!=0)
{
- delayed_log_level_changed_callback.log_level_changed_callback(delayed_log_level_changed_callback.contextID,
- delayed_log_level_changed_callback.log_level,
- delayed_log_level_changed_callback.trace_status);
+ delayed_log_level_changed_callback.log_level_changed_callback(delayed_log_level_changed_callback.contextID,
+ delayed_log_level_changed_callback.log_level,
+ delayed_log_level_changed_callback.trace_status);
}
/* keep not read data in buffer */
- if (dlt_receiver_remove(receiver,sizeof(DltUserHeader)+sizeof(DltUserControlMsgLogLevel))==-1)
+ if (dlt_receiver_remove(receiver,sizeof(DltUserHeader)+sizeof(DltUserControlMsgLogLevel)) == DLT_RETURN_ERROR)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
}
break;
@@ -4084,7 +4148,7 @@ int dlt_user_log_check_user_message(void)
usercontextinj = (DltUserControlMsgInjection*) (receiver->buf+sizeof(DltUserHeader));
userbuffer = (unsigned char*) (receiver->buf+sizeof(DltUserHeader)+sizeof(DltUserControlMsgInjection));
- if (userbuffer!=0)
+ if (userbuffer != NULL)
{
if (receiver->bytesRcvd < (int32_t)(sizeof(DltUserHeader)+sizeof(DltUserControlMsgInjection)+usercontextinj->data_length_inject))
@@ -4103,18 +4167,17 @@ int dlt_user_log_check_user_message(void)
if ((dlt_user.dlt_ll_ts[usercontextinj->log_level_pos].injection_table) &&
(dlt_user.dlt_ll_ts[usercontextinj->log_level_pos].injection_table[i].service_id == usercontextinj->service_id))
{
- /* Prepare delayed injection callback call */
- if (dlt_user.dlt_ll_ts[usercontextinj->log_level_pos].injection_table[i].injection_callback!=0)
- {
- delayed_injection_callback.injection_callback = dlt_user.dlt_ll_ts[usercontextinj->log_level_pos].injection_table[i].injection_callback;
- delayed_injection_callback.service_id = usercontextinj->service_id;
- delayed_inject_data_length = usercontextinj->data_length_inject;
- delayed_inject_buffer = malloc(delayed_inject_data_length);
- if(delayed_inject_buffer != 0) {
- memcpy(delayed_inject_buffer, userbuffer, delayed_inject_data_length);
- }
-
- }
+ /* Prepare delayed injection callback call */
+ if (dlt_user.dlt_ll_ts[usercontextinj->log_level_pos].injection_table[i].injection_callback!=0)
+ {
+ delayed_injection_callback.injection_callback = dlt_user.dlt_ll_ts[usercontextinj->log_level_pos].injection_table[i].injection_callback;
+ delayed_injection_callback.service_id = usercontextinj->service_id;
+ delayed_inject_data_length = usercontextinj->data_length_inject;
+ delayed_inject_buffer = malloc(delayed_inject_data_length);
+
+ if(delayed_inject_buffer != NULL)
+ memcpy(delayed_inject_buffer, userbuffer, delayed_inject_data_length);
+ }
break;
}
}
@@ -4123,8 +4186,9 @@ int dlt_user_log_check_user_message(void)
DLT_SEM_FREE();
/* Delayed injection callback call */
- if(delayed_inject_buffer != 0 && delayed_injection_callback.injection_callback != 0) {
- delayed_injection_callback.injection_callback(delayed_injection_callback.service_id, delayed_inject_buffer, delayed_inject_data_length);
+ if(delayed_inject_buffer != NULL && delayed_injection_callback.injection_callback != 0)
+ {
+ delayed_injection_callback.injection_callback(delayed_injection_callback.service_id, delayed_inject_buffer, delayed_inject_data_length);
delayed_injection_callback.injection_callback = 0;
free(delayed_inject_buffer);
delayed_inject_buffer = NULL;
@@ -4132,10 +4196,8 @@ int dlt_user_log_check_user_message(void)
}
/* keep not read data in buffer */
- if (dlt_receiver_remove(receiver,(sizeof(DltUserHeader)+sizeof(DltUserControlMsgInjection)+usercontextinj->data_length_inject))==-1)
- {
- return -1;
- }
+ if (dlt_receiver_remove(receiver,(sizeof(DltUserHeader)+sizeof(DltUserControlMsgInjection)+usercontextinj->data_length_inject)) == DLT_RETURN_ERROR)
+ return DLT_RETURN_ERROR;
}
}
break;
@@ -4149,13 +4211,13 @@ int dlt_user_log_check_user_message(void)
}
userlogstate = (DltUserControlMsgLogState*) (receiver->buf+sizeof(DltUserHeader));
- dlt_user.log_state = userlogstate->log_state;
+ dlt_user.log_state = userlogstate->log_state;
- /* keep not read data in buffer */
- if (dlt_receiver_remove(receiver,(sizeof(DltUserHeader)+sizeof(DltUserControlMsgLogState)))==-1)
- {
- return -1;
- }
+ /* keep not read data in buffer */
+ if (dlt_receiver_remove(receiver,(sizeof(DltUserHeader)+sizeof(DltUserControlMsgLogState))) == DLT_RETURN_ERROR)
+ {
+ return DLT_RETURN_ERROR;
+ }
}
break;
default:
@@ -4163,7 +4225,7 @@ int dlt_user_log_check_user_message(void)
dlt_log(LOG_WARNING,"Invalid user message type received!\n");
/* Ignore result */
dlt_receiver_remove(receiver,sizeof(DltUserHeader));
- /* In next invocation of while loop, a resync will be triggered if additional data was received */
+ /* In next invocation of while loop, a resync will be triggered if additional data was received */
}
break;
} /* switch() */
@@ -4176,9 +4238,9 @@ int dlt_user_log_check_user_message(void)
} /* while buffer*/
- if (dlt_receiver_move_to_begin(receiver)==-1)
+ if (dlt_receiver_move_to_begin(receiver) == DLT_RETURN_ERROR)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
} /* while receive */
} /* if */
@@ -4186,9 +4248,9 @@ int dlt_user_log_check_user_message(void)
return DLT_RETURN_OK;
}
-int dlt_user_log_resend_buffer(void)
+DltReturnValue dlt_user_log_resend_buffer(void)
{
- int num,count;
+ int num,count;
int size;
DltReturnValue ret;
@@ -4197,16 +4259,16 @@ int dlt_user_log_resend_buffer(void)
return 0;
}
- /* Send content of ringbuffer */
- DLT_SEM_LOCK();
- count = dlt_buffer_get_message_count(&(dlt_user.startup_buffer));
- DLT_SEM_FREE();
+ /* Send content of ringbuffer */
+ DLT_SEM_LOCK();
+ count = dlt_buffer_get_message_count(&(dlt_user.startup_buffer));
+ DLT_SEM_FREE();
- for (num=0;num<count;num++)
- {
+ for (num=0;num<count;num++)
+ {
- DLT_SEM_LOCK();
- size = dlt_buffer_copy(&(dlt_user.startup_buffer),dlt_user.resend_buffer,sizeof(dlt_user.resend_buffer));
+ DLT_SEM_LOCK();
+ size = dlt_buffer_copy(&(dlt_user.startup_buffer),dlt_user.resend_buffer,sizeof(dlt_user.resend_buffer));
if (size>0)
{
@@ -4243,39 +4305,39 @@ int dlt_user_log_resend_buffer(void)
}
#ifdef DLT_SHM_ENABLE
- dlt_shm_push(&dlt_user.dlt_shm,dlt_user.resend_buffer+sizeof(DltUserHeader),size-sizeof(DltUserHeader),0,0,0,0);
+ dlt_shm_push(&dlt_user.dlt_shm, dlt_user.resend_buffer+sizeof(DltUserHeader), size-sizeof(DltUserHeader), 0, 0, 0, 0);
- /* log to FIFO */
- ret = dlt_user_log_out3(dlt_user.dlt_log_handle, dlt_user.resend_buffer,sizeof(DltUserHeader),0,0,0,0);
+ /* log to FIFO */
+ ret = dlt_user_log_out3(dlt_user.dlt_log_handle, dlt_user.resend_buffer,sizeof(DltUserHeader), 0, 0, 0, 0);
#else
- /* log to FIFO */
- ret = dlt_user_log_out3(dlt_user.dlt_log_handle, dlt_user.resend_buffer,size,0,0,0,0);
+ /* log to FIFO */
+ ret = dlt_user_log_out3(dlt_user.dlt_log_handle, dlt_user.resend_buffer,size, 0, 0, 0, 0);
#endif
- /* in case of error, keep message in ringbuffer */
- if (ret==DLT_RETURN_OK)
- {
- dlt_buffer_remove(&(dlt_user.startup_buffer));
- }
- else
- {
- /* keep message in ringbuffer */
- DLT_SEM_FREE();
- return -1;
- }
- }
- DLT_SEM_FREE();
- }
+ /* in case of error, keep message in ringbuffer */
+ if (ret == DLT_RETURN_OK)
+ {
+ dlt_buffer_remove(&(dlt_user.startup_buffer));
+ }
+ else
+ {
+ /* keep message in ringbuffer */
+ DLT_SEM_FREE();
+ return DLT_RETURN_ERROR;
+ }
+ }
+ DLT_SEM_FREE();
+ }
- return 0;
+ return DLT_RETURN_OK;
}
void dlt_user_log_reattach_to_daemon(void)
{
- uint32_t num,reregistered=0;
+ uint32_t num, reregistered = 0;
- DltContext handle;
- DltContextData log_new;
+ DltContext handle;
+ DltContextData log_new;
if (dlt_user.dlt_log_handle<0)
{
@@ -4285,27 +4347,26 @@ void dlt_user_log_reattach_to_daemon(void)
dlt_user.dlt_log_handle = open(dlt_daemon_fifo, O_WRONLY | O_NONBLOCK);
if (dlt_user.dlt_log_handle > 0)
{
- if (dlt_user_log_init(&handle,&log_new)==-1)
+ if (dlt_user_log_init(&handle,&log_new) < DLT_RETURN_OK)
{
- return;
+ return;
}
#ifdef DLT_SHM_ENABLE
- /* init shared memory */
- if (dlt_shm_init_client(&dlt_user.dlt_shm,DLT_SHM_KEY) < 0)
- {
- snprintf(str,DLT_USER_BUFFER_LENGTH,"Loging disabled, Shared memory %d cannot be created!\n",DLT_SHM_KEY);
- dlt_log(LOG_WARNING, str);
- //return 0;
- }
+ /* init shared memory */
+ if (dlt_shm_init_client(&dlt_user.dlt_shm,DLT_SHM_KEY) < 0)
+ {
+ dlt_vnlog(LOG_WARNING, DLT_USER_BUFFER_LENGTH, "Loging disabled, Shared memory %d cannot be created!\n", DLT_SHM_KEY);
+ //return DLT_RETURN_OK;
+ }
#endif
dlt_log(LOG_NOTICE, "Logging (re-)enabled!\n");
/* Re-register application */
- if (dlt_user_log_send_register_application()==-1)
+ if (dlt_user_log_send_register_application() < DLT_RETURN_ERROR)
{
- return;
+ return;
}
DLT_SEM_LOCK();
@@ -4328,9 +4389,9 @@ void dlt_user_log_reattach_to_daemon(void)
log_new.log_level = DLT_USER_LOG_LEVEL_NOT_SET;
log_new.trace_status = DLT_USER_TRACE_STATUS_NOT_SET;
- if (dlt_user_log_send_register_context(&log_new)==-1)
+ if (dlt_user_log_send_register_context(&log_new) < DLT_RETURN_ERROR)
{
- return;
+ return;
}
reregistered=1;
@@ -4346,27 +4407,26 @@ void dlt_user_log_reattach_to_daemon(void)
if (reregistered==1)
{
- dlt_user_log_resend_buffer();
+ dlt_user_log_resend_buffer();
}
}
}
}
-int dlt_user_log_send_overflow(void)
+DltReturnValue dlt_user_log_send_overflow(void)
{
DltUserHeader userheader;
DltUserControlMsgBufferOverflow userpayload;
- DltReturnValue ret;
/* set userheader */
- if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_OVERFLOW)==-1)
+ if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_OVERFLOW) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (dlt_user.dlt_is_file)
{
- return 0;
+ return DLT_RETURN_OK;
}
/* set user message parameters */
@@ -4374,22 +4434,25 @@ int dlt_user_log_send_overflow(void)
dlt_set_id(userpayload.apid,dlt_user.appID);
/* log to FIFO */
- ret=dlt_user_log_out2(dlt_user.dlt_log_handle, &(userheader), sizeof(DltUserHeader),
- &(userpayload), sizeof(DltUserControlMsgBufferOverflow));
- return ((ret==DLT_RETURN_OK)?0:-1);
+ return dlt_user_log_out2(dlt_user.dlt_log_handle,
+ &(userheader), sizeof(DltUserHeader),
+ &(userpayload), sizeof(DltUserControlMsgBufferOverflow));
}
-int dlt_user_check_buffer(int *total_size, int *used_size)
+DltReturnValue dlt_user_check_buffer(int *total_size, int *used_size)
{
+ if(total_size == NULL || used_size == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
#ifdef DLT_SHM_ENABLE
- *total_size = dlt_shm_get_total_size(&(dlt_user.dlt_shm));
- *used_size = dlt_shm_get_used_size(&(dlt_user.dlt_shm));
+ *total_size = dlt_shm_get_total_size(&(dlt_user.dlt_shm));
+ *used_size = dlt_shm_get_used_size(&(dlt_user.dlt_shm));
#else
- *total_size = dlt_buffer_get_total_size(&(dlt_user.startup_buffer));
- *used_size = dlt_buffer_get_used_size(&(dlt_user.startup_buffer));
+ *total_size = dlt_buffer_get_total_size(&(dlt_user.startup_buffer));
+ *used_size = dlt_buffer_get_used_size(&(dlt_user.startup_buffer));
#endif
- return 0; /* ok */
+ return DLT_RETURN_OK; /* ok */
}
#ifdef DLT_TEST_ENABLE
diff --git a/src/lib/dlt_user_cfg.h b/src/lib/dlt_user_cfg.h
index a8f9d8d..e51fe83 100644
--- a/src/lib/dlt_user_cfg.h
+++ b/src/lib/dlt_user_cfg.h
@@ -91,10 +91,10 @@
#define DLT_USER_MAX_FILENAME_LENGTH 255
/* Maximum length of a single version number */
-#define DLT_USER_MAX_LIB_VERSION_LENGTH 3
+#define DLT_USER_MAX_LIB_VERSION_LENGTH 3
/* Length of buffer for constructing text output */
-#define DLT_USER_TEXT_LENGTH 10024
+#define DLT_USER_TEXT_LENGTH 10024
/* Stack size of receiver thread */
#define DLT_USER_RECEIVERTHREAD_STACKSIZE 100000
@@ -146,7 +146,7 @@
/* Defines of the different local print modes */
#define DLT_PM_UNSET 0
#define DLT_PM_AUTOMATIC 1
-#define DLT_PM_FORCE_ON 2
-#define DLT_PM_FORCE_OFF 3
+#define DLT_PM_FORCE_ON 2
+#define DLT_PM_FORCE_OFF 3
#endif /* DLT_USER_CFG_H */
diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c
index b0123b6..680e0a4 100644
--- a/src/shared/dlt_common.c
+++ b/src/shared/dlt_common.c
@@ -33,6 +33,7 @@
#include <time.h> /* for localtime(), strftime() */
#include <limits.h> /* for NAME_MAX */
#include <inttypes.h> /* for PRI formatting macro */
+#include <stdarg.h>
#include <errno.h>
#include <sys/stat.h> /* for mkdir() */
@@ -54,7 +55,7 @@
#include <io.h>
#else
#include <unistd.h> /* for read(), close() */
-#include <sys/time.h> /* for gettimeofday() */
+#include <sys/time.h> /* for gettimeofday() */
#endif
#if defined (__MSDOS__) || defined (_MSC_VER)
@@ -73,7 +74,7 @@ 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 = 0;
+static FILE *logging_handle = NULL;
char *message_type[] = {"log","app_trace","nw_trace","control","","","",""};
char *log_info[] = {"","fatal","error","warn","info","debug","verbose","","","","","","","","",""};
@@ -99,7 +100,7 @@ void dlt_print_hex(uint8_t *ptr,int size)
{
int num;
- if (ptr==0)
+ if (ptr == NULL)
{
return;
}
@@ -115,13 +116,13 @@ void dlt_print_hex(uint8_t *ptr,int size)
}
}
-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)
{
int num;
- if ((ptr==0) || (text==0) || (textlength<=0) || (size<0))
+ if ((ptr == NULL) || (text == NULL) || (textlength <= 0) || (size < 0))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* Length 3: AB_ , A is first digit of hex number, B is second digit of hex number, _ is space */
@@ -130,10 +131,10 @@ int dlt_print_hex_string(char *text,int textlength,uint8_t *ptr,int size)
char str[255];
snprintf(str, 254, "String does not fit hex data (available=%d, required=%d) !\n", textlength, size*3);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
- for (num=0;num<size;num++)
+ for (num=0; num<size; num++)
{
if (num>0)
{
@@ -145,21 +146,21 @@ int dlt_print_hex_string(char *text,int textlength,uint8_t *ptr,int size)
text+=2; /* 2 chars */
}
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
int required_size = 0;
int lines, rest, i;
- if ((ptr==0) || (text==0) || (textlength<=0) || (size<0))
+ if ((ptr == NULL) || (text == NULL) || (textlength <= 0) || (size < 0))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* Check maximum required size and do a length check */
- if (html==0)
+ if (html == 0)
{
required_size=(DLT_COMMON_HEX_LINELEN+(2*DLT_COMMON_HEX_CHARS+(DLT_COMMON_HEX_CHARS-1))+DLT_COMMON_CHARLEN+DLT_COMMON_HEX_CHARS+DLT_COMMON_CHARLEN) *
((size/DLT_COMMON_HEX_CHARS) + 1);
@@ -178,7 +179,7 @@ int dlt_print_mixed_string(char *text,int textlength,uint8_t *ptr,int size,int h
{
snprintf(str,DLT_COMMON_BUFFER_LENGTH, "String does not fit mixed data (available=%d, required=%d) !\n", textlength, required_size);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
/* print full lines */
@@ -244,32 +245,27 @@ int dlt_print_mixed_string(char *text,int textlength,uint8_t *ptr,int size,int h
dlt_print_char_string(&text,textlength,(uint8_t*)(ptr+ ((size / DLT_COMMON_HEX_CHARS) * DLT_COMMON_HEX_CHARS)),rest);
}
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
int num;
- if (text==0)
+ if ((text == NULL) || (ptr == NULL) || (*text == NULL) || (textlength <= 0) || (size < 0))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if ((ptr==0) || (*text==0) || (textlength<=0) || (size<0))
- {
- return -1;
- }
-
- if (textlength< size)
+ if (textlength < size)
{
char str[255];
snprintf(str, 254, "String does not fit character data (available=%d, required=%d) !\n", textlength, size);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
- for (num=0;num<size;num++)
+ for (num=0; num<size; num++)
{
if ( (((char*)ptr)[num]<DLT_COMMON_ASCII_CHAR_SPACE) || (((char*)ptr)[num]>DLT_COMMON_ASCII_CHAR_TILDE) )
{
@@ -290,21 +286,16 @@ int dlt_print_char_string(char **text,int textlength,uint8_t *ptr,int size)
(*text)++;
}
- return 0;
+ return DLT_RETURN_OK;
}
-void dlt_print_id(char *text,const char *id)
+void dlt_print_id(char *text, const char *id)
{
- int i, len;
-
// check nullpointer
- if(!text || !id)
+ if(text == NULL || id == NULL)
return;
- if (text==0)
- {
- return;
- }
+ int i, len;
/* Initialize text */
for (i=0; i<DLT_ID_SIZE; i++)
@@ -321,10 +312,10 @@ void dlt_print_id(char *text,const char *id)
text[i] = id[i];
}
-void dlt_set_id(char *id,const char *text)
+void dlt_set_id(char *id, const char *text)
{
// check nullpointer
- if(!id || !text)
+ if(id == NULL || text == NULL)
return;
id[0] = 0;
@@ -332,11 +323,6 @@ void dlt_set_id(char *id,const char *text)
id[2] = 0;
id[3] = 0;
- if (text==0)
- {
- return;
- }
-
if (text[0]!=0)
{
id[0] = text[0];
@@ -374,11 +360,11 @@ void dlt_set_id(char *id,const char *text)
}
}
-void dlt_clean_string(char *text,int length)
+void dlt_clean_string(char *text, int length)
{
int num;
- if (text==0)
+ if (text == NULL)
{
return;
}
@@ -392,51 +378,51 @@ void dlt_clean_string(char *text,int length)
}
}
-int dlt_filter_init(DltFilter *filter,int verbose)
+DltReturnValue dlt_filter_init(DltFilter *filter, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (filter==0)
+ if (filter == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
filter->counter = 0;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_filter_free(DltFilter *filter,int verbose)
+DltReturnValue dlt_filter_free(DltFilter *filter, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (filter==0)
+ if (filter == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_filter_load(DltFilter *filter,const char *filename,int verbose)
+DltReturnValue dlt_filter_load(DltFilter *filter, const char *filename, int verbose)
{
+ if (filter == NULL || filename == NULL)
+ {
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
FILE *handle;
char str1[DLT_COMMON_BUFFER_LENGTH];
char apid[DLT_ID_SIZE],ctid[DLT_ID_SIZE];
PRINT_FUNCTION_VERBOSE(verbose);
- if (filter==0)
- {
- return -1;
- }
-
handle = fopen(filename,"r");
- if (handle == 0)
+ if (handle == NULL)
{
- snprintf(str,DLT_COMMON_BUFFER_LENGTH,"Filter file %s cannot be opened!\n",filename);
+ snprintf(str, DLT_COMMON_BUFFER_LENGTH, "Filter file %s cannot be opened!\n", filename);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
/* Reset filters */
@@ -490,34 +476,34 @@ int dlt_filter_load(DltFilter *filter,const char *filename,int verbose)
{
snprintf(str,DLT_COMMON_BUFFER_LENGTH, "Maximum number (%d) of allowed filters reached, ignoring rest of filters!\n", DLT_FILTER_MAX);
dlt_log(LOG_WARNING, str);
- return 0;
+ return DLT_RETURN_OK;
}
}
fclose(handle);
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_filter_save(DltFilter *filter,const char *filename,int verbose)
+DltReturnValue dlt_filter_save(DltFilter *filter, const char *filename, int verbose)
{
+ if (filter == NULL || filename == NULL)
+ {
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
FILE *handle;
int num;
char buf[DLT_COMMON_BUFFER_LENGTH];
PRINT_FUNCTION_VERBOSE(verbose);
- if (filter==0)
- {
- return -1;
- }
-
handle = fopen(filename,"w");
- if (handle == 0)
+ if (handle == NULL)
{
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"Filter file %s cannot be opened!\n",filename);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
for (num=0;num<filter->counter;num++)
@@ -544,16 +530,16 @@ int dlt_filter_save(DltFilter *filter,const char *filename,int verbose)
fclose(handle);
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_filter_find(DltFilter *filter,const char *apid,const char *ctid, int verbose)
+int dlt_filter_find(DltFilter *filter, const char *apid, const char *ctid, int verbose)
{
int num;
PRINT_FUNCTION_VERBOSE(verbose);
- if ((filter==0) || (apid==0))
+ if ((filter == NULL) || (apid == NULL))
{
return -1;
}
@@ -563,7 +549,7 @@ int dlt_filter_find(DltFilter *filter,const char *apid,const char *ctid, int ver
if (memcmp(filter->apid[num],apid,DLT_ID_SIZE)==0)
{
/* apid matches, now check for ctid */
- if (ctid==0)
+ if (ctid == NULL)
{
/* check if empty ctid matches */
//if (memcmp(filter->ctid[num],"",DLT_ID_SIZE)==0)//coverity complains here about Out-of-bounds access.
@@ -586,20 +572,20 @@ int dlt_filter_find(DltFilter *filter,const char *apid,const char *ctid, int ver
return -1; /* Not found */
}
-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)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if ((filter==0) || (apid==0))
+ if ((filter == NULL) || (apid == NULL))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
if (filter->counter >= DLT_FILTER_MAX)
{
sprintf(str, "Maximum number (%d) of allowed filters reached, ignoring filter!\n", DLT_FILTER_MAX);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
/* add each filter (apid, ctid) only once to filter array */
@@ -613,23 +599,23 @@ int dlt_filter_add(DltFilter *filter,const char *apid,const char *ctid, int verb
filter->counter++;
- return 0;
+ return DLT_RETURN_OK;
}
}
- return -1;
+ return DLT_RETURN_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)
{
int j,k;
int found=0;
PRINT_FUNCTION_VERBOSE(verbose);
- if ((filter==0) || (apid==0))
+ if ((filter == NULL) || (apid == NULL) || (ctid == NULL))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
if (filter->counter>0)
@@ -662,77 +648,77 @@ int dlt_filter_delete(DltFilter *filter,const char *apid,const char *ctid, int v
}
filter->counter--;
- return 0;
+ return DLT_RETURN_OK;
}
}
- return -1;
+ return DLT_RETURN_ERROR;
}
-int dlt_message_init(DltMessage *msg,int verbose)
+DltReturnValue dlt_message_init(DltMessage *msg, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (msg==0)
+ if (msg == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* initalise structure parameters */
msg->headersize = 0;
msg->datasize = 0;
- msg->databuffer = 0;
+ msg->databuffer = NULL;
msg->databuffersize = 0;
- msg->storageheader = 0;
- msg->standardheader = 0;
- msg->extendedheader = 0;
+ msg->storageheader = NULL;
+ msg->standardheader = NULL;
+ msg->extendedheader = NULL;
msg->found_serialheader = 0;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_message_free(DltMessage *msg,int verbose)
+DltReturnValue dlt_message_free(DltMessage *msg, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (msg==0)
+ if (msg == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* delete databuffer if exists */
if (msg->databuffer)
{
free(msg->databuffer);
- msg->databuffer = 0;
+ msg->databuffer = NULL;
msg->databuffersize = 0;
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_message_header(DltMessage *msg,char *text,int textlength,int verbose)
+DltReturnValue dlt_message_header(DltMessage *msg, char *text, int textlength, int verbose)
{
- return dlt_message_header_flags(msg,text,textlength,DLT_HEADER_SHOW_ALL,verbose);
+ return dlt_message_header_flags(msg, text, textlength, DLT_HEADER_SHOW_ALL, verbose);
}
-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)
{
struct tm * timeinfo;
char buffer [DLT_COMMON_BUFFER_LENGTH];
PRINT_FUNCTION_VERBOSE(verbose);
- if ((msg==0) || (text==0) || (textlength<=0))
+ if ((msg == NULL) || (text == NULL) || (textlength <= 0))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
if ((flags<DLT_HEADER_SHOW_NONE) || (flags>DLT_HEADER_SHOW_ALL))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
text[0] = 0;
@@ -740,10 +726,10 @@ int dlt_message_header_flags(DltMessage *msg,char *text,int textlength,int flags
if ((flags & DLT_HEADER_SHOW_TIME) == DLT_HEADER_SHOW_TIME)
{
/* print received time */
- time_t tt = msg->storageheader->seconds;
+ time_t tt = msg->storageheader->seconds;
timeinfo = localtime (&tt);
- if (timeinfo!=0)
+ if (timeinfo != NULL)
{
strftime (buffer,sizeof(buffer),"%Y/%m/%d %H:%M:%S",timeinfo);
snprintf(text,textlength,"%s.%.6d ",buffer,msg->storageheader->microseconds);
@@ -891,12 +877,12 @@ int dlt_message_header_flags(DltMessage *msg,char *text,int textlength,int flags
}
}
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
- uint32_t id=0,id_tmp=0;
+ uint32_t id=0, id_tmp=0;
uint8_t retval=0;
uint8_t *ptr;
@@ -913,15 +899,15 @@ int dlt_message_payload(DltMessage *msg,char *text,int textlength,int type,int v
PRINT_FUNCTION_VERBOSE(verbose);
- if ((msg==0) || (text==0))
+ if ((msg == NULL) || (text == NULL))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if (textlength<=0)
+ if (textlength <= 0)
{
dlt_log(LOG_WARNING, "String does not fit binary data!\n");
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* start with empty string */
@@ -930,18 +916,18 @@ int dlt_message_payload(DltMessage *msg,char *text,int textlength,int type,int v
/* print payload only as hex */
if (type==DLT_OUTPUT_HEX)
{
- return dlt_print_hex_string(text,textlength,msg->databuffer,msg->datasize);
+ return dlt_print_hex_string(text, textlength, msg->databuffer, msg->datasize);
}
/* print payload as mixed */
if (type==DLT_OUTPUT_MIXED_FOR_PLAIN)
{
- return dlt_print_mixed_string(text,textlength,msg->databuffer,msg->datasize,0);
+ return dlt_print_mixed_string(text, textlength, msg->databuffer, msg->datasize,0);
}
if (type==DLT_OUTPUT_MIXED_FOR_HTML)
{
- return dlt_print_mixed_string(text,textlength,msg->databuffer,msg->datasize,1);
+ return dlt_print_mixed_string(text, textlength, msg->databuffer, msg->datasize,1);
}
ptr = msg->databuffer;
@@ -965,7 +951,7 @@ int dlt_message_payload(DltMessage *msg,char *text,int textlength,int type,int v
char str[255];
snprintf(str, 254, "String does not fit binary data (available=%d, required=%d) !\n", textlength, (datalength*3)+20);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
/* process message id / service id */
@@ -1051,42 +1037,42 @@ int dlt_message_payload(DltMessage *msg,char *text,int textlength,int type,int v
type_info=DLT_ENDIAN_GET_32(msg->standardheader->htyp, type_info_tmp);
/* print out argument */
- if (dlt_message_argument_print(msg, type_info, pptr, pdatalength, text, textlength, -1, 0)==-1)
+ if (dlt_message_argument_print(msg, type_info, pptr, pdatalength, text, textlength, -1, 0) == DLT_RETURN_ERROR)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_message_filter_check(DltMessage *msg,DltFilter *filter,int verbose)
+DltReturnValue dlt_message_filter_check(DltMessage *msg, DltFilter *filter, int verbose)
{
/* check the filters if message is used */
int num;
- int found = 0;
+ DltReturnValue found = DLT_RETURN_OK;
PRINT_FUNCTION_VERBOSE(verbose);
- if ((msg==0) || (filter==0))
+ if ((msg == NULL) || (filter == NULL))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
if ((filter->counter==0) || (!(DLT_IS_HTYP_UEH(msg->standardheader->htyp))))
{
/* no filter is set, or no extended header is available, so do as filter is matching */
- return 1;
+ return DLT_RETURN_TRUE;
}
- for (num=0;num<filter->counter;num++)
+ for (num=0 ;num<filter->counter; num++)
{
/* check each filter if it matches */
if ((DLT_IS_HTYP_UEH(msg->standardheader->htyp)) &&
(filter->apid[num][0]==0 || memcmp(filter->apid[num],msg->extendedheader->apid,DLT_ID_SIZE)==0) &&
(filter->ctid[num][0]==0 || memcmp(filter->ctid[num],msg->extendedheader->ctid,DLT_ID_SIZE)==0) )
{
- found = 1;
+ found = DLT_RETURN_TRUE;
break;
}
}
@@ -1094,13 +1080,13 @@ int dlt_message_filter_check(DltMessage *msg,DltFilter *filter,int verbose)
return found;
}
-int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int resync, int verbose)
+int dlt_message_read(DltMessage *msg, uint8_t *buffer, unsigned int length, int resync, int verbose)
{
int extra_size = 0;
PRINT_FUNCTION_VERBOSE(verbose);
- if ((msg==0) || (buffer==0) || (length<=0))
+ if ((msg == NULL) || (buffer == NULL) || (length <= 0))
{
return DLT_MESSAGE_ERROR_UNKNOWN;
}
@@ -1115,7 +1101,7 @@ int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int res
return DLT_MESSAGE_ERROR_SIZE;
}
- if (memcmp(buffer,dltSerialHeader,sizeof(dltSerialHeader)) == 0)
+ if (memcmp(buffer, dltSerialHeader, sizeof(dltSerialHeader)) == 0)
{
/* serial header found */
msg->found_serialheader = 1;
@@ -1133,7 +1119,7 @@ int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int res
do
{
- if (memcmp(buffer+msg->resync_offset,dltSerialHeader,sizeof(dltSerialHeader)) == 0)
+ if (memcmp(buffer+msg->resync_offset, dltSerialHeader, sizeof(dltSerialHeader)) == 0)
{
/* serial header found */
msg->found_serialheader = 1;
@@ -1162,7 +1148,7 @@ int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int res
/* dlt_log(LOG_ERR, "Length smaller than standard header!\n"); */
return DLT_MESSAGE_ERROR_SIZE;
}
- memcpy(msg->headerbuffer+sizeof(DltStorageHeader),buffer,sizeof(DltStandardHeader));
+ memcpy(msg->headerbuffer+sizeof(DltStorageHeader), buffer, sizeof(DltStandardHeader));
/* set ptrs to structures */
msg->storageheader = (DltStorageHeader*) msg->headerbuffer;
@@ -1175,14 +1161,14 @@ int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int res
if (verbose)
{
- snprintf(str,DLT_COMMON_BUFFER_LENGTH,"BufferLength=%d, HeaderSize=%d, DataSize=%d\n",length, msg->headersize, msg->datasize);
+ snprintf(str,DLT_COMMON_BUFFER_LENGTH, "BufferLength=%d, HeaderSize=%d, DataSize=%d\n", length, msg->headersize, msg->datasize);
dlt_log(LOG_DEBUG, str);
}
/* check data size */
if (msg->datasize < 0)
{
- snprintf(str,DLT_COMMON_BUFFER_LENGTH,"Plausibility check failed. Complete message size too short (%d)!\n",msg->datasize);
+ snprintf(str,DLT_COMMON_BUFFER_LENGTH, "Plausibility check failed. Complete message size too short (%d)!\n",msg->datasize);
dlt_log(LOG_WARNING, str);
return DLT_MESSAGE_ERROR_CONTENT;
}
@@ -1205,7 +1191,7 @@ int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int res
}
else
{
- msg->extendedheader = 0;
+ msg->extendedheader = NULL;
}
dlt_message_get_extraparameters(msg,verbose);
@@ -1221,17 +1207,17 @@ int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int res
/* free last used memory for buffer */
if (msg->databuffer)
{
- if (msg->datasize>msg->databuffersize){
- free(msg->databuffer);
- msg->databuffer=(uint8_t *)malloc(msg->datasize);
- msg->databuffersize = msg->datasize;
- }
+ if (msg->datasize>msg->databuffersize){
+ free(msg->databuffer);
+ msg->databuffer=(uint8_t *)malloc(msg->datasize);
+ msg->databuffersize = msg->datasize;
+ }
}else{
- /* get new memory for buffer */
- msg->databuffer = (uint8_t *)malloc(msg->datasize);
- msg->databuffersize = msg->datasize;
+ /* get new memory for buffer */
+ msg->databuffer = (uint8_t *)malloc(msg->datasize);
+ msg->databuffersize = msg->datasize;
}
- if (msg->databuffer == 0)
+ if (msg->databuffer == NULL)
{
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"Cannot allocate memory for payload buffer of size %d!\n",msg->datasize);
dlt_log(LOG_WARNING, str);
@@ -1244,13 +1230,13 @@ int dlt_message_read(DltMessage *msg,uint8_t *buffer,unsigned int length,int res
return DLT_MESSAGE_ERROR_OK;
}
-int dlt_message_get_extraparameters(DltMessage *msg,int verbose)
+DltReturnValue dlt_message_get_extraparameters(DltMessage *msg, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (msg==0)
+ if (msg == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
if (DLT_IS_HTYP_WEID(msg->standardheader->htyp))
@@ -1273,16 +1259,16 @@ int dlt_message_get_extraparameters(DltMessage *msg,int verbose)
msg->headerextra.tmsp = DLT_BETOH_32(msg->headerextra.tmsp);
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_message_set_extraparameters(DltMessage *msg,int verbose)
+DltReturnValue dlt_message_set_extraparameters(DltMessage *msg, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (msg==0)
+ if (msg == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
if (DLT_IS_HTYP_WEID(msg->standardheader->htyp))
@@ -1305,25 +1291,25 @@ int dlt_message_set_extraparameters(DltMessage *msg,int verbose)
+ (DLT_IS_HTYP_WSID(msg->standardheader->htyp) ? DLT_SIZE_WSID : 0), &(msg->headerextra.tmsp),DLT_SIZE_WTMS);
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_file_init(DltFile *file,int verbose)
+DltReturnValue dlt_file_init(DltFile *file, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (file==0)
+ if (file == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* initalise structure parameters */
- file->handle = 0;
+ file->handle = NULL;
file->counter = 0;
file->counter_total = 0;
- file->index = 0;
+ file->index = NULL;
- file->filter = 0;
+ file->filter = NULL;
file->filter_counter = 0;
file->file_position = 0;
@@ -1334,38 +1320,38 @@ int dlt_file_init(DltFile *file,int verbose)
return dlt_message_init(&(file->msg),verbose);
}
-int dlt_file_set_filter(DltFile *file,DltFilter *filter,int verbose)
+DltReturnValue dlt_file_set_filter(DltFile *file, DltFilter *filter, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (file==0)
+ if (file == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* set filter */
file->filter = filter;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_file_read_header(DltFile *file,int verbose)
+DltReturnValue dlt_file_read_header(DltFile *file, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (file==0)
+ if (file == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* load header from file */
- if (fread(file->msg.headerbuffer,sizeof(DltStorageHeader)+sizeof(DltStandardHeader),1,file->handle)!=1)
+ if (fread(file->msg.headerbuffer, sizeof(DltStorageHeader)+sizeof(DltStandardHeader), 1, file->handle)!=1)
{
if (!feof(file->handle))
{
dlt_log(LOG_WARNING, "Cannot read header from file!\n");
}
- return -1;
+ return DLT_RETURN_ERROR;
}
/* set ptrs to structures */
@@ -1373,10 +1359,10 @@ int dlt_file_read_header(DltFile *file,int verbose)
file->msg.standardheader = (DltStandardHeader*) (file->msg.headerbuffer + sizeof(DltStorageHeader));
/* check id of storage header */
- if (dlt_check_storageheader(file->msg.storageheader)==0)
+ if (dlt_check_storageheader(file->msg.storageheader) != DLT_RETURN_TRUE)
{
dlt_log(LOG_WARNING, "DLT storage header pattern not found!\n");
- return -1;
+ return DLT_RETURN_ERROR;
}
/* calculate complete size of headers */
@@ -1394,21 +1380,21 @@ int dlt_file_read_header(DltFile *file,int verbose)
{
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"Plausibility check failed. Complete message size too short! (%d)\n", file->msg.datasize);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_file_read_header_raw(DltFile *file,int resync,int verbose)
+DltReturnValue dlt_file_read_header_raw(DltFile *file, int resync, int verbose)
{
char dltSerialHeaderBuffer[DLT_ID_SIZE];
PRINT_FUNCTION_VERBOSE(verbose);
- if (file==0)
+ if (file == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* check if serial header exists, ignore if found */
@@ -1419,7 +1405,7 @@ int dlt_file_read_header_raw(DltFile *file,int resync,int verbose)
{
dlt_log(LOG_WARNING, "Cannot read header from file!\n");
}
- return -1;
+ return DLT_RETURN_ERROR;
}
if (memcmp(dltSerialHeaderBuffer,dltSerialHeader,sizeof(dltSerialHeader)) == 0)
{
@@ -1442,7 +1428,7 @@ int dlt_file_read_header_raw(DltFile *file,int resync,int verbose)
if (fread(dltSerialHeaderBuffer+3,1,1,file->handle)!=1)
{
/* cannot read any data, perhaps end of file reached */
- return -1;
+ return DLT_RETURN_ERROR;
}
if (memcmp(dltSerialHeaderBuffer,dltSerialHeader,sizeof(dltSerialHeader)) == 0)
{
@@ -1455,7 +1441,7 @@ int dlt_file_read_header_raw(DltFile *file,int resync,int verbose)
{
/* go back to last file position */
if (0 != fseek(file->handle,file->file_position,SEEK_SET))
- return -1;
+ return DLT_RETURN_ERROR;
}
}
@@ -1466,7 +1452,7 @@ int dlt_file_read_header_raw(DltFile *file,int resync,int verbose)
{
dlt_log(LOG_WARNING, "Cannot read header from file!\n");
}
- return -1;
+ return DLT_RETURN_ERROR;
}
/* set ptrs to structures */
@@ -1474,7 +1460,7 @@ int dlt_file_read_header_raw(DltFile *file,int resync,int verbose)
file->msg.standardheader = (DltStandardHeader*) (file->msg.headerbuffer + sizeof(DltStorageHeader));
/* Skip storage header field, fill this field with '0' */
- memset(file->msg.storageheader,0,sizeof(DltStorageHeader));
+ memset(file->msg.storageheader, 0, sizeof(DltStorageHeader));
/* Set storage header */
dlt_set_storageheader(file->msg.storageheader,DLT_COMMON_DUMMY_ECUID);
@@ -1496,19 +1482,19 @@ int dlt_file_read_header_raw(DltFile *file,int resync,int verbose)
{
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"Plausibility check failed. Complete message size too short! (%d)\n", file->msg.datasize);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_file_read_header_extended(DltFile *file, int verbose)
+DltReturnValue dlt_file_read_header_extended(DltFile *file, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (file==0)
+ if (file == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* load standard header extra parameters if used */
@@ -1519,7 +1505,7 @@ int dlt_file_read_header_extended(DltFile *file, int verbose)
1,file->handle)!=1)
{
dlt_log(LOG_WARNING, "Cannot read standard header extra parameters from file!\n");
- return -1;
+ return DLT_RETURN_ERROR;
}
dlt_message_get_extraparameters(&(file->msg),verbose);
@@ -1529,7 +1515,7 @@ int dlt_file_read_header_extended(DltFile *file, int verbose)
if (DLT_IS_HTYP_UEH(file->msg.standardheader->htyp)==0)
{
/* there is nothing to be loaded */
- return 0;
+ return DLT_RETURN_OK;
}
if (fread(file->msg.headerbuffer+sizeof(DltStorageHeader)+sizeof(DltStandardHeader)+DLT_STANDARD_HEADER_EXTRA_SIZE(file->msg.standardheader->htyp),
@@ -1537,7 +1523,7 @@ int dlt_file_read_header_extended(DltFile *file, int verbose)
1,file->handle)!=1)
{
dlt_log(LOG_WARNING, "Cannot read extended header from file!\n");
- return -1;
+ return DLT_RETURN_ERROR;
}
/* set extended header ptr */
@@ -1548,39 +1534,39 @@ int dlt_file_read_header_extended(DltFile *file, int verbose)
}
else
{
- file->msg.extendedheader = 0;
+ file->msg.extendedheader = NULL;
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_file_read_data(DltFile *file, int verbose)
+DltReturnValue dlt_file_read_data(DltFile *file, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (file==0)
+ if (file == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* free last used memory for buffer */
if (file->msg.databuffer && (file->msg.databuffersize < file->msg.datasize))
{
free(file->msg.databuffer);
- file->msg.databuffer=0;
+ file->msg.databuffer = NULL;
}
- if (file->msg.databuffer == 0){
- /* get new memory for buffer */
- file->msg.databuffer = (uint8_t *)malloc(file->msg.datasize);
- file->msg.databuffersize = file->msg.datasize;
+ if (file->msg.databuffer == NULL){
+ /* get new memory for buffer */
+ file->msg.databuffer = (uint8_t *)malloc(file->msg.datasize);
+ file->msg.databuffersize = file->msg.datasize;
}
- if (file->msg.databuffer == 0)
+ if (file->msg.databuffer == NULL)
{
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"Cannot allocate memory for payload buffer of size %d!\n",file->msg.datasize);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
/* load payload data from file */
@@ -1590,19 +1576,19 @@ int dlt_file_read_data(DltFile *file, int verbose)
{
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"Cannot read payload data from file of size %d!\n",file->msg.datasize);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_file_open(DltFile *file,const char *filename,int verbose)
+DltReturnValue dlt_file_open(DltFile *file,const char *filename,int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if(!file || !filename)
- return -1;
+ if(file == NULL || filename == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
/* reset counters */
file->counter = 0;
@@ -1619,18 +1605,18 @@ int dlt_file_open(DltFile *file,const char *filename,int verbose)
/* open dlt file */
file->handle = fopen(filename,"rb");
- if (file->handle == 0)
+ if (file->handle == NULL)
{
- snprintf(str, DLT_COMMON_BUFFER_LENGTH - 1 ,"File %s cannot be opened!\n",filename);
+ snprintf(str, DLT_COMMON_BUFFER_LENGTH - 1 ,"File %s cannot be opened!\n", filename);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
- if (0 != fseek(file->handle,0,SEEK_END))
+ if (0 != fseek(file->handle, 0, SEEK_END))
{
- snprintf(str,DLT_COMMON_BUFFER_LENGTH,"dlt_file_open: Seek failed to 0,SEEK_END");
+ snprintf(str, DLT_COMMON_BUFFER_LENGTH, "dlt_file_open: Seek failed to 0,SEEK_END");
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
file->file_length = ftell(file->handle);
@@ -1638,7 +1624,7 @@ int dlt_file_open(DltFile *file,const char *filename,int verbose)
{
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"dlt_file_open: Seek failed to 0,SEEK_SET");
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
if (verbose)
@@ -1647,13 +1633,13 @@ int dlt_file_open(DltFile *file,const char *filename,int verbose)
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"File is %lu bytes long\n",file->file_length);
dlt_log(LOG_DEBUG, str);
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_file_read(DltFile *file,int verbose)
+DltReturnValue dlt_file_read(DltFile *file,int verbose)
{
long *ptr;
- int found = 0;
+ int found = DLT_RETURN_OK;
if (verbose)
{
@@ -1661,9 +1647,9 @@ int dlt_file_read(DltFile *file,int verbose)
dlt_log(LOG_DEBUG, str);
}
- if (file==0)
+ if (file == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* allocate new memory for index if number of messages exceeds a multiple of DLT_COMMON_INDEX_ALLOC (e.g.: 1000) */
@@ -1671,9 +1657,9 @@ int dlt_file_read(DltFile *file,int verbose)
{
ptr = (long *) malloc(((file->counter/DLT_COMMON_INDEX_ALLOC) + 1) * DLT_COMMON_INDEX_ALLOC * sizeof(long));
- if (ptr==0)
+ if (ptr == NULL)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (file->index)
@@ -1689,7 +1675,7 @@ int dlt_file_read(DltFile *file,int verbose)
{
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"Seek failed to file_position %ld \n",file->file_position);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
/* get file position at start of DLT message */
@@ -1700,17 +1686,17 @@ int dlt_file_read(DltFile *file,int verbose)
}
/* read header */
- if (dlt_file_read_header(file,verbose)<0)
+ if (dlt_file_read_header(file,verbose) < DLT_RETURN_OK)
{
/* go back to last position in file */
fseek(file->handle,file->file_position,SEEK_SET);
- return -1;
+ return DLT_RETURN_ERROR;
}
if (file->filter)
{
/* read the extended header if filter is enabled and extended header exists */
- if (dlt_file_read_header_extended(file, verbose)<0)
+ if (dlt_file_read_header_extended(file, verbose) < DLT_RETURN_OK)
{
/* go back to last position in file */
if (0 != fseek(file->handle,file->file_position,SEEK_SET))
@@ -1718,11 +1704,11 @@ int dlt_file_read(DltFile *file,int verbose)
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"Seek to last file pos failed!\n");
dlt_log(LOG_WARNING, str);
}
- return-1;
+ return DLT_RETURN_ERROR;
}
/* check the filters if message is used */
- if (dlt_message_filter_check(&(file->msg),file->filter,verbose) == 1)
+ if (dlt_message_filter_check(&(file->msg),file->filter,verbose) == DLT_RETURN_TRUE)
{
/* filter matched, consequently store current message */
/* store index pointer to message position in DLT file */
@@ -1730,7 +1716,7 @@ int dlt_file_read(DltFile *file,int verbose)
file->counter++;
file->position = file->counter - 1;
- found = 1;
+ found = DLT_RETURN_TRUE;
}
/* skip payload data */
@@ -1746,7 +1732,7 @@ int dlt_file_read(DltFile *file,int verbose)
dlt_log(LOG_WARNING, str);
}
- return -1;
+ return DLT_RETURN_ERROR;
}
}
else
@@ -1765,7 +1751,7 @@ int dlt_file_read(DltFile *file,int verbose)
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"Seek back also failed!\n");
dlt_log(LOG_WARNING, str);
}
- return -1;
+ return DLT_RETURN_ERROR;
}
/* store index pointer to message position in DLT file */
@@ -1773,7 +1759,7 @@ int dlt_file_read(DltFile *file,int verbose)
file->counter++;
file->position = file->counter - 1;
- found = 1;
+ found = DLT_RETURN_TRUE;
}
/* increase total message counter */
@@ -1785,28 +1771,28 @@ int dlt_file_read(DltFile *file,int verbose)
return found;
}
-int dlt_file_read_raw(DltFile *file,int resync, int verbose)
+DltReturnValue dlt_file_read_raw(DltFile *file, int resync, int verbose)
{
- int found = 0;
+ int found = DLT_RETURN_OK;
long *ptr;
if (verbose)
{
- snprintf(str,DLT_COMMON_BUFFER_LENGTH,"%s: Message %d:\n",__func__, file->counter_total);
+ snprintf(str, DLT_COMMON_BUFFER_LENGTH, "%s: Message %d:\n", __func__, file->counter_total);
dlt_log(LOG_DEBUG, str);
}
- if (file==0)
- return -1;
+ if (file == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
/* allocate new memory for index if number of messages exceeds a multiple of DLT_COMMON_INDEX_ALLOC (e.g.: 1000) */
if (file->counter % DLT_COMMON_INDEX_ALLOC == 0)
{
ptr = (long *) malloc(((file->counter/DLT_COMMON_INDEX_ALLOC) + 1) * DLT_COMMON_INDEX_ALLOC * sizeof(long));
- if (ptr==0)
+ if (ptr == NULL)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (file->index)
@@ -1819,7 +1805,7 @@ int dlt_file_read_raw(DltFile *file,int resync, int verbose)
/* set to end of last successful read message, because of conflicting calls to dlt_file_read and dlt_file_message */
if (0 != fseek(file->handle,file->file_position,SEEK_SET))
- return -1;
+ return DLT_RETURN_ERROR;
/* get file position at start of DLT message */
if (verbose)
@@ -1829,7 +1815,7 @@ int dlt_file_read_raw(DltFile *file,int resync, int verbose)
}
/* read header */
- if (dlt_file_read_header_raw(file,resync,verbose)<0)
+ if (dlt_file_read_header_raw(file,resync,verbose) < DLT_RETURN_OK)
{
/* go back to last position in file */
if (0!= fseek(file->handle,file->file_position,SEEK_SET))
@@ -1837,11 +1823,11 @@ int dlt_file_read_raw(DltFile *file,int resync, int verbose)
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"dlt_file_read_raw, fseek failed 1\n");
dlt_log(LOG_WARNING, str);
}
- return -1;
+ return DLT_RETURN_ERROR;
}
/* read the extended header if filter is enabled and extended header exists */
- if (dlt_file_read_header_extended(file, verbose)<0)
+ if (dlt_file_read_header_extended(file, verbose) < DLT_RETURN_OK)
{
/* go back to last position in file */
if (0 != fseek(file->handle,file->file_position,SEEK_SET))
@@ -1849,10 +1835,10 @@ int dlt_file_read_raw(DltFile *file,int resync, int verbose)
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"dlt_file_read_raw, fseek failed 2\n");
dlt_log(LOG_WARNING, str);
}
- return-1;
+ return DLT_RETURN_ERROR;
}
- if (dlt_file_read_data(file,verbose)<0)
+ if (dlt_file_read_data(file,verbose) < DLT_RETURN_OK)
{
/* go back to last position in file */
if (0 != fseek(file->handle,file->file_position,SEEK_SET))
@@ -1860,7 +1846,7 @@ int dlt_file_read_raw(DltFile *file,int resync, int verbose)
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"dlt_file_read_raw, fseek failed 3\n");
dlt_log(LOG_WARNING, str);
}
- return-1;
+ return DLT_RETURN_ERROR;
}
/* store index pointer to message position in DLT file */
@@ -1868,7 +1854,7 @@ int dlt_file_read_raw(DltFile *file,int resync, int verbose)
file->counter++;
file->position = file->counter - 1;
- found = 1;
+ found = DLT_RETURN_TRUE;
/* increase total message counter */
file->counter_total++;
@@ -1879,13 +1865,13 @@ int dlt_file_read_raw(DltFile *file,int resync, int verbose)
return found;
}
-int dlt_file_close(DltFile *file,int verbose)
+DltReturnValue dlt_file_close(DltFile *file, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (file==0)
+ if (file == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
if (file->handle)
@@ -1893,26 +1879,26 @@ int dlt_file_close(DltFile *file,int verbose)
fclose(file->handle);
}
- file->handle = 0;
+ file->handle = NULL;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_file_message(DltFile *file,int index,int verbose)
+DltReturnValue dlt_file_message(DltFile *file, int index, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (file==0)
+ if (file == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* check if message is in range */
if (index >= file->counter)
{
- snprintf(str,DLT_COMMON_BUFFER_LENGTH,"Message %d out of range!\r\n",index);
+ snprintf(str,DLT_COMMON_BUFFER_LENGTH, "Message %d out of range!\r\n", index);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* seek to position in file */
@@ -1920,38 +1906,38 @@ int dlt_file_message(DltFile *file,int index,int verbose)
{
snprintf(str,DLT_COMMON_BUFFER_LENGTH,"Seek to message %d to position %ld failed!\r\n",index,file->index[index]);
dlt_log(LOG_WARNING, str);
- return -1;
+ return DLT_RETURN_ERROR;
}
/* read all header and payload */
- if (dlt_file_read_header(file,verbose)<0)
+ if (dlt_file_read_header(file,verbose) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if (dlt_file_read_header_extended(file,verbose)<0)
+ if (dlt_file_read_header_extended(file,verbose) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- if (dlt_file_read_data(file,verbose)<0)
+ if (dlt_file_read_data(file,verbose) < DLT_RETURN_OK)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* set current position in file */
file->position = index;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_file_free(DltFile *file,int verbose)
+DltReturnValue dlt_file_free(DltFile *file, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
- if (file==0)
+ if (file == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* delete index lost if exists */
@@ -1959,32 +1945,42 @@ int dlt_file_free(DltFile *file,int verbose)
{
free(file->index);
}
- file->index = 0;
+ file->index = NULL;
/* close file */
if (file->handle)
{
fclose(file->handle);
}
- file->handle = 0;
+ file->handle = NULL;
return dlt_message_free(&(file->msg),verbose);
}
void dlt_log_set_level(int level)
{
- logging_level = level;
+ if(level < 0 || level > LOG_DEBUG)
+ {
+ if(logging_level < LOG_WARNING)
+ logging_level = LOG_WARNING;
+
+ dlt_vlog(LOG_WARNING, "Wrong parameter for level: %d\n", level);
+ }
+ else
+ logging_level = level;
}
void dlt_log_set_filename(const char *filename)
{
// check nullpointer
- if(!filename)
+ if(filename == NULL)
+ {
+ dlt_log(LOG_WARNING, "Wrong parameter: filename is NULL\n");
return;
+ }
- strncpy(logging_filename,filename,NAME_MAX);
+ strncpy(logging_filename, filename, NAME_MAX);
logging_filename[NAME_MAX]=0;
-
}
void dlt_log_set_fifo_basedir(const char * env_pipe_dir)
@@ -1995,81 +1991,135 @@ void dlt_log_set_fifo_basedir(const char * env_pipe_dir)
void dlt_log_init(int mode)
{
+ if(mode < DLT_LOG_TO_CONSOLE || mode > DLT_LOG_DROPPED)
+ {
+ dlt_vlog(LOG_WARNING, "Wrong parameter for mode: %d\n", mode);
+ return;
+ }
+
logging_mode = mode;
- if(logging_mode == DLT_LOG_TO_FILE)
- {
- /* internal logging to file */
- logging_handle = fopen(logging_filename,"w");
- if (logging_handle == 0)
- {
- printf("Internal log file %s cannot be opened!\n",logging_filename);
- return;
- }
- }
+ if(logging_mode == DLT_LOG_TO_FILE)
+ {
+ /* internal logging to file */
+ logging_handle = fopen(logging_filename,"w");
+ if (logging_handle == NULL)
+ {
+ printf("Internal log file %s cannot be opened!\n", logging_filename);
+ return;
+ }
+ }
}
void dlt_log_free(void)
{
- if(logging_mode == DLT_LOG_TO_FILE) {
- fclose(logging_handle);
- }
+ if(logging_mode == DLT_LOG_TO_FILE) {
+ fclose(logging_handle);
+ }
}
-int dlt_log(int prio, char *s)
+DltReturnValue dlt_log(int prio, char *s)
{
static const char asSeverity[LOG_DEBUG+2][11] = {"EMERGENCY", "ALERT ", "CRITICAL ", "ERROR ", "WARNING ", "NOTICE ", "INFO ", "DEBUG ", " "};
static const char sFormatString[] = "[%5d.%06d]~DLT~%5d~%s~%s";
struct timespec sTimeSpec;
- if (s==0)
+ if (s == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+ if(logging_level<prio)
+ {
+ return DLT_RETURN_OK;
}
- if(logging_level<prio)
- {
- return 0;
- }
if ((prio < 0) || (prio > LOG_DEBUG))
{
prio = LOG_DEBUG + 1;
}
clock_gettime(CLOCK_MONOTONIC, &sTimeSpec);
- switch(logging_mode)
- {
- case DLT_LOG_TO_CONSOLE:
- /* log to stdout */
- printf(sFormatString, (unsigned int)sTimeSpec.tv_sec, (unsigned int)(sTimeSpec.tv_nsec/1000), getpid(), asSeverity[prio], s);
- break;
- case DLT_LOG_TO_SYSLOG:
- /* log to syslog */
+ switch(logging_mode)
+ {
+ case DLT_LOG_TO_CONSOLE:
+ /* log to stdout */
+ printf(sFormatString, (unsigned int)sTimeSpec.tv_sec, (unsigned int)(sTimeSpec.tv_nsec/1000), getpid(), asSeverity[prio], s);
+ break;
+ case DLT_LOG_TO_SYSLOG:
+ /* log to syslog */
#if !defined (__WIN32__) && !defined(_MSC_VER)
- openlog("DLT",LOG_PID,LOG_DAEMON);
- syslog(prio, sFormatString, (unsigned int)sTimeSpec.tv_sec, (unsigned int)(sTimeSpec.tv_nsec/1000), getpid(), asSeverity[prio], s);
- closelog();
+ openlog("DLT",LOG_PID,LOG_DAEMON);
+ syslog(prio, sFormatString, (unsigned int)sTimeSpec.tv_sec, (unsigned int)(sTimeSpec.tv_nsec/1000), getpid(), asSeverity[prio], s);
+ closelog();
#endif
- break;
- case DLT_LOG_TO_FILE:
- /* log to file */
- if(logging_handle) {
- fprintf(logging_handle,sFormatString, (unsigned int)sTimeSpec.tv_sec, (unsigned int)(sTimeSpec.tv_nsec/1000), getpid(), asSeverity[prio], s);
- fflush(logging_handle);
- }
- break;
- case DLT_LOG_DROPPED:
- default:
- break;
- }
+ break;
+ case DLT_LOG_TO_FILE:
+ /* log to file */
+ if(logging_handle) {
+ fprintf(logging_handle,sFormatString, (unsigned int)sTimeSpec.tv_sec, (unsigned int)(sTimeSpec.tv_nsec/1000), getpid(), asSeverity[prio], s);
+ fflush(logging_handle);
+ }
+ break;
+ case DLT_LOG_DROPPED:
+ default:
+ break;
+ }
- return 0;
+ return DLT_RETURN_OK;
+}
+
+DltReturnValue dlt_vlog(int prio, const char *format, ...)
+{
+ char outputString[2048] = { 0 }; /* TODO: what is a reasonable string length here? */
+
+ va_list args;
+
+ if (format == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (logging_level < prio)
+ return DLT_RETURN_OK;
+
+ va_start(args, format);
+ vsnprintf(outputString, 2047, format, args);
+ va_end(args);
+
+ dlt_log(prio, outputString);
+
+ return DLT_RETURN_OK;
+}
+
+DltReturnValue dlt_vnlog(int prio, size_t size, const char *format, ...)
+{
+ char *outputString = NULL;
+
+ va_list args;
+
+ if (format == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if (logging_level < prio || size == 0)
+ return DLT_RETURN_OK;
+
+ if ( (outputString = (char*) calloc(size + 1, sizeof(char))) == NULL )
+ return DLT_RETURN_ERROR;
+
+ va_start(args, format);
+ vsnprintf(outputString, size, format, args);
+ va_end(args);
+
+ dlt_log(prio, outputString);
+
+ free(outputString);
+ outputString = NULL;
+
+ return DLT_RETURN_OK;
}
-int dlt_receiver_init(DltReceiver *receiver,int fd, int buffersize)
+DltReturnValue dlt_receiver_init(DltReceiver *receiver, int fd, int buffersize)
{
- if (receiver==0)
+ if (receiver == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
receiver->lastBytesRcvd = 0;
@@ -2079,25 +2129,25 @@ int dlt_receiver_init(DltReceiver *receiver,int fd, int buffersize)
receiver->fd = fd;
receiver->buffer = (char*)malloc(receiver->buffersize);
- if (receiver->buffer == 0)
+ if (receiver->buffer == NULL)
{
- receiver->buf = 0;
- return -1;
+ receiver->buf = NULL;
+ return DLT_RETURN_ERROR;
}
else
{
receiver->buf = receiver->buffer;
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_receiver_free(DltReceiver *receiver)
+DltReturnValue dlt_receiver_free(DltReceiver *receiver)
{
- if (receiver==0)
+ if (receiver == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
if (receiver->buffer)
@@ -2105,21 +2155,21 @@ int dlt_receiver_free(DltReceiver *receiver)
free(receiver->buffer);
}
- receiver->buffer = 0;
- receiver->buf = 0;
+ receiver->buffer = NULL;
+ receiver->buf = NULL;
- return 0;
+ return DLT_RETURN_OK;
}
#ifndef QT_VIEWER
int dlt_receiver_receive_socket(DltReceiver *receiver)
{
- if (receiver==0)
+ if (receiver == NULL)
{
return -1;
}
- if (receiver->buffer==0)
+ if (receiver->buffer == NULL)
{
return -1;
}
@@ -2144,12 +2194,12 @@ int dlt_receiver_receive_socket(DltReceiver *receiver)
int dlt_receiver_receive_fd(DltReceiver *receiver)
{
- if (receiver==0)
+ if (receiver == NULL)
{
return -1;
}
- if (receiver->buffer==0)
+ if (receiver->buffer == NULL)
{
return -1;
}
@@ -2171,41 +2221,41 @@ int dlt_receiver_receive_fd(DltReceiver *receiver)
return receiver->bytesRcvd;
}
-int dlt_receiver_remove(DltReceiver *receiver,int size)
+DltReturnValue dlt_receiver_remove(DltReceiver *receiver, int size)
{
- if (receiver==0)
+ if (receiver == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if (receiver->buf==0)
+ if (receiver->buf == NULL)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (size > receiver->bytesRcvd || size <= 0)
{
- receiver->buf = receiver->buf + receiver->bytesRcvd;
- receiver->bytesRcvd=0;
- return -1;
+ receiver->buf = receiver->buf + receiver->bytesRcvd;
+ receiver->bytesRcvd = 0;
+ return DLT_RETURN_WRONG_PARAMETER;
}
receiver->bytesRcvd = receiver->bytesRcvd - size;
receiver->buf = receiver->buf + size;
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_receiver_move_to_begin(DltReceiver *receiver)
+DltReturnValue dlt_receiver_move_to_begin(DltReceiver *receiver)
{
- if (receiver==0)
+ if (receiver == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
- if ((receiver->buffer==0) || (receiver->buf==0))
+ if ((receiver->buffer == NULL) || (receiver->buf == NULL))
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if ((receiver->buffer!=receiver->buf) && (receiver->bytesRcvd!=0))
@@ -2213,19 +2263,19 @@ int dlt_receiver_move_to_begin(DltReceiver *receiver)
memmove(receiver->buffer,receiver->buf,receiver->bytesRcvd);
}
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_set_storageheader(DltStorageHeader *storageheader, const char *ecu)
+DltReturnValue dlt_set_storageheader(DltStorageHeader *storageheader, const char *ecu)
{
#if !defined(_MSC_VER)
struct timeval tv;
#endif
- if (storageheader==0)
+ if (storageheader == NULL || ecu == NULL)
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
/* get time of day */
@@ -2251,20 +2301,19 @@ int dlt_set_storageheader(DltStorageHeader *storageheader, const char *ecu)
storageheader->microseconds = (int32_t)tv.tv_usec; /* value is long */
#endif
- return 0;
+ return DLT_RETURN_OK;
}
-int dlt_check_storageheader(DltStorageHeader *storageheader)
+DltReturnValue dlt_check_storageheader(DltStorageHeader *storageheader)
{
- if (storageheader==0)
- {
- return -1;
- }
+ if (storageheader == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
return ((storageheader->pattern[0] == 'D') &&
(storageheader->pattern[1] == 'L') &&
(storageheader->pattern[2] == 'T') &&
- (storageheader->pattern[3] == 1));
+ (storageheader->pattern[3] == 1))
+ ? DLT_RETURN_TRUE : DLT_RETURN_OK;
}
@@ -2278,131 +2327,147 @@ int dlt_check_storageheader(DltStorageHeader *storageheader)
-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)
{
- char str[256];
- DltBufferHead *head;
+ if(buf == NULL || ptr == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
- // Init parameters
- buf->shm = (unsigned char *)ptr;
- buf->min_size = size;
- buf->max_size = size;
- buf->step_size = 0;
+ char str[256];
+ DltBufferHead *head;
- // Init pointers
- head = (DltBufferHead*)buf->shm;
- head->read = 0;
- head->write = 0;
- head->count = 0;
+ // Init parameters
+ buf->shm = (unsigned char *)ptr;
+ buf->min_size = size;
+ buf->max_size = size;
+ buf->step_size = 0;
+
+ // Init pointers
+ head = (DltBufferHead*)buf->shm;
+ head->read = 0;
+ head->write = 0;
+ head->count = 0;
buf->mem = (unsigned char *)(buf->shm + sizeof(DltBufferHead));
- buf->size = buf->min_size - sizeof(DltBufferHead);
+ buf->size = buf->min_size - sizeof(DltBufferHead);
- // clear memory
- memset(buf->mem,0,buf->size);
+ // clear memory
+ memset(buf->mem, 0, buf->size);
- snprintf(str,sizeof(str),"Buffer: Size %d\n",buf->size);
- dlt_log(LOG_DEBUG, str);
+ snprintf(str,sizeof(str),"Buffer: Size %d\n",buf->size);
+ dlt_log(LOG_DEBUG, str);
- return 0; /* OK */
+ return DLT_RETURN_OK; /* OK */
}
-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)
{
- char str[256];
+ if(buf == NULL || ptr == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ char str[256];
- // Init parameters
- buf->shm = (unsigned char *)ptr;
- buf->min_size = size;
- buf->max_size = size;
- buf->step_size = 0;
+ // Init parameters
+ buf->shm = (unsigned char *)ptr;
+ buf->min_size = size;
+ buf->max_size = size;
+ buf->step_size = 0;
- // Init pointers
+ // Init pointers
buf->mem = (unsigned char *)(buf->shm + sizeof(DltBufferHead));
buf->size = buf->min_size - sizeof(DltBufferHead);
- snprintf(str,sizeof(str),"Buffer: Size %d\n",buf->size);
- dlt_log(LOG_DEBUG, str);
+ snprintf(str,sizeof(str),"Buffer: Size %d\n",buf->size);
+ dlt_log(LOG_DEBUG, str);
- return 0; /* OK */
+ return DLT_RETURN_OK; /* OK */
}
-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)
{
//Do not DLT_SEM_LOCK inside here!
- char str[256];
- DltBufferHead *head;
+ char str[256];
+ DltBufferHead *head;
// catch null pointer
- if(!buf)
- return -1;
+ if(buf == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
// catch 0 logical errors
if(min_size == 0 || max_size == 0 || step_size == 0)
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
- // Init parameters
- buf->min_size = min_size;
- buf->max_size = max_size;
- buf->step_size = step_size;
-
- // allocat memory
- buf->shm = malloc(buf->min_size);
- if(buf->shm == NULL) {
- snprintf(str,sizeof(str),"Buffer: Cannot allocate %d bytes\n",buf->min_size);
- dlt_log(LOG_EMERG, str);
- return -1;
- }
+ if(min_size > max_size)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ if(step_size > max_size)
+ return DLT_RETURN_WRONG_PARAMETER;
+
+ // Init parameters
+ buf->min_size = min_size;
+ buf->max_size = max_size;
+ buf->step_size = step_size;
+
+ // allocat memory
+ buf->shm = malloc(buf->min_size);
+ if(buf->shm == NULL) {
+ snprintf(str,sizeof(str),"Buffer: Cannot allocate %d bytes\n",buf->min_size);
+ dlt_log(LOG_EMERG, str);
+ return DLT_RETURN_ERROR;
+ }
- // Init pointers
- head = (DltBufferHead*)buf->shm;
- head->read = 0;
- head->write = 0;
- head->count = 0;
+ // Init pointers
+ head = (DltBufferHead*)buf->shm;
+ head->read = 0;
+ head->write = 0;
+ head->count = 0;
buf->mem = (unsigned char *)(buf->shm + sizeof(DltBufferHead));
buf->size = buf->min_size - sizeof(DltBufferHead);
- // clear memory
- memset(buf->mem,0,buf->size);
+ // clear memory
+ memset(buf->mem,0,buf->size);
- //snprintf(str,sizeof(str),"Buffer: Size %d bytes\n",buf->size);
- //dlt_log(LOG_INFO, str);
+ //snprintf(str,sizeof(str),"Buffer: Size %d bytes\n",buf->size);
+ //dlt_log(LOG_INFO, str);
- return 0; /* OK */
+ return DLT_RETURN_OK; /* OK */
}
-int dlt_buffer_free_static(DltBuffer *buf)
+DltReturnValue dlt_buffer_free_static(DltBuffer *buf)
{
- if(!buf->mem) {
- // buffer not initialised
- dlt_log(LOG_WARNING,"Buffer: Buffer not initialised\n");
- return -1; /* ERROR */
- }
+ // catch null pointer
+ if(buf == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
- return 0;
+ if(buf->mem == NULL) {
+ // buffer not initialized
+ dlt_log(LOG_WARNING,"Buffer: Buffer not initialized\n");
+ return DLT_RETURN_ERROR; /* ERROR */
+ }
+
+ return DLT_RETURN_OK;
}
-int dlt_buffer_free_dynamic(DltBuffer *buf)
+DltReturnValue dlt_buffer_free_dynamic(DltBuffer *buf)
{
// catch null pointer
- if(!buf)
- return -1;
+ if(buf == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
- if(!buf->shm) {
- // buffer not initialised
- dlt_log(LOG_WARNING,"Buffer: Buffer not initialised\n");
- return -1; /* ERROR */
- }
+ if(buf->shm == NULL) {
+ // buffer not initialized
+ dlt_log(LOG_WARNING,"Buffer: Buffer not initialized\n");
+ return DLT_RETURN_ERROR; /* ERROR */
+ }
free(buf->shm);
- buf->shm = 0;
- buf->mem = 0;
-
- return 0;
+ buf->shm = NULL;
+ buf->mem = NULL;
+
+ return DLT_RETURN_OK;
}
-void dlt_buffer_write_block(DltBuffer *buf,int *write, const unsigned char *data,unsigned int size)
+void dlt_buffer_write_block(DltBuffer *buf, int *write, const unsigned char *data, unsigned int size)
{
// catch null pointer
- if(buf && write && data) {
+ if(buf != NULL && write != NULL && data != NULL) {
if((int)(*write+size) <= buf->size) {
// write one block
memcpy(buf->mem+*write,data,size);
@@ -2415,12 +2480,16 @@ void dlt_buffer_write_block(DltBuffer *buf,int *write, const unsigned char *data
*write += size-buf->size;
}
}
+ else
+ {
+ dlt_log(LOG_WARNING, "Wrong parameter: Null pointer\n");
+ }
}
-void dlt_buffer_read_block(DltBuffer *buf,int *read,unsigned char *data,unsigned int size)
+void dlt_buffer_read_block(DltBuffer *buf, int *read, unsigned char *data, unsigned int size)
{
// catch nullpointer
- if(buf && read && data) {
+ if(buf != NULL && read != NULL && data != NULL) {
if((int)(*read+size) <= buf->size) {
// read one block
memcpy(data,buf->mem+*read,size);
@@ -2433,420 +2502,440 @@ void dlt_buffer_read_block(DltBuffer *buf,int *read,unsigned char *data,unsigned
*read += size-buf->size;
}
}
+ else
+ {
+ dlt_log(LOG_WARNING, "Wrong parameter: Null pointer\n");
+ }
}
int dlt_buffer_increase_size(DltBuffer *buf)
{
// catch null pointer
- if(!buf)
+ if(buf == NULL) {
return -1;
+ }
- DltBufferHead *head,*new_head;
- unsigned char *new_ptr;
+ DltBufferHead *head,*new_head;
+ unsigned char *new_ptr;
- /* check size */
- if(buf->step_size==0) {
- /* cannot increase size */
- return -1;
- }
+ /* check size */
+ if(buf->step_size==0) {
+ /* cannot increase size */
+ return -1;
+ }
- /* check size */
- if((buf->size + sizeof(DltBufferHead) + buf->step_size) > buf->max_size) {
- /* max size reached, do not increase */
- return -1;
- }
+ /* check size */
+ if((buf->size + sizeof(DltBufferHead) + buf->step_size) > buf->max_size) {
+ /* max size reached, do not increase */
+ return -1;
+ }
- /* allocate new buffer */
- new_ptr = malloc(buf->size + sizeof(DltBufferHead) + buf->step_size);
- if(new_ptr == NULL) {
- snprintf(str,sizeof(str),"Buffer: Cannot increase size because allocate %d bytes failed\n",buf->min_size);
- dlt_log(LOG_WARNING, str);
- return -1;
- }
-
- /* copy data */
- head = (DltBufferHead*)buf->shm;
- new_head = (DltBufferHead*)new_ptr;
- if(head->read < head->write) {
- memcpy(new_ptr+sizeof(DltBufferHead) , buf->mem+head->read , head->write-head->read);
- new_head->read = 0;
- new_head->write = head->write-head->read;
- new_head->count = head->count;
- }
- else {
- memcpy(new_ptr+sizeof(DltBufferHead) , buf->mem+head->read , buf->size-head->read);
- memcpy(new_ptr+sizeof(DltBufferHead)+buf->size-head->read , buf->mem , head->write);
- new_head->read = 0;
- new_head->write = buf->size-head->read+head->write;
- new_head->count = head->count;
- }
-
- /* free old data */
- free(buf->shm);
-
- /* update data */
- buf->shm = new_ptr;
- buf->mem = new_ptr+sizeof(DltBufferHead);
- buf->size += buf->step_size;
-
- snprintf(str,sizeof(str),"Buffer: Size increased to %d bytes\n",buf->size+(int32_t)sizeof(DltBufferHead));
- dlt_log(LOG_DEBUG, str);
+ /* allocate new buffer */
+ new_ptr = malloc(buf->size + sizeof(DltBufferHead) + buf->step_size);
+ if(new_ptr == NULL) {
+ snprintf(str,sizeof(str),"Buffer: Cannot increase size because allocate %d bytes failed\n",buf->min_size);
+ dlt_log(LOG_WARNING, str);
+ return -1;
+ }
+
+ /* copy data */
+ head = (DltBufferHead*)buf->shm;
+ new_head = (DltBufferHead*)new_ptr;
+ if(head->read < head->write) {
+ memcpy(new_ptr+sizeof(DltBufferHead) , buf->mem+head->read , head->write-head->read);
+ new_head->read = 0;
+ new_head->write = head->write-head->read;
+ new_head->count = head->count;
+ }
+ else {
+ memcpy(new_ptr+sizeof(DltBufferHead) , buf->mem+head->read , buf->size-head->read);
+ memcpy(new_ptr+sizeof(DltBufferHead)+buf->size-head->read , buf->mem , head->write);
+ new_head->read = 0;
+ new_head->write = buf->size-head->read+head->write;
+ new_head->count = head->count;
+ }
+
+ /* free old data */
+ free(buf->shm);
- return 0; // OK
+ /* update data */
+ buf->shm = new_ptr;
+ buf->mem = new_ptr+sizeof(DltBufferHead);
+ buf->size += buf->step_size;
+
+ snprintf(str,sizeof(str), "Buffer: Size increased to %d bytes\n", buf->size+(int32_t)sizeof(DltBufferHead));
+ dlt_log(LOG_DEBUG, str);
+
+ return 0; // OK
}
int dlt_buffer_minimize_size(DltBuffer *buf)
{
- unsigned char *new_ptr;
+ unsigned char *new_ptr;
// catch null pointer
- if(!buf)
+ if(buf == NULL)
+ {
+ dlt_log(LOG_WARNING, "Wrong parameter: Null pointer\n");
return -1;
+ }
- if((buf->size + sizeof(DltBufferHead)) == buf->min_size)
- {
- /* already minimized */
- return 0;
- }
+ if((buf->size + sizeof(DltBufferHead)) == buf->min_size)
+ {
+ /* already minimized */
+ return 0;
+ }
- /* allocate new buffer */
- new_ptr = malloc(buf->min_size);
- if(new_ptr == NULL) {
- snprintf(str,sizeof(str),"Buffer: Cannot set to min size of %d bytes\n",buf->min_size);
- dlt_log(LOG_WARNING, str);
- return -1;
- }
+ /* allocate new buffer */
+ new_ptr = malloc(buf->min_size);
+ if(new_ptr == NULL) {
+ snprintf(str,sizeof(str),"Buffer: Cannot set to min size of %d bytes\n",buf->min_size);
+ dlt_log(LOG_WARNING, str);
+ return -1;
+ }
- /* free old data */
- free(buf->shm);
+ /* free old data */
+ free(buf->shm);
- /* update data */
- buf->shm = new_ptr;
- buf->mem = new_ptr+sizeof(DltBufferHead);
- buf->size = buf->min_size - sizeof(DltBufferHead);
+ /* update data */
+ buf->shm = new_ptr;
+ buf->mem = new_ptr+sizeof(DltBufferHead);
+ buf->size = buf->min_size - sizeof(DltBufferHead);
- /* reset pointers and counters */
- ((int*)(buf->shm))[0] = 0; // pointer to write memory
- ((int*)(buf->shm))[1] = 0; // pointer to read memory
- ((int*)(buf->shm))[2] = 0; // number of packets
+ /* reset pointers and counters */
+ ((int*)(buf->shm))[0] = 0; // pointer to write memory
+ ((int*)(buf->shm))[1] = 0; // pointer to read memory
+ ((int*)(buf->shm))[2] = 0; // number of packets
- // clear memory
- memset(buf->mem,0,buf->size);
+ // clear memory
+ memset(buf->mem, 0, buf->size);
- dlt_log(LOG_DEBUG,"Buffer: Buffer minimized.\n");
+ dlt_log(LOG_DEBUG,"Buffer: Buffer minimized.\n");
- return 0; /* OK */
+ return 0; /* OK */
}
int dlt_buffer_reset(DltBuffer *buf)
{
// catch null pointer
- if(!buf)
+ if(buf == NULL)
+ {
+ dlt_log(LOG_WARNING, "Wrong parameter: Null pointer\n");
return -1;
+ }
- dlt_log(LOG_WARNING,"Buffer: Buffer reset triggered.\n");
+ dlt_log(LOG_WARNING, "Buffer: Buffer reset triggered.\n");
- /* reset pointers and counters */
- ((int*)(buf->shm))[0] = 0; // pointer to write memory
- ((int*)(buf->shm))[1] = 0; // pointer to read memory
- ((int*)(buf->shm))[2] = 0; // number of packets
+ /* reset pointers and counters */
+ ((int*)(buf->shm))[0] = 0; // pointer to write memory
+ ((int*)(buf->shm))[1] = 0; // pointer to read memory
+ ((int*)(buf->shm))[2] = 0; // number of packets
- // clear memory
+ // clear memory
memset(buf->mem,0,buf->size);
- return 0; /* OK */
+ return 0; /* OK */
}
-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)
{
- return dlt_buffer_push3(buf,data,size,0,0,0,0);
+ return dlt_buffer_push3(buf, data, size, 0, 0, 0, 0);
}
-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_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 free_size;
- int write, read, count;
- DltBufferBlockHead head;
+ int free_size;
+ int write, read, count;
+ DltBufferBlockHead head;
// catch null pointer
- if(!buf)
- return -1;
-
- if(!buf->shm) {
- // buffer not initialised
- dlt_log(LOG_ERR,"Buffer: Buffer not initialised\n");
- return -1; /* ERROR */
- }
+ if (buf == NULL)
+ return DLT_RETURN_ERROR;
- // get current write pointer
- write = ((int*)(buf->shm))[0];
- read = ((int*)(buf->shm))[1];
- count = ((int*)(buf->shm))[2];
+ if (buf->shm == NULL)
+ {
+ // buffer not initialised
+ dlt_log(LOG_ERR, "Buffer: Buffer not initialised\n");
+ return DLT_RETURN_ERROR; /* ERROR */
+ }
- // check pointers
- if((read>buf->size) || (write>buf->size))
- {
- dlt_log(LOG_ERR,"Buffer: Pointer out of range\n");
- dlt_buffer_reset(buf);
- return -1; // ERROR
- }
+ // get current write pointer
+ write = ((int*) (buf->shm))[0];
+ read = ((int*) (buf->shm))[1];
+ count = ((int*) (buf->shm))[2];
- // calculate free size
- if(read>write)
- free_size = read - write;
- else if(count && (write == read))
- free_size = 0;
- else
- free_size = buf->size - write + read;
-
- // check size
- if(free_size < (int)(sizeof(DltBufferBlockHead)+size1+size2+size3)) {
- // try to increase size if possible
- if(dlt_buffer_increase_size(buf)) {
- /* increase size is not possible */
- //dlt_log(LOG_ERR,"Buffer: Buffer is full\n");
- return -1; // ERROR
- }
- // update pointers
- write = ((int*)(buf->shm))[0];
- read = ((int*)(buf->shm))[1];
- }
+ // check pointers
+ if ((read > buf->size) || (write > buf->size))
+ {
+ dlt_log(LOG_ERR, "Buffer: Pointer out of range\n");
+ dlt_buffer_reset(buf);
+ return DLT_RETURN_ERROR; // ERROR
+ }
- // set header
- strncpy(head.head,DLT_BUFFER_HEAD,3);
- head.head[3]=0;
- head.status = 2;
- head.size = size1+size2+size3;
+ // calculate free size
+ if (read > write)
+ free_size = read - write;
+ else if (count && (write == read))
+ free_size = 0;
+ else
+ free_size = buf->size - write + read;
- // write data
- dlt_buffer_write_block(buf,&write,(unsigned char*)&head,sizeof(DltBufferBlockHead));
- if(size1) dlt_buffer_write_block(buf,&write,data1,size1);
- if(size2) dlt_buffer_write_block(buf,&write,data2,size2);
- if(size3) dlt_buffer_write_block(buf,&write,data3,size3);
+ // check size
+ if (free_size < (int) (sizeof(DltBufferBlockHead) + size1 + size2 + size3))
+ {
+ // try to increase size if possible
+ if (dlt_buffer_increase_size(buf))
+ {
+ /* increase size is not possible */
+ //dlt_log(LOG_ERR,"Buffer: Buffer is full\n");
+ return DLT_RETURN_ERROR; // ERROR
+ }
+
+ // update pointers
+ write = ((int*) (buf->shm))[0];
+ read = ((int*) (buf->shm))[1];
+ }
- // update global shm pointers
- ((int*)(buf->shm))[0] = write; // set new write pointer
- ((int*)(buf->shm))[2] += 1; // increase counter
+ // set header
+ strncpy(head.head, DLT_BUFFER_HEAD, 3);
+ head.head[3] = 0;
+ head.status = 2;
+ head.size = size1 + size2 + size3;
+
+ // write data
+ dlt_buffer_write_block(buf, &write, (unsigned char*) &head, sizeof(DltBufferBlockHead));
+ if (size1)
+ dlt_buffer_write_block(buf, &write, data1, size1);
+ if (size2)
+ dlt_buffer_write_block(buf, &write, data2, size2);
+ if (size3)
+ dlt_buffer_write_block(buf, &write, data3, size3);
+
+ // update global shm pointers
+ ((int*) (buf->shm))[0] = write; // set new write pointer
+ ((int*) (buf->shm))[2] += 1; // increase counter
+
+ return DLT_RETURN_OK; // OK
- return 0; // OK
-
}
-int dlt_buffer_get(DltBuffer *buf,unsigned char *data, int max_size,int delete)
+int dlt_buffer_get(DltBuffer *buf, unsigned char *data, int max_size, int delete)
{
- int used_size;
- int write, read, count;
- char head_compare[] = DLT_BUFFER_HEAD;
- DltBufferBlockHead head;
+ int used_size;
+ int write, read, count;
+ char head_compare[] = DLT_BUFFER_HEAD;
+ DltBufferBlockHead head;
// catch null pointer
- if(!buf)
+ if(buf == NULL)
return -1;
-
- if(!buf->shm) {
- // shm not initialised
- dlt_log(LOG_ERR,"Buffer: SHM not initialised\n");
- return -1; /* ERROR */
- }
- // get current write pointer
- write = ((int*)(buf->shm))[0];
- read = ((int*)(buf->shm))[1];
- count = ((int*)(buf->shm))[2];
+ if(buf->shm == NULL) {
+ // shm not initialised
+ dlt_log(LOG_ERR,"Buffer: SHM not initialised\n");
+ return -1; /* ERROR */
+ }
- // check pointers
- if((read>buf->size) || (write>buf->size) || (count<0))
- {
- dlt_log(LOG_ERR,"Buffer: Pointer out of range\n");
- dlt_buffer_reset(buf);
- return -1; // ERROR
- }
+ // get current write pointer
+ write = ((int*)(buf->shm))[0];
+ read = ((int*)(buf->shm))[1];
+ count = ((int*)(buf->shm))[2];
- // check if data is in there
- if(count==0) {
- if(write!=read)
- {
- dlt_log(LOG_ERR,"Buffer: SHM should be empty, but is not\n");
- dlt_buffer_reset(buf);
- }
- return -1; // ERROR
- }
+ // check pointers
+ if((read>buf->size) || (write>buf->size) || (count<0))
+ {
+ dlt_log(LOG_ERR,"Buffer: Pointer out of range\n");
+ dlt_buffer_reset(buf);
+ return -1; // ERROR
+ }
- // calculate used size
- if(write>read)
- used_size = write - read;
- else
- used_size = buf->size - read + write;
-
- // first check size
- if(used_size < (int)(sizeof(DltBufferBlockHead))) {
- dlt_log(LOG_ERR,"Buffer: Size check 1 failed\n");
- dlt_buffer_reset(buf);
- return -1; // ERROR
- }
+ // check if data is in there
+ if(count==0) {
+ if(write!=read)
+ {
+ dlt_log(LOG_ERR,"Buffer: SHM should be empty, but is not\n");
+ dlt_buffer_reset(buf);
+ }
+ return -1; // ERROR
+ }
- // read header
- dlt_buffer_read_block(buf,&read,(unsigned char*)&head,sizeof(DltBufferBlockHead));
+ // calculate used size
+ if(write>read)
+ used_size = write - read;
+ else
+ used_size = buf->size - read + write;
- // check header
- if(memcmp((unsigned char*)(head.head),head_compare,sizeof(head_compare))!=0)
- {
- dlt_log(LOG_ERR,"Buffer: Header head check failed\n");
- dlt_buffer_reset(buf);
- return -1; // ERROR
- }
- if(head.status != 2)
- {
- dlt_log(LOG_ERR,"Buffer: Header status check failed\n");
- dlt_buffer_reset(buf);
- return -1; // ERROR
- }
+ // first check size
+ if(used_size < (int)(sizeof(DltBufferBlockHead))) {
+ dlt_log(LOG_ERR,"Buffer: Size check 1 failed\n");
+ dlt_buffer_reset(buf);
+ return -1; // ERROR
+ }
- // second check size
- if(used_size < (int)(sizeof(DltBufferBlockHead)+head.size)) {
- dlt_log(LOG_ERR,"Buffer: Size check 2 failed\n");
- dlt_buffer_reset(buf);
- return -1; // ERROR
- }
+ // read header
+ dlt_buffer_read_block(buf,&read,(unsigned char*)&head,sizeof(DltBufferBlockHead));
- // third check size
- if(max_size && (head.size > max_size)) {
- dlt_log(LOG_ERR,"Buffer: Size check 3 failed\n");
- // nothing to do but data does not fit provided buffer
- }
+ // check header
+ if(memcmp((unsigned char*)(head.head),head_compare,sizeof(head_compare))!=0)
+ {
+ dlt_log(LOG_ERR,"Buffer: Header head check failed\n");
+ dlt_buffer_reset(buf);
+ return -1; // ERROR
+ }
+ if(head.status != 2)
+ {
+ dlt_log(LOG_ERR,"Buffer: Header status check failed\n");
+ dlt_buffer_reset(buf);
+ return -1; // ERROR
+ }
- if(data && max_size)
- {
- // read data
- dlt_buffer_read_block(buf,&read,data,head.size);
+ // second check size
+ if(used_size < (int)(sizeof(DltBufferBlockHead)+head.size)) {
+ dlt_log(LOG_ERR,"Buffer: Size check 2 failed\n");
+ dlt_buffer_reset(buf);
+ return -1; // ERROR
+ }
- if(delete)
- {
- // update buffer pointers
- ((int*)(buf->shm))[1] = read; // set new read pointer
- }
- }
- else
- {
- if(delete) {
- if( (read+head.size) <= buf->size)
- ((int*)(buf->shm))[1] = read+head.size; // set new read pointer
- else
- ((int*)(buf->shm))[1] = read+head.size-buf->size; // set new read pointer
- }
- }
- if(delete) {
- ((int*)(buf->shm))[2] -= 1; // decrease counter
+ // third check size
+ if(max_size && (head.size > max_size)) {
+ dlt_log(LOG_ERR,"Buffer: Size check 3 failed\n");
+ // nothing to do but data does not fit provided buffer
+ }
- if(((int*)(buf->shm))[2] == 0)
- {
- // try to minimize size
- dlt_buffer_minimize_size(buf);
- }
- }
+ if(data != NULL && max_size)
+ {
+ // read data
+ dlt_buffer_read_block(buf,&read,data,head.size);
+
+ if(delete)
+ {
+ // update buffer pointers
+ ((int*)(buf->shm))[1] = read; // set new read pointer
+ }
+ }
+ else
+ {
+ if(delete) {
+ if( (read+head.size) <= buf->size)
+ ((int*)(buf->shm))[1] = read+head.size; // set new read pointer
+ else
+ ((int*)(buf->shm))[1] = read+head.size-buf->size; // set new read pointer
+ }
+ }
+ if(delete) {
+ ((int*)(buf->shm))[2] -= 1; // decrease counter
- return head.size; // OK
+ if(((int*)(buf->shm))[2] == 0)
+ {
+ // try to minimize size
+ dlt_buffer_minimize_size(buf);
+ }
+ }
+
+ return head.size; // OK
}
int dlt_buffer_pull(DltBuffer *buf,unsigned char *data, int max_size)
{
- return dlt_buffer_get(buf,data,max_size,1);
+ return dlt_buffer_get(buf,data,max_size,1);
}
int dlt_buffer_copy(DltBuffer *buf,unsigned char *data, int max_size)
{
- return dlt_buffer_get(buf,data,max_size,0);
+ return dlt_buffer_get(buf,data,max_size,0);
}
int dlt_buffer_remove(DltBuffer *buf)
{
- return dlt_buffer_get(buf,0,0,1);
+ return dlt_buffer_get(buf,0,0,1);
}
void dlt_buffer_info(DltBuffer *buf)
{
// check nullpointer
- if(!buf)
+ if(buf == NULL)
return;
- char str[256];
+ char str[256];
- snprintf(str,sizeof(str),"Buffer: Available size: %d\n",buf->size);
- dlt_log(LOG_DEBUG, str);
- snprintf(str,sizeof(str),"Buffer: Buffer full start address: %lX\n",(unsigned long)buf->shm);
- dlt_log(LOG_DEBUG, str);
- snprintf(str,sizeof(str),"Buffer: Buffer start address: %lX\n",(unsigned long)buf->mem);
- dlt_log(LOG_DEBUG, str);
+ snprintf(str,sizeof(str),"Buffer: Available size: %d\n",buf->size);
+ dlt_log(LOG_DEBUG, str);
+ snprintf(str,sizeof(str),"Buffer: Buffer full start address: %lX\n",(unsigned long)buf->shm);
+ dlt_log(LOG_DEBUG, str);
+ snprintf(str,sizeof(str),"Buffer: Buffer start address: %lX\n",(unsigned long)buf->mem);
+ dlt_log(LOG_DEBUG, str);
}
void dlt_buffer_status(DltBuffer *buf)
{
- int write, read, count;
- char str[256];
+ int write, read, count;
+ char str[256];
// check nullpointer
- if(!buf)
+ if(buf == NULL) {
+ dlt_log(LOG_WARNING, "Wrong parameter: Null pointer\n");
return;
+ }
/* check if buffer available */
- if(!buf->shm)
+ if(buf->shm == NULL)
return;
- write = ((int*)(buf->shm))[0];
- read = ((int*)(buf->shm))[1];
- count = ((int*)(buf->shm))[2];
+ write = ((int*)(buf->shm))[0];
+ read = ((int*)(buf->shm))[1];
+ count = ((int*)(buf->shm))[2];
- snprintf(str,sizeof(str),"Buffer: Write: %d\n",write);
- dlt_log(LOG_DEBUG, str);
- snprintf(str,sizeof(str),"Buffer: Read: %d\n",read);
- dlt_log(LOG_DEBUG, str);
- snprintf(str,sizeof(str),"Buffer: Count: %d\n",count);
- dlt_log(LOG_DEBUG, str);
+ snprintf(str,sizeof(str),"Buffer: Write: %d\n",write);
+ dlt_log(LOG_DEBUG, str);
+ snprintf(str,sizeof(str),"Buffer: Read: %d\n",read);
+ dlt_log(LOG_DEBUG, str);
+ snprintf(str,sizeof(str),"Buffer: Count: %d\n",count);
+ dlt_log(LOG_DEBUG, str);
}
-int dlt_buffer_get_total_size(DltBuffer *buf)
+uint32_t dlt_buffer_get_total_size(DltBuffer *buf)
{
// catch null pointer
- if(!buf)
+ if(buf == NULL)
return -1;
- return buf->max_size;
+ return buf->max_size;
}
int dlt_buffer_get_used_size(DltBuffer *buf)
{
- int write, read, count;
+ int write, read, count;
// catch null pointer
- if(!buf)
+ if(buf == NULL)
return -1;
/* check if buffer available */
- if(!buf->shm)
+ if(buf->shm == NULL)
return 0;
- write = ((int*)(buf->shm))[0];
- read = ((int*)(buf->shm))[1];
- count = ((int*)(buf->shm))[2];
+ write = ((int*)(buf->shm))[0];
+ read = ((int*)(buf->shm))[1];
+ count = ((int*)(buf->shm))[2];
- if(count == 0)
- return 0;
+ if(count == 0)
+ return 0;
- if(write>read)
- return (write - read);
+ if(write>read)
+ return (write - read);
- return (buf->size - read + write);
+ return (buf->size - read + write);
}
int dlt_buffer_get_message_count(DltBuffer *buf)
{
// catch null pointer
- if(!buf)
+ if(buf == NULL)
return -1;
/* check if buffer available */
- if(!buf->shm)
+ if(buf->shm == NULL)
return 0;
return ((int*)(buf->shm))[2];
@@ -2854,19 +2943,19 @@ int dlt_buffer_get_message_count(DltBuffer *buf)
#if !defined (__WIN32__)
-int dlt_setup_serial(int fd, speed_t speed)
+DltReturnValue dlt_setup_serial(int fd, speed_t speed)
{
#if !defined (__WIN32__) && !defined(_MSC_VER)
struct termios config;
if (isatty(fd)==0)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (tcgetattr(fd, &config) < 0)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* Input flags - Turn off input processing
@@ -2913,19 +3002,19 @@ int dlt_setup_serial(int fd, speed_t speed)
*/
if (cfsetispeed(&config, speed) < 0 || cfsetospeed(&config, speed) < 0)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
/* Finally, apply the configuration
*/
if (tcsetattr(fd, TCSAFLUSH, &config) < 0)
{
- return -1;
+ return DLT_RETURN_ERROR;
}
- return 0;
+ return DLT_RETURN_OK;
#else
- return -1;
+ return DLT_RETURN_ERROR;
#endif
}
@@ -3103,18 +3192,36 @@ speed_t dlt_convert_serial_speed(int baudrate)
void dlt_get_version(char *buf, size_t size)
{
+ if(buf == NULL && size > 0)
+ {
+ dlt_log(LOG_WARNING, "Wrong parameter: Null pointer\n");
+ return;
+ }
+
snprintf(buf,size,"DLT Package Version: %s %s, Package Revision: %s, build on %s %s\n%s %s %s %s\n",
_DLT_PACKAGE_VERSION, _DLT_PACKAGE_VERSION_STATE, _DLT_PACKAGE_REVISION, __DATE__ , __TIME__,_DLT_SYSTEMD_ENABLE,_DLT_SYSTEMD_WATCHDOG_ENABLE,_DLT_TEST_ENABLE,_DLT_SHM_ENABLE );
}
void dlt_get_major_version(char *buf, size_t size)
{
- snprintf(buf,size,"%s",_DLT_PACKAGE_MAJOR_VERSION);
+ if (buf == NULL && size > 0)
+ {
+ dlt_log(LOG_WARNING, "Wrong parameter: Null pointer\n");
+ return;
+ }
+
+ snprintf(buf, size, "%s", _DLT_PACKAGE_MAJOR_VERSION);
}
void dlt_get_minor_version(char *buf, size_t size)
{
- snprintf(buf,size,"%s",_DLT_PACKAGE_MINOR_VERSION);
+ if (buf == NULL && size > 0)
+ {
+ dlt_log(LOG_WARNING, "Wrong parameter: Null pointer\n");
+ return;
+ }
+
+ snprintf(buf, size, "%s", _DLT_PACKAGE_MINOR_VERSION);
}
@@ -3141,24 +3248,24 @@ uint32_t dlt_uptime(void)
}
-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)
{
- if ((message==0) || (text==0))
+ if ((message == NULL) || (text == NULL))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
- dlt_message_header(message,text,size,verbose);
+ dlt_message_header(message, text, size, verbose);
printf("%s\n",text);
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
- if ((message==0) || (text==0))
+ if ((message == NULL) || (text == NULL))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
dlt_message_header(message,text,size,verbose);
@@ -3166,14 +3273,14 @@ int dlt_message_print_hex(DltMessage *message, char *text, uint32_t size, int ve
dlt_message_payload(message,text,size,DLT_OUTPUT_HEX,verbose);
printf("[%s]\n",text);
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
- if ((message==0) || (text==0))
+ if ((message == NULL) || (text == NULL))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
dlt_message_header(message,text,size,verbose);
@@ -3181,14 +3288,14 @@ int dlt_message_print_ascii(DltMessage *message, char *text, uint32_t size, int
dlt_message_payload(message,text,size,DLT_OUTPUT_ASCII,verbose);
printf("[%s]\n",text);
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
- if ((message==0) || (text==0))
+ if ((message == NULL) || (text == NULL))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
dlt_message_header(message,text,size,verbose);
@@ -3196,14 +3303,14 @@ int dlt_message_print_mixed_plain(DltMessage *message, char *text, uint32_t size
dlt_message_payload(message,text,size,DLT_OUTPUT_MIXED_FOR_PLAIN,verbose);
printf("[%s]\n",text);
- return 0;
+ return DLT_RETURN_OK;
}
-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)
{
- if ((message==0) || (text==0))
+ if ((message == NULL) || (text == NULL))
{
- return -1;
+ return DLT_RETURN_WRONG_PARAMETER;
}
dlt_message_header(message,text,size,verbose);
@@ -3211,11 +3318,15 @@ int dlt_message_print_mixed_html(DltMessage *message, char *text, uint32_t size,
dlt_message_payload(message,text,size,DLT_OUTPUT_MIXED_FOR_HTML,verbose);
printf("[%s]\n",text);
- return 0;
+ return DLT_RETURN_OK;
}
-int 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)
+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)
{
+ // check null pointers
+ if(msg == NULL || ptr == NULL || datalength == NULL || text == NULL)
+ return DLT_RETURN_WRONG_PARAMETER;
+
int16_t length=0,length_tmp=0; /* the macro can set this variable to -1 */
uint16_t length2=0,length2_tmp=0,length3=0,length3_tmp=0;
@@ -3237,13 +3348,12 @@ int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,
uint32_t quantisation_tmp = 0;
if ( (type_info & DLT_TYPE_INFO_STRG) && (((type_info & DLT_TYPE_INFO_SCOD) == DLT_SCOD_ASCII) || ((type_info & DLT_TYPE_INFO_SCOD) == DLT_SCOD_UTF8)) )
{
-
/* string type or utf8-encoded string type */
if (byteLength<0)
{
DLT_MSG_READ_VALUE(length_tmp,*ptr,*datalength,uint16_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
length=DLT_ENDIAN_GET_16(msg->standardheader->htyp, length_tmp);
}
else
@@ -3255,17 +3365,17 @@ int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,
{
DLT_MSG_READ_VALUE(length2_tmp,*ptr,*datalength,uint16_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
length2=DLT_ENDIAN_GET_16(msg->standardheader->htyp, length2_tmp);
if((*datalength)<length2)
- return -1;
+ return DLT_RETURN_ERROR;
*ptr += length2;
*datalength-=length2;
}
DLT_MSG_READ_STRING((text+strlen(text)),*ptr,*datalength,length);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
}
else if (type_info & DLT_TYPE_INFO_BOOL)
@@ -3275,17 +3385,17 @@ int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,
{
DLT_MSG_READ_VALUE(length2_tmp,*ptr,*datalength,uint16_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
length2=DLT_ENDIAN_GET_16(msg->standardheader->htyp, length2_tmp);
if((*datalength)<length2)
- return -1;
+ return DLT_RETURN_ERROR;
*ptr += length2;
*datalength-=length2;
}
value8u=0;
DLT_MSG_READ_VALUE(value8u,*ptr,*datalength,uint8_t); /* No endian conversion necessary */
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
snprintf(text+strlen(text),textlength-strlen(text),"%d",value8u);
}
else if ((type_info & DLT_TYPE_INFO_UINT) && (DLT_SCOD_BIN == (type_info & DLT_TYPE_INFO_SCOD)))
@@ -3294,7 +3404,7 @@ int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,
{
DLT_MSG_READ_VALUE(value8u,*ptr,*datalength,uint8_t); /* No endian conversion necessary */
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
char binary[10] = {'\0'}; // e.g.: "0b1100 0010"
int i;
for (i = (1 << 7); i > 0; i >>= 1)
@@ -3310,7 +3420,7 @@ int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,
{
DLT_MSG_READ_VALUE(value16u,*ptr,*datalength,uint16_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
char binary[20] = {'\0'}; // e.g.: "0b1100 0010 0011 0110"
int i;
for (i = (1 << 15); i > 0; i >>= 1)
@@ -3329,21 +3439,21 @@ int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,
{
DLT_MSG_READ_VALUE(value8u,*ptr,*datalength,uint8_t); /* No endian conversion necessary */
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
snprintf(text+strlen(text),textlength-strlen(text),"0x%02x",value8u);
}
if (DLT_TYLE_16BIT == (type_info & DLT_TYPE_INFO_TYLE))
{
DLT_MSG_READ_VALUE(value16u,*ptr,*datalength,uint16_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
snprintf(text+strlen(text),textlength-strlen(text),"0x%04x",value16u);
}
if (DLT_TYLE_32BIT == (type_info & DLT_TYPE_INFO_TYLE))
{
DLT_MSG_READ_VALUE(value32u,*ptr,*datalength,uint32_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
snprintf(text+strlen(text),textlength-strlen(text),"0x%08x",value32u);
}
if (DLT_TYLE_64BIT == (type_info & DLT_TYPE_INFO_TYLE))
@@ -3351,12 +3461,12 @@ int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,
*ptr += 4;
DLT_MSG_READ_VALUE(value32u,*ptr,*datalength,uint32_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
snprintf(text+strlen(text),textlength-strlen(text),"0x%08x",value32u);
*ptr -= 8;
DLT_MSG_READ_VALUE(value32u,*ptr,*datalength,uint32_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
snprintf(text+strlen(text),textlength-strlen(text),"%08x",value32u);
*ptr += 4;
}
@@ -3368,178 +3478,179 @@ int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,
{
DLT_MSG_READ_VALUE(length2_tmp,*ptr,*datalength,uint16_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
length2=DLT_ENDIAN_GET_16(msg->standardheader->htyp, length2_tmp);
DLT_MSG_READ_VALUE(length3_tmp,*ptr,*datalength,uint16_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
length3=DLT_ENDIAN_GET_16(msg->standardheader->htyp, length3_tmp);
if((*datalength)<length2)
- return -1;
+ return DLT_RETURN_ERROR;
*ptr += length2;
*datalength-=length2;
if((*datalength)<length3)
- return -1;
+ return DLT_RETURN_ERROR;
*ptr += length3;
*datalength-=length3;
}
if (type_info & DLT_TYPE_INFO_FIXP)
{
- quantisation_tmp=quantisation_tmp; // prevent compiler warning
- DLT_MSG_READ_VALUE(quantisation_tmp,*ptr,*datalength,uint32_t);
+ quantisation_tmp=quantisation_tmp; // prevent compiler warning
+ DLT_MSG_READ_VALUE(quantisation_tmp, *ptr, *datalength, uint32_t);
if((*datalength)<0)
- return -1;
- switch ( type_info & DLT_TYPE_INFO_TYLE)
+ return DLT_RETURN_ERROR;
+
+ switch ( type_info & DLT_TYPE_INFO_TYLE)
{
- case DLT_TYLE_8BIT:
- case DLT_TYLE_16BIT:
- case DLT_TYLE_32BIT:
- {
+ case DLT_TYLE_8BIT:
+ case DLT_TYLE_16BIT:
+ case DLT_TYLE_32BIT:
+ {
if((*datalength)<4)
- return -1;
+ return DLT_RETURN_ERROR;
*ptr += 4;
- *datalength-=4;
- break;
- }
- case DLT_TYLE_64BIT:
- {
+ *datalength-=4;
+ break;
+ }
+ case DLT_TYLE_64BIT:
+ {
if((*datalength)<8)
- return -1;
+ return DLT_RETURN_ERROR;
*ptr += 8;
- *datalength-=8;
- break;
- }
- case DLT_TYLE_128BIT:
- {
+ *datalength-=8;
+ break;
+ }
+ case DLT_TYLE_128BIT:
+ {
if((*datalength)<16)
- return -1;
+ return DLT_RETURN_ERROR;
*ptr += 16;
- *datalength-=16;
- break;
- }
- default:
- {
- return -1;
- }
+ *datalength-=16;
+ break;
+ }
+ default:
+ {
+ return DLT_RETURN_ERROR;
+ }
}
}
- switch ( type_info & DLT_TYPE_INFO_TYLE)
+ switch (type_info & DLT_TYPE_INFO_TYLE)
{
- case DLT_TYLE_8BIT:
- {
- if (type_info & DLT_TYPE_INFO_SINT)
- {
- value8i=0;
- DLT_MSG_READ_VALUE(value8i,*ptr,*datalength,int8_t); /* No endian conversion necessary */
+ case DLT_TYLE_8BIT:
+ {
+ if (type_info & DLT_TYPE_INFO_SINT)
+ {
+ value8i=0;
+ DLT_MSG_READ_VALUE(value8i,*ptr,*datalength,int8_t); /* No endian conversion necessary */
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
snprintf(text+strlen(text),textlength-strlen(text),"%d",value8i);
- }
- else
- {
- value8u=0;
- DLT_MSG_READ_VALUE(value8u,*ptr,*datalength,uint8_t); /* No endian conversion necessary */
+ }
+ else
+ {
+ value8u=0;
+ DLT_MSG_READ_VALUE(value8u,*ptr,*datalength,uint8_t); /* No endian conversion necessary */
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
snprintf(text+strlen(text),textlength-strlen(text),"%d",value8u);
- }
- break;
- }
- case DLT_TYLE_16BIT:
- {
- if (type_info & DLT_TYPE_INFO_SINT)
- {
- value16i=0;
- value16i_tmp=0;
- DLT_MSG_READ_VALUE(value16i_tmp,*ptr,*datalength,int16_t);
+ }
+ break;
+ }
+ case DLT_TYLE_16BIT:
+ {
+ if (type_info & DLT_TYPE_INFO_SINT)
+ {
+ value16i=0;
+ value16i_tmp=0;
+ DLT_MSG_READ_VALUE(value16i_tmp,*ptr,*datalength,int16_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
value16i=DLT_ENDIAN_GET_16(msg->standardheader->htyp, value16i_tmp);
- snprintf(text+strlen(text),textlength-strlen(text),"%hd",value16i);
- }
- else
- {
- value16u=0;
- value16u_tmp=0;
- DLT_MSG_READ_VALUE(value16u_tmp,*ptr,*datalength,uint16_t);
+ snprintf(text+strlen(text),textlength-strlen(text),"%hd",value16i);
+ }
+ else
+ {
+ value16u=0;
+ value16u_tmp=0;
+ DLT_MSG_READ_VALUE(value16u_tmp,*ptr,*datalength,uint16_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
value16u=DLT_ENDIAN_GET_16(msg->standardheader->htyp, value16u_tmp);
- snprintf(text+strlen(text),textlength-strlen(text),"%hu",value16u);
- }
- break;
- }
- case DLT_TYLE_32BIT:
- {
- if (type_info & DLT_TYPE_INFO_SINT)
- {
- value32i=0;
- value32i_tmp=0;
- DLT_MSG_READ_VALUE(value32i_tmp,*ptr,*datalength,int32_t);
+ snprintf(text+strlen(text),textlength-strlen(text),"%hu",value16u);
+ }
+ break;
+ }
+ case DLT_TYLE_32BIT:
+ {
+ if (type_info & DLT_TYPE_INFO_SINT)
+ {
+ value32i=0;
+ value32i_tmp=0;
+ DLT_MSG_READ_VALUE(value32i_tmp,*ptr,*datalength,int32_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
value32i=DLT_ENDIAN_GET_32(msg->standardheader->htyp, (uint32_t)value32i_tmp);
- snprintf(text+strlen(text),textlength-strlen(text),"%d",value32i);
- }
- else
- {
- value32u=0;
- value32u_tmp=0;
- DLT_MSG_READ_VALUE(value32u_tmp,*ptr,*datalength,uint32_t);
+ snprintf(text+strlen(text),textlength-strlen(text),"%d",value32i);
+ }
+ else
+ {
+ value32u=0;
+ value32u_tmp=0;
+ DLT_MSG_READ_VALUE(value32u_tmp,*ptr,*datalength,uint32_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
value32u=DLT_ENDIAN_GET_32(msg->standardheader->htyp, value32u_tmp);
- snprintf(text+strlen(text),textlength-strlen(text),"%u",value32u);
- }
- break;
- }
- case DLT_TYLE_64BIT:
- {
- if (type_info & DLT_TYPE_INFO_SINT)
- {
- value64i=0;
- value64i_tmp=0;
- DLT_MSG_READ_VALUE(value64i_tmp,*ptr,*datalength,int64_t);
+ snprintf(text+strlen(text),textlength-strlen(text),"%u",value32u);
+ }
+ break;
+ }
+ case DLT_TYLE_64BIT:
+ {
+ if (type_info & DLT_TYPE_INFO_SINT)
+ {
+ value64i=0;
+ value64i_tmp=0;
+ DLT_MSG_READ_VALUE(value64i_tmp,*ptr,*datalength,int64_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
value64i=DLT_ENDIAN_GET_64(msg->standardheader->htyp, (uint64_t)value64i_tmp);
- #if defined (__WIN32__) && !defined(_MSC_VER)
- snprintf(text+strlen(text),textlength-strlen(text),"%I64d",value64i);
- #else
- snprintf(text+strlen(text),textlength-strlen(text),"%"PRId64, value64i);
- #endif
- }
- else
- {
- value64u=0;
- value64u_tmp=0;
- DLT_MSG_READ_VALUE(value64u_tmp,*ptr,*datalength,uint64_t);
+ #if defined (__WIN32__) && !defined(_MSC_VER)
+ snprintf(text+strlen(text),textlength-strlen(text),"%I64d",value64i);
+ #else
+ snprintf(text+strlen(text),textlength-strlen(text),"%"PRId64, value64i);
+ #endif
+ }
+ else
+ {
+ value64u=0;
+ value64u_tmp=0;
+ DLT_MSG_READ_VALUE(value64u_tmp,*ptr,*datalength,uint64_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
value64u=DLT_ENDIAN_GET_64(msg->standardheader->htyp, value64u_tmp);
- #if defined (__WIN32__) && !defined(_MSC_VER)
- snprintf(text+strlen(text),textlength-strlen(text),"%I64u",value64u);
- #else
- snprintf(text+strlen(text),textlength-strlen(text),"%"PRId64,value64u);
- #endif
- }
- break;
- }
- case DLT_TYLE_128BIT:
- {
- if (*datalength>=16)
- dlt_print_hex_string(text+strlen(text),textlength,*ptr,16);
+ #if defined (__WIN32__) && !defined(_MSC_VER)
+ snprintf(text+strlen(text),textlength-strlen(text),"%I64u",value64u);
+ #else
+ snprintf(text+strlen(text),textlength-strlen(text),"%"PRId64,value64u);
+ #endif
+ }
+ break;
+ }
+ case DLT_TYLE_128BIT:
+ {
+ if (*datalength>=16)
+ dlt_print_hex_string(text+strlen(text),textlength,*ptr,16);
if((*datalength)<16)
- return -1;
+ return DLT_RETURN_ERROR;
*ptr += 16;
- *datalength-=16;
- break;
- }
- default:
- {
- return -1;
- }
+ *datalength-=16;
+ break;
+ }
+ default:
+ {
+ return DLT_RETURN_ERROR;
+ }
}
}
else if (type_info & DLT_TYPE_INFO_FLOA)
@@ -3549,107 +3660,107 @@ int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,
{
DLT_MSG_READ_VALUE(length2_tmp,*ptr,*datalength,uint16_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
length2=DLT_ENDIAN_GET_16(msg->standardheader->htyp, length2_tmp);
DLT_MSG_READ_VALUE(length3_tmp,*ptr,*datalength,uint16_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
length3=DLT_ENDIAN_GET_16(msg->standardheader->htyp, length3_tmp);
if((*datalength)<length2)
- return -1;
+ return DLT_RETURN_ERROR;
*ptr += length2;
*datalength-=length2;
if((*datalength)<length3)
- return -1;
+ return DLT_RETURN_ERROR;
*ptr += length3;
*datalength-=length3;
}
- switch ( type_info & DLT_TYPE_INFO_TYLE)
+ switch ( type_info & DLT_TYPE_INFO_TYLE)
{
- case DLT_TYLE_8BIT:
- {
- if (*datalength>=1)
- dlt_print_hex_string(text+strlen(text),textlength,*ptr,1);
+ case DLT_TYLE_8BIT:
+ {
+ if (*datalength>=1)
+ dlt_print_hex_string(text+strlen(text),textlength,*ptr,1);
if((*datalength)<1)
- return -1;
+ return DLT_RETURN_ERROR;
*ptr += 1;
- *datalength-=1;
- break;
- }
- case DLT_TYLE_16BIT:
- {
- if (*datalength>=2)
- dlt_print_hex_string(text+strlen(text),textlength,*ptr,2);
+ *datalength-=1;
+ break;
+ }
+ case DLT_TYLE_16BIT:
+ {
+ if (*datalength>=2)
+ dlt_print_hex_string(text+strlen(text),textlength,*ptr,2);
if((*datalength)<2)
- return -1;
+ return DLT_RETURN_ERROR;
*ptr += 2;
- *datalength-=2;
- break;
- }
- case DLT_TYLE_32BIT:
- {
- if (sizeof(float32_t)==4)
- {
- value32f=0;
- value32f_tmp=0;
- value32f_tmp_int32i=0;
- value32f_tmp_int32i_swaped=0;
- DLT_MSG_READ_VALUE(value32f_tmp,*ptr,*datalength,float32_t);
+ *datalength-=2;
+ break;
+ }
+ case DLT_TYLE_32BIT:
+ {
+ if (sizeof(float32_t)==4)
+ {
+ value32f=0;
+ value32f_tmp=0;
+ value32f_tmp_int32i=0;
+ value32f_tmp_int32i_swaped=0;
+ DLT_MSG_READ_VALUE(value32f_tmp,*ptr,*datalength,float32_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
memcpy(&value32f_tmp_int32i,&value32f_tmp,sizeof(float32_t));
- value32f_tmp_int32i_swaped=DLT_ENDIAN_GET_32(msg->standardheader->htyp, (uint32_t)value32f_tmp_int32i);
- memcpy(&value32f,&value32f_tmp_int32i_swaped,sizeof(float32_t));
- snprintf(text+strlen(text),textlength-strlen(text),"%g",value32f);
- }
- else
- {
- dlt_log(LOG_ERR, "Invalid size of float32_t\n");
- return -1;
- }
- break;
- }
- case DLT_TYLE_64BIT:
- {
- if (sizeof(float64_t)==8)
- {
- value64f=0;
- value64f_tmp=0;
- value64f_tmp_int64i=0;
- value64f_tmp_int64i_swaped=0;
- DLT_MSG_READ_VALUE(value64f_tmp,*ptr,*datalength,float64_t);
+ value32f_tmp_int32i_swaped=DLT_ENDIAN_GET_32(msg->standardheader->htyp, (uint32_t)value32f_tmp_int32i);
+ memcpy(&value32f,&value32f_tmp_int32i_swaped,sizeof(float32_t));
+ snprintf(text+strlen(text),textlength-strlen(text),"%g",value32f);
+ }
+ else
+ {
+ dlt_log(LOG_ERR, "Invalid size of float32_t\n");
+ return DLT_RETURN_ERROR;
+ }
+ break;
+ }
+ case DLT_TYLE_64BIT:
+ {
+ if (sizeof(float64_t)==8)
+ {
+ value64f=0;
+ value64f_tmp=0;
+ value64f_tmp_int64i=0;
+ value64f_tmp_int64i_swaped=0;
+ DLT_MSG_READ_VALUE(value64f_tmp,*ptr,*datalength,float64_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
memcpy(&value64f_tmp_int64i,&value64f_tmp,sizeof(float64_t));
- value64f_tmp_int64i_swaped=DLT_ENDIAN_GET_64(msg->standardheader->htyp, (uint64_t)value64f_tmp_int64i);
- memcpy(&value64f,&value64f_tmp_int64i_swaped,sizeof(float64_t));
+ value64f_tmp_int64i_swaped=DLT_ENDIAN_GET_64(msg->standardheader->htyp, (uint64_t)value64f_tmp_int64i);
+ memcpy(&value64f,&value64f_tmp_int64i_swaped,sizeof(float64_t));
#ifdef __arm__
- snprintf(text+strlen(text),textlength-strlen(text),"ILLEGAL");
+ snprintf(text+strlen(text),textlength-strlen(text),"ILLEGAL");
#else
- snprintf(text+strlen(text),textlength-strlen(text),"%g",value64f);
+ snprintf(text+strlen(text),textlength-strlen(text),"%g",value64f);
#endif
- }
- else
- {
- dlt_log(LOG_ERR, "Invalid size of float64_t\n");
- return -1;
- }
- break;
- }
- case DLT_TYLE_128BIT:
- {
- if (*datalength>=16)
- dlt_print_hex_string(text+strlen(text),textlength,*ptr,16);
+ }
+ else
+ {
+ dlt_log(LOG_ERR, "Invalid size of float64_t\n");
+ return DLT_RETURN_ERROR;
+ }
+ break;
+ }
+ case DLT_TYLE_128BIT:
+ {
+ if (*datalength>=16)
+ dlt_print_hex_string(text+strlen(text),textlength,*ptr,16);
if((*datalength)<16)
- return -1;
+ return DLT_RETURN_ERROR;
*ptr += 16;
- *datalength-=16;
- break;
- }
- default:
- {
- return -1;
- }
+ *datalength-=16;
+ break;
+ }
+ default:
+ {
+ return DLT_RETURN_ERROR;
+ }
}
}
@@ -3658,21 +3769,21 @@ int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,
/* raw data argument */
DLT_MSG_READ_VALUE(length_tmp,*ptr,*datalength,uint16_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
length=DLT_ENDIAN_GET_16(msg->standardheader->htyp, length_tmp);
if (type_info & DLT_TYPE_INFO_VARI)
{
DLT_MSG_READ_VALUE(length2_tmp,*ptr,*datalength,uint16_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
length2=DLT_ENDIAN_GET_16(msg->standardheader->htyp, length2_tmp);
if((*datalength)<length2)
- return -1;
+ return DLT_RETURN_ERROR;
*ptr += length2;
*datalength-=length2;
}
if((*datalength)<length)
- return -1;
+ return DLT_RETURN_ERROR;
dlt_print_hex_string(text+strlen(text),textlength,*ptr,length);
*ptr+=length;
*datalength-=length;
@@ -3682,24 +3793,24 @@ int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,
/* trace info argument */
DLT_MSG_READ_VALUE(length_tmp,*ptr,*datalength,uint16_t);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
length=DLT_ENDIAN_GET_16(msg->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING((text+strlen(text)),*ptr,*datalength,length);
if((*datalength)<0)
- return -1;
+ return DLT_RETURN_ERROR;
}
else
{
- return -1;
+ return DLT_RETURN_ERROR;
}
if (*datalength<0)
{
dlt_log(LOG_ERR, "Payload of DLT message corrupted\n");
- return -1;
+ return DLT_RETURN_ERROR;
}
- return 0;
+ return DLT_RETURN_OK;
}
void dlt_check_envvar()
diff --git a/src/shared/dlt_common_cfg.h b/src/shared/dlt_common_cfg.h
index 2278049..454f885 100644
--- a/src/shared/dlt_common_cfg.h
+++ b/src/shared/dlt_common_cfg.h
@@ -86,7 +86,7 @@
#define DLT_COMMON_CHARLEN 1
/* Number of indices to be allocated at one, if no more indeces are left */
-#define DLT_COMMON_INDEX_ALLOC 1000
+#define DLT_COMMON_INDEX_ALLOC 1000
/* If limited output is called,
this is the maximum number of characters to be printed out */
diff --git a/src/shared/dlt_offline_trace.c b/src/shared/dlt_offline_trace.c
index 9925a7a..c4d3f6b 100644
--- a/src/shared/dlt_offline_trace.c
+++ b/src/shared/dlt_offline_trace.c
@@ -65,43 +65,43 @@
#include <dlt_offline_trace.h>
-int dlt_offline_trace_create_new_file(DltOfflineTrace *trace) {
+DltReturnValue dlt_offline_trace_create_new_file(DltOfflineTrace *trace) {
time_t t;
struct tm *tmp;
char outstr[200];
- /* set filename */
+ /* set filename */
t = time(NULL);
tmp = localtime(&t);
if (NULL == tmp) {
printf("dlt_offline_trace_create_new_file: pointer to tmp is NULL!");
- return -1;
+ return DLT_RETURN_ERROR;
}
if (strftime(outstr, sizeof(outstr),"%Y%m%d_%H%M%S", tmp) == 0) {
}
- snprintf(trace->filename,NAME_MAX + 1,"%s/dlt_offlinetrace_%s.dlt",trace->directory,outstr);
+ snprintf(trace->filename,NAME_MAX + 1,"%s/dlt_offlinetrace_%s.dlt",trace->directory,outstr);
/* open DLT output file */
- trace->ohandle = open(trace->filename,O_WRONLY|O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); /* mode: wb */
- if (trace->ohandle == -1)
- {
- /* trace file cannot be opened */
- printf("Offline trace file %s cannot be created\n",trace->filename);
- return -1;
- } /* if */
-
- return 0; /* OK */
+ trace->ohandle = open(trace->filename,O_WRONLY|O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); /* mode: wb */
+ if (trace->ohandle == -1)
+ {
+ /* trace file cannot be opened */
+ printf("Offline trace file %s cannot be created\n",trace->filename);
+ return DLT_RETURN_ERROR;
+ } /* if */
+
+ return DLT_RETURN_OK; /* OK */
}
unsigned long dlt_offline_trace_get_total_size(DltOfflineTrace *trace) {
- struct dirent *dp;
- char filename[256];
- unsigned long size = 0;
- struct stat status;
-
- /* go through all dlt files in directory */
- DIR *dir = opendir(trace->directory);
- while ((dp=readdir(dir)) != NULL) {
+ struct dirent *dp;
+ char filename[256];
+ unsigned long size = 0;
+ struct stat status;
+
+ /* go through all dlt files in directory */
+ DIR *dir = opendir(trace->directory);
+ while ((dp=readdir(dir)) != NULL) {
if(strstr(dp->d_name,".dlt"))
{
int res = snprintf(filename, sizeof(filename), "%s/%s",trace->directory,dp->d_name);
@@ -110,12 +110,12 @@ unsigned long dlt_offline_trace_get_total_size(DltOfflineTrace *trace) {
// if an output error is encountered, a negative value is returned.
if( (unsigned int)res<sizeof(filename) && res>0 )
{
- if(0 == stat(filename,&status))
- {
- size += status.st_size;
- }
- else
- printf("Offline trace file %s cannot be stat-ed",filename);
+ if(0 == stat(filename,&status))
+ {
+ size += status.st_size;
+ }
+ else
+ printf("Offline trace file %s cannot be stat-ed",filename);
}
//else
//{
@@ -124,142 +124,142 @@ unsigned long dlt_offline_trace_get_total_size(DltOfflineTrace *trace) {
}
}
- closedir(dir);
+ closedir(dir);
- /* return size */
- return size;
+ /* return size */
+ return size;
}
int dlt_offline_trace_delete_oldest_file(DltOfflineTrace *trace) {
- struct dirent *dp;
- char filename[PATH_MAX+1];
- char filename_oldest[PATH_MAX+1];
- unsigned long size_oldest = 0;
- struct stat status;
- time_t time_oldest = 0;
-
- filename[0] = 0;
- filename_oldest[0] = 0;
-
- /* go through all dlt files in directory */
- DIR *dir = opendir(trace->directory);
- while ((dp=readdir(dir)) != NULL) {
- if(strstr(dp->d_name,".dlt")) {
- int res = snprintf(filename, sizeof(filename), "%s/%s",trace->directory,dp->d_name);
- // if the total length of the string is greater than the buffer, silently forget it.
- // snprintf: a return value of size or more means that the output was truncated
- // if an output error is encountered, a negative value is returned.
- if( (unsigned int)res<sizeof(filename) && res>0 )
- {
- if(0 == stat(filename,&status))
- {
- if(time_oldest == 0 || status.st_mtime < time_oldest) {
- time_oldest = status.st_mtime;
- size_oldest = status.st_size;
- strncpy(filename_oldest,filename,PATH_MAX);
- filename_oldest[PATH_MAX]=0;
- }
- }
- else
- printf("Old offline trace file %s cannot be stat-ed",filename);
- }
- }
- }
- closedir(dir);
-
- /* delete file */
- if(filename_oldest[0]) {
- if(remove(filename_oldest)) {
- printf("Remove file %s failed!\n",filename_oldest);
- return -1; /* ERROR */
- }
- }
- else {
- printf("No file to be removed!\n");
- return -1; /* ERROR */
- }
-
- /* return size of deleted file*/
- return size_oldest;
+ struct dirent *dp;
+ char filename[PATH_MAX+1];
+ char filename_oldest[PATH_MAX+1];
+ unsigned long size_oldest = 0;
+ struct stat status;
+ time_t time_oldest = 0;
+
+ filename[0] = 0;
+ filename_oldest[0] = 0;
+
+ /* go through all dlt files in directory */
+ DIR *dir = opendir(trace->directory);
+ while ((dp=readdir(dir)) != NULL) {
+ if(strstr(dp->d_name,".dlt")) {
+ int res = snprintf(filename, sizeof(filename), "%s/%s",trace->directory,dp->d_name);
+ // if the total length of the string is greater than the buffer, silently forget it.
+ // snprintf: a return value of size or more means that the output was truncated
+ // if an output error is encountered, a negative value is returned.
+ if( (unsigned int)res<sizeof(filename) && res>0 )
+ {
+ if(0 == stat(filename,&status))
+ {
+ if(time_oldest == 0 || status.st_mtime < time_oldest) {
+ time_oldest = status.st_mtime;
+ size_oldest = status.st_size;
+ strncpy(filename_oldest,filename,PATH_MAX);
+ filename_oldest[PATH_MAX]=0;
+ }
+ }
+ else
+ printf("Old offline trace file %s cannot be stat-ed",filename);
+ }
+ }
+ }
+ closedir(dir);
+
+ /* delete file */
+ if(filename_oldest[0]) {
+ if(remove(filename_oldest)) {
+ printf("Remove file %s failed!\n",filename_oldest);
+ return -1; /* ERROR */
+ }
+ }
+ else {
+ printf("No file to be removed!\n");
+ return -1; /* ERROR */
+ }
+
+ /* return size of deleted file*/
+ return size_oldest;
}
-int dlt_offline_trace_check_size(DltOfflineTrace *trace) {
+DltReturnValue dlt_offline_trace_check_size(DltOfflineTrace *trace) {
- /* check size of complete offline trace */
- while((int)dlt_offline_trace_get_total_size(trace) > (trace->maxSize-trace->fileSize))
- {
- /* remove oldest files as long as new file will not fit in completely into complete offline trace */
- if(dlt_offline_trace_delete_oldest_file(trace)<0) {
- return -1;
- }
- }
+ /* check size of complete offline trace */
+ while((int)dlt_offline_trace_get_total_size(trace) > (trace->maxSize-trace->fileSize))
+ {
+ /* remove oldest files as long as new file will not fit in completely into complete offline trace */
+ if(dlt_offline_trace_delete_oldest_file(trace) < 0) {
+ return DLT_RETURN_ERROR;
+ }
+ }
- return 0; /* OK */
+ return DLT_RETURN_OK; /* OK */
}
-int dlt_offline_trace_init(DltOfflineTrace *trace,const char *directory,int fileSize,int maxSize) {
+DltReturnValue dlt_offline_trace_init(DltOfflineTrace *trace,const char *directory,int fileSize,int maxSize) {
- /* init parameters */
+ /* init parameters */
strncpy(trace->directory,directory,NAME_MAX);
trace->directory[NAME_MAX]=0;
- trace->fileSize = fileSize;
- trace->maxSize = maxSize;
+ trace->fileSize = fileSize;
+ trace->maxSize = maxSize;
- /* check complete offlien trace size, remove old logs if needed */
- dlt_offline_trace_check_size(trace);
+ /* check complete offlien trace size, remove old logs if needed */
+ dlt_offline_trace_check_size(trace);
- return dlt_offline_trace_create_new_file(trace);
+ return dlt_offline_trace_create_new_file(trace);
}
-int dlt_offline_trace_write(DltOfflineTrace *trace,unsigned char *data1,int size1,unsigned char *data2,int size2,unsigned char *data3,int size3) {
+DltReturnValue dlt_offline_trace_write(DltOfflineTrace *trace,unsigned char *data1,int size1,unsigned char *data2,int size2,unsigned char *data3,int size3) {
- if(trace->ohandle <= 0)
- return -1;
+ if(trace->ohandle <= 0)
+ return DLT_RETURN_ERROR;
- /* check file size here */
- if((lseek(trace->ohandle,0,SEEK_CUR)+size1+size2+size3)>=trace->fileSize)
- {
- /* close old file */
- close(trace->ohandle);
+ /* check file size here */
+ if((lseek(trace->ohandle,0,SEEK_CUR)+size1+size2+size3)>=trace->fileSize)
+ {
+ /* close old file */
+ close(trace->ohandle);
trace->ohandle = -1;
- /* check complete offline trace size, remove old logs if needed */
- dlt_offline_trace_check_size(trace);
+ /* check complete offline trace size, remove old logs if needed */
+ dlt_offline_trace_check_size(trace);
- /* create new file */
- dlt_offline_trace_create_new_file(trace);
- }
+ /* create new file */
+ dlt_offline_trace_create_new_file(trace);
+ }
- /* write data into log file */
+ /* write data into log file */
if(data1 && (trace->ohandle >= 0)) {
- if(write(trace->ohandle,data1,size1)!=size1) {
- printf("Offline trace write failed!\n");
- return -1;
- }
- }
+ if(write(trace->ohandle,data1,size1)!=size1) {
+ printf("Offline trace write failed!\n");
+ return DLT_RETURN_ERROR;
+ }
+ }
if(data2 && (trace->ohandle >= 0)) {
- if(write(trace->ohandle,data2,size2)!=size2) {
- printf("Offline trace write failed!\n");
- return -1;
- }
- }
+ if(write(trace->ohandle,data2,size2)!=size2) {
+ printf("Offline trace write failed!\n");
+ return DLT_RETURN_ERROR;
+ }
+ }
if(data3 && (trace->ohandle >= 0)) {
- if(write(trace->ohandle,data3,size3)!=size3) {
- printf("Offline trace write failed!\n");
- return -1;
- }
- }
+ if(write(trace->ohandle,data3,size3)!=size3) {
+ printf("Offline trace write failed!\n");
+ return DLT_RETURN_ERROR;
+ }
+ }
- return 0; /* OK */
+ return DLT_RETURN_OK; /* OK */
}
-int dlt_offline_trace_free(DltOfflineTrace *trace) {
+DltReturnValue dlt_offline_trace_free(DltOfflineTrace *trace) {
- if(trace->ohandle <= 0)
- return -1;
+ if(trace->ohandle <= 0)
+ return DLT_RETURN_ERROR;
- /* close last used log file */
- close(trace->ohandle);
+ /* close last used log file */
+ close(trace->ohandle);
- return 0; /* OK */
+ return DLT_RETURN_OK; /* OK */
}
diff --git a/src/shared/dlt_shm.c b/src/shared/dlt_shm.c
index d188e2d..78e5951 100644
--- a/src/shared/dlt_shm.c
+++ b/src/shared/dlt_shm.c
@@ -76,240 +76,240 @@ void dlt_shm_print_hex(char *ptr,int size)
for (num=0;num<size;num++)
{
- if((num%16)==15)
- printf("%.2x\n",((unsigned char*)ptr)[num]);
- else
- printf("%.2x ",((unsigned char*)ptr)[num]);
+ if((num%16)==15)
+ printf("%.2x\n",((unsigned char*)ptr)[num]);
+ else
+ printf("%.2x ",((unsigned char*)ptr)[num]);
}
printf("\n");
}
void dlt_shm_pv(int id,int operation)
{
- static struct sembuf semaphor;
+ static struct sembuf semaphor;
- semaphor.sem_op = operation;
- semaphor.sem_flg = SEM_UNDO;
+ semaphor.sem_op = operation;
+ semaphor.sem_flg = SEM_UNDO;
- if(semop(id, &semaphor,1) == -1) {
- dlt_log(LOG_WARNING,"SHM: semop() failed");
- }
+ if(semop(id, &semaphor,1) == -1) {
+ dlt_log(LOG_WARNING,"SHM: semop() failed");
+ }
}
int dlt_shm_init_server(DltShm *buf,int key,int size) {
- struct shmid_ds shm_buf;
- unsigned char *ptr;
+ struct shmid_ds shm_buf;
+ unsigned char *ptr;
- // Init parameters
- buf->shmid = 0;
- buf->semid = 0;
+ // Init parameters
+ buf->shmid = 0;
+ buf->semid = 0;
// Create the segment.
if ((buf->shmid = shmget(key, size, IPC_CREAT | 0666)) < 0) {
dlt_log(LOG_WARNING,"SHM: shmget() failed");
- return -1; /* ERROR */
+ return DLT_RETURN_ERROR; /* ERROR */
}
- // get the size of shm
- if (shmctl(buf->shmid, IPC_STAT, &shm_buf))
- {
- dlt_log(LOG_WARNING,"SHM: shmctl() failed");
- return -1; /* ERROR */
- }
+ // get the size of shm
+ if (shmctl(buf->shmid, IPC_STAT, &shm_buf))
+ {
+ dlt_log(LOG_WARNING,"SHM: shmctl() failed");
+ return DLT_RETURN_ERROR; /* ERROR */
+ }
// Now we attach the segment to our data space.
if ((ptr = shmat(buf->shmid, NULL, 0)) == (unsigned char *) -1) {
dlt_log(LOG_WARNING,"SHM: shmat() failed");
- return -1; /* ERROR */
+ return DLT_RETURN_ERROR; /* ERROR */
}
- // Init semaphore
- if( (buf->semid = semget(DLT_SHM_SEM,1,S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT|IPC_EXCL)) == -1 ) {
- if( (buf->semid = semget(DLT_SHM_SEM,1,S_IRWXU|S_IRWXG|S_IRWXO|IPC_EXCL)) == -1 ) {
- dlt_log(LOG_WARNING,"SHM: semget() failed");
- return -1; /* ERROR */
- }
- }
- if( semctl(buf->semid,0,SETVAL,(int)1) == -1 ) {
+ // Init semaphore
+ if( (buf->semid = semget(DLT_SHM_SEM,1,S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT|IPC_EXCL)) == -1 ) {
+ if( (buf->semid = semget(DLT_SHM_SEM,1,S_IRWXU|S_IRWXG|S_IRWXO|IPC_EXCL)) == -1 ) {
+ dlt_log(LOG_WARNING,"SHM: semget() failed");
+ return DLT_RETURN_ERROR; /* ERROR */
+ }
+ }
+ if( semctl(buf->semid,0,SETVAL,(int)1) == -1 ) {
dlt_log(LOG_WARNING,"SHM: semctl() failed");
- return -1; /* ERROR */
- }
+ return DLT_RETURN_ERROR; /* ERROR */
+ }
- // init buffer
- dlt_buffer_init_static_server(&(buf->buffer),ptr,shm_buf.shm_segsz);
+ // init buffer
+ dlt_buffer_init_static_server(&(buf->buffer),ptr,shm_buf.shm_segsz);
- return 0; /* OK */
+ return DLT_RETURN_OK; /* OK */
}
-int dlt_shm_init_client(DltShm *buf,int key) {
- struct shmid_ds shm_buf;
- unsigned char *ptr;
+DltReturnValue dlt_shm_init_client(DltShm *buf,int key) {
+ struct shmid_ds shm_buf;
+ unsigned char *ptr;
- // init parameters
- buf->shmid = 0;
- buf->semid = 0;
+ // init parameters
+ buf->shmid = 0;
+ buf->semid = 0;
// Create the segment.
if ((buf->shmid = shmget(key, 0, 0666)) < 0) {
dlt_log(LOG_WARNING,"SHM: shmget() failed");
- return -1; /* ERROR */
+ return DLT_RETURN_ERROR; /* ERROR */
+ }
+
+ // get the size of shm
+ if (shmctl(buf->shmid, IPC_STAT, &shm_buf))
+ {
+ dlt_log(LOG_WARNING,"SHM: shmctl() failed");
+ return DLT_RETURN_ERROR; /* ERROR */
+ }
+
+ // Now we attach the segment to our data space.
+ if ((ptr = shmat(buf->shmid, NULL, 0)) == (unsigned char *) -1) {
+ dlt_log(LOG_WARNING,"shmat() failed");
+ return DLT_RETURN_ERROR; /* ERROR */
}
- // get the size of shm
- if (shmctl(buf->shmid, IPC_STAT, &shm_buf))
- {
- dlt_log(LOG_WARNING,"SHM: shmctl() failed");
- return -1; /* ERROR */
- }
-
- // Now we attach the segment to our data space.
- if ((ptr = shmat(buf->shmid, NULL, 0)) == (unsigned char *) -1) {
- dlt_log(LOG_WARNING,"shmat() failed");
- return -1; /* ERROR */
- }
-
- // Init semaphore
- if( (buf->semid = semget(DLT_SHM_SEM,0,0)) == -1 ) {
+ // Init semaphore
+ if( (buf->semid = semget(DLT_SHM_SEM,0,0)) == -1 ) {
dlt_log(LOG_WARNING,"SHM: semget() failed");
- return -1; /* ERROR */
- }
+ return DLT_RETURN_ERROR; /* ERROR */
+ }
- // init buffer
- dlt_buffer_init_static_client(&(buf->buffer),ptr,shm_buf.shm_segsz);
+ // init buffer
+ dlt_buffer_init_static_client(&(buf->buffer),ptr,shm_buf.shm_segsz);
- return 0; /* OK */
+ return DLT_RETURN_OK; /* OK */
}
void dlt_shm_info(DltShm *buf)
{
- dlt_buffer_info(&(buf->buffer));
+ dlt_buffer_info(&(buf->buffer));
}
void dlt_shm_status(DltShm *buf)
{
- dlt_buffer_status(&(buf->buffer));
+ dlt_buffer_status(&(buf->buffer));
}
int dlt_shm_get_total_size(DltShm *buf)
{
- return dlt_buffer_get_total_size(&(buf->buffer));
+ return dlt_buffer_get_total_size(&(buf->buffer));
}
int dlt_shm_get_used_size(DltShm *buf)
{
- int ret;
+ int ret;
- /* check if buffer available */
- if(!buf->buffer.mem)
- return -1;
+ /* check if buffer available */
+ if(!buf->buffer.mem)
+ return -1;
- DLT_SHM_SEM_GET(buf->semid);
- ret = dlt_buffer_get_used_size(&(buf->buffer));
- DLT_SHM_SEM_FREE(buf->semid);
+ DLT_SHM_SEM_GET(buf->semid);
+ ret = dlt_buffer_get_used_size(&(buf->buffer));
+ DLT_SHM_SEM_FREE(buf->semid);
- return ret;
+ return ret;
}
int dlt_shm_get_message_count(DltShm *buf)
{
- return dlt_buffer_get_message_count(&(buf->buffer));
+ return dlt_buffer_get_message_count(&(buf->buffer));
}
int dlt_shm_push(DltShm *buf,const unsigned char *data1,unsigned int size1,const unsigned char *data2,unsigned int size2,const unsigned char *data3,unsigned int size3)
{
- int ret;
+ int ret;
- /* check if buffer available */
- if(!buf->buffer.mem)
- return -1;
+ /* check if buffer available */
+ if(!buf->buffer.mem)
+ return -1;
- DLT_SHM_SEM_GET(buf->semid);
- ret = dlt_buffer_push3(&(buf->buffer),data1,size1,data2,size2,data3,size3);
- DLT_SHM_SEM_FREE(buf->semid);
+ DLT_SHM_SEM_GET(buf->semid);
+ ret = dlt_buffer_push3(&(buf->buffer),data1,size1,data2,size2,data3,size3);
+ DLT_SHM_SEM_FREE(buf->semid);
- return ret;
+ return ret;
}
int dlt_shm_pull(DltShm *buf,unsigned char *data, int max_size)
{
- int ret;
+ int ret;
- /* check if buffer available */
- if(!buf->buffer.mem)
- return -1;
+ /* check if buffer available */
+ if(!buf->buffer.mem)
+ return -1;
- DLT_SHM_SEM_GET(buf->semid);
- ret = dlt_buffer_pull(&(buf->buffer),data,max_size);
- DLT_SHM_SEM_FREE(buf->semid);
+ DLT_SHM_SEM_GET(buf->semid);
+ ret = dlt_buffer_pull(&(buf->buffer),data,max_size);
+ DLT_SHM_SEM_FREE(buf->semid);
- return ret;
+ return ret;
}
int dlt_shm_copy(DltShm *buf,unsigned char *data, int max_size)
{
- int ret;
+ int ret;
- /* check if buffer available */
- if(!buf->buffer.mem)
- return -1;
+ /* check if buffer available */
+ if(!buf->buffer.mem)
+ return -1;
- DLT_SHM_SEM_GET(buf->semid);
- ret = dlt_buffer_copy(&(buf->buffer),data,max_size);
- DLT_SHM_SEM_FREE(buf->semid);
+ DLT_SHM_SEM_GET(buf->semid);
+ ret = dlt_buffer_copy(&(buf->buffer),data,max_size);
+ DLT_SHM_SEM_FREE(buf->semid);
- return ret;
+ return ret;
}
int dlt_shm_remove(DltShm *buf)
{
- int ret;
+ int ret;
- /* check if buffer available */
- if(!buf->buffer.mem)
- return -1;
+ /* check if buffer available */
+ if(!buf->buffer.mem)
+ return -1;
- DLT_SHM_SEM_GET(buf->semid);
- ret = dlt_buffer_remove(&(buf->buffer));
- DLT_SHM_SEM_FREE(buf->semid);
+ DLT_SHM_SEM_GET(buf->semid);
+ ret = dlt_buffer_remove(&(buf->buffer));
+ DLT_SHM_SEM_FREE(buf->semid);
- return ret;
+ return ret;
}
-int dlt_shm_free_server(DltShm *buf) {
+DltReturnValue dlt_shm_free_server(DltShm *buf) {
- if(shmdt(buf->buffer.shm)) {
+ if(shmdt(buf->buffer.shm)) {
dlt_log(LOG_WARNING,"SHM: shmdt() failed");
- return -1; /* ERROR */
+ return DLT_RETURN_ERROR; /* ERROR */
}
- if(shmctl(buf->shmid,IPC_RMID,NULL) == -1) {
+ if(shmctl(buf->shmid,IPC_RMID,NULL) == -1) {
dlt_log(LOG_WARNING,"SHM: shmdt() failed");
- return -1; /* ERROR */
- }
+ return DLT_RETURN_ERROR; /* ERROR */
+ }
- if(semctl(buf->semid,0,IPC_RMID,(int)0) == -1) {
+ if(semctl(buf->semid,0,IPC_RMID,(int)0) == -1) {
dlt_log(LOG_WARNING,"SHM: shmdt() failed");
- return -1; /* ERROR */
- }
+ return DLT_RETURN_ERROR; /* ERROR */
+ }
- // Reset parameters
- buf->shmid = 0;
- buf->semid = 0;
+ // Reset parameters
+ buf->shmid = 0;
+ buf->semid = 0;
- return dlt_buffer_free_static(&(buf->buffer));
+ return dlt_buffer_free_static(&(buf->buffer));
}
-int dlt_shm_free_client(DltShm *buf) {
+DltReturnValue dlt_shm_free_client(DltShm *buf) {
- if(shmdt(buf->buffer.shm)) {
+ if(shmdt(buf->buffer.shm)) {
dlt_log(LOG_WARNING,"SHM: shmdt() failed");
- return -1; /* ERROR */
+ return DLT_RETURN_ERROR; /* ERROR */
}
- // Reset parameters
- buf->shmid = 0;
- buf->semid = 0;
+ // Reset parameters
+ buf->shmid = 0;
+ buf->semid = 0;
- return dlt_buffer_free_static(&(buf->buffer));
+ return dlt_buffer_free_static(&(buf->buffer));
}
diff --git a/src/shared/dlt_user_shared.c b/src/shared/dlt_user_shared.c
index 0113a3f..60418b4 100644
--- a/src/shared/dlt_user_shared.c
+++ b/src/shared/dlt_user_shared.c
@@ -77,17 +77,13 @@
#include "dlt_user_shared.h"
#include "dlt_user_shared_cfg.h"
-int dlt_user_set_userheader(DltUserHeader *userheader, uint32_t mtype)
+DltReturnValue dlt_user_set_userheader(DltUserHeader *userheader, uint32_t mtype)
{
- if (userheader==0)
- {
- return -1;
- }
+ if (userheader == 0)
+ return DLT_RETURN_ERROR;
- if (mtype<=0)
- {
- return -1;
- }
+ if (mtype <= 0)
+ return DLT_RETURN_ERROR;
userheader->pattern[0] = 'D';
userheader->pattern[1] = 'U';
@@ -95,15 +91,15 @@ int dlt_user_set_userheader(DltUserHeader *userheader, uint32_t mtype)
userheader->pattern[3] = 1;
userheader->message = mtype;
- return 0;
+ return DLT_RETURN_OK;
}
int dlt_user_check_userheader(DltUserHeader *userheader)
{
if (userheader==0)
- {
+ {
return -1;
- }
+ }
return ((userheader->pattern[0] == 'D') &&
(userheader->pattern[1] == 'U') &&
diff --git a/src/shared/dlt_user_shared.h b/src/shared/dlt_user_shared.h
index a0d563b..795928e 100644
--- a/src/shared/dlt_user_shared.h
+++ b/src/shared/dlt_user_shared.h
@@ -76,24 +76,12 @@
#include <sys/types.h>
/**
- * This are the return values for the functions dlt_user_log_out2() and dlt_user_log_out3()
- */
-typedef enum
-{
- DLT_RETURN_BUFFER_FULL = -4,
- DLT_RETURN_PIPE_FULL = -3,
- DLT_RETURN_PIPE_ERROR = -2,
- DLT_RETURN_ERROR = -1,
- DLT_RETURN_OK = 0
-} DltReturnValue;
-
-/**
* This is the header of each message to be exchanged between application and daemon.
*/
typedef struct
{
- char pattern[DLT_ID_SIZE]; /**< This pattern should be DUH0x01 */
- uint32_t message; /**< messsage info */
+ char pattern[DLT_ID_SIZE]; /**< This pattern should be DUH0x01 */
+ uint32_t message; /**< messsage info */
} PACKED DltUserHeader;
/**
@@ -101,8 +89,8 @@ typedef struct
*/
typedef struct
{
- char apid[DLT_ID_SIZE]; /**< application id */
- pid_t pid; /**< process id of user application */
+ char apid[DLT_ID_SIZE]; /**< application id */
+ pid_t pid; /**< process id of user application */
uint32_t description_length; /**< length of description */
} PACKED DltUserControlMsgRegisterApplication;
@@ -111,7 +99,7 @@ typedef struct
*/
typedef struct
{
- char apid[DLT_ID_SIZE]; /**< application id */
+ char apid[DLT_ID_SIZE]; /**< application id */
pid_t pid; /**< process id of user application */
} PACKED DltUserControlMsgUnregisterApplication;
@@ -120,12 +108,12 @@ typedef struct
*/
typedef struct
{
- char apid[DLT_ID_SIZE]; /**< application id */
- char ctid[DLT_ID_SIZE]; /**< context id */
- int32_t log_level_pos; /**< offset in management structure on user-application side */
- int8_t log_level; /**< log level */
- int8_t trace_status; /**< trace status */
- pid_t pid; /**< process id of user application */
+ char apid[DLT_ID_SIZE]; /**< application id */
+ char ctid[DLT_ID_SIZE]; /**< context id */
+ int32_t log_level_pos; /**< offset in management structure on user-application side */
+ int8_t log_level; /**< log level */
+ int8_t trace_status; /**< trace status */
+ pid_t pid; /**< process id of user application */
uint32_t description_length; /**< length of description */
} PACKED DltUserControlMsgRegisterContext;
@@ -134,9 +122,9 @@ typedef struct
*/
typedef struct
{
- char apid[DLT_ID_SIZE]; /**< application id */
- char ctid[DLT_ID_SIZE]; /**< context id */
- pid_t pid; /**< process id of user application */
+ char apid[DLT_ID_SIZE]; /**< application id */
+ char ctid[DLT_ID_SIZE]; /**< context id */
+ pid_t pid; /**< process id of user application */
} PACKED DltUserControlMsgUnregisterContext;
/**
@@ -144,9 +132,9 @@ typedef struct
*/
typedef struct
{
- uint8_t log_level; /**< log level */
- uint8_t trace_status; /**< trace status */
- int32_t log_level_pos; /**< offset in management structure on user-application side */
+ uint8_t log_level; /**< log level */
+ uint8_t trace_status; /**< trace status */
+ int32_t log_level_pos; /**< offset in management structure on user-application side */
} PACKED DltUserControlMsgLogLevel;
/**
@@ -154,8 +142,8 @@ typedef struct
*/
typedef struct
{
- int32_t log_level_pos; /**< offset in management structure on user-application side */
- uint32_t service_id; /**< service id of injection */
+ int32_t log_level_pos; /**< offset in management structure on user-application side */
+ uint32_t service_id; /**< service id of injection */
uint32_t data_length_inject; /**< length of injection message data field */
} PACKED DltUserControlMsgInjection;
@@ -166,8 +154,8 @@ typedef struct
typedef struct
{
char apid[DLT_ID_SIZE]; /**< application id */
- uint8_t log_level; /**< log level */
- uint8_t trace_status; /**< trace status */
+ uint8_t log_level; /**< log level */
+ uint8_t trace_status; /**< trace status */
} PACKED DltUserControlMsgAppLogLevelTraceStatus;
/**
@@ -175,7 +163,7 @@ typedef struct
*/
typedef struct
{
- int8_t log_mode; /**< the mode to be used for logging: off, external, internal, both */
+ int8_t log_mode; /**< the mode to be used for logging: off, external, internal, both */
} PACKED DltUserControlMsgLogMode;
/**
@@ -183,7 +171,7 @@ typedef struct
*/
typedef struct
{
- int8_t log_state; /**< the state to be used for logging state: 0 = off, 1 = external client connected */
+ int8_t log_state; /**< the state to be used for logging state: 0 = off, 1 = external client connected */
} PACKED DltUserControlMsgLogState;
/**
@@ -191,8 +179,8 @@ typedef struct
*/
typedef struct
{
- uint32_t overflow_counter; /**< counts the number of lost messages */
- char apid[4]; /**< application which lost messages */
+ uint32_t overflow_counter; /**< counts the number of lost messages */
+ char apid[4]; /**< application which lost messages */
} PACKED DltUserControlMsgBufferOverflow;
/**************************************************************************************************
@@ -203,11 +191,9 @@ typedef struct
* Set user header marker and store message type in user header
* @param userheader pointer to the userheader
* @param mtype user message type of internal message
- * @return negative value if there was an error {
- return -1;
- }
+ * @return Value from DltReturnValue enum
*/
-int dlt_user_set_userheader(DltUserHeader *userheader, uint32_t mtype);
+DltReturnValue dlt_user_set_userheader(DltUserHeader *userheader, uint32_t mtype);
/**
* Check if user header contains its marker
diff --git a/src/tests/dlt-test-client.c b/src/tests/dlt-test-client.c
index 645b0e1..a3a79d9 100644
--- a/src/tests/dlt-test-client.c
+++ b/src/tests/dlt-test-client.c
@@ -82,7 +82,7 @@
#define DLT_TESTCLIENT_TEXTBUFSIZE 10024 /* Size of buffer for text output */
#define DLT_TESTCLIENT_ECU_ID "ECU1"
-#define DLT_TESTCLIENT_NUM_TESTS 9
+#define DLT_TESTCLIENT_NUM_TESTS 9
/* Function prototypes */
int dlt_testclient_message_callback(DltMessage *message, void *data);
@@ -308,7 +308,7 @@ int main(int argc, char* argv[])
return -1;
}
- dlt_client_setbaudrate(&dltclient,dltdata.bvalue);
+ dlt_client_setbaudrate(&dltclient,dltdata.bvalue);
}
/* initialise structure to use DLT file */
@@ -319,7 +319,7 @@ int main(int argc, char* argv[])
if (dltdata.fvalue)
{
- if (dlt_filter_load(&(dltdata.filter),dltdata.fvalue,dltdata.vflag)<0)
+ if (dlt_filter_load(&(dltdata.filter),dltdata.fvalue,dltdata.vflag) < DLT_RETURN_OK)
{
dlt_file_free(&(dltdata.file),dltdata.vflag);
return -1;
@@ -351,7 +351,7 @@ int main(int argc, char* argv[])
}
/* Connect to TCP socket or open serial device */
- if (dlt_client_connect(&dltclient, dltdata.vflag)!=-1)
+ if (dlt_client_connect(&dltclient, dltdata.vflag) != DLT_RETURN_ERROR)
{
dltdata.sock = dltclient.sock;
@@ -381,18 +381,18 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
int mtin;
DltTestclientData *dltdata;
- uint32_t type_info, type_info_tmp;
- int16_t length,length_tmp; /* the macro can set this variable to -1 */
- uint32_t length_tmp32 = 0;
- uint8_t *ptr;
- int32_t datalength;
+ uint32_t type_info, type_info_tmp;
+ int16_t length,length_tmp; /* the macro can set this variable to -1 */
+ uint32_t length_tmp32 = 0;
+ uint8_t *ptr;
+ int32_t datalength;
- uint32_t id,id_tmp;
- int slen;
- int tc_old;
+ uint32_t id,id_tmp;
+ int slen;
+ int tc_old;
- struct iovec iov[2];
- int bytes_written;
+ struct iovec iov[2];
+ int bytes_written;
if ((message==0) || (data==0))
{
@@ -411,7 +411,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
dlt_set_storageheader(message->storageheader,dltdata->ecuid);
}
- if ((dltdata->fvalue==0) || (dltdata->fvalue && dlt_message_filter_check(message,&(dltdata->filter),dltdata->vflag)==1))
+ if ((dltdata->fvalue==0) || (dltdata->fvalue && dlt_message_filter_check(message,&(dltdata->filter),dltdata->vflag) == DLT_RETURN_TRUE))
{
dlt_message_header(message,text,sizeof(text),dltdata->vflag);
@@ -865,7 +865,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
ptr+=slen;
if (datalength==sizeof(uint16_t))
{
- dltdata->test_counter_macro[2]++;
+ dltdata->test_counter_macro[2]++;
}
break;
}
@@ -1122,16 +1122,16 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
}
else if (dltdata->running_test==6)
{
- if (strcmp(text,"Message (visible: locally printed)")==0)
- {
- printf("Message (visible: locally printed)\n");
- dltdata->test_counter_macro[5]++;
- }
- if (strcmp(text,"Message (invisible: not locally printed)")==0)
- {
- printf("Message (invisible: not locally printed)\n");
- dltdata->test_counter_macro[5]++;
- }
+ if (strcmp(text,"Message (visible: locally printed)")==0)
+ {
+ printf("Message (visible: locally printed)\n");
+ dltdata->test_counter_macro[5]++;
+ }
+ if (strcmp(text,"Message (invisible: not locally printed)")==0)
+ {
+ printf("Message (invisible: not locally printed)\n");
+ dltdata->test_counter_macro[5]++;
+ }
}
/* check test 7m */
@@ -1167,19 +1167,19 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
if (mtin==DLT_NW_TRACE_IPC)
{
- dltdata->test_counter_macro[6]++;
+ dltdata->test_counter_macro[6]++;
}
if (mtin==DLT_NW_TRACE_CAN)
{
- dltdata->test_counter_macro[6]++;
+ dltdata->test_counter_macro[6]++;
}
if (mtin==DLT_NW_TRACE_FLEXRAY)
{
- dltdata->test_counter_macro[6]++;
+ dltdata->test_counter_macro[6]++;
}
if (mtin==DLT_NW_TRACE_MOST)
{
- dltdata->test_counter_macro[6]++;
+ dltdata->test_counter_macro[6]++;
}
/* Check payload, must be two arguments (2 raw data blocks) */
@@ -1266,19 +1266,19 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
if (mtin==DLT_NW_TRACE_IPC)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
if (mtin==DLT_NW_TRACE_CAN)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
if (mtin==DLT_NW_TRACE_FLEXRAY)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
if (mtin==DLT_NW_TRACE_MOST)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
/* Check payload, must be two arguments (2 raw data blocks) */
@@ -1296,41 +1296,41 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_STRG)
{
- // Read NWTR
- char chdr[10];
+ // Read NWTR
+ char chdr[10];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
if(strcmp((char *)chdr, "NWTR")==0)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_RAWD)
{
- char hdr[2048];
+ char hdr[2048];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(hdr, ptr, datalength, length);
if(length == 16 && hdr[15] == 15)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t orig_size;
+ uint32_t orig_size;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
orig_size=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
if(orig_size == 1024*5)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
@@ -1342,7 +1342,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
// Size of the truncated message after headers
if(length == 2001)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
}
}
@@ -1363,7 +1363,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
}
else if (strcmp(text,"Test9: (Macro IF) finished")==0)
{
- /* (Interface types) * (results per packet)*/
+ /* (Interface types) * (results per packet)*/
if (dltdata->test_counter_macro[8]==4*35)
{
printf("Test9m PASSED\n");
@@ -1388,19 +1388,19 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
if (mtin==DLT_NW_TRACE_IPC)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
if (mtin==DLT_NW_TRACE_CAN)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
if (mtin==DLT_NW_TRACE_FLEXRAY)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
if (mtin==DLT_NW_TRACE_MOST)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* Payload for first segmented message */
@@ -1419,13 +1419,13 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_STRG)
{
- char chdr[10];
+ char chdr[10];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
if(strcmp((char *)chdr, "NWST")==0)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* Streahandle */
@@ -1433,12 +1433,12 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t handle;
+ uint32_t handle;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
if(handle > 0)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* Header */
@@ -1452,7 +1452,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
// Test packet header size 16
if(length == 16)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* Skip data */
ptr+=length;
@@ -1463,14 +1463,14 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t pl_sz;
+ uint32_t pl_sz;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
pl_sz=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
// Test packet payload size.
if(pl_sz == 5120)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* Segmentcount */
@@ -1478,14 +1478,14 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint16_t scount;
+ uint16_t scount;
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
scount=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
/* Test packet segment count 5 */
if(scount == 5)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* Segment length */
@@ -1493,13 +1493,13 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint16_t slen;
+ uint16_t slen;
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
slen=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
/* Default segment size 1024 */
if(slen == 1024)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
}
}
@@ -1524,13 +1524,13 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_STRG)
{
- char chdr[10];
+ char chdr[10];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
if(strcmp((char *)chdr, "NWCH")==0)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* handle */
@@ -1538,12 +1538,12 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t handle;
+ uint32_t handle;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
if(handle > 0)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* Sequence */
@@ -1554,7 +1554,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
//uint16_t seq;
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
//seq=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
/* Data */
DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
@@ -1567,7 +1567,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
// Segment size by default, 1024
if(length == 1024)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
}
}
@@ -1585,33 +1585,33 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
ptr = message->databuffer;
datalength = message->datasize;
- /* NWEN */
- DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
- type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
- if(type_info & DLT_TYPE_INFO_STRG)
- {
- char chdr[10];
- DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
- length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
- DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
- if(strcmp((char *)chdr, "NWEN")==0)
- {
- dltdata->test_counter_macro[8]++;
- }
-
- /* handle */
- DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
- type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
- if(type_info & DLT_TYPE_INFO_UINT)
- {
- uint32_t handle;
- DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
- handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
- if(handle > 0)
- {
- dltdata->test_counter_macro[8]++;
- }
- }
+ /* NWEN */
+ DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
+ type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
+ if(type_info & DLT_TYPE_INFO_STRG)
+ {
+ char chdr[10];
+ DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
+ length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
+ DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
+ if(strcmp((char *)chdr, "NWEN")==0)
+ {
+ dltdata->test_counter_macro[8]++;
+ }
+
+ /* handle */
+ DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
+ type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
+ if(type_info & DLT_TYPE_INFO_UINT)
+ {
+ uint32_t handle;
+ DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
+ handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
+ if(handle > 0)
+ {
+ dltdata->test_counter_macro[8]++;
+ }
+ }
}
}
}
@@ -1650,27 +1650,27 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
if (mtin==DLT_LOG_FATAL)
{
- dltdata->test_counter_function[0]++;
+ dltdata->test_counter_function[0]++;
}
if (mtin==DLT_LOG_ERROR)
{
- dltdata->test_counter_function[0]++;
+ dltdata->test_counter_function[0]++;
}
if (mtin==DLT_LOG_WARN)
{
- dltdata->test_counter_function[0]++;
+ dltdata->test_counter_function[0]++;
}
if (mtin==DLT_LOG_INFO)
{
- dltdata->test_counter_function[0]++;
+ dltdata->test_counter_function[0]++;
}
if (mtin==DLT_LOG_DEBUG)
{
- dltdata->test_counter_function[0]++;
+ dltdata->test_counter_function[0]++;
}
if (mtin==DLT_LOG_VERBOSE)
{
- dltdata->test_counter_function[0]++;
+ dltdata->test_counter_function[0]++;
}
}
}
@@ -1789,7 +1789,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
{
case DLT_TYLE_8BIT:
{
- if (datalength==sizeof(uint8_t))
+ if (datalength==sizeof(uint8_t))
{
dltdata->test_counter_function[1]++;
}
@@ -2276,16 +2276,16 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
}
else if (dltdata->running_test==15)
{
- if (strcmp(text,"Message (visible: locally printed)")==0)
- {
- printf("Message (visible: locally printed)\n");
- dltdata->test_counter_function[5]++;
- }
- if (strcmp(text,"Message (invisible: not locally printed)")==0)
- {
- printf("Message (invisible: not locally printed)\n");
- dltdata->test_counter_function[5]++;
- }
+ if (strcmp(text,"Message (visible: locally printed)")==0)
+ {
+ printf("Message (visible: locally printed)\n");
+ dltdata->test_counter_function[5]++;
+ }
+ if (strcmp(text,"Message (invisible: not locally printed)")==0)
+ {
+ printf("Message (invisible: not locally printed)\n");
+ dltdata->test_counter_function[5]++;
+ }
}
/* check test 7f */
@@ -2321,19 +2321,19 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
if (mtin==DLT_NW_TRACE_IPC)
{
- dltdata->test_counter_function[6]++;
+ dltdata->test_counter_function[6]++;
}
if (mtin==DLT_NW_TRACE_CAN)
{
- dltdata->test_counter_function[6]++;
+ dltdata->test_counter_function[6]++;
}
if (mtin==DLT_NW_TRACE_FLEXRAY)
{
- dltdata->test_counter_function[6]++;
+ dltdata->test_counter_function[6]++;
}
if (mtin==DLT_NW_TRACE_MOST)
{
- dltdata->test_counter_function[6]++;
+ dltdata->test_counter_function[6]++;
}
/* Check payload, must be two arguments (2 raw data blocks) */
@@ -2421,19 +2421,19 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
if (mtin==DLT_NW_TRACE_IPC)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
if (mtin==DLT_NW_TRACE_CAN)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
if (mtin==DLT_NW_TRACE_FLEXRAY)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
if (mtin==DLT_NW_TRACE_MOST)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
/* Check payload, must be two arguments (2 raw data blocks) */
@@ -2451,41 +2451,41 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_STRG)
{
- // Read NWTR
- char chdr[10];
+ // Read NWTR
+ char chdr[10];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
if(strcmp((char *)chdr, "NWTR")==0)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_RAWD)
{
- char hdr[2048];
+ char hdr[2048];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(hdr, ptr, datalength, length);
if(length == 16 && hdr[15] == 15)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t orig_size;
+ uint32_t orig_size;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
orig_size=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
if(orig_size == 1024*5)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
@@ -2497,7 +2497,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
// Size of the truncated message after headers
if(length == 2001)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
}
}
@@ -2517,7 +2517,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
}
else if (strcmp(text,"Test9: (Function IF) finished")==0)
{
- /* (Interface types) * (number of messages per complete message) */
+ /* (Interface types) * (number of messages per complete message) */
if (dltdata->test_counter_function[8]==4*35)
{
printf("Test9f PASSED\n");
@@ -2542,19 +2542,19 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
if (mtin==DLT_NW_TRACE_IPC)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
if (mtin==DLT_NW_TRACE_CAN)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
if (mtin==DLT_NW_TRACE_FLEXRAY)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
if (mtin==DLT_NW_TRACE_MOST)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* Payload for first segmented message */
@@ -2573,13 +2573,13 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_STRG)
{
- char chdr[10];
+ char chdr[10];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
if(strcmp((char *)chdr, "NWST")==0)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* Streahandle */
@@ -2587,12 +2587,12 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t handle;
+ uint32_t handle;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
if(handle > 0)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* Header */
@@ -2606,7 +2606,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
// Test packet header size 16
if(length == 16)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* Skip data */
ptr+=length;
@@ -2617,14 +2617,14 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t pl_sz;
+ uint32_t pl_sz;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
pl_sz=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
// Test packet payload size.
if(pl_sz == 5120)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* Segmentcount */
@@ -2632,14 +2632,14 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint16_t scount;
+ uint16_t scount;
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
scount=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
/* Test packet segment count 5 */
if(scount == 5)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* Segment length */
@@ -2647,13 +2647,13 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint16_t slen;
+ uint16_t slen;
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
slen=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
/* Default segment size 1024 */
if(slen == 1024)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
}
}
@@ -2678,13 +2678,13 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_STRG)
{
- char chdr[10];
+ char chdr[10];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
if(strcmp((char *)chdr, "NWCH")==0)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* handle */
@@ -2692,12 +2692,12 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t handle;
+ uint32_t handle;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
if(handle > 0)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* Sequence */
@@ -2721,7 +2721,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
// Segment size by default, 1024
if(length == 1024)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
}
}
@@ -2739,33 +2739,33 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
ptr = message->databuffer;
datalength = message->datasize;
- /* NWEN */
- DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
- type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
- if(type_info & DLT_TYPE_INFO_STRG)
- {
- char chdr[10];
- DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
- length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
- DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
- if(strcmp((char *)chdr, "NWEN")==0)
- {
- dltdata->test_counter_function[8]++;
- }
-
- /* handle */
- DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
- type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
- if(type_info & DLT_TYPE_INFO_UINT)
- {
- uint32_t handle;
- DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
- handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
- if(handle > 0)
- {
- dltdata->test_counter_function[8]++;
- }
- }
+ /* NWEN */
+ DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
+ type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
+ if(type_info & DLT_TYPE_INFO_STRG)
+ {
+ char chdr[10];
+ DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
+ length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
+ DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
+ if(strcmp((char *)chdr, "NWEN")==0)
+ {
+ dltdata->test_counter_function[8]++;
+ }
+
+ /* handle */
+ DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
+ type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
+ if(type_info & DLT_TYPE_INFO_UINT)
+ {
+ uint32_t handle;
+ DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
+ handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
+ if(handle > 0)
+ {
+ dltdata->test_counter_function[8]++;
+ }
+ }
}
}
}
diff --git a/src/tests/dlt-test-filetransfer.c b/src/tests/dlt-test-filetransfer.c
index 46a6845..8c4b5c3 100644
--- a/src/tests/dlt-test-filetransfer.c
+++ b/src/tests/dlt-test-filetransfer.c
@@ -55,8 +55,8 @@
*******************************************************************************/
-#include <dlt_filetransfer.h> /*Needed for transferring files with the dlt protocol*/
-#include <dlt.h> /*Needed for dlt logging*/
+#include <dlt_filetransfer.h> /*Needed for transferring files with the dlt protocol*/
+#include <dlt.h> /*Needed for dlt logging*/
//!Declare some context for the main program. It's a must have to do this, when you want to log with dlt.
DLT_DECLARE_CONTEXT(mainContext);
@@ -80,326 +80,326 @@ int i,countPackages, transferResult;
//!Prints the test result
void printTestResultPositiveExpected(const char *function, int result){
- if(result >= 0){
- printf("%s successful\n",function);
- }
- else
- {
- printf("%s failed\n",function);
- }
+ if(result >= 0){
+ printf("%s successful\n",function);
+ }
+ else
+ {
+ printf("%s failed\n",function);
+ }
}
//!Prints the test result
void printTestResultNegativeExpected(const char *function, int result){
- if(result < 0){
- printf("%s successful\n",function);
- }
- else
- {
- printf("%s failed\n",function);
- }
+ if(result < 0){
+ printf("%s successful\n",function);
+ }
+ else
+ {
+ printf("%s failed\n",function);
+ }
}
//!Test the file transfer with the condition that the transferred file is smaller as the file transfer buffer using dlt_user_log_file_complete.
int testFile1Run1(){
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF1P1 - dlt_user_log_file_complete"),DLT_STRING(file1));
-
- //Here's the line where the dlt file transfer is called. The method call needs a context, the absolute file path, will the file be deleted after transfer and the timeout between the packages
- transferResult = dlt_user_log_file_complete(&fileContext,file1,0,20);
- if(transferResult < 0 )
- {
- printf("Error: dlt_user_log_file_complete\n");
- return transferResult;
- }
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF1P1"),DLT_STRING(file1));
-
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
-
- return transferResult;
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF1P1 - dlt_user_log_file_complete"),DLT_STRING(file1));
+
+ //Here's the line where the dlt file transfer is called. The method call needs a context, the absolute file path, will the file be deleted after transfer and the timeout between the packages
+ transferResult = dlt_user_log_file_complete(&fileContext,file1,0,20);
+ if(transferResult < 0 )
+ {
+ printf("Error: dlt_user_log_file_complete\n");
+ return transferResult;
+ }
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF1P1"),DLT_STRING(file1));
+
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+
+ return transferResult;
}
//!Test the file transfer with the condition that the transferred file is smaller as the file transfer buffer using single package transfer
int testFile1Run2(){
- int total_size, used_size;
-
- //Get the information how many packages have the file
- countPackages = dlt_user_log_file_packagesCount(&fileContext,file1);
- if(countPackages < 0 )
- {
- printf("Error: dlt_user_log_file_packagesCount\n");
- printTestResultPositiveExpected(__FUNCTION__,countPackages);
- return -1;
- }
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF1P2 - transfer single package"),DLT_STRING(file1));
-
- //Logs the header of the file transfer. For more details see Mainpage.c.
- //The header gives information about the file serial number, filename (with absolute path), filesize, packages of file, buffer size
- transferResult = dlt_user_log_file_header(&fileContext,file1);
- if(transferResult >= 0)
- {
- //Loop to log all packages
- for(i=1;i<=countPackages;i++)
- {
- dlt_user_check_buffer(&total_size, &used_size);
- if((total_size - used_size) < (total_size/2))
- {
- printf("Error: dlt_user_log_file_data\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- break;
- }
-
- //Logs one single package to the file context
- transferResult = dlt_user_log_file_data(&fileContext,file1,i,20);
- if(transferResult < 0)
- {
- printf("Error: dlt_user_log_file_data\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- }
-
- //Logs the end of the file transfer. For more details see Mainpage.c
- //The end gives just information about the file serial number but is needed to signal that the file transfer has correctly finished and needed for the file transfer plugin of the dlt viewer.
- transferResult = dlt_user_log_file_end(&fileContext,file1,0);
- if(transferResult < 0)
- {
- printf("Error: dlt_user_log_file_end\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- }
- else
- {
- printf("Error: dlt_user_log_file_header\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
-
- //Just some log to main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF1P2 - transfer single package"),DLT_STRING(file1));
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return 0;
+ int total_size, used_size;
+
+ //Get the information how many packages have the file
+ countPackages = dlt_user_log_file_packagesCount(&fileContext,file1);
+ if(countPackages < 0 )
+ {
+ printf("Error: dlt_user_log_file_packagesCount\n");
+ printTestResultPositiveExpected(__FUNCTION__,countPackages);
+ return -1;
+ }
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF1P2 - transfer single package"),DLT_STRING(file1));
+
+ //Logs the header of the file transfer. For more details see Mainpage.c.
+ //The header gives information about the file serial number, filename (with absolute path), filesize, packages of file, buffer size
+ transferResult = dlt_user_log_file_header(&fileContext,file1);
+ if(transferResult >= 0)
+ {
+ //Loop to log all packages
+ for(i=1;i<=countPackages;i++)
+ {
+ dlt_user_check_buffer(&total_size, &used_size);
+ if((total_size - used_size) < (total_size/2))
+ {
+ printf("Error: dlt_user_log_file_data\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ break;
+ }
+
+ //Logs one single package to the file context
+ transferResult = dlt_user_log_file_data(&fileContext,file1,i,20);
+ if(transferResult < 0)
+ {
+ printf("Error: dlt_user_log_file_data\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ }
+
+ //Logs the end of the file transfer. For more details see Mainpage.c
+ //The end gives just information about the file serial number but is needed to signal that the file transfer has correctly finished and needed for the file transfer plugin of the dlt viewer.
+ transferResult = dlt_user_log_file_end(&fileContext,file1,0);
+ if(transferResult < 0)
+ {
+ printf("Error: dlt_user_log_file_end\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ }
+ else
+ {
+ printf("Error: dlt_user_log_file_header\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+
+ //Just some log to main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF1P2 - transfer single package"),DLT_STRING(file1));
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return 0;
}
//!Test the file transfer with the condition that the transferred file is bigger as the file transfer buffer using dlt_user_log_file_complete.
int testFile2Run1(){
- //Just some log to main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF2P1 - dlt_user_log_file_complete"),DLT_STRING(file2));
-
- //Here's the line where the dlt file transfer is called. The method call needs a context, the absolute file path, will the file be deleted after transfer and the timeout between the packages
- transferResult = dlt_user_log_file_complete(&fileContext,file2,0,20);
- if(transferResult < 0)
- {
- printf("Error: dlt_user_log_file_complete\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- //Just some log to main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF2P1"),DLT_STRING(file2));
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
+ //Just some log to main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF2P1 - dlt_user_log_file_complete"),DLT_STRING(file2));
+
+ //Here's the line where the dlt file transfer is called. The method call needs a context, the absolute file path, will the file be deleted after transfer and the timeout between the packages
+ transferResult = dlt_user_log_file_complete(&fileContext,file2,0,20);
+ if(transferResult < 0)
+ {
+ printf("Error: dlt_user_log_file_complete\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ //Just some log to main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF2P1"),DLT_STRING(file2));
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
}
//!Test the file transfer with the condition that the transferred file is bigger as the file transfer buffer using single package transfer
int testFile2Run2(){
- int total_size, used_size;
-
- //Get the information how many packages have the file
- countPackages = dlt_user_log_file_packagesCount(&fileContext,file2);
- if(countPackages < 0 )
- {
- printf("Error: dlt_user_log_file_packagesCount\n");
- printTestResultPositiveExpected(__FUNCTION__,countPackages);
- return -1;
- }
-
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF2P2 - transfer single package"),DLT_STRING(file2));
-
- //Logs the header of the file transfer. For more details see Mainpage.c.
- //The header gives information about the file serial number, filename (with absolute path), filesize, packages of file, buffer size
- transferResult = dlt_user_log_file_header(&fileContext,file2);
- if( transferResult >= 0){
-
- //Loop to log all packages
- for(i=1;i<=countPackages;i++)
- {
- dlt_user_check_buffer(&total_size, &used_size);
- if((total_size - used_size) < (total_size/2))
- {
- printf("Error: dlt_user_log_file_data\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- break;
- }
-
- //Logs one single package to the file context
- transferResult = dlt_user_log_file_data(&fileContext,file2,i,20);
- if(transferResult < 0)
- {
- printf("Error: dlt_user_log_file_data\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- }
-
- //Logs the end of the file transfer. For more details see Mainpage.c
- //The end gives just information about the file serial number but is needed to signal that the file transfer has correctly finished and needed for the file transfer plugin of the dlt viewer.
- transferResult = dlt_user_log_file_end(&fileContext,file2,0);
- if(transferResult < 0)
- {
- printf("Error: dlt_user_log_file_end\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- }
- else
- {
- printf("Error: dlt_user_log_file_header\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF2P2"),DLT_STRING(file2));
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return 0;
+ int total_size, used_size;
+
+ //Get the information how many packages have the file
+ countPackages = dlt_user_log_file_packagesCount(&fileContext,file2);
+ if(countPackages < 0 )
+ {
+ printf("Error: dlt_user_log_file_packagesCount\n");
+ printTestResultPositiveExpected(__FUNCTION__,countPackages);
+ return -1;
+ }
+
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF2P2 - transfer single package"),DLT_STRING(file2));
+
+ //Logs the header of the file transfer. For more details see Mainpage.c.
+ //The header gives information about the file serial number, filename (with absolute path), filesize, packages of file, buffer size
+ transferResult = dlt_user_log_file_header(&fileContext,file2);
+ if( transferResult >= 0){
+
+ //Loop to log all packages
+ for(i=1;i<=countPackages;i++)
+ {
+ dlt_user_check_buffer(&total_size, &used_size);
+ if((total_size - used_size) < (total_size/2))
+ {
+ printf("Error: dlt_user_log_file_data\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ break;
+ }
+
+ //Logs one single package to the file context
+ transferResult = dlt_user_log_file_data(&fileContext,file2,i,20);
+ if(transferResult < 0)
+ {
+ printf("Error: dlt_user_log_file_data\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ }
+
+ //Logs the end of the file transfer. For more details see Mainpage.c
+ //The end gives just information about the file serial number but is needed to signal that the file transfer has correctly finished and needed for the file transfer plugin of the dlt viewer.
+ transferResult = dlt_user_log_file_end(&fileContext,file2,0);
+ if(transferResult < 0)
+ {
+ printf("Error: dlt_user_log_file_end\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ }
+ else
+ {
+ printf("Error: dlt_user_log_file_header\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF2P2"),DLT_STRING(file2));
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return 0;
}
//!Test the file transfer with the condition that the transferred file does not exist using dlt_user_log_file_complete.
int testFile3Run1(){
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF3P1"),DLT_STRING(file3_1));
-
- //Here's the line where the dlt file transfer is called. The method call needs a context, the absolute file path, will the file be deleted after transfer and the timeout between the packages
- transferResult = dlt_user_log_file_complete(&fileContext,file3_1,0,20);
- if(transferResult < 0)
- {
- //Error expected because file doesn't exist
- //printf("Error: dlt_user_log_file_complete\n");
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF3P1"),DLT_STRING(file3_1));
- printTestResultNegativeExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- printTestResultNegativeExpected(__FUNCTION__,transferResult);
- return transferResult;
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF3P1"),DLT_STRING(file3_1));
+
+ //Here's the line where the dlt file transfer is called. The method call needs a context, the absolute file path, will the file be deleted after transfer and the timeout between the packages
+ transferResult = dlt_user_log_file_complete(&fileContext,file3_1,0,20);
+ if(transferResult < 0)
+ {
+ //Error expected because file doesn't exist
+ //printf("Error: dlt_user_log_file_complete\n");
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF3P1"),DLT_STRING(file3_1));
+ printTestResultNegativeExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ printTestResultNegativeExpected(__FUNCTION__,transferResult);
+ return transferResult;
}
//!Test the file transfer with the condition that the transferred file does not exist using single package transfer
int testFile3Run2(){
- //Get the information how many packages have the file
- countPackages = dlt_user_log_file_packagesCount(&fileContext,file3_2);
- if(countPackages < 0 )
- {
- //Error expected because file doesn't exist
- //printf("Error: dlt_user_log_file_packagesCount\n");
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF3P1"),DLT_STRING(file3_2));
- printTestResultNegativeExpected(__FUNCTION__,countPackages);
- return -1;
- }
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF3P1"),DLT_STRING(file3_2));
-
- //Logs the header of the file transfer. For more details see Mainpage.c.
- //The header gives information about the file serial number, filename (with absolute path), filesize, packages of file, buffer size
- transferResult = dlt_user_log_file_header(&fileContext,file3_2);
- if( transferResult >= 0){
-
- //Loop to log all packages
- for(i=1;i<=countPackages;i++)
- {
- //Logs one single package to the file context
- transferResult = dlt_user_log_file_data(&fileContext,file3_2,i,20);
- if(transferResult < 0)
- {
- printf("Error: dlt_user_log_file_data\n");
- printTestResultNegativeExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- }
-
- //Logs the end of the file transfer. For more details see Mainpage.c
- //The end gives just information about the file serial number but is needed to signal that the file transfer has correctly finished and needed for the file transfer plugin of the dlt viewer.
- transferResult = dlt_user_log_file_end(&fileContext,file3_2,0);
- if(transferResult < 0)
- {
- printf("Error: dlt_user_log_file_end\n");
- printTestResultNegativeExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- }
- printTestResultNegativeExpected(__FUNCTION__,transferResult);
- return 0;
+ //Get the information how many packages have the file
+ countPackages = dlt_user_log_file_packagesCount(&fileContext,file3_2);
+ if(countPackages < 0 )
+ {
+ //Error expected because file doesn't exist
+ //printf("Error: dlt_user_log_file_packagesCount\n");
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF3P1"),DLT_STRING(file3_2));
+ printTestResultNegativeExpected(__FUNCTION__,countPackages);
+ return -1;
+ }
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF3P1"),DLT_STRING(file3_2));
+
+ //Logs the header of the file transfer. For more details see Mainpage.c.
+ //The header gives information about the file serial number, filename (with absolute path), filesize, packages of file, buffer size
+ transferResult = dlt_user_log_file_header(&fileContext,file3_2);
+ if( transferResult >= 0){
+
+ //Loop to log all packages
+ for(i=1;i<=countPackages;i++)
+ {
+ //Logs one single package to the file context
+ transferResult = dlt_user_log_file_data(&fileContext,file3_2,i,20);
+ if(transferResult < 0)
+ {
+ printf("Error: dlt_user_log_file_data\n");
+ printTestResultNegativeExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ }
+
+ //Logs the end of the file transfer. For more details see Mainpage.c
+ //The end gives just information about the file serial number but is needed to signal that the file transfer has correctly finished and needed for the file transfer plugin of the dlt viewer.
+ transferResult = dlt_user_log_file_end(&fileContext,file3_2,0);
+ if(transferResult < 0)
+ {
+ printf("Error: dlt_user_log_file_end\n");
+ printTestResultNegativeExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ }
+ printTestResultNegativeExpected(__FUNCTION__,transferResult);
+ return 0;
}
//!Logs some information about the file.
int testFile3Run3(){
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF3P2"),DLT_STRING(file3_3));
-
- //Here's the line where the dlt file file info is called. The method call logs some information to dlt about the file, filesize, file serial number and number of packages
- transferResult = dlt_user_log_file_infoAbout(&fileContext,file3_3);
- if(transferResult < 0)
- {
- //Error expected because file doesn't exist
- //printf("Error: dlt_user_log_file_infoAbout\n");
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF3P2"),DLT_STRING(file3_3));
- printTestResultNegativeExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- printTestResultNegativeExpected(__FUNCTION__,transferResult);
- return 0;
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF3P2"),DLT_STRING(file3_3));
+
+ //Here's the line where the dlt file file info is called. The method call logs some information to dlt about the file, filesize, file serial number and number of packages
+ transferResult = dlt_user_log_file_infoAbout(&fileContext,file3_3);
+ if(transferResult < 0)
+ {
+ //Error expected because file doesn't exist
+ //printf("Error: dlt_user_log_file_infoAbout\n");
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF3P2"),DLT_STRING(file3_3));
+ printTestResultNegativeExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ printTestResultNegativeExpected(__FUNCTION__,transferResult);
+ return 0;
}
//!Main program dlt-test-filestransfer starts here
int main(void)
{
- //First file contains some text
- file1 = "/usr/share/dlt-filetransfer/dlt-test-filetransfer-file";
- //Second file is a picture
- file2 = "/usr/share/dlt-filetransfer/dlt-test-filetransfer-image.png";
- //Third file doesn't exist. Just to test the reaction when the file isn't available.
- file3_1 = "dlt-test-filetransfer-doesntExist_1";
- //Third file doesn't exist. Just to test the reaction when the file isn't available.
- file3_2 = "dlt-test-filetransfer-doesntExist_2";
- //Third file doesn't exist. Just to test the reaction when the file isn't available.
- file3_3 = "dlt-test-filetransfer-doesntExist_3";
-
- //Register the application at the dlt-daemon
- DLT_REGISTER_APP("FLTR","Test Application filetransfer");
-
- //Register the context of the main program at the dlt-daemon
- DLT_REGISTER_CONTEXT(mainContext,"MAIN","Main context for filetransfer test");
-
- //Register the context in which the file transfer will be logged at the dlt-daemon
- DLT_REGISTER_CONTEXT(fileContext,"FLTR","Test Context for filetransfer");
-
- //More details in corresponding methods
- testFile1Run1();
- testFile1Run2();
- testFile2Run1();
- testFile2Run2();
- testFile3Run1();
- testFile3Run2();
- testFile3Run3();
-
- //Unregister the context in which the file transfer happened from the dlt-daemon
- DLT_UNREGISTER_CONTEXT(fileContext);
- //Unregister the context of the main program from the dlt-daemon
- DLT_UNREGISTER_CONTEXT(mainContext);
- //Unregister the app from the dlt-daemon
- DLT_UNREGISTER_APP();
-
- return(0);
+ //First file contains some text
+ file1 = "/usr/share/dlt-filetransfer/dlt-test-filetransfer-file";
+ //Second file is a picture
+ file2 = "/usr/share/dlt-filetransfer/dlt-test-filetransfer-image.png";
+ //Third file doesn't exist. Just to test the reaction when the file isn't available.
+ file3_1 = "dlt-test-filetransfer-doesntExist_1";
+ //Third file doesn't exist. Just to test the reaction when the file isn't available.
+ file3_2 = "dlt-test-filetransfer-doesntExist_2";
+ //Third file doesn't exist. Just to test the reaction when the file isn't available.
+ file3_3 = "dlt-test-filetransfer-doesntExist_3";
+
+ //Register the application at the dlt-daemon
+ DLT_REGISTER_APP("FLTR","Test Application filetransfer");
+
+ //Register the context of the main program at the dlt-daemon
+ DLT_REGISTER_CONTEXT(mainContext,"MAIN","Main context for filetransfer test");
+
+ //Register the context in which the file transfer will be logged at the dlt-daemon
+ DLT_REGISTER_CONTEXT(fileContext,"FLTR","Test Context for filetransfer");
+
+ //More details in corresponding methods
+ testFile1Run1();
+ testFile1Run2();
+ testFile2Run1();
+ testFile2Run2();
+ testFile3Run1();
+ testFile3Run2();
+ testFile3Run3();
+
+ //Unregister the context in which the file transfer happened from the dlt-daemon
+ DLT_UNREGISTER_CONTEXT(fileContext);
+ //Unregister the context of the main program from the dlt-daemon
+ DLT_UNREGISTER_CONTEXT(mainContext);
+ //Unregister the app from the dlt-daemon
+ DLT_UNREGISTER_APP();
+
+ return(0);
}
diff --git a/src/tests/dlt-test-multi-process-client.c b/src/tests/dlt-test-multi-process-client.c
index fdd0307..c943578 100644
--- a/src/tests/dlt-test-multi-process-client.c
+++ b/src/tests/dlt-test-multi-process-client.c
@@ -63,22 +63,22 @@
// Local data structures
typedef struct {
- int max_messages;
- int verbose;
- int serial;
- int baudrate;
- char *output;
- int output_handle;
- int messages_left;
- DltClient *client_ref;
+ int max_messages;
+ int verbose;
+ int serial;
+ int baudrate;
+ char *output;
+ int output_handle;
+ int messages_left;
+ DltClient *client_ref;
} s_parameters;
typedef struct {
- int messages_received;
- int broken_messages_received;
- int bytes_received;
- int first_message_time;
- int output_bytes;
+ int messages_received;
+ int broken_messages_received;
+ int bytes_received;
+ int first_message_time;
+ int output_bytes;
} s_statistics;
// Forward declarations
@@ -88,17 +88,17 @@ int receive(DltMessage *msg, void *data);
* Print usage information
*/
void usage(char *name) {
- char version[255];
- dlt_get_version(version,255);
-
- printf("Usage: %s [options] <remote address|serial device>\n", name);
- printf("Receive messages from dlt-test-multi-process.\n");
- printf("%s", version);
- printf("Options:\n");
- printf(" -m Total messages to receive. (Default: 10000)\n");
+ char version[255];
+ dlt_get_version(version,255);
+
+ printf("Usage: %s [options] <remote address|serial device>\n", name);
+ printf("Receive messages from dlt-test-multi-process.\n");
+ printf("%s", version);
+ printf("Options:\n");
+ printf(" -m Total messages to receive. (Default: 10000)\n");
printf(" -y Serial device mode.\n");
printf(" -b baudrate Serial device baudrate. (Default: 115200)\n");
- printf(" -v Verbose. Increases the verbosity level of dlt client library.\n");
+ printf(" -v Verbose. Increases the verbosity level of dlt client library.\n");
printf(" -o filename Output messages in new DLT file.\n");
}
@@ -106,106 +106,106 @@ void usage(char *name) {
* Initialize reasonable default parameters.
*/
void init_params(s_parameters *params) {
- params->max_messages = 10000;
- params->verbose = 0;
- params->serial = 0;
- params->output = NULL;
- params->output_handle = -1;
- params->baudrate = 115200;
+ params->max_messages = 10000;
+ params->verbose = 0;
+ params->serial = 0;
+ params->output = NULL;
+ params->output_handle = -1;
+ params->baudrate = 115200;
}
/**
* Read the command line parameters
*/
int read_params(s_parameters *params, int argc, char *argv[]) {
- init_params(params);
- int c;
- opterr = 0;
- while ((c = getopt(argc, argv, "m:yb:vo:")) != -1) {
- switch (c) {
- case 'm':
- params->max_messages = atoi(optarg);
- break;
- case 'y':
- params->serial = 1;
- break;
- case 'b':
- params->baudrate = atoi(optarg);
- break;
- case 'v':
- params->verbose = 1;
- break;
- case 'o':
- params->output = optarg;
- break;
- case '?':
- if(optopt == 'm' || optopt == 'b' || optopt == 'o')
- {
- fprintf(stderr, "Option -%c requires an argument.\n", optopt);
- }
- if (isprint(optopt)) {
- fprintf(stderr, "Unknown option '-%c'.\n", optopt);
- } else {
- fprintf(stderr, "Unknown option character '\\x%x'.\n", optopt);
- }
- return -1;
- break;
- default:
- return -1;
- }
- }
- return 0;
+ init_params(params);
+ int c;
+ opterr = 0;
+ while ((c = getopt(argc, argv, "m:yb:vo:")) != -1) {
+ switch (c) {
+ case 'm':
+ params->max_messages = atoi(optarg);
+ break;
+ case 'y':
+ params->serial = 1;
+ break;
+ case 'b':
+ params->baudrate = atoi(optarg);
+ break;
+ case 'v':
+ params->verbose = 1;
+ break;
+ case 'o':
+ params->output = optarg;
+ break;
+ case '?':
+ if(optopt == 'm' || optopt == 'b' || optopt == 'o')
+ {
+ fprintf(stderr, "Option -%c requires an argument.\n", optopt);
+ }
+ if (isprint(optopt)) {
+ fprintf(stderr, "Unknown option '-%c'.\n", optopt);
+ } else {
+ fprintf(stderr, "Unknown option character '\\x%x'.\n", optopt);
+ }
+ return -1;
+ break;
+ default:
+ return -1;
+ }
+ }
+ return 0;
}
/**
* Set the connection parameters for dlt client
*/
int init_dlt_connect(DltClient *client, const s_parameters *params, int argc, char *argv[]) {
- char id[4];
- if (argc < 2)
- return -1;
- if(params->serial > 0)
- {
- client->serial_mode = 1;
- client->serialDevice = argv[argc - 1];
- dlt_client_setbaudrate(client, params->baudrate);
- }
- else
- {
- client->servIP = argv[argc - 1];
- }
- dlt_set_id(id, ECUID);
- return 0;
+ char id[4];
+ if (argc < 2)
+ return -1;
+ if(params->serial > 0)
+ {
+ client->serial_mode = 1;
+ client->serialDevice = argv[argc - 1];
+ dlt_client_setbaudrate(client, params->baudrate);
+ }
+ else
+ {
+ client->servIP = argv[argc - 1];
+ }
+ dlt_set_id(id, ECUID);
+ return 0;
}
/**
* Entry point
*/
int main(int argc, char *argv[]) {
- s_parameters params;
- DltClient client;
- params.client_ref = &client;
- int err = read_params(&params, argc, argv);
-
- if (err != 0) {
- usage(argv[0]);
- return err;
- }
-
- dlt_client_init(&client, params.verbose);
- dlt_client_register_message_callback(receive);
-
- err = init_dlt_connect(&client, &params, argc, argv);
- if (err != 0) {
- usage(argv[0]);
- return err;
- }
-
- err = dlt_client_connect(&client, params.verbose);
- if (err != 0) {
- printf("Failed to connect %s.\n", client.serial_mode > 0 ? client.serialDevice : client.servIP);
- return err;
- }
+ s_parameters params;
+ DltClient client;
+ params.client_ref = &client;
+ int err = read_params(&params, argc, argv);
+
+ if (err != 0) {
+ usage(argv[0]);
+ return err;
+ }
+
+ dlt_client_init(&client, params.verbose);
+ dlt_client_register_message_callback(receive);
+
+ err = init_dlt_connect(&client, &params, argc, argv);
+ if (err != 0) {
+ usage(argv[0]);
+ return err;
+ }
+
+ err = dlt_client_connect(&client, params.verbose);
+ if (err != DLT_RETURN_OK) {
+ printf("Failed to connect %s.\n", client.serial_mode > 0 ? client.serialDevice : client.servIP);
+ return err;
+ }
if(params.output)
{
@@ -220,13 +220,13 @@ int main(int argc, char *argv[]) {
params.messages_left = params.max_messages;
- dlt_client_main_loop(&client, &params, params.verbose);
+ dlt_client_main_loop(&client, &params, params.verbose);
- if(params.output_handle > 0)
- {
- close(params.output_handle);
- }
- return 0;
+ if(params.output_handle > 0)
+ {
+ close(params.output_handle);
+ }
+ return 0;
}
/**
@@ -234,79 +234,79 @@ int main(int argc, char *argv[]) {
*/
void print_stats(s_statistics stats, s_parameters params)
{
- static int last_print_time;
- if(last_print_time >= time(NULL) && // Only print once a second
- (stats.messages_received+stats.broken_messages_received) % 1000 != 0 &&
- params.messages_left != 0) // Print also every 1000th message
- {
- return;
- }
- printf("\033[2J\033[1;1H"); // Clear screen.
- printf("Statistics:\n");
- printf(" Messages received : %d\n", stats.messages_received);
- printf(" Broken messages received : %d\n", stats.broken_messages_received);
- printf(" Bytes received : %d\n", stats.bytes_received);
- printf(" Time running (seconds) : %ld\n", time(NULL)-stats.first_message_time);
- printf(" Throughput (msgs/sec)/(B/sec) : %ld/%ld\n",
- stats.messages_received/((time(NULL)-stats.first_message_time)+1),
- (stats.bytes_received)/((time(NULL)-stats.first_message_time)+1));
- if(params.messages_left == 0)
- {
- if(stats.broken_messages_received == 0)
- printf("All messages received succesfully!\n");
- else
- printf("Test failure! There were %d broken messages.", stats.broken_messages_received);
-
- }
- fflush(stdout);
- last_print_time = time(NULL);
+ static int last_print_time;
+ if(last_print_time >= time(NULL) && // Only print once a second
+ (stats.messages_received+stats.broken_messages_received) % 1000 != 0 &&
+ params.messages_left != 0) // Print also every 1000th message
+ {
+ return;
+ }
+ printf("\033[2J\033[1;1H"); // Clear screen.
+ printf("Statistics:\n");
+ printf(" Messages received : %d\n", stats.messages_received);
+ printf(" Broken messages received : %d\n", stats.broken_messages_received);
+ printf(" Bytes received : %d\n", stats.bytes_received);
+ printf(" Time running (seconds) : %ld\n", time(NULL)-stats.first_message_time);
+ printf(" Throughput (msgs/sec)/(B/sec) : %ld/%ld\n",
+ stats.messages_received/((time(NULL)-stats.first_message_time)+1),
+ (stats.bytes_received)/((time(NULL)-stats.first_message_time)+1));
+ if(params.messages_left == 0)
+ {
+ if(stats.broken_messages_received == 0)
+ printf("All messages received succesfully!\n");
+ else
+ printf("Test failure! There were %d broken messages.", stats.broken_messages_received);
+
+ }
+ fflush(stdout);
+ last_print_time = time(NULL);
}
/**
* Callback for dlt client
*/
int receive(DltMessage *msg, void *data) {
- static s_statistics stats;
- char apid[5];
- struct iovec iov[2];
- s_parameters *params = (s_parameters *)data;
+ static s_statistics stats;
+ char apid[5];
+ struct iovec iov[2];
+ s_parameters *params = (s_parameters *)data;
- memset(apid, 0, 5);
- memcpy(apid, msg->extendedheader->apid, 4);
+ memset(apid, 0, 5);
+ memcpy(apid, msg->extendedheader->apid, 4);
- if(apid[0] != 'M' || apid[1] != 'T') // TODO: Check through the app description
- return 0;
+ if(apid[0] != 'M' || apid[1] != 'T') // TODO: Check through the app description
+ return 0;
params->messages_left--;
- if(stats.first_message_time == 0)
- {
- stats.first_message_time = time(NULL);
- }
+ if(stats.first_message_time == 0)
+ {
+ stats.first_message_time = time(NULL);
+ }
- int buflen = msg->datasize + 1;
- char *buf = malloc(buflen);
- if(buf==0)
- {
- printf("Out of memory\n");
- return -1;
- }
- memset(buf, 0, buflen);
+ int buflen = msg->datasize + 1;
+ char *buf = malloc(buflen);
+ if(buf==0)
+ {
+ printf("Out of memory\n");
+ return -1;
+ }
+ memset(buf, 0, buflen);
- dlt_message_payload(msg,buf,buflen-1,DLT_OUTPUT_ASCII,0);
+ dlt_message_payload(msg,buf,buflen-1,DLT_OUTPUT_ASCII,0);
- if(strcmp(buf, PAYLOAD_DATA) == 0)
- {
- stats.messages_received++;
- }
- else
- {
- stats.broken_messages_received++;
- }
- stats.bytes_received += msg->datasize+msg->headersize-sizeof(DltStorageHeader);;
+ if(strcmp(buf, PAYLOAD_DATA) == 0)
+ {
+ stats.messages_received++;
+ }
+ else
+ {
+ stats.broken_messages_received++;
+ }
+ stats.bytes_received += msg->datasize+msg->headersize-sizeof(DltStorageHeader);;
- free(buf);
+ free(buf);
- print_stats(stats, *params);
+ print_stats(stats, *params);
if (params->output_handle > 0)
{
@@ -319,7 +319,7 @@ int receive(DltMessage *msg, void *data) {
}
if(params->messages_left < 1)
{
- dlt_client_cleanup(params->client_ref, params->verbose);
+ dlt_client_cleanup(params->client_ref, params->verbose);
}
- return 0;
+ return 0;
}
diff --git a/src/tests/dlt-test-multi-process.c b/src/tests/dlt-test-multi-process.c
index 93fd069..c5c8ddd 100644
--- a/src/tests/dlt-test-multi-process.c
+++ b/src/tests/dlt-test-multi-process.c
@@ -64,16 +64,16 @@
// Structs
typedef struct {
- int nmsgs; // Number of messages to send
- int nprocs; // Number of processes to start
- int nthreads; // Number of threads to start
- int delay; // Delay between logs messages for each process
- int delay_fudge; // Fudge the delay by 0-n to cause desynchronization
+ int nmsgs; // Number of messages to send
+ int nprocs; // Number of processes to start
+ int nthreads; // Number of threads to start
+ int delay; // Delay between logs messages for each process
+ int delay_fudge; // Fudge the delay by 0-n to cause desynchronization
} s_parameters;
typedef struct {
- s_parameters params;
- DltContext ctx;
+ s_parameters params;
+ DltContext ctx;
} s_thread_data;
// Forward declarations
@@ -97,31 +97,31 @@ unsigned int pidcount = 0;
*/
void usage(char *prog_name)
{
- char version[255];
- dlt_get_version(version,255);
- s_parameters defaults;
- init_params(&defaults);
-
- printf("Usage: %s [options]\n", prog_name);
- printf("Test application for stress testing the daemon with multiple processes and threads.\n");
- printf("%s\n", version);
- printf("Options (Default):\n");
- printf(" -m number Number of messages per thread to send. (%d)\n", defaults.nmsgs);
- printf(" -p number Number of processes to start. (%d), Max %d.\n", defaults.nprocs, MAX_PROCS);
- printf(" -t number Number of threads per process. (%d), Max %d.\n", defaults.nthreads, MAX_THREADS);
- printf(" -d delay Delay in milliseconds to wait between log messages. (%d)\n", defaults.delay);
- printf(" -f delay Random fudge in milliseconds to add to delay. (%d)\n", defaults.delay_fudge);
+ char version[255];
+ dlt_get_version(version,255);
+ s_parameters defaults;
+ init_params(&defaults);
+
+ printf("Usage: %s [options]\n", prog_name);
+ printf("Test application for stress testing the daemon with multiple processes and threads.\n");
+ printf("%s\n", version);
+ printf("Options (Default):\n");
+ printf(" -m number Number of messages per thread to send. (%d)\n", defaults.nmsgs);
+ printf(" -p number Number of processes to start. (%d), Max %d.\n", defaults.nprocs, MAX_PROCS);
+ printf(" -t number Number of threads per process. (%d), Max %d.\n", defaults.nthreads, MAX_THREADS);
+ printf(" -d delay Delay in milliseconds to wait between log messages. (%d)\n", defaults.delay);
+ printf(" -f delay Random fudge in milliseconds to add to delay. (%d)\n", defaults.delay_fudge);
}
/**
* Set nice default values for parameters
*/
void init_params(s_parameters * params) {
- params->nmsgs = 100;
- params->nprocs = 10;
- params->nthreads = 2;
- params->delay = 1000;
- params->delay_fudge = 100;
+ params->nmsgs = 100;
+ params->nprocs = 10;
+ params->nthreads = 2;
+ params->delay = 1000;
+ params->delay_fudge = 100;
}
/**
@@ -129,58 +129,58 @@ void init_params(s_parameters * params) {
*/
int read_cli(s_parameters *params, int argc, char **argv)
{
- int c;
- opterr = 0;
+ int c;
+ opterr = 0;
while ((c = getopt (argc, argv, "m:p:t:d:f:")) != -1)
- {
- switch(c)
- {
- case 'm':
- params->nmsgs = atoi(optarg);
- break;
- case 'p':
- params->nprocs = atoi(optarg);
- if(params->nprocs > MAX_PROCS)
- {
- fprintf(stderr, "Too many processes selected.\n");
- return -1;
- }
- break;
- case 't':
- params->nthreads = atoi(optarg);
- if(params->nprocs > MAX_PROCS)
- {
- fprintf(stderr, "Too many threads selected.\n");
- return -1;
- }
- break;
- case 'd':
- params->delay = atoi(optarg);
- break;
- case 'f':
- params->delay_fudge = atoi(optarg);
- break;
- case '?':
- if(optopt == 'n' || optopt == 'd' || optopt == 'f')
- {
- fprintf(stderr, "Option -%c requires an argument.\n", optopt);
- }
- else if(isprint(optopt))
- {
- fprintf(stderr, "Unknown option '-%c'.\n", optopt);
- }
- else
- {
- fprintf(stderr, "Unknown option character '\\x%x'.\n", optopt);
- }
- return -1;
- break;
- default:
- abort();
+ {
+ switch(c)
+ {
+ case 'm':
+ params->nmsgs = atoi(optarg);
+ break;
+ case 'p':
+ params->nprocs = atoi(optarg);
+ if(params->nprocs > MAX_PROCS)
+ {
+ fprintf(stderr, "Too many processes selected.\n");
+ return -1;
+ }
+ break;
+ case 't':
+ params->nthreads = atoi(optarg);
+ if(params->nprocs > MAX_PROCS)
+ {
+ fprintf(stderr, "Too many threads selected.\n");
+ return -1;
+ }
+ break;
+ case 'd':
+ params->delay = atoi(optarg);
+ break;
+ case 'f':
+ params->delay_fudge = atoi(optarg);
+ break;
+ case '?':
+ if(optopt == 'n' || optopt == 'd' || optopt == 'f')
+ {
+ fprintf(stderr, "Option -%c requires an argument.\n", optopt);
+ }
+ else if(isprint(optopt))
+ {
+ fprintf(stderr, "Unknown option '-%c'.\n", optopt);
+ }
+ else
+ {
+ fprintf(stderr, "Unknown option character '\\x%x'.\n", optopt);
+ }
+ return -1;
+ break;
+ default:
+ abort();
return -1;//for parasoft
- }
- }
- return 0;
+ }
+ }
+ return 0;
}
/**
@@ -188,31 +188,31 @@ int read_cli(s_parameters *params, int argc, char **argv)
*/
int main(int argc, char **argv)
{
- // Prepare parameters
- s_parameters params;
- init_params(&params);
- if(read_cli(&params, argc, argv) != 0) {
- usage(argv[0]);
- exit(-1);
- }
-
- // Launch the child processes
- do_forks(params);
-
- // Register signal handlers
- if(signal(SIGINT, quit_handler) == SIG_IGN)
- signal(SIGINT, SIG_IGN); // C-c
- if(signal(SIGHUP, quit_handler) == SIG_IGN)
- signal(SIGHUP, SIG_IGN); // Terminal closed
- if(signal(SIGTERM, quit_handler) == SIG_IGN)
- signal(SIGTERM, SIG_IGN); // kill (nice)
-
- printf("Setup done. Listening. My pid: %d\n", getpid());
- fflush(stdout);
-
- int err = wait_for_death();
- cleanup();
- return err;
+ // Prepare parameters
+ s_parameters params;
+ init_params(&params);
+ if(read_cli(&params, argc, argv) != 0) {
+ usage(argv[0]);
+ exit(-1);
+ }
+
+ // Launch the child processes
+ do_forks(params);
+
+ // Register signal handlers
+ if(signal(SIGINT, quit_handler) == SIG_IGN)
+ signal(SIGINT, SIG_IGN); // C-c
+ if(signal(SIGHUP, quit_handler) == SIG_IGN)
+ signal(SIGHUP, SIG_IGN); // Terminal closed
+ if(signal(SIGTERM, quit_handler) == SIG_IGN)
+ signal(SIGTERM, SIG_IGN); // kill (nice)
+
+ printf("Setup done. Listening. My pid: %d\n", getpid());
+ fflush(stdout);
+
+ int err = wait_for_death();
+ cleanup();
+ return err;
}
/**
@@ -223,34 +223,34 @@ void do_forks(s_parameters params)
{
int i;
- // Launch child processes
- for(i=0;i<params.nprocs;i++)
- {
- pid_t pid = fork();
- switch(pid)
- {
- case -1: // An error occured
- if(errno == EAGAIN)
- {
- fprintf(stderr, "Could not allocate resources for child process.\n");
- cleanup();
- abort();
- }
- if(errno == ENOMEM)
- {
- fprintf(stderr, "Could not allocate memory for child process' kernel structure.\n");
- cleanup();
- abort();
- }
- break;
- case 0: // Child process, start threads
- run_threads(params);
- break;
- default: // Parent process, store the childs pid
- pids[pidcount++] = pid;
- break;
- }
- }
+ // Launch child processes
+ for(i=0;i<params.nprocs;i++)
+ {
+ pid_t pid = fork();
+ switch(pid)
+ {
+ case -1: // An error occured
+ if(errno == EAGAIN)
+ {
+ fprintf(stderr, "Could not allocate resources for child process.\n");
+ cleanup();
+ abort();
+ }
+ if(errno == ENOMEM)
+ {
+ fprintf(stderr, "Could not allocate memory for child process' kernel structure.\n");
+ cleanup();
+ abort();
+ }
+ break;
+ case 0: // Child process, start threads
+ run_threads(params);
+ break;
+ default: // Parent process, store the childs pid
+ pids[pidcount++] = pid;
+ break;
+ }
+ }
}
/**
@@ -259,14 +259,14 @@ void do_forks(s_parameters params)
*/
void quit_handler(int signum)
{
- if(in_handler)
- raise(signum);
- in_handler = 1;
+ if(in_handler)
+ raise(signum);
+ in_handler = 1;
- cleanup();
+ cleanup();
- signal(signum, SIG_DFL);
- raise(signum);
+ signal(signum, SIG_DFL);
+ raise(signum);
}
/**
@@ -274,11 +274,11 @@ void quit_handler(int signum)
*/
void cleanup()
{
- unsigned int i;
- for(i=0;i<pidcount;i++)
- {
- kill(pids[i], SIGINT);
- }
+ unsigned int i;
+ for(i=0;i<pidcount;i++)
+ {
+ kill(pids[i], SIGINT);
+ }
}
/**
@@ -297,22 +297,22 @@ time_t mksleep_time(int delay, int fudge)
*/
void do_logging(s_thread_data *data)
{
- DltContext mycontext;
- char ctid[5];
- char ctid_name[256];
+ DltContext mycontext;
+ char ctid[5];
+ char ctid_name[256];
snprintf(ctid,5,"%.2x", rand() & 0x0000ffff);
- snprintf(ctid_name,256, "Child %s in dlt-test-multi-process", ctid);
- DLT_REGISTER_CONTEXT(mycontext, ctid, ctid_name);
-
- int msgs_left = data->params.nmsgs;
- while(msgs_left-- > 0)
- {
- DLT_LOG(mycontext, DLT_LOG_INFO, DLT_STRING(PAYLOAD_DATA));
- usleep(mksleep_time(data->params.delay, data->params.delay_fudge));
- }
- DLT_UNREGISTER_CONTEXT(mycontext);
+ snprintf(ctid_name,256, "Child %s in dlt-test-multi-process", ctid);
+ DLT_REGISTER_CONTEXT(mycontext, ctid, ctid_name);
+
+ int msgs_left = data->params.nmsgs;
+ while(msgs_left-- > 0)
+ {
+ DLT_LOG(mycontext, DLT_LOG_INFO, DLT_STRING(PAYLOAD_DATA));
+ usleep(mksleep_time(data->params.delay, data->params.delay_fudge));
+ }
+ DLT_UNREGISTER_CONTEXT(mycontext);
}
/**
@@ -320,39 +320,39 @@ void do_logging(s_thread_data *data)
*/
void run_threads(s_parameters params)
{
- pthread_t thread[params.nthreads];
- s_thread_data thread_data;
- char apid[5];
- char apid_name[256];
- int i;
+ pthread_t thread[params.nthreads];
+ s_thread_data thread_data;
+ char apid[5];
+ char apid_name[256];
+ int i;
- srand(getpid());
+ srand(getpid());
snprintf(apid,5,"MT%02u", pidcount);
snprintf(apid_name,256, "Apps %s.", apid);
- DLT_REGISTER_APP(apid, apid_name);
+ DLT_REGISTER_APP(apid, apid_name);
- thread_data.params = params;
+ thread_data.params = params;
- for(i=0;i<params.nthreads;i++)
- {
- if(pthread_create(&(thread[i]), NULL, (void *) &do_logging, &thread_data) != 0)
- {
- printf("Error creating thread.\n");
- abort();
- }
- }
+ for(i=0;i<params.nthreads;i++)
+ {
+ if(pthread_create(&(thread[i]), NULL, (void *) &do_logging, &thread_data) != 0)
+ {
+ printf("Error creating thread.\n");
+ abort();
+ }
+ }
- for(i=0;i<params.nthreads;i++)
- {
- pthread_join(thread[i], NULL);
- }
+ for(i=0;i<params.nthreads;i++)
+ {
+ pthread_join(thread[i], NULL);
+ }
- DLT_UNREGISTER_APP();
- // We can exit now
- exit(0);
+ DLT_UNREGISTER_APP();
+ // We can exit now
+ exit(0);
}
/**
@@ -360,27 +360,27 @@ void run_threads(s_parameters params)
*/
int wait_for_death()
{
- int pids_left = pidcount;
- while(pids_left > 0)
- {
- int status;
- pid_t w = waitpid(WAIT_ANY, &status, 0);
- if(status < 0)
- {
- return -1;
- }
- else
- {
- unsigned int i;
- for(i=0;i<pidcount;i++)
- {
- if(pids[i] == w)
- {
- pids_left--;
- break;
- }
- }
- }
- }
- return 0;
+ int pids_left = pidcount;
+ while(pids_left > 0)
+ {
+ int status;
+ pid_t w = waitpid(WAIT_ANY, &status, 0);
+ if(status < 0)
+ {
+ return -1;
+ }
+ else
+ {
+ unsigned int i;
+ for(i=0;i<pidcount;i++)
+ {
+ if(pids[i] == w)
+ {
+ pids_left--;
+ break;
+ }
+ }
+ }
+ }
+ return 0;
}
diff --git a/src/tests/dlt-test-stress-client.c b/src/tests/dlt-test-stress-client.c
index 28c2c9e..fc62230 100644
--- a/src/tests/dlt-test-stress-client.c
+++ b/src/tests/dlt-test-stress-client.c
@@ -81,7 +81,7 @@
#define DLT_TESTCLIENT_TEXTBUFSIZE 10024 /* Size of buffer for text output */
#define DLT_TESTCLIENT_ECU_ID "ECU1"
-#define DLT_TESTCLIENT_NUM_TESTS 7
+#define DLT_TESTCLIENT_NUM_TESTS 7
/* Function prototypes */
int dlt_testclient_message_callback(DltMessage *message, void *data);
@@ -188,8 +188,8 @@ int main(int argc, char* argv[])
dltdata.tests_passed = 0;
dltdata.tests_failed = 0;
- dltdata.bytes_received = 0;
- dltdata.time_elapsed = dlt_uptime();
+ dltdata.bytes_received = 0;
+ dltdata.time_elapsed = dlt_uptime();
dltdata.last_value = 0;
dltdata.count_received_messages = 0;
@@ -331,7 +331,7 @@ int main(int argc, char* argv[])
return -1;
}
- dlt_client_setbaudrate(&dltclient,dltdata.bvalue);
+ dlt_client_setbaudrate(&dltclient,dltdata.bvalue);
}
/* initialise structure to use DLT file */
@@ -342,7 +342,7 @@ int main(int argc, char* argv[])
if (dltdata.fvalue)
{
- if (dlt_filter_load(&(dltdata.filter),dltdata.fvalue,dltdata.vflag)<0)
+ if (dlt_filter_load(&(dltdata.filter),dltdata.fvalue,dltdata.vflag) < DLT_RETURN_OK)
{
dlt_file_free(&(dltdata.file),dltdata.vflag);
return -1;
@@ -374,7 +374,7 @@ int main(int argc, char* argv[])
}
/* Connect to TCP socket or open serial device */
- if (dlt_client_connect(&dltclient, dltdata.vflag)!=-1)
+ if (dlt_client_connect(&dltclient, dltdata.vflag) != DLT_RETURN_ERROR)
{
dltdata.sock = dltclient.sock;
@@ -403,15 +403,15 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
static char text[DLT_TESTCLIENT_TEXTBUFSIZE];
DltTestclientData *dltdata;
- uint32_t type_info, type_info_tmp;
- int16_t length,length_tmp; /* the macro can set this variable to -1 */
- uint8_t *ptr;
- int32_t datalength;
- int32_t value;
- uint32_t value_tmp = 0;
+ uint32_t type_info, type_info_tmp;
+ int16_t length,length_tmp; /* the macro can set this variable to -1 */
+ uint8_t *ptr;
+ int32_t datalength;
+ int32_t value;
+ uint32_t value_tmp = 0;
- struct iovec iov[2];
- int bytes_written;
+ struct iovec iov[2];
+ int bytes_written;
if ((message==0) || (data==0))
{
@@ -430,7 +430,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
dlt_set_storageheader(message->storageheader,dltdata->ecuid);
}
- if ((dltdata->fvalue==0) || (dltdata->fvalue && dlt_message_filter_check(message,&(dltdata->filter),dltdata->vflag)==1))
+ if ((dltdata->fvalue==0) || (dltdata->fvalue && dlt_message_filter_check(message,&(dltdata->filter),dltdata->vflag) == DLT_RETURN_TRUE))
{
//dlt_message_header(message,text,sizeof(text),dltdata->vflag);
@@ -444,98 +444,98 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
//printf("[%s]\n",text);
}
- /* do something here */
-
- // Count number of received bytes
- dltdata->bytes_received += message->datasize+message->headersize-sizeof(DltStorageHeader);
-
- // print number of received bytes
- if((dlt_uptime() - dltdata->time_elapsed) > 10000)
- {
- printf("Received %lu Bytes/s\n",dltdata->bytes_received/**10000/(dlt_uptime()-dltdata->time_elapsed)*/);
- //printf("Received %lu Bytes received\n",dltdata->bytes_received);
- dltdata->time_elapsed = dlt_uptime();
- dltdata->bytes_received = 0;
- }
-
- /* Extended header */
- if (DLT_IS_HTYP_UEH(message->standardheader->htyp))
- {
- /* Log message */
- if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_LOG)
- {
- /* Verbose */
- if (DLT_IS_MSIN_VERB(message->extendedheader->msin))
- {
- /* 2 arguments */
- if (message->extendedheader->noar==2)
- {
- /* verbose mode */
- type_info=0;
- type_info_tmp=0;
- length=0;
- length_tmp=0; /* the macro can set this variable to -1 */
-
- ptr = message->databuffer;
- datalength = message->datasize;
-
- /* first read the type info of the first argument: must be string */
- DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
- type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
-
- if (type_info & DLT_TYPE_INFO_SINT)
- {
- /* read value */
- DLT_MSG_READ_VALUE(value_tmp,ptr,datalength,int32_t);
- value=DLT_ENDIAN_GET_32(message->standardheader->htyp, value_tmp);
- //printf("%d\n",value);
-
- if(value < dltdata->last_value)
- {
- if(dltdata->nvalue == dltdata->count_received_messages)
- printf("PASSED: %d Msg received, %d not received\n",dltdata->count_received_messages,dltdata->count_not_received_messages);
- else
- printf("FAILED: %d Msg received, %d not received\n",dltdata->count_received_messages,dltdata->count_not_received_messages);
-
- dltdata->last_value = 0;
- dltdata->count_received_messages = 0;
- dltdata->count_not_received_messages = value -1;
- }
- else
- {
- dltdata->count_not_received_messages += value - dltdata->last_value -1;
- }
- dltdata->last_value = value;
- dltdata->count_received_messages++;
-
- if (length>=0)
- {
- ptr+=length;
- datalength-=length;
-
- /* read type of second argument: must be raw */
- DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
- type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
-
- if (type_info & DLT_TYPE_INFO_RAWD)
- {
- /* get length of raw data block */
- DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
- length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
-
- if ((length>=0) && (length==datalength))
- {
- //printf("Raw data found in payload, length=");
- //printf("%d, datalength=%d \n", length, datalength);
- dltdata->test_counter_macro[3]++;
- }
- }
- }
- }
- }
- }
- }
- }
+ /* do something here */
+
+ // Count number of received bytes
+ dltdata->bytes_received += message->datasize+message->headersize-sizeof(DltStorageHeader);
+
+ // print number of received bytes
+ if((dlt_uptime() - dltdata->time_elapsed) > 10000)
+ {
+ printf("Received %lu Bytes/s\n",dltdata->bytes_received/**10000/(dlt_uptime()-dltdata->time_elapsed)*/);
+ //printf("Received %lu Bytes received\n",dltdata->bytes_received);
+ dltdata->time_elapsed = dlt_uptime();
+ dltdata->bytes_received = 0;
+ }
+
+ /* Extended header */
+ if (DLT_IS_HTYP_UEH(message->standardheader->htyp))
+ {
+ /* Log message */
+ if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_LOG)
+ {
+ /* Verbose */
+ if (DLT_IS_MSIN_VERB(message->extendedheader->msin))
+ {
+ /* 2 arguments */
+ if (message->extendedheader->noar==2)
+ {
+ /* verbose mode */
+ type_info=0;
+ type_info_tmp=0;
+ length=0;
+ length_tmp=0; /* the macro can set this variable to -1 */
+
+ ptr = message->databuffer;
+ datalength = message->datasize;
+
+ /* first read the type info of the first argument: must be string */
+ DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
+ type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
+
+ if (type_info & DLT_TYPE_INFO_SINT)
+ {
+ /* read value */
+ DLT_MSG_READ_VALUE(value_tmp,ptr,datalength,int32_t);
+ value=DLT_ENDIAN_GET_32(message->standardheader->htyp, value_tmp);
+ //printf("%d\n",value);
+
+ if(value < dltdata->last_value)
+ {
+ if(dltdata->nvalue == dltdata->count_received_messages)
+ printf("PASSED: %d Msg received, %d not received\n",dltdata->count_received_messages,dltdata->count_not_received_messages);
+ else
+ printf("FAILED: %d Msg received, %d not received\n",dltdata->count_received_messages,dltdata->count_not_received_messages);
+
+ dltdata->last_value = 0;
+ dltdata->count_received_messages = 0;
+ dltdata->count_not_received_messages = value -1;
+ }
+ else
+ {
+ dltdata->count_not_received_messages += value - dltdata->last_value -1;
+ }
+ dltdata->last_value = value;
+ dltdata->count_received_messages++;
+
+ if (length>=0)
+ {
+ ptr+=length;
+ datalength-=length;
+
+ /* read type of second argument: must be raw */
+ DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
+ type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
+
+ if (type_info & DLT_TYPE_INFO_RAWD)
+ {
+ /* get length of raw data block */
+ DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
+ length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
+
+ if ((length>=0) && (length==datalength))
+ {
+ //printf("Raw data found in payload, length=");
+ //printf("%d, datalength=%d \n", length, datalength);
+ dltdata->test_counter_macro[3]++;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
/* if no filter set or filter is matching display message */
if (dltdata->xflag)
diff --git a/src/tests/dlt-test-stress-user.c b/src/tests/dlt-test-stress-user.c
index 355f510..dcd7555 100644
--- a/src/tests/dlt-test-stress-user.c
+++ b/src/tests/dlt-test-stress-user.c
@@ -100,20 +100,20 @@ DltContextData context_data;
*/
void usage()
{
- char version[255];
-
- dlt_get_version(version,255);
-
- printf("Usage: dlt-test-stress-user [options]\n");
- printf("Test user application providing Test messages.\n");
- printf("%s \n", version);
- printf("Options:\n");
- printf(" -v Verbose mode\n");
- printf(" -f filename Use local log file instead of sending to daemon\n");
- printf(" -n count Number of messages to be sent per test (Default: 10000)\n");
- printf(" -r repeat How often test is repeated (Default: 100)\n");
- printf(" -d delay Delay between sent messages in uSec (Default: 1000)\n");
- printf(" -s size Size of extra message data in bytes (Default: 100)\n");
+ char version[255];
+
+ dlt_get_version(version,255);
+
+ printf("Usage: dlt-test-stress-user [options]\n");
+ printf("Test user application providing Test messages.\n");
+ printf("%s \n", version);
+ printf("Options:\n");
+ printf(" -v Verbose mode\n");
+ printf(" -f filename Use local log file instead of sending to daemon\n");
+ printf(" -n count Number of messages to be sent per test (Default: 10000)\n");
+ printf(" -r repeat How often test is repeated (Default: 100)\n");
+ printf(" -d delay Delay between sent messages in uSec (Default: 1000)\n");
+ printf(" -s size Size of extra message data in bytes (Default: 100)\n");
}
/**
@@ -133,7 +133,7 @@ int main(int argc, char* argv[])
opterr = 0;
while ((c = getopt (argc, argv, "vf:n:r:d:s:")) != -1)
- {
+ {
switch (c)
{
case 'v':
@@ -190,7 +190,7 @@ int main(int argc, char* argv[])
return -1;//for parasoft
}
}
- }
+ }
if (fvalue)
{
@@ -201,11 +201,11 @@ int main(int argc, char* argv[])
}
}
- /* Register APP */
- DLT_REGISTER_APP("DIFT","DLT Interface Test");
+ /* Register APP */
+ DLT_REGISTER_APP("DIFT","DLT Interface Test");
- /* Register CONTEXTS... */
- DLT_REGISTER_CONTEXT(context_info,"INFO","Information context");
+ /* Register CONTEXTS... */
+ DLT_REGISTER_CONTEXT(context_info,"INFO","Information context");
/* Tests starting */
printf("Tests starting\n");
@@ -214,7 +214,7 @@ int main(int argc, char* argv[])
/* wait 3 seconds before starting */
//sleep(3);
- testall(nvalue,rvalue,dvalue,svalue);
+ testall(nvalue,rvalue,dvalue,svalue);
/* Tests finished */
printf("Tests finished\n");
@@ -223,10 +223,10 @@ int main(int argc, char* argv[])
/* wait 3 seconds before terminating application */
//sleep(3);
- /* Unregister CONTEXTS... */
- DLT_UNREGISTER_CONTEXT(context_info);
+ /* Unregister CONTEXTS... */
+ DLT_UNREGISTER_CONTEXT(context_info);
- /* Unregister APP */
+ /* Unregister APP */
DLT_UNREGISTER_APP();
return 0;
@@ -238,7 +238,7 @@ int main(int argc, char* argv[])
int testall(int count,int repeat,int delay,int size)
{
- char buffer[size];
+ char buffer[size];
int num,rnum;
for(num=0;num< size;num++)
@@ -246,24 +246,24 @@ int testall(int count,int repeat,int delay,int size)
buffer[num] = num;
}
- /* Test All: Test all start */
+ /* Test All: Test all start */
//printf("Test1: Test all\n");
//DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test1: Test all"));
- for(rnum=0;rnum<repeat;rnum++)
- {
- for(num=1;num<=count;num++)
- {
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_INT(num),DLT_RAW(buffer, size));
- usleep(delay);
- }
- }
+ for(rnum=0;rnum<repeat;rnum++)
+ {
+ for(num=1;num<=count;num++)
+ {
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_INT(num),DLT_RAW(buffer, size));
+ usleep(delay);
+ }
+ }
- /* wait 5 seconds after test */
+ /* wait 5 seconds after test */
//sleep(5);
- //DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test1: finished"));
+ //DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test1: finished"));
- return 0;
+ return 0;
}
diff --git a/src/tests/dlt-test-stress.c b/src/tests/dlt-test-stress.c
index 59e11f7..14067f1 100644
--- a/src/tests/dlt-test-stress.c
+++ b/src/tests/dlt-test-stress.c
@@ -221,15 +221,15 @@ int main(int argc, char* argv[])
if (test[0])
{
- stress1();
+ stress1();
}
if (test[1])
{
- stress2();
+ stress2();
}
if (test[2])
{
- stress3();
+ stress3();
}
DLT_UNREGISTER_APP();
@@ -301,7 +301,7 @@ void stress2(void)
ret=pthread_create(&(thread[index]), NULL, (void *) &thread_function, (void *) &(thread_data[index]));
if (ret!=0)
{
- printf("Error creating thread %d: %s \n", index, strerror(errno));
+ printf("Error creating thread %d: %s \n", index, strerror(errno));
}
usleep(1000);
@@ -309,7 +309,7 @@ void stress2(void)
for (index=0;index<STRESS2_MAX_NUM_THREADS;index++)
{
- pthread_join(thread[index], NULL);
+ pthread_join(thread[index], NULL);
}
printf("Finished stress test2 \n\n");
diff --git a/src/tests/dlt-test-user.c b/src/tests/dlt-test-user.c
index 282832f..3abe9d8 100644
--- a/src/tests/dlt-test-user.c
+++ b/src/tests/dlt-test-user.c
@@ -124,36 +124,36 @@ DltContextData context_data;
*/
void usage()
{
- char version[255];
-
- dlt_get_version(version,255);
-
- printf("Usage: dlt-test-user [options]\n");
- printf("Test user application providing several Tests.\n");
- printf("%s \n", version);
- printf("Options:\n");
- printf(" -v Verbose mode\n");
- printf(" -f filename Use local log file instead of sending to daemon\n");
- printf(" -n count Repeats of tests (Default: 1)\n");
- printf("Tests:\n");
- printf(" 1m: (Macro IF) Test all log levels\n");
- printf(" 2m: (Macro IF) Test all variable types (verbose) \n");
- printf(" 3m: (Macro IF) Test all variable types (non-verbose) \n");
- printf(" 4m: (Macro IF) Test different message sizes\n");
- printf(" 5m: (Macro IF) Test high-level API\n");
- printf(" 6m: (Macro IF) Test local printing\n");
- printf(" 7m: (Macro IF) Test network trace\n");
- printf(" 8m: (Macro IF) Test truncated network trace\n");
- printf(" 9m: (Macro IF) Test segmented network trace\n");
- printf(" 1f: (Function IF) Test all log levels\n");
- printf(" 2f: (Function IF) Test all variable types (verbose) \n");
- printf(" 3f: (Function IF) Test all variable types (non-verbose) \n");
- printf(" 4f: (Function IF) Test different message sizes\n");
- printf(" 5f: (Function IF) Test high-level API\n");
- printf(" 6f: (Function IF) Test local printing\n");
- printf(" 7f: (Function IF) Test network trace\n");
- printf(" 8f: (Function IF) Test truncated network trace\n");
- printf(" 9f: (Function IF) Test segmented network trace\n");
+ char version[255];
+
+ dlt_get_version(version,255);
+
+ printf("Usage: dlt-test-user [options]\n");
+ printf("Test user application providing several Tests.\n");
+ printf("%s \n", version);
+ printf("Options:\n");
+ printf(" -v Verbose mode\n");
+ printf(" -f filename Use local log file instead of sending to daemon\n");
+ printf(" -n count Repeats of tests (Default: 1)\n");
+ printf("Tests:\n");
+ printf(" 1m: (Macro IF) Test all log levels\n");
+ printf(" 2m: (Macro IF) Test all variable types (verbose) \n");
+ printf(" 3m: (Macro IF) Test all variable types (non-verbose) \n");
+ printf(" 4m: (Macro IF) Test different message sizes\n");
+ printf(" 5m: (Macro IF) Test high-level API\n");
+ printf(" 6m: (Macro IF) Test local printing\n");
+ printf(" 7m: (Macro IF) Test network trace\n");
+ printf(" 8m: (Macro IF) Test truncated network trace\n");
+ printf(" 9m: (Macro IF) Test segmented network trace\n");
+ printf(" 1f: (Function IF) Test all log levels\n");
+ printf(" 2f: (Function IF) Test all variable types (verbose) \n");
+ printf(" 3f: (Function IF) Test all variable types (non-verbose) \n");
+ printf(" 4f: (Function IF) Test different message sizes\n");
+ printf(" 5f: (Function IF) Test high-level API\n");
+ printf(" 6f: (Function IF) Test local printing\n");
+ printf(" 7f: (Function IF) Test network trace\n");
+ printf(" 8f: (Function IF) Test truncated network trace\n");
+ printf(" 9f: (Function IF) Test segmented network trace\n");
}
/**
@@ -167,15 +167,15 @@ int main(int argc, char* argv[])
int c;
- int i;
- char ctid[4], ctdesc[255];
+ int i;
+ char ctid[4], ctdesc[255];
- int num,maxnum;
+ int num,maxnum;
opterr = 0;
while ((c = getopt (argc, argv, "vf:n:")) != -1)
- {
+ {
switch (c)
{
case 'v':
@@ -217,7 +217,7 @@ int main(int argc, char* argv[])
return -1;//for parasoft
}
}
- }
+ }
if (fvalue)
{
@@ -237,43 +237,43 @@ int main(int argc, char* argv[])
maxnum = 1;
}
- /* Register APP */
- DLT_REGISTER_APP("DIFT","DLT Interface Test");
+ /* Register APP */
+ DLT_REGISTER_APP("DIFT","DLT Interface Test");
- /* Register CONTEXTS... */
- DLT_REGISTER_CONTEXT(context_info,"INFO","Information context");
+ /* Register CONTEXTS... */
+ DLT_REGISTER_CONTEXT(context_info,"INFO","Information context");
- /* used for macro interface tests */
- DLT_REGISTER_CONTEXT(context_macro_callback,"CBM","Callback Test context for macro interface");
- for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
- {
- snprintf(ctid,4,"TM%d",i+1);
- snprintf(ctdesc,255,"Test %d context for macro interface",i+1);
- DLT_REGISTER_CONTEXT(context_macro_test[i],ctid,ctdesc);
- }
+ /* used for macro interface tests */
+ DLT_REGISTER_CONTEXT(context_macro_callback,"CBM","Callback Test context for macro interface");
+ for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
+ {
+ snprintf(ctid,4,"TM%d",i+1);
+ snprintf(ctdesc,255,"Test %d context for macro interface",i+1);
+ DLT_REGISTER_CONTEXT(context_macro_test[i],ctid,ctdesc);
+ }
- /* used for function interface tests */
- dlt_register_context(&context_function_callback,"CBF","Callback Test context for function interface");
- for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
- {
- snprintf(ctid,4,"TF%d",i+1);
- snprintf(ctdesc,255,"Test %d context for function interface",i+1);
- dlt_register_context(&(context_function_test[i]),ctid,ctdesc);
- }
+ /* used for function interface tests */
+ dlt_register_context(&context_function_callback,"CBF","Callback Test context for function interface");
+ for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
+ {
+ snprintf(ctid,4,"TF%d",i+1);
+ snprintf(ctdesc,255,"Test %d context for function interface",i+1);
+ dlt_register_context(&(context_function_test[i]),ctid,ctdesc);
+ }
- /* Register callbacks... */
+ /* Register callbacks... */
- /* with macro interface */
- DLT_LOG(context_macro_callback,DLT_LOG_INFO,DLT_STRING("Register callback (Macro Interface) for Injection ID: 0xFFF"));
- DLT_REGISTER_INJECTION_CALLBACK(context_macro_callback, 0xFFF, test_injection_macro_callback);
+ /* with macro interface */
+ DLT_LOG(context_macro_callback,DLT_LOG_INFO,DLT_STRING("Register callback (Macro Interface) for Injection ID: 0xFFF"));
+ DLT_REGISTER_INJECTION_CALLBACK(context_macro_callback, 0xFFF, test_injection_macro_callback);
- /* with function interface */
- if (dlt_user_log_write_start(&context_function_callback,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Register callback (Function Interface) for Injection ID: 0xFFF");
- dlt_user_log_write_finish(&context_data);
+ /* with function interface */
+ if (dlt_user_log_write_start(&context_function_callback,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Register callback (Function Interface) for Injection ID: 0xFFF");
+ dlt_user_log_write_finish(&context_data);
}
- dlt_register_injection_callback(&context_function_callback, 0xFFF, test_injection_function_callback);
+ dlt_register_injection_callback(&context_function_callback, 0xFFF, test_injection_function_callback);
/* Tests starting */
printf("Tests starting\n");
@@ -284,31 +284,31 @@ int main(int argc, char* argv[])
for (num=0;num<maxnum;num++)
{
- /* Execute tests... */
-
- /* with macro interface */
- test1m();
- test2m();
- test3m();
- test4m();
- test5m();
- test6m();
- test7m();
- test8m();
- test9m();
-
- /* with function interface */
- test1f();
- test2f();
- test3f();
- test4f();
- test5f();
- test6f();
- test7f();
- test8f();
- test9f();
-
- /* wait 1 second before next repeat of tests */
+ /* Execute tests... */
+
+ /* with macro interface */
+ test1m();
+ test2m();
+ test3m();
+ test4m();
+ test5m();
+ test6m();
+ test7m();
+ test8m();
+ test9m();
+
+ /* with function interface */
+ test1f();
+ test2f();
+ test3f();
+ test4f();
+ test5f();
+ test6f();
+ test7f();
+ test8f();
+ test9f();
+
+ /* wait 1 second before next repeat of tests */
sleep(1);
}
@@ -319,24 +319,24 @@ int main(int argc, char* argv[])
/* wait 3 seconds before terminating application */
sleep(3);
- /* Unregister CONTEXTS... */
- DLT_UNREGISTER_CONTEXT(context_info);
+ /* Unregister CONTEXTS... */
+ DLT_UNREGISTER_CONTEXT(context_info);
- /* used for macro interface tests */
- for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
- {
- DLT_UNREGISTER_CONTEXT(context_macro_test[i]);
- }
- DLT_UNREGISTER_CONTEXT(context_macro_callback);
+ /* used for macro interface tests */
+ for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
+ {
+ DLT_UNREGISTER_CONTEXT(context_macro_test[i]);
+ }
+ DLT_UNREGISTER_CONTEXT(context_macro_callback);
- /* used for function interface tests */
- for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
- {
- dlt_unregister_context(&(context_function_test[i]));
- }
- dlt_unregister_context(&context_function_callback);
+ /* used for function interface tests */
+ for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
+ {
+ dlt_unregister_context(&(context_function_test[i]));
+ }
+ dlt_unregister_context(&context_function_callback);
- /* Unregister APP */
+ /* Unregister APP */
DLT_UNREGISTER_APP();
return 0;
@@ -348,7 +348,7 @@ int main(int argc, char* argv[])
int test1m(void)
{
- /* Test 1: (Macro IF) Test all log levels */
+ /* Test 1: (Macro IF) Test all log levels */
printf("Test1m: (Macro IF) Test all log levels\n");
DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test1: (Macro IF) Test all log levels"));
@@ -359,19 +359,19 @@ int test1m(void)
DLT_LOG(context_macro_test[0],DLT_LOG_DEBUG,DLT_STRING("debug"));
DLT_LOG(context_macro_test[0],DLT_LOG_VERBOSE,DLT_STRING("verbose"));
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test1: (Macro IF) finished"));
- return 0;
+ return 0;
}
int test2m(void)
{
- char buffer[10];
+ char buffer[10];
int num2;
- /* Test 2: (Macro IF) Test all variable types (verbose) */
+ /* Test 2: (Macro IF) Test all variable types (verbose) */
printf("Test2m: (Macro IF) Test all variable types (verbose)\n");
DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test2: (Macro IF) Test all variable types (verbose)"));
@@ -398,23 +398,23 @@ int test2m(void)
DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("raw"),DLT_RAW(buffer,10));
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test2: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test2: (Macro IF) finished"));
- return 0;
+ return 0;
}
int test3m(void)
{
- char buffer[10];
+ char buffer[10];
int num2;
- /* Test 3: (Macro IF) Test all variable types (non-verbose) */
+ /* Test 3: (Macro IF) Test all variable types (non-verbose) */
printf("Test3m: (Macro IF) Test all variable types (non-verbose)\n");
DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test3: (Macro IF) Test all variable types (non-verbose)"));
- DLT_NONVERBOSE_MODE();
+ DLT_NONVERBOSE_MODE();
DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,1,DLT_STRING("string"),DLT_STRING("Hello world"));
DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,2,DLT_STRING("utf8"),DLT_UTF8("Hello world"));
@@ -439,18 +439,18 @@ int test3m(void)
}
DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,14,DLT_STRING("raw"),DLT_RAW(buffer,10));
- DLT_VERBOSE_MODE();
+ DLT_VERBOSE_MODE();
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test3: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test3: (Macro IF) finished"));
- return 0;
+ return 0;
}
int test4m(void)
{
- char buffer[1024];
+ char buffer[1024];
int num;
for(num=0;num<1024;num++)
@@ -458,7 +458,7 @@ int test4m(void)
buffer[num] = num;
}
- /* Test 4: (Macro IF) Message size test */
+ /* Test 4: (Macro IF) Message size test */
printf("Test4m: (Macro IF) Test different message sizes\n");
DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test4: (Macro IF) Test different message sizes"));
@@ -467,16 +467,16 @@ int test4m(void)
DLT_LOG(context_macro_test[3],DLT_LOG_INFO,DLT_STRING("256"),DLT_RAW(buffer,256));
DLT_LOG(context_macro_test[3],DLT_LOG_INFO,DLT_STRING("1024"),DLT_RAW(buffer,1024));
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test4: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test4: (Macro IF) finished"));
- return 0;
+ return 0;
}
int test5m(void)
{
- char buffer[32];
+ char buffer[32];
int num;
for(num=0;num<32;num++)
@@ -484,57 +484,57 @@ int test5m(void)
buffer[num] = num;
}
- /* Test 5: (Macro IF) Test high-level API */
+ /* Test 5: (Macro IF) Test high-level API */
printf("Test5m: (Macro IF) Test high-level API\n");
DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test5: (Macro IF) Test high-level API"));
- DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_INT"));
- DLT_LOG_INT(context_macro_test[4], DLT_LOG_INFO, -42);
+ DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_INT"));
+ DLT_LOG_INT(context_macro_test[4], DLT_LOG_INFO, -42);
- DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_UINT"));
- DLT_LOG_UINT(context_macro_test[4], DLT_LOG_INFO, 42);
+ DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_UINT"));
+ DLT_LOG_UINT(context_macro_test[4], DLT_LOG_INFO, 42);
- DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING"));
- DLT_LOG_STRING(context_macro_test[4], DLT_LOG_INFO, "String output");
+ DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING"));
+ DLT_LOG_STRING(context_macro_test[4], DLT_LOG_INFO, "String output");
- DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_RAW"));
- DLT_LOG_RAW(context_macro_test[4],DLT_LOG_INFO, buffer,16);
+ DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_RAW"));
+ DLT_LOG_RAW(context_macro_test[4],DLT_LOG_INFO, buffer,16);
- DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING_INT"));
- DLT_LOG_STRING_INT(context_macro_test[4], DLT_LOG_INFO, "String output: ", -42);
+ DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING_INT"));
+ DLT_LOG_STRING_INT(context_macro_test[4], DLT_LOG_INFO, "String output: ", -42);
- DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING_UINT"));
- DLT_LOG_STRING_UINT(context_macro_test[4], DLT_LOG_INFO,"String output: ", 42);
+ DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING_UINT"));
+ DLT_LOG_STRING_UINT(context_macro_test[4], DLT_LOG_INFO,"String output: ", 42);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test5: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test5: (Macro IF) finished"));
- return 0;
+ return 0;
}
int test6m(void)
{
- /* Test 6: (Macro IF) Test local printing */
- printf("Test6m: (Macro IF) Test local printing\n");
+ /* Test 6: (Macro IF) Test local printing */
+ printf("Test6m: (Macro IF) Test local printing\n");
DLT_LOG_STRING(context_info, DLT_LOG_INFO, "Test 6: (Macro IF) Test local printing");
- DLT_ENABLE_LOCAL_PRINT();
- DLT_LOG_STRING(context_macro_test[5], DLT_LOG_INFO, "Message (visible: locally printed)");
+ DLT_ENABLE_LOCAL_PRINT();
+ DLT_LOG_STRING(context_macro_test[5], DLT_LOG_INFO, "Message (visible: locally printed)");
- DLT_DISABLE_LOCAL_PRINT();
- DLT_LOG_STRING(context_macro_test[5], DLT_LOG_INFO, "Message (invisible: not locally printed)");
+ DLT_DISABLE_LOCAL_PRINT();
+ DLT_LOG_STRING(context_macro_test[5], DLT_LOG_INFO, "Message (invisible: not locally printed)");
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test6: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test6: (Macro IF) finished"));
- return 0;
+ return 0;
}
int test7m(void)
{
- char buffer[32];
+ char buffer[32];
int num;
for(num=0;num<32;num++)
@@ -542,32 +542,32 @@ int test7m(void)
buffer[num] = num;
}
- /* Show all log messages and traces */
- DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
+ /* Show all log messages and traces */
+ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
- /* Test 7: (Macro IF) Test network trace */
- printf("Test7m: (Macro IF) Test network trace\n");
+ /* Test 7: (Macro IF) Test network trace */
+ printf("Test7m: (Macro IF) Test network trace\n");
DLT_LOG_STRING(context_info, DLT_LOG_INFO, "Test 7: (Macro IF) Test network trace");
- /* Dummy messages: 16 byte header, 32 byte payload */
- DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_IPC, 16, buffer, 32, buffer);
- DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_CAN, 16, buffer, 32, buffer);
- DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_FLEXRAY, 16, buffer, 32, buffer);
- DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_MOST, 16, buffer, 32, buffer);
+ /* Dummy messages: 16 byte header, 32 byte payload */
+ DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_IPC, 16, buffer, 32, buffer);
+ DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_CAN, 16, buffer, 32, buffer);
+ DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_FLEXRAY, 16, buffer, 32, buffer);
+ DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_MOST, 16, buffer, 32, buffer);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test7: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test7: (Macro IF) finished"));
- DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
- sleep(2);
+ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
+ sleep(2);
- return 0;
+ return 0;
}
int test8m(void)
{
- char buffer[1024*5];
+ char buffer[1024*5];
int num;
for(num=0;num<1024*5;num++)
@@ -575,32 +575,32 @@ int test8m(void)
buffer[num] = num;
}
- /* Show all log messages and traces */
- DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
+ /* Show all log messages and traces */
+ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
- /* Test 8: (Macro IF) Test truncated network trace*/
- printf("Test8m: (Macro IF) Test truncated network trace\n");
+ /* Test 8: (Macro IF) Test truncated network trace*/
+ printf("Test8m: (Macro IF) Test truncated network trace\n");
DLT_LOG_STRING(context_info, DLT_LOG_INFO, "Test 8: (Macro IF) Test truncated network trace");
- /* Dummy messages: 16 byte header, 5k payload */
- DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer);
- DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer);
- DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer);
- DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer);
+ /* Dummy messages: 16 byte header, 5k payload */
+ DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer);
+ DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer);
+ DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer);
+ DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test8: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test8: (Macro IF) finished"));
- DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
- sleep(2);
+ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
+ sleep(2);
- return 0;
+ return 0;
}
int test9m(void)
{
- char buffer[1024*5];
+ char buffer[1024*5];
int num;
for(num=0;num<1024*5;num++)
@@ -608,176 +608,176 @@ int test9m(void)
buffer[num] = num;
}
- /* Show all log messages and traces */
- DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
+ /* Show all log messages and traces */
+ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
- /* Test 9: (Macro IF) Test segmented network trace*/
- printf("Test9m: (Macro IF) Test segmented network trace\n");
+ /* Test 9: (Macro IF) Test segmented network trace*/
+ printf("Test9m: (Macro IF) Test segmented network trace\n");
DLT_LOG_STRING(context_info, DLT_LOG_INFO, "Test 9: (Macro IF) Test segmented network trace");
- /* Dummy messages: 16 byte header, 5k payload */
- DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer);
- DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer);
- DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer);
- DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer);
+ /* Dummy messages: 16 byte header, 5k payload */
+ DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer);
+ DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer);
+ DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer);
+ DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test9: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test9: (Macro IF) finished"));
- DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
- sleep(2);
+ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
+ sleep(2);
- return 0;
+ return 0;
}
int test1f(void)
{
- /* Test 1: (Function IF) Test all log levels */
+ /* Test 1: (Function IF) Test all log levels */
printf("Test1f: (Function IF) Test all log levels\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test1: (Function IF) Test all log levels");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test1: (Function IF) Test all log levels");
+ dlt_user_log_write_finish(&context_data);
}
- if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_FATAL)>0)
- {
- dlt_user_log_write_string(&context_data,"fatal");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_FATAL)>0)
+ {
+ dlt_user_log_write_string(&context_data,"fatal");
+ dlt_user_log_write_finish(&context_data);
}
- if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_ERROR)>0)
- {
- dlt_user_log_write_string(&context_data,"error");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_ERROR)>0)
+ {
+ dlt_user_log_write_string(&context_data,"error");
+ dlt_user_log_write_finish(&context_data);
}
- if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_WARN)>0)
- {
- dlt_user_log_write_string(&context_data,"warn");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_WARN)>0)
+ {
+ dlt_user_log_write_string(&context_data,"warn");
+ dlt_user_log_write_finish(&context_data);
}
- if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"info");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"info");
+ dlt_user_log_write_finish(&context_data);
}
- if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_DEBUG)>0)
- {
- dlt_user_log_write_string(&context_data,"debug");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_DEBUG)>0)
+ {
+ dlt_user_log_write_string(&context_data,"debug");
+ dlt_user_log_write_finish(&context_data);
}
- if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_VERBOSE)>0)
- {
- dlt_user_log_write_string(&context_data,"verbose");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_VERBOSE)>0)
+ {
+ dlt_user_log_write_string(&context_data,"verbose");
+ dlt_user_log_write_finish(&context_data);
}
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test1: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test1: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- return 0;
+ return 0;
}
int test2f(void)
{
- char buffer[10];
+ char buffer[10];
int num2;
- /* Test 2: (Function IF) Test all variable types (verbose) */
+ /* Test 2: (Function IF) Test all variable types (verbose) */
printf("Test2f: (Function IF) Test all variable types (verbose)\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test2: (Function IF) Test all variable types (verbose)");
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"bool");
- dlt_user_log_write_bool(&context_data,1);
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"int");
- dlt_user_log_write_int(&context_data,INT32_MIN); /* (-2147483647-1) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"int8");
- dlt_user_log_write_int8(&context_data,INT8_MIN); /* (-128) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"int16");
- dlt_user_log_write_int16(&context_data,INT16_MIN); /* (-32767-1) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"int32");
- dlt_user_log_write_int32(&context_data,INT32_MIN); /* (-2147483647-1) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"int64");
- dlt_user_log_write_int64(&context_data,INT64_MIN); /* (-__INT64_C(9223372036854775807)-1) */
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"uint");
- dlt_user_log_write_uint(&context_data,UINT32_MAX); /* (4294967295U) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"uint8");
- dlt_user_log_write_uint8(&context_data,UINT8_MAX); /* (255) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"uint16");
- dlt_user_log_write_uint16(&context_data,UINT16_MAX); /* (65535) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"uint32");
- dlt_user_log_write_uint32(&context_data,UINT32_MAX); /* (4294967295U) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"uint64");
- dlt_user_log_write_uint64(&context_data,UINT64_MAX); /* (__UINT64_C(18446744073709551615)) */
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"float32");
- dlt_user_log_write_float32(&context_data,FLT_MIN);
- dlt_user_log_write_float32(&context_data,FLT_MAX);
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"float64");
- dlt_user_log_write_float64(&context_data,DBL_MIN);
- dlt_user_log_write_float64(&context_data,DBL_MAX);
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test2: (Function IF) Test all variable types (verbose)");
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"bool");
+ dlt_user_log_write_bool(&context_data,1);
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int");
+ dlt_user_log_write_int(&context_data,INT32_MIN); /* (-2147483647-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int8");
+ dlt_user_log_write_int8(&context_data,INT8_MIN); /* (-128) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int16");
+ dlt_user_log_write_int16(&context_data,INT16_MIN); /* (-32767-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int32");
+ dlt_user_log_write_int32(&context_data,INT32_MIN); /* (-2147483647-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int64");
+ dlt_user_log_write_int64(&context_data,INT64_MIN); /* (-__INT64_C(9223372036854775807)-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint");
+ dlt_user_log_write_uint(&context_data,UINT32_MAX); /* (4294967295U) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint8");
+ dlt_user_log_write_uint8(&context_data,UINT8_MAX); /* (255) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint16");
+ dlt_user_log_write_uint16(&context_data,UINT16_MAX); /* (65535) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint32");
+ dlt_user_log_write_uint32(&context_data,UINT32_MAX); /* (4294967295U) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint64");
+ dlt_user_log_write_uint64(&context_data,UINT64_MAX); /* (__UINT64_C(18446744073709551615)) */
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"float32");
+ dlt_user_log_write_float32(&context_data,FLT_MIN);
+ dlt_user_log_write_float32(&context_data,FLT_MAX);
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"float64");
+ dlt_user_log_write_float64(&context_data,DBL_MIN);
+ dlt_user_log_write_float64(&context_data,DBL_MAX);
+ dlt_user_log_write_finish(&context_data);
}
for(num2=0;num2<10;num2++)
@@ -785,151 +785,151 @@ int test2f(void)
buffer[num2] = num2;
}
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"raw");
- dlt_user_log_write_raw(&context_data,buffer,10);
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"raw");
+ dlt_user_log_write_raw(&context_data,buffer,10);
+ dlt_user_log_write_finish(&context_data);
}
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test2: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test2: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- return 0;
+ return 0;
}
int test3f(void)
{
- char buffer[10];
+ char buffer[10];
int num2;
- /* Test 3: (Function IF) Test all variable types (non-verbose) */
+ /* Test 3: (Function IF) Test all variable types (non-verbose) */
printf("Test3f: (Function IF) Test all variable types (non-verbose)\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test3: (Function IF) Test all variable types (non-verbose)");
- dlt_user_log_write_finish(&context_data);
- }
-
- dlt_nonverbose_mode();
-
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,1)>0) // bug mb: we have to compare against >0. in case of error -1 is returned!
- {
- dlt_user_log_write_string(&context_data,"bool");
- dlt_user_log_write_bool(&context_data,1);
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,2)>0)
- {
- dlt_user_log_write_string(&context_data,"int");
- dlt_user_log_write_int(&context_data,INT32_MIN); /* (-2147483647-1) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,3)>0)
- {
- dlt_user_log_write_string(&context_data,"int8");
- dlt_user_log_write_int8(&context_data,INT8_MIN); /* (-128) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,4)>0)
- {
- dlt_user_log_write_string(&context_data,"int16");
- dlt_user_log_write_int16(&context_data,INT16_MIN); /* (-32767-1) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,5)>0)
- {
- dlt_user_log_write_string(&context_data,"int32");
- dlt_user_log_write_int32(&context_data,INT32_MIN); /* (-2147483647-1) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,6)>0)
- {
- dlt_user_log_write_string(&context_data,"int64");
- dlt_user_log_write_int64(&context_data,INT64_MIN); /* (-__INT64_C(9223372036854775807)-1) */
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,7)>0)
- {
- dlt_user_log_write_string(&context_data,"uint");
- dlt_user_log_write_uint(&context_data,UINT32_MAX); /* (4294967295U) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,8)>0)
- {
- dlt_user_log_write_string(&context_data,"uint8");
- dlt_user_log_write_uint8(&context_data,UINT8_MAX); /* (255) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,9)>0)
- {
- dlt_user_log_write_string(&context_data,"uint16");
- dlt_user_log_write_uint16(&context_data,UINT16_MAX); /* (65535) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,10)>0)
- {
- dlt_user_log_write_string(&context_data,"uint32");
- dlt_user_log_write_uint32(&context_data,UINT32_MAX); /* (4294967295U) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,11)>0)
- {
- dlt_user_log_write_string(&context_data,"uint64");
- dlt_user_log_write_uint64(&context_data,UINT64_MAX); /* (__UINT64_C(18446744073709551615)) */
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,12)>0)
- {
- dlt_user_log_write_string(&context_data,"float32");
- dlt_user_log_write_float32(&context_data,FLT_MIN);
- dlt_user_log_write_float32(&context_data,FLT_MAX);
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,13)>0)
- {
- dlt_user_log_write_string(&context_data,"float64");
- dlt_user_log_write_float64(&context_data,DBL_MIN);
- dlt_user_log_write_float64(&context_data,DBL_MAX);
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test3: (Function IF) Test all variable types (non-verbose)");
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ dlt_nonverbose_mode();
+
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,1)>0) // bug mb: we have to compare against >0. in case of error -1 is returned!
+ {
+ dlt_user_log_write_string(&context_data,"bool");
+ dlt_user_log_write_bool(&context_data,1);
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,2)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int");
+ dlt_user_log_write_int(&context_data,INT32_MIN); /* (-2147483647-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,3)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int8");
+ dlt_user_log_write_int8(&context_data,INT8_MIN); /* (-128) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,4)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int16");
+ dlt_user_log_write_int16(&context_data,INT16_MIN); /* (-32767-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,5)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int32");
+ dlt_user_log_write_int32(&context_data,INT32_MIN); /* (-2147483647-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,6)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int64");
+ dlt_user_log_write_int64(&context_data,INT64_MIN); /* (-__INT64_C(9223372036854775807)-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,7)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint");
+ dlt_user_log_write_uint(&context_data,UINT32_MAX); /* (4294967295U) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,8)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint8");
+ dlt_user_log_write_uint8(&context_data,UINT8_MAX); /* (255) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,9)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint16");
+ dlt_user_log_write_uint16(&context_data,UINT16_MAX); /* (65535) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,10)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint32");
+ dlt_user_log_write_uint32(&context_data,UINT32_MAX); /* (4294967295U) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,11)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint64");
+ dlt_user_log_write_uint64(&context_data,UINT64_MAX); /* (__UINT64_C(18446744073709551615)) */
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,12)>0)
+ {
+ dlt_user_log_write_string(&context_data,"float32");
+ dlt_user_log_write_float32(&context_data,FLT_MIN);
+ dlt_user_log_write_float32(&context_data,FLT_MAX);
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,13)>0)
+ {
+ dlt_user_log_write_string(&context_data,"float64");
+ dlt_user_log_write_float64(&context_data,DBL_MIN);
+ dlt_user_log_write_float64(&context_data,DBL_MAX);
+ dlt_user_log_write_finish(&context_data);
}
for(num2=0;num2<10;num2++)
{
buffer[num2] = num2;
- }
+ }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,14)>0)
- {
- dlt_user_log_write_string(&context_data,"raw");
- dlt_user_log_write_raw(&context_data,buffer,10);
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,14)>0)
+ {
+ dlt_user_log_write_string(&context_data,"raw");
+ dlt_user_log_write_raw(&context_data,buffer,10);
+ dlt_user_log_write_finish(&context_data);
}
- dlt_verbose_mode();
+ dlt_verbose_mode();
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test3: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test3: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- return 0;
+ return 0;
}
int test4f(void)
{
- char buffer[1024];
+ char buffer[1024];
int num;
for(num=0;num<1024;num++)
@@ -937,53 +937,53 @@ int test4f(void)
buffer[num] = num;
}
- /* Test 4: (Function IF) Message size test */
+ /* Test 4: (Function IF) Message size test */
printf("Test4f: (Function IF) Test different message sizes\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test4: (Function IF) Test different message sizes");
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"1");
- dlt_user_log_write_raw(&context_data,buffer,1);
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"16");
- dlt_user_log_write_raw(&context_data,buffer,16);
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"256");
- dlt_user_log_write_raw(&context_data,buffer,256);
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"1024");
- dlt_user_log_write_raw(&context_data,buffer,1024);
- dlt_user_log_write_finish(&context_data);
- }
-
- /* wait 2 second before next test */
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test4: (Function IF) Test different message sizes");
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"1");
+ dlt_user_log_write_raw(&context_data,buffer,1);
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"16");
+ dlt_user_log_write_raw(&context_data,buffer,16);
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"256");
+ dlt_user_log_write_raw(&context_data,buffer,256);
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"1024");
+ dlt_user_log_write_raw(&context_data,buffer,1024);
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test4: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test4: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- return 0;
+ return 0;
}
int test5f(void)
{
- char buffer[32];
+ char buffer[32];
int num;
for(num=0;num<32;num++)
@@ -991,73 +991,73 @@ int test5f(void)
buffer[num] = num;
}
- /* Test 5: (Function IF) Test high-level API */
+ /* Test 5: (Function IF) Test high-level API */
printf("Test5f: (Function IF) Test high-level API\n");
- dlt_log_string(&context_info,DLT_LOG_INFO,"Test5: (Function IF) Test high-level API");
+ dlt_log_string(&context_info,DLT_LOG_INFO,"Test5: (Function IF) Test high-level API");
- dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_int()");
- dlt_log_int(&(context_function_test[4]),DLT_LOG_INFO, -42);
+ dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_int()");
+ dlt_log_int(&(context_function_test[4]),DLT_LOG_INFO, -42);
- dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_uint()");
- dlt_log_uint(&(context_function_test[4]),DLT_LOG_INFO, 42);
+ dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_uint()");
+ dlt_log_uint(&(context_function_test[4]),DLT_LOG_INFO, 42);
- dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string()");
- dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO, "String output");
+ dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string()");
+ dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO, "String output");
- dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_raw()");
- dlt_log_raw(&(context_function_test[4]),DLT_LOG_INFO, buffer,16);
+ dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_raw()");
+ dlt_log_raw(&(context_function_test[4]),DLT_LOG_INFO, buffer,16);
- dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string_int()");
- dlt_log_string_int(&(context_function_test[4]), DLT_LOG_INFO, "String output: ", -42);
+ dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string_int()");
+ dlt_log_string_int(&(context_function_test[4]), DLT_LOG_INFO, "String output: ", -42);
- dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string_uint()");
- dlt_log_string_uint(&(context_function_test[4]), DLT_LOG_INFO,"String output: ", 42);
+ dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string_uint()");
+ dlt_log_string_uint(&(context_function_test[4]), DLT_LOG_INFO,"String output: ", 42);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- dlt_log_string(&context_info,DLT_LOG_INFO,"Test5: (Function IF) finished");
+ dlt_log_string(&context_info,DLT_LOG_INFO,"Test5: (Function IF) finished");
- return 0;
+ return 0;
}
int test6f(void)
{
- /* Test 6: (Function IF) Test local printing */
- printf("Test6f: (Function IF) Test local printing\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test 6: (Function IF) Test local printing");
- dlt_user_log_write_finish(&context_data);
+ /* Test 6: (Function IF) Test local printing */
+ printf("Test6f: (Function IF) Test local printing\n");
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test 6: (Function IF) Test local printing");
+ dlt_user_log_write_finish(&context_data);
}
- dlt_enable_local_print();
- if (dlt_user_log_write_start(&(context_function_test[5]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Message (visible: locally printed)");
- dlt_user_log_write_finish(&context_data);
+ dlt_enable_local_print();
+ if (dlt_user_log_write_start(&(context_function_test[5]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Message (visible: locally printed)");
+ dlt_user_log_write_finish(&context_data);
}
- dlt_disable_local_print();
- if (dlt_user_log_write_start(&(context_function_test[5]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Message (invisible: not locally printed)");
- dlt_user_log_write_finish(&context_data);
+ dlt_disable_local_print();
+ if (dlt_user_log_write_start(&(context_function_test[5]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Message (invisible: not locally printed)");
+ dlt_user_log_write_finish(&context_data);
}
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test6: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test6: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- return 0;
+ return 0;
}
int test7f(void)
{
- char buffer[32];
+ char buffer[32];
int num;
for(num=0;num<32;num++)
@@ -1065,40 +1065,40 @@ int test7f(void)
buffer[num] = num;
}
- /* Show all log messages and traces */
- dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
+ /* Show all log messages and traces */
+ dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
- /* Test 7: (Function IF) Test network trace */
- printf("Test7f: (Function IF) Test network trace\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test 7: (Function IF) Test network trace");
- dlt_user_log_write_finish(&context_data);
+ /* Test 7: (Function IF) Test network trace */
+ printf("Test7f: (Function IF) Test network trace\n");
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test 7: (Function IF) Test network trace");
+ dlt_user_log_write_finish(&context_data);
}
- /* Dummy message: 16 byte header, 32 byte payload */
- dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_IPC, 16, buffer, 32, buffer);
- dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_CAN, 16, buffer, 32, buffer);
- dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 32, buffer);
- dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_MOST, 16, buffer, 32, buffer);
+ /* Dummy message: 16 byte header, 32 byte payload */
+ dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_IPC, 16, buffer, 32, buffer);
+ dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_CAN, 16, buffer, 32, buffer);
+ dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 32, buffer);
+ dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_MOST, 16, buffer, 32, buffer);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test7: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test7: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- dlt_set_application_ll_ts_limit(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
- sleep(2);
+ dlt_set_application_ll_ts_limit(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
+ sleep(2);
- return 0;
+ return 0;
}
int test8f(void)
{
- char buffer[1024*5];
+ char buffer[1024*5];
int num;
for(num=0;num<1024*5;num++)
@@ -1106,40 +1106,40 @@ int test8f(void)
buffer[num] = num;
}
- /* Show all log messages and traces */
- dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
+ /* Show all log messages and traces */
+ dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
- /* Test 8: (Function IF) Test truncated network trace */
- printf("Test8f: (Function IF) Test truncated network trace\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test 8: (Function IF) Test truncated network trace");
- dlt_user_log_write_finish(&context_data);
+ /* Test 8: (Function IF) Test truncated network trace */
+ printf("Test8f: (Function IF) Test truncated network trace\n");
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test 8: (Function IF) Test truncated network trace");
+ dlt_user_log_write_finish(&context_data);
}
- /* Dummy message: 16 byte header, 32 byte payload */
- dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer, 1);
- dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer, 1);
- dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer, 1);
- dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer, 1);
+ /* Dummy message: 16 byte header, 32 byte payload */
+ dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer, 1);
+ dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer, 1);
+ dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer, 1);
+ dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer, 1);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test8: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test8: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- dlt_set_application_ll_ts_limit(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
- sleep(2);
+ dlt_set_application_ll_ts_limit(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
+ sleep(2);
- return 0;
+ return 0;
}
int test9f(void)
{
- char buffer[1024*5];
+ char buffer[1024*5];
int num;
for(num=0;num<1024*5;num++)
@@ -1147,74 +1147,74 @@ int test9f(void)
buffer[num] = num;
}
- /* Show all log messages and traces */
- dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
+ /* Show all log messages and traces */
+ dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
- /* Test 9: (Function IF) Test segmented network trace */
- printf("Test9f: (Function IF) Test segmented network trace\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test 9: (Function IF) Test segmented network trace");
- dlt_user_log_write_finish(&context_data);
+ /* Test 9: (Function IF) Test segmented network trace */
+ printf("Test9f: (Function IF) Test segmented network trace\n");
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test 9: (Function IF) Test segmented network trace");
+ dlt_user_log_write_finish(&context_data);
}
- /* Dummy message: 16 byte header, 5k payload */
- dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer);
- dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer);
- dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer);
- dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer);
+ /* Dummy message: 16 byte header, 5k payload */
+ dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer);
+ dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer);
+ dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer);
+ dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test9: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test9: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- dlt_set_application_ll_ts_limit(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
- sleep(2);
+ dlt_set_application_ll_ts_limit(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
+ sleep(2);
- return 0;
+ return 0;
}
int test_injection_macro_callback(uint32_t service_id, void *data, uint32_t length)
{
- char text[1024];
+ char text[1024];
- memset(text,0,1024);
- snprintf(text,1024,"Injection received (macro IF). ID: 0x%.4x, Length: %d",service_id,length);
- printf("%s \n", text);
- DLT_LOG(context_macro_callback, DLT_LOG_INFO, DLT_STRING("Injection received (macro IF). ID: "), DLT_UINT32(service_id),DLT_STRING("Data:"),DLT_STRING(text));
- memset(text,0,1024);
+ memset(text,0,1024);
+ snprintf(text,1024,"Injection received (macro IF). ID: 0x%.4x, Length: %d",service_id,length);
+ printf("%s \n", text);
+ DLT_LOG(context_macro_callback, DLT_LOG_INFO, DLT_STRING("Injection received (macro IF). ID: "), DLT_UINT32(service_id),DLT_STRING("Data:"),DLT_STRING(text));
+ memset(text,0,1024);
- if (length>0)
- {
- dlt_print_mixed_string(text,1024,data,length,0);
- printf("%s \n", text);
- }
+ if (length>0)
+ {
+ dlt_print_mixed_string(text,1024,data,length,0);
+ printf("%s \n", text);
+ }
- return 0;
+ return 0;
}
int test_injection_function_callback(uint32_t service_id, void *data, uint32_t length)
{
- char text[1024];
+ char text[1024];
- memset(text,0,1024);
+ memset(text,0,1024);
- snprintf(text,1024,"Injection received (function IF). ID: 0x%.4x, Length: %d",service_id,length);
- printf("%s \n", text);
- DLT_LOG(context_function_callback, DLT_LOG_INFO, DLT_STRING("Injection received (function IF). ID: "), DLT_UINT32(service_id),DLT_STRING("Data:"),DLT_STRING(text));
- memset(text,0,1024);
+ snprintf(text,1024,"Injection received (function IF). ID: 0x%.4x, Length: %d",service_id,length);
+ printf("%s \n", text);
+ DLT_LOG(context_function_callback, DLT_LOG_INFO, DLT_STRING("Injection received (function IF). ID: "), DLT_UINT32(service_id),DLT_STRING("Data:"),DLT_STRING(text));
+ memset(text,0,1024);
- if (length>0)
- {
- dlt_print_mixed_string(text,1024,data,length,0);
- printf("%s \n", text);
- }
+ if (length>0)
+ {
+ dlt_print_mixed_string(text,1024,data,length,0);
+ printf("%s \n", text);
+ }
- return 0;
+ return 0;
}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 57381b8..8c90299 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -5,6 +5,8 @@ include_directories(${gtest_SOURCE_DIR}/include)
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
+
configure_file(${CMAKE_SOURCE_DIR}/tests/testfile.dlt ${PROJECT_BINARY_DIR}/tests COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/tests/testfilter.txt ${PROJECT_BINARY_DIR}/tests COPYONLY)
diff --git a/tests/dlt_test_receiver.c b/tests/dlt_test_receiver.c
index 1eda31b..0c1d5cd 100644
--- a/tests/dlt_test_receiver.c
+++ b/tests/dlt_test_receiver.c
@@ -300,7 +300,7 @@ int main(int argc, char* argv[])
}
/* Connect to TCP socket or open serial device */
- if (dlt_client_connect(&dltclient, dltdata.vflag)!=-1)
+ if (dlt_client_connect(&dltclient, dltdata.vflag) != DLT_RETURN_ERROR)
{
/* Dlt Client Main Loop */
diff --git a/tests/gtest_dlt_common.cpp b/tests/gtest_dlt_common.cpp
index adf492c..7ad8ee7 100644
--- a/tests/gtest_dlt_common.cpp
+++ b/tests/gtest_dlt_common.cpp
@@ -30,20 +30,18 @@
#include <limits.h>
#include <syslog.h>
-extern "C" {
+extern "C"
+{
#include "dlt-daemon.h"
#include "dlt-daemon_cfg.h"
-#include "dlt_user.h"
-#include "dlt_user_shared.h"
-#include "dlt_user_shared_cfg.h"
#include "dlt_user_cfg.h"
-#include "dlt_client.h"
#include "dlt_version.h"
+
int dlt_buffer_increase_size(DltBuffer *);
int dlt_buffer_minimize_size(DltBuffer *);
int dlt_buffer_reset(DltBuffer *);
-int dlt_buffer_push(DltBuffer *,const unsigned char *,unsigned int);
-int dlt_buffer_push3(DltBuffer *,const unsigned char *,unsigned int,const unsigned char *,unsigned int,const unsigned char *,unsigned int);
+DltReturnValue dlt_buffer_push(DltBuffer *,const unsigned char *,unsigned int);
+DltReturnValue dlt_buffer_push3(DltBuffer *,const unsigned char *,unsigned int,const unsigned char *,unsigned int,const unsigned char *,unsigned int);
int dlt_buffer_get(DltBuffer *,unsigned char *, int,int);
int dlt_buffer_pull(DltBuffer *,unsigned char *, int);
int dlt_buffer_remove(DltBuffer *);
@@ -60,58 +58,59 @@ TEST(t_dlt_buffer_init_dynamic, normal)
DltBuffer init_dynamic;
// Normal Use-Case for initializing a buffer
- EXPECT_LE(0,dlt_buffer_init_dynamic(&init_dynamic, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_free_dynamic(&init_dynamic));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&init_dynamic, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK,dlt_buffer_free_dynamic(&init_dynamic));
// Min Values for a success init
- EXPECT_LE(0, dlt_buffer_init_dynamic(&init_dynamic, 12,12,12));
- EXPECT_LE(0,dlt_buffer_free_dynamic(&init_dynamic));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&init_dynamic, 12,12,12));
+ EXPECT_LE(DLT_RETURN_OK,dlt_buffer_free_dynamic(&init_dynamic));
}
TEST(t_dlt_buffer_init_dynamic, abnormal)
{
// DltBuffer buf;
// Initialze buffer twice, expected -1 for second init
-// EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
// EXPECT_GE(-1, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_free_dynamic(&buf));
// Initialize buffer with max-value of uint32, expected 0
-// EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, UINT_MAX,UINT_MAX,UINT_MAX));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+ // TODO: what should the maximum parameter values be? UINT_MAX is too large and leads to segfault
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, UINT_MAX,UINT_MAX,UINT_MAX));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_free_dynamic(&buf));
// Initialize buffer with min-value of uint32, expected 0
-// EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, 0,0,0));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, 0,0,0));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_free_dynamic(&buf));
// Initialize buffer min-value > max-value, expected -1
// EXPECT_GE(-1, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_free_dynamic(&buf));
// Initialsize buffer step-value > max-value, expected -1
-// EXPECT_GE(-1, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE * 2));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_GE(-1,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE * 2));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_init_dynamic, nullpointer)
{
DltBuffer buf;
// NULL-Pointer, expect -1
- EXPECT_GE(-1, dlt_buffer_init_dynamic(NULL, 0, 0, 0));
- EXPECT_GE(-1, dlt_buffer_init_dynamic(NULL, 0, 0, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_GE(-1, dlt_buffer_init_dynamic(NULL, 0, DLT_USER_RINGBUFFER_MAX_SIZE, 0));
- EXPECT_GE(-1, dlt_buffer_init_dynamic(NULL, 0, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_GE(-1, dlt_buffer_init_dynamic(NULL, DLT_USER_RINGBUFFER_MIN_SIZE, 0, 0));
- EXPECT_GE(-1, dlt_buffer_init_dynamic(NULL, DLT_USER_RINGBUFFER_MIN_SIZE, 0, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_GE(-1, dlt_buffer_init_dynamic(NULL, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, 0));
- EXPECT_GE(-1, dlt_buffer_init_dynamic(NULL, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_GE(-1, dlt_buffer_init_dynamic(&buf, 0, 0, 0));
- EXPECT_GE(-1, dlt_buffer_init_dynamic(&buf, 0, 0, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_GE(-1, dlt_buffer_init_dynamic(&buf, 0, DLT_USER_RINGBUFFER_MAX_SIZE, 0));
- EXPECT_GE(-1, dlt_buffer_init_dynamic(&buf, 0, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_GE(-1, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, 0, 0));
- EXPECT_GE(-1, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, 0, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_GE(-1, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(NULL, 0, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(NULL, 0, 0, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(NULL, 0, DLT_USER_RINGBUFFER_MAX_SIZE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(NULL, 0, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(NULL, DLT_USER_RINGBUFFER_MIN_SIZE, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(NULL, DLT_USER_RINGBUFFER_MIN_SIZE, 0, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(NULL, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(NULL, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(&buf, 0, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(&buf, 0, 0, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(&buf, 0, DLT_USER_RINGBUFFER_MAX_SIZE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(&buf, 0, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, 0, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, 0));
}
/* End Method: dlt_common::dlt_buffer_init_dynamic */
@@ -124,24 +123,24 @@ TEST(t_dlt_buffer_free_dynamic, normal)
DltBuffer buf;
// Normal Use-Case szenario
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Normal Use-Case szenario
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, 12,12,12));
- EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, 12,12,12));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_free_dynamic, abnormal)
{
// DltBuffer buf;
// Free uninizialised buffer, expected -1
-// EXPECT_GE(-1,dlt_buffer_free_dynamic(&buf));
+// EXPECT_GE(-1, dlt_buffer_free_dynamic(&buf));
- // Free buffer twice, expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
-// EXPECT_GE(-1,dlt_buffer_free_dynamic(&buf));
+ // Free buffer twice, expected -1
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_GE(-1, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_free_dynamic, nullpointer)
@@ -160,17 +159,17 @@ TEST(t_dlt_buffer_increase_size, normal)
DltBuffer buf;
// Normal Use-Case, expected 0
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_increase_size(&buf));
- EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(0, dlt_buffer_increase_size(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Fill buffer to max-value, expected 0
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
for(int i = 0; i <= (DLT_USER_RINGBUFFER_MAX_SIZE / DLT_USER_RINGBUFFER_MIN_SIZE); i += DLT_USER_RINGBUFFER_STEP_SIZE)
{
- EXPECT_LE(0,dlt_buffer_increase_size(&buf));
+ EXPECT_LE(0, dlt_buffer_increase_size(&buf));
}
- EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_increase_size, abnormal)
{
@@ -180,19 +179,19 @@ TEST(t_dlt_buffer_increase_size, abnormal)
// EXPECT_GE(-1, dlt_buffer_increase_size(&buf));
// Fill buffer over max-value, expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
// EXPECT_GE(-1, dlt_buffer_increase_size(&buf));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// min-value > max-value, trying to increase buffer, expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
// EXPECT_GE(-1, dlt_buffer_increase_size(&buf));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// trying to increase buffer with 0 , expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, 0));
// EXPECT_GE(-1, dlt_buffer_increase_size(&buf));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_increase_size, nullpointer)
{
@@ -210,17 +209,17 @@ TEST(t_dlt_buffer_minimize_size, normal)
DltBuffer buf;
// Normal Use-Case, expected 0
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_minimize_size(&buf));
- EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(0, dlt_buffer_minimize_size(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// minimize buffer to min-value, expected 0
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
for(int i = (DLT_USER_RINGBUFFER_MAX_SIZE / DLT_USER_RINGBUFFER_MIN_SIZE); i >= 0; i -= DLT_USER_RINGBUFFER_STEP_SIZE)
{
- EXPECT_LE(0,dlt_buffer_minimize_size(&buf));
+ EXPECT_LE(0, dlt_buffer_minimize_size(&buf));
}
- EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_minimize_size, abnormal)
{
@@ -230,19 +229,19 @@ TEST(t_dlt_buffer_minimize_size, abnormal)
// EXPECT_GE(-1, dlt_buffer_minimize_size(&buf));
// minimize buffer under min-value, expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
// EXPECT_GE(-1, dlt_buffer_minimize_size(&buf));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// min-value > max-value, trying to minimize buffer, expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
// EXPECT_GE(-1, dlt_buffer_minimize_size(&buf));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// trying to minimize buffer with 0 , expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, 0));
// EXPECT_GE(-1, dlt_buffer_minimize_size(&buf));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_minimize_size, nullpointer)
{
@@ -260,8 +259,8 @@ TEST(t_dlt_buffer_reset, normal)
DltBuffer buf;
// Normal Use-Case. expect 0
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_reset(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(0, dlt_buffer_reset(&buf));
}
TEST(t_dlt_buffer_reset, abnormal)
@@ -289,17 +288,17 @@ TEST(t_dlt_buffer_push, normal)
unsigned int size = sizeof(test);
// Normal Use-Case, expected 0
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0, dlt_buffer_push(&buf,(unsigned char *)&test,size));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&test,size));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Push till buffer is full, expected 0
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
for(unsigned int i=0; i<= (DLT_USER_RINGBUFFER_MIN_SIZE/size); i++)
{
- EXPECT_LE(0, dlt_buffer_push(&buf,(unsigned char *)&test,size));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&test,size));
}
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_push, abnormal)
{
@@ -312,33 +311,33 @@ TEST(t_dlt_buffer_push, abnormal)
// set size == 0, expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push(&buf,(unsigned char *)&test,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push(&buf,(unsigned char *)&test,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// set size == 0 and char == 0 expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push(&buf,0,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push(&buf,0,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Push till buffer is overfilled , expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
// for(int i=0; i<= (DLT_USER_RINGBUFFER_MIN_SIZE/size) + size; i++)
// {
// if(i <= DLT_USER_RINGBUFFER_MIN_SIZE)
-// EXPECT_LE(0, dlt_buffer_push(&buf,(unsigned char *)&test,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&test,size));
// else
-// EXPECT_GE(-1, dlt_buffer_push(&buf,(unsigned char *)&test,size));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push(&buf,(unsigned char *)&test,size));
// }
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// All use-case, wich works with null pointer, has to discuss
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push(&buf,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push(&buf,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push(&buf,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push(&buf,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_push, nullpointer)
@@ -347,10 +346,10 @@ TEST(t_dlt_buffer_push, nullpointer)
int size = sizeof(test);
// NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_buffer_push(NULL,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push(NULL,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push(NULL,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push(NULL,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push(NULL,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push(NULL,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push(NULL,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push(NULL,(unsigned char *)&test,size));
}
/* End Method: dlt_common::dlt_buffer_push*/
@@ -365,21 +364,21 @@ TEST(t_dlt_buffer_push3, normal)
int size = sizeof(test);
// Normal Use-Case, expected 0
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0, dlt_buffer_push3(&buf,(unsigned char *)&test,size,0,0,0,0));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push3(&buf,(unsigned char *)&test,size,0,0,0,0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Push till buffer is full, expected 0
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
for(int i=0; i<= (DLT_USER_RINGBUFFER_MIN_SIZE/size); i++)
{
- EXPECT_LE(0, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
}
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_push3, abnormal)
{
@@ -388,201 +387,201 @@ TEST(t_dlt_buffer_push3, abnormal)
// int size = sizeof(test);
// Use uninizialsied, expected -1
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
// set size == 0, expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,0, (unsigned char *)&test,0, (unsigned char *)&test,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,0, (unsigned char *)&test,0, (unsigned char *)&test,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// set size == 0 and char == 0 expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,0,0,0,0,0,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,0,0,0,0,0,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// works with null pointer, expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,NULL,0,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,NULL,0,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Push till buffer is overfilled , expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
// for(int i=0; i<= (DLT_USER_RINGBUFFER_MIN_SIZE/size) + size; i++)
// {
// if(i <= DLT_USER_RINGBUFFER_MIN_SIZE)
-// EXPECT_LE(0, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
// else
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
// }
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// All use-case, wich works with null pointer, has to discuss
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,NULL,0,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,NULL,0,(unsigned char *)&test,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,NULL,0,(unsigned char *)&test,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,NULL,size,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,NULL,size,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,NULL,size,(unsigned char *)&test,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,NULL,size,(unsigned char *)&test,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,0,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,0,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,0,(unsigned char *)&test,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,0,(unsigned char *)&test,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,size,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,size,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,size,(unsigned char *)&test,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,size,(unsigned char *)&test,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,NULL,0,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,NULL,0,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,NULL,0,(unsigned char *)&test,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,NULL,0,(unsigned char *)&test,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,NULL,size,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,NULL,size,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,NULL,size,(unsigned char *)&test,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,NULL,size,(unsigned char *)&test,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,0,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,0,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,0,(unsigned char *)&test,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,0,(unsigned char *)&test,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,size,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,size,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,size,(unsigned char *)&test,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,0,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,0,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,0,(unsigned char *)&test,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,0,(unsigned char *)&test,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,size,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,size,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,size,(unsigned char *)&test,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,size,(unsigned char *)&test,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,0,(unsigned char *)&test,0,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,0,(unsigned char *)&test,0,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,0,(unsigned char *)&test,size,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,0,(unsigned char *)&test,size,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,0,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,0,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,0,(unsigned char *)&test,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,0,(unsigned char *)&test,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,size,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,size,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,size,(unsigned char *)&test,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,size,(unsigned char *)&test,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,0,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,0,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,size,NULL,0));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_GE(-1, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,size,NULL,size));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,NULL,0,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,NULL,0,(unsigned char *)&test,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,NULL,0,(unsigned char *)&test,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,NULL,size,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,NULL,size,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,NULL,size,(unsigned char *)&test,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,NULL,size,(unsigned char *)&test,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,0,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,0,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,0,(unsigned char *)&test,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,0,(unsigned char *)&test,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,size,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,size,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,size,(unsigned char *)&test,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,0,(unsigned char *)&test,size,(unsigned char *)&test,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,NULL,0,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,NULL,0,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,NULL,0,(unsigned char *)&test,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,NULL,0,(unsigned char *)&test,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,NULL,size,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,NULL,size,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,NULL,size,(unsigned char *)&test,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,NULL,size,(unsigned char *)&test,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,0,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,0,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,0,(unsigned char *)&test,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,0,(unsigned char *)&test,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,size,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,size,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,size,(unsigned char *)&test,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,NULL,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,0,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,0,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,0,(unsigned char *)&test,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,0,(unsigned char *)&test,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,size,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,size,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,size,(unsigned char *)&test,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,0,NULL,size,(unsigned char *)&test,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,0,(unsigned char *)&test,0,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,0,(unsigned char *)&test,0,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,0,(unsigned char *)&test,size,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,0,(unsigned char *)&test,size,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,0,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,0,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,0,(unsigned char *)&test,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,0,(unsigned char *)&test,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,size,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,size,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,size,(unsigned char *)&test,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,size,NULL,size,(unsigned char *)&test,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,0,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,0,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,size,NULL,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(&buf,(unsigned char *)&test,size,(unsigned char *)&test,size,NULL,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_push3, nullpointer)
{
@@ -590,70 +589,70 @@ TEST(t_dlt_buffer_push3, nullpointer)
int size = sizeof(test);
//Null Pointer, expected -1
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,NULL,0,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,NULL,0,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,NULL,0,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,NULL,0,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,NULL,size,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,NULL,size,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,NULL,size,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,NULL,size,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,0,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,0,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,0,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,0,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,size,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,size,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,size,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,size,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,NULL,0,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,NULL,0,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,NULL,0,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,NULL,0,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,NULL,size,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,NULL,size,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,NULL,size,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,NULL,size,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,0,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,0,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,0,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,0,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,size,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,size,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,size,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,0,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,0,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,0,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,0,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,size,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,size,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,size,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,size,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,0,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,0,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,0,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,0,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,size,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,size,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,size,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,size,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,0,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,0,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,0,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,0,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,size,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,size,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,size,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,size,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,0,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,0,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,0,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,0,(unsigned char *)&test,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,size,NULL,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,size,NULL,size));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,size,(unsigned char *)&test,0));
- EXPECT_GE(-1, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,NULL,0,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,NULL,0,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,NULL,0,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,NULL,0,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,NULL,size,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,NULL,size,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,NULL,size,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,NULL,size,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,0,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,0,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,0,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,0,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,size,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,size,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,size,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,0,(unsigned char *)&test,size,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,NULL,0,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,NULL,0,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,NULL,0,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,NULL,0,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,NULL,size,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,NULL,size,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,NULL,size,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,NULL,size,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,0,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,0,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,0,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,0,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,size,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,size,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,size,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,NULL,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,0,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,0,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,0,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,0,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,size,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,size,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,size,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,NULL,size,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,0,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,0,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,0,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,0,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,size,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,size,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,size,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,0,(unsigned char *)&test,size,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,0,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,0,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,0,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,0,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,size,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,size,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,size,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,NULL,size,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,0,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,0,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,0,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,0,(unsigned char *)&test,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,size,NULL,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,size,NULL,size));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,size,(unsigned char *)&test,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_buffer_push3(NULL,(unsigned char *)&test,size,(unsigned char *)&test,size,(unsigned char *)&test,size));
}
/* End Method: dlt_common::dlt_buffer_push3 */
@@ -669,15 +668,15 @@ TEST(t_dlt_buffer_pull, normal)
int size = sizeof(DltUserHeader);
// Normal Use-Case, empty pull, expected -1
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_GE(-1, dlt_buffer_pull(&buf, (unsigned char*)&header, size));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Normal Use-Case, expected > 0
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
EXPECT_LE(1, dlt_buffer_pull(&buf, (unsigned char*)&header, size));
- EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_pull, abnormal)
{
@@ -688,15 +687,15 @@ TEST(t_dlt_buffer_pull, abnormal)
// EXPECT_GE(-1, dlt_buffer_pull(&buf, (unsigned char*)&header, sizeof(DltUserHeader)));
// data == 0 and max_size == 0, expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
// EXPECT_GE(-1, dlt_buffer_pull(&buf, 0, 0));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// no push before pull, expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
// EXPECT_GE(-1, dlt_buffer_pull(&buf, 0, 0));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_pull, nullpointer)
{
@@ -708,12 +707,12 @@ TEST(t_dlt_buffer_pull, nullpointer)
EXPECT_GE(-1, dlt_buffer_pull(NULL, NULL, sizeof(DltUserHeader)));
EXPECT_GE(-1, dlt_buffer_pull(NULL, (unsigned char *)&header, 0));
EXPECT_GE(-1, dlt_buffer_pull(NULL, (unsigned char *)&header, sizeof(DltUserHeader)));
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_GE(-1, dlt_buffer_pull(&buf, NULL, 0));
- EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_GE(-1, dlt_buffer_pull(&buf, NULL, sizeof(DltUserHeader)));
- EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
/* End Method: dlt_common::dlt_buffer_pull */
@@ -727,15 +726,15 @@ TEST(t_dlt_buffer_remove, normal)
int size = sizeof(DltUserHeader);
// Normal Use-Case, empty pull, expected -1
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_GE(-1, dlt_buffer_remove(&buf));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Normal Use-Case, expected > 0
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,size));
- EXPECT_LE(0,dlt_buffer_remove(&buf));
- EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&header,size));
+ EXPECT_LE(0, dlt_buffer_remove(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_remove, abnormal)
{
@@ -747,14 +746,14 @@ TEST(t_dlt_buffer_remove, abnormal)
// EXPECT_GE(-1, dlt_buffer_remove(&buf));
// no push before remove, expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
// EXPECT_GE(-1, dlt_buffer_remove(&buf));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Call remove 10 time, expected > 1 till buffer is empty
// pushed one time so expect one > 1 and 9 times < 0
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&header,size));
// for(int i=0; i<10;i++)
// {
// if(i == 0)
@@ -762,7 +761,7 @@ TEST(t_dlt_buffer_remove, abnormal)
// else
// EXPECT_GE(-1, dlt_buffer_remove(&buf));
// }
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_remove, nullpointer)
{
@@ -782,15 +781,15 @@ TEST(t_dlt_buffer_copy, normal)
int size = sizeof(DltUserHeader);
// Normal Use-Case, empty pull, expected -1
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_GE(-1, dlt_buffer_copy(&buf, (unsigned char *)&header, size));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Normal Use-Case, expected > 0
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
EXPECT_LE(1, dlt_buffer_copy(&buf, (unsigned char *)&header, size));
- EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_copy, abnormal)
{
@@ -802,9 +801,9 @@ TEST(t_dlt_buffer_copy, abnormal)
// EXPECT_LE(-1, dlt_buffer_copy(&buf, (unsigned char *)&header, size));
// no push before copy, expected -1
-// EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
// EXPECT_LE(-1, dlt_buffer_copy(&buf, (unsigned char *)&header, size));
-// EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_copy, nullpointer)
{
@@ -817,12 +816,12 @@ TEST(t_dlt_buffer_copy, nullpointer)
EXPECT_LE(-1, dlt_buffer_copy(NULL,NULL,0));
EXPECT_LE(-1, dlt_buffer_copy(NULL,(unsigned char *)&header,size));
EXPECT_LE(-1, dlt_buffer_copy(NULL,(unsigned char *)&header,0));
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_LE(-1, dlt_buffer_copy(&buf,NULL,size));
- EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0,dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_LE(-1, dlt_buffer_copy(&buf,NULL,0));
- EXPECT_LE(0,dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
/* End Method: dlt_common::dlt_buffer_copy */
@@ -837,82 +836,82 @@ TEST(t_dlt_buffer_get, normal)
int size = sizeof(DltUserHeader);
// Normal Use-Case
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,size));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&header,size));
printf("#### %i\n", dlt_buffer_get(&buf,(unsigned char*)&header,size,0));
EXPECT_LE(0, dlt_buffer_get(&buf,(unsigned char*)&header,size,0));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,size));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&header,size));
printf("#### %i\n", dlt_buffer_get(&buf,(unsigned char*)&header,size,0));
EXPECT_LE(0, dlt_buffer_get(&buf,(unsigned char*)&header,size,1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
printf("#### %i\n", dlt_buffer_get(&buf,(unsigned char*)&header,size,0));
EXPECT_GE(-1, dlt_buffer_get(&buf,(unsigned char*)&header,size,1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
printf("#### %i\n", dlt_buffer_get(&buf,(unsigned char*)&header,size,0));
((int*)(buf.shm))[0] = 50000;
EXPECT_GE(-1, dlt_buffer_get(&buf,(unsigned char*)&header,size,1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
printf("#### %i\n", dlt_buffer_get(&buf,(unsigned char*)&header,size,0));
((int*)(buf.shm))[1] = 50000;
EXPECT_GE(-1, dlt_buffer_get(&buf,(unsigned char*)&header,size,1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
printf("#### %i\n", dlt_buffer_get(&buf,(unsigned char*)&header,size,0));
((int*)(buf.shm))[2] = -50000;
EXPECT_GE(-1, dlt_buffer_get(&buf,(unsigned char*)&header,size,1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
printf("#### %i\n", dlt_buffer_get(&buf,(unsigned char*)&header,size,0));
((int*)(buf.shm))[2] = 0;
EXPECT_GE(-1, dlt_buffer_get(&buf,(unsigned char*)&header,size,1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
printf("#### %i\n", dlt_buffer_get(&buf,(unsigned char*)&header,size,0));
((int*)(buf.shm))[0] = 4000;
((int*)(buf.shm))[1] = 5000;
((int*)(buf.shm))[2] = 0;
EXPECT_GE(-1, dlt_buffer_get(&buf,(unsigned char*)&header,size,1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
printf("#### %i\n", dlt_buffer_get(&buf,(unsigned char*)&header,size,0));
((int*)(buf.shm))[0] = 10;
((int*)(buf.shm))[1] = 5;
((int*)(buf.shm))[2] = 5;
EXPECT_GE(-1, dlt_buffer_get(&buf,(unsigned char*)&header,size,1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
printf("#### %i\n", dlt_buffer_get(&buf,(unsigned char*)&header,size,0));
((int*)(buf.shm))[2] = 50000;
EXPECT_GE(-1, dlt_buffer_get(&buf,(unsigned char*)&header,size,1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,size));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&header,size));
printf("#### %i\n", dlt_buffer_get(&buf,(unsigned char*)&header,size,0));
((int*)(buf.shm))[0] = 19;
EXPECT_GE(-1, dlt_buffer_get(&buf,(unsigned char*)&header,size,1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,size));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&header,size));
printf("#### %i\n", dlt_buffer_get(&buf,(unsigned char*)&header,size,0));
((int*)(buf.shm))[2] = 19;
EXPECT_LE(0, dlt_buffer_get(&buf,(unsigned char*)&header,5,1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_get, abnormal)
{
@@ -924,11 +923,11 @@ TEST(t_dlt_buffer_get, abnormal)
// EXPECT_GE(-1, dlt_buffer_get(&buf,(unsigned char *)&header,size, 0));
// Integer with 12345678
-// EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
-// EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,size));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&header,size));
// printf("#### %i\n", dlt_buffer_get(&buf,(unsigned char*)&header,size,0));
// EXPECT_LE(0, dlt_buffer_get(&buf,(unsigned char*)&header,size,12345678));
-// EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+// EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_get, nullpointer)
{
@@ -945,18 +944,18 @@ TEST(t_dlt_buffer_get, nullpointer)
EXPECT_GE(-1, dlt_buffer_get(NULL, (unsigned char*)&header, 0, 1));
EXPECT_GE(-1, dlt_buffer_get(NULL, (unsigned char*)&header, size, 0));
EXPECT_GE(-1, dlt_buffer_get(NULL, (unsigned char*)&header, size, 1));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_GE(-1, dlt_buffer_get(&buf, NULL, 0, 0));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_GE(-1, dlt_buffer_get(&buf, NULL, 0, 1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_GE(-1, dlt_buffer_get(&buf, NULL, size, 0));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_GE(-1, dlt_buffer_get(&buf, NULL, size, 1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
/* End Method: dlt_common::dlt_buffer_get */
@@ -970,27 +969,27 @@ TEST(t_dlt_buffer_get_message_count, normal)
DltUserHeader header;
// Normal Usce-Case without pushing data, expected 0
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
//printf("##### %i\n", dlt_buffer_get_message_count(&buf));
EXPECT_LE(0, dlt_buffer_get_message_count(&buf));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Normal Use-Case, with pushing data, expected > 0
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
//printf("#### %i\n", dlt_buffer_get_message_count(&buf));
EXPECT_LE(0, dlt_buffer_get_message_count(&buf));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Pushing 1000 mesages, expected 10000
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
for(int i = 1; i <= 10000; i++)
{
- EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
//printf("#### %i\n", dlt_buffer_get_message_count(&buf));
EXPECT_LE(i, dlt_buffer_get_message_count(&buf));
}
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_get_message_count, abnormal)
@@ -1017,17 +1016,17 @@ TEST(t_dlt_buffer_get_total_size, normal)
DltUserHeader header;
// Normal Use-Case, expected max buffer size (DLT_USER_RINGBUFFER_MAX_SIZE)
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
//printf("##### %i\n", dlt_buffer_get_total_size(&buf));
EXPECT_LE(DLT_USER_RINGBUFFER_MAX_SIZE, dlt_buffer_get_total_size(&buf));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Normal Use-Case, 1st pushing data, expected max buffer size (DLT_USER_RINGBUFFER_MAX_SIZE)
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
//printf("##### %i\n", dlt_buffer_get_total_size(&buf));
EXPECT_LE(DLT_USER_RINGBUFFER_MAX_SIZE, dlt_buffer_get_total_size(&buf));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_get_total_size, abnormal)
{
@@ -1052,27 +1051,27 @@ TEST(t_dlt_buffer_get_used_size, normal)
DltUserHeader header;
// Normal Use Cas buffer empty, expected 0
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
//printf("##### %i\n", dlt_buffer_get_used_size(&buf));
EXPECT_LE(0, dlt_buffer_get_used_size(&buf));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Normal Use-Case with pushing data, expected > 0
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK,dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
//printf("##### %i\n", dlt_buffer_get_used_size(&buf));
EXPECT_LE(0, dlt_buffer_get_used_size(&buf));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
// Normal Use-Case with pushing 10000 data, expected > 0
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
for(int i = 1; i <= 10000; i++)
{
- EXPECT_LE(0,dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_push(&buf,(unsigned char *)&header,sizeof(DltUserHeader)));
//printf("#### %i\n", dlt_buffer_get_used_size(&buf));
EXPECT_LE(1, dlt_buffer_get_used_size(&buf));
}
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_get_used_size, abnormal)
{
@@ -1101,22 +1100,22 @@ TEST(t_dlt_buffer_write_block, normal)
int size2 = 1024;
// Normal Use-Case, void method, expected no error
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_write_block(&buf,&write, data, size1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_write_block(&buf,&write, data, size2));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
int tmp =0;
for(int i = 0; i<= 10000; i+=10)
{
tmp += i;
EXPECT_NO_THROW(dlt_buffer_write_block(&buf,&write, data, i));
}
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_write_block, abnormal)
{
@@ -1139,24 +1138,24 @@ TEST(t_dlt_buffer_write_block, nullpointer)
EXPECT_NO_THROW(dlt_buffer_write_block(NULL, &write, NULL, test1));
EXPECT_NO_THROW(dlt_buffer_write_block(NULL, &write, (unsigned char *)&data, 0));
EXPECT_NO_THROW(dlt_buffer_write_block(NULL, &write, (unsigned char *)&data, test1));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_write_block(&buf, NULL, NULL, 0));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_write_block(&buf, NULL, NULL, test1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_write_block(&buf, NULL, (unsigned char *)&data, 0));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_write_block(&buf, NULL, (unsigned char *)&data, test1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_write_block(&buf, &write, NULL, 0));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_write_block(&buf, &write, NULL, test1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
/* End Method: dlt_common::dlt_buffer_write_block */
@@ -1173,15 +1172,15 @@ TEST(t_dlt_buffer_read_block, normal)
int size2 = 1024;
// Normal Use-Case, void method, expected no error
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_write_block(&buf,&write, data, size1));
EXPECT_NO_THROW(dlt_buffer_read_block(&buf,&write, data, size1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_write_block(&buf,&read, data, size2));
EXPECT_NO_THROW(dlt_buffer_read_block(&buf,&write, data, size2));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_buffer_read_block, abnormal)
{
@@ -1204,27 +1203,27 @@ TEST(t_dlt_buffer_read_block, nullpointer)
EXPECT_NO_THROW(dlt_buffer_read_block(NULL, &read, NULL, test1));
EXPECT_NO_THROW(dlt_buffer_read_block(NULL, &read, (unsigned char *)&data, 0));
EXPECT_NO_THROW(dlt_buffer_read_block(NULL, &read, (unsigned char *)&data, test1));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_read_block(&buf, NULL, NULL, 0));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_read_block(&buf, NULL, NULL, test1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_read_block(&buf, NULL, (unsigned char *)&data, 0));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_read_block(&buf, NULL, (unsigned char *)&data, test1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_read_block(&buf, &read, NULL, 0));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_read_block(&buf, &read, NULL, test1));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_read_block(&buf, &read, (unsigned char *)&data, 0));
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
/* End Method: dlt_common::dlt_buffer_read_block */
@@ -1237,13 +1236,13 @@ TEST(t_dlt_buffer_info, normal)
DltBuffer buf;
// Normal Use-Case
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_info(&buf));
}
TEST(t_dlt_buffer_info, abnormal)
{
- // actual no abnormal test cases
- // because of void funktion and missing gtest tools for that
+ // actually no abnormal test cases
+ // because of void function and missing gtest tools for that
}
TEST(t_dlt_buffer_info, nullpointer)
{
@@ -1261,7 +1260,7 @@ TEST(t_dlt_buffer_status, normal)
DltBuffer buf;
// Normal Use-Case
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
EXPECT_NO_THROW(dlt_buffer_status(&buf));
}
TEST(t_dlt_buffer_status, abnormal)
@@ -1292,32 +1291,32 @@ TEST(t_dlt_message_init, normal)
DltMessage msg;
// Normal Use-Case, expected 0
- EXPECT_LE(0, dlt_message_init(&msg, 0));
- EXPECT_LE(0, dlt_message_free(&msg, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_init(&msg, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_free(&msg, 0));
- EXPECT_LE(0, dlt_message_init(&msg, 1));
- EXPECT_LE(0, dlt_message_free(&msg, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_init(&msg, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_free(&msg, 0));
}
TEST(t_dlt_message_init, abnormal)
{
// DltMessage msg;
// Double use init, expected -1
-// EXPECT_LE(0, dlt_message_init(&msg,0));
-// EXPECT_GE(-1, dlt_message_init(&msg,0));
-// EXPECT_LE(0, dlt_message_free(&msg,0));
-// EXPECT_LE(0, dlt_message_init(&msg,1));
-// EXPECT_GE(-1, dlt_message_init(&msg,1));
-// EXPECT_LE(0, dlt_message_free(&msg,1));
+// EXPECT_LE(DLT_RETURN_OK, dlt_message_init(&msg,0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_init(&msg,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_message_free(&msg,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_message_init(&msg,1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_init(&msg,1));
+// EXPECT_LE(DLT_RETURN_OK, dlt_message_free(&msg,1));
// set Verbose to 12345678, expected -1
-// EXPECT_GE(-1, dlt_message_init(&msg,12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_init(&msg,12345678));
}
TEST(t_dlt_message_init, nullpointer)
{
//NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_message_init(NULL, 0));
- EXPECT_GE(-1, dlt_message_init(NULL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_init(NULL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_init(NULL, 1));
}
/* End Method: dlt_common::dlt_message_init*/
@@ -1330,33 +1329,33 @@ TEST(t_dlt_message_free, normal)
DltMessage msg;
// Normal Use Case, expected 0
- EXPECT_LE(0, dlt_message_init(&msg, 0));
- EXPECT_LE(0, dlt_message_free(&msg, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_init(&msg, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_free(&msg, 0));
- EXPECT_LE(0, dlt_message_init(&msg, 0));
- EXPECT_LE(0, dlt_message_free(&msg, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_init(&msg, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_free(&msg, 1));
}
TEST(t_dlt_message_free, abnormal)
{
// DltMessage msg;
// Double use free, expected -1
-// EXPECT_LE(0, dlt_message_init(&msg,0));
-// EXPECT_LE(0, dlt_message_free(&msg,0));
-// EXPECT_GE(-1, dlt_message_free(&msg,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_message_init(&msg,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_message_free(&msg,0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_free(&msg,0));
-// EXPECT_LE(0, dlt_message_init(&msg,0));
-// EXPECT_LE(0, dlt_message_free(&msg,1));
-// EXPECT_GE(-1, dlt_message_free(&msg,1));
+// EXPECT_LE(DLT_RETURN_OK, dlt_message_init(&msg,0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_message_free(&msg,1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_free(&msg,1));
// set Verbose to 12345678, expected -1
-// EXPECT_GE(-1, dlt_message_free(&msg,12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_free(&msg,12345678));
}
TEST(t_dlt_message_free, nullpointer)
{
//NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_message_free(NULL, 0));
- EXPECT_GE(-1, dlt_message_free(NULL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_free(NULL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_free(NULL, 1));
}
/* End Method: dlt_common::dlt_message_free */
@@ -1375,13 +1374,13 @@ TEST(t_dlt_file_open, normal)
/*---------------------------------------*/
// Normal Use-Case, expected 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 1));
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_file_open, abnormal)
{
@@ -1394,14 +1393,14 @@ TEST(t_dlt_file_open, abnormal)
/*---------------------------------------*/
// Uninizialsied, expected -1
-// EXPECT_GE(-1, dlt_file_open(&file, openfile, 0));
-// EXPECT_GE(-1, dlt_file_open(&file, openfile, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_file_open(&file, openfile, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_file_open(&file, openfile, 1));
// Verbose set to 12345678
-// EXPECT_GE(-1, dlt_file_open(&file, openfile, 12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_file_open(&file, openfile, 12345678));
// Path doesn't exist, expected -1
-// EXPECT_GE(-1, dlt_file_open(&file, "This Path doesn't exist!!", 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_file_open(&file, "This Path doesn't exist!!", 0));
}
TEST(t_dlt_file_open, nullpointer)
{
@@ -1414,12 +1413,12 @@ TEST(t_dlt_file_open, nullpointer)
/*---------------------------------------*/
// NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_file_open(NULL, NULL, 0));
- EXPECT_GE(-1, dlt_file_open(NULL, NULL, 1));
- EXPECT_GE(-1, dlt_file_open(NULL, openfile, 0));
- EXPECT_GE(-1, dlt_file_open(NULL, openfile, 1));
- EXPECT_GE(-1, dlt_file_open(&file, NULL, 0));
- EXPECT_GE(-1, dlt_file_open(&file, NULL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_file_open(NULL, NULL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_file_open(NULL, NULL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_file_open(NULL, openfile, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_file_open(NULL, openfile, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_file_open(&file, NULL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_file_open(&file, NULL, 1));
}
/* End Method: dlt_common::dlt_file_open */
@@ -1441,20 +1440,20 @@ TEST(t_dlt_message_print_ascii, normal)
/*---------------------------------------*/
// Normal Use-Case, expected 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_ascii, abnormal)
{
@@ -1469,21 +1468,21 @@ TEST(t_dlt_message_print_ascii, abnormal)
/*---------------------------------------*/
// No messages read, expected -1
-// EXPECT_GE(-1, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
-// EXPECT_GE(-1, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
// Set verbose to 12345678
-// EXPECT_GE(-1, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
-// EXPECT_LE(0, dlt_file_init(&file, 0));
-// EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
// while (dlt_file_read(&file,0)>=0){}
// for(int i=0;i<file.counter;i++)
// {
-// EXPECT_LE(0, dlt_file_message(&file, i, 0));
-// EXPECT_GE(-1, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
// }
-// EXPECT_LE(0, dlt_file_free(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_ascii, nullpointer)
{
@@ -1498,18 +1497,18 @@ TEST(t_dlt_message_print_ascii, nullpointer)
/*---------------------------------------*/
// NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_message_print_ascii(NULL,NULL,0,0));
- EXPECT_GE(-1, dlt_message_print_ascii(NULL,NULL,0,1));
- EXPECT_GE(-1, dlt_message_print_ascii(NULL,NULL,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_ascii(NULL,NULL,DLT_DAEMON_TEXTSIZE,1));
- EXPECT_GE(-1, dlt_message_print_ascii(NULL,text,0,0));
- EXPECT_GE(-1, dlt_message_print_ascii(NULL,text,0,1));
- EXPECT_GE(-1, dlt_message_print_ascii(NULL,text,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_ascii(NULL,text,DLT_DAEMON_TEXTSIZE,1));
- EXPECT_GE(-1, dlt_message_print_ascii(&file.msg,NULL,0,0));
- EXPECT_GE(-1, dlt_message_print_ascii(&file.msg,NULL,0,1));
- EXPECT_GE(-1, dlt_message_print_ascii(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_ascii(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(NULL,NULL,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(NULL,NULL,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(NULL,NULL,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(NULL,NULL,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(NULL,text,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(NULL,text,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(NULL,text,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(NULL,text,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(&file.msg,NULL,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(&file.msg,NULL,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_ascii(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,1));
}
/* End Method: dlt_common::dlt_message_print_ascii*/
@@ -1533,23 +1532,23 @@ TEST(t_dlt_message_print_ascii_with_filter, normal)
/*---------------------------------------*/
// Normal Use-Case, expect 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_filter_init(&filter, 0));
- EXPECT_LE(0, dlt_filter_load(&filter, openfilter, 0));
- EXPECT_LE(0, dlt_file_set_filter(&file, &filter, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_filter_init(&filter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_filter_load(&filter, openfilter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_set_filter(&file, &filter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_ascii(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_ascii_with_filter, abnormal)
{
@@ -1578,20 +1577,20 @@ TEST(t_dlt_message_print_header, normal)
/*---------------------------------------*/
// Normal Use-Case, expected 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_header, abnormal)
{
@@ -1606,21 +1605,21 @@ TEST(t_dlt_message_print_header, abnormal)
/*---------------------------------------*/
// No messages read, expected -1
-// EXPECT_GE(-1, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
-// EXPECT_GE(-1, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
// Set verbose to 12345678
-// EXPECT_GE(-1, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
-// EXPECT_LE(0, dlt_file_init(&file, 0));
-// EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
// while (dlt_file_read(&file,0)>=0){}
// for(int i=0;i<file.counter;i++)
// {
-// EXPECT_LE(0, dlt_file_message(&file, i, 0));
-// EXPECT_GE(-1, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
// }
-// EXPECT_LE(0, dlt_file_free(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_header, nullpointer)
{
@@ -1635,18 +1634,18 @@ TEST(t_dlt_message_print_header, nullpointer)
/*---------------------------------------*/
// NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_message_print_header(NULL,NULL,0,0));
- EXPECT_GE(-1, dlt_message_print_header(NULL,NULL,0,1));
- EXPECT_GE(-1, dlt_message_print_header(NULL,NULL,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_header(NULL,NULL,DLT_DAEMON_TEXTSIZE,1));
- EXPECT_GE(-1, dlt_message_print_header(NULL,text,0,0));
- EXPECT_GE(-1, dlt_message_print_header(NULL,text,0,1));
- EXPECT_GE(-1, dlt_message_print_header(NULL,text,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_header(NULL,text,DLT_DAEMON_TEXTSIZE,1));
- EXPECT_GE(-1, dlt_message_print_header(&file.msg,NULL,0,0));
- EXPECT_GE(-1, dlt_message_print_header(&file.msg,NULL,0,1));
- EXPECT_GE(-1, dlt_message_print_header(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_header(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(NULL,NULL,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(NULL,NULL,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(NULL,NULL,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(NULL,NULL,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(NULL,text,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(NULL,text,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(NULL,text,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(NULL,text,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(&file.msg,NULL,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(&file.msg,NULL,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_header(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,1));
}
/* End Method: dlt_common::dlt_message_print_header */
@@ -1671,23 +1670,23 @@ TEST(t_dlt_message_print_header_with_filter, normal)
/*---------------------------------------*/
// Normal Use-Case, expect 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_filter_init(&filter, 0));
- EXPECT_LE(0, dlt_filter_load(&filter, openfilter, 0));
- EXPECT_LE(0, dlt_file_set_filter(&file, &filter, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_filter_init(&filter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_filter_load(&filter, openfilter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_set_filter(&file, &filter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_header_with_filter, abnormal)
{
@@ -1716,20 +1715,20 @@ TEST(t_dlt_message_print_hex, normal)
/*---------------------------------------*/
// Normal Use-Case, expected 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_hex, abnormal)
{
@@ -1744,21 +1743,21 @@ TEST(t_dlt_message_print_hex, abnormal)
/*---------------------------------------*/
// No messages read, expected -1
-// EXPECT_GE(-1, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
-// EXPECT_GE(-1, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
// Set verbose to 12345678
-// EXPECT_GE(-1, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
-// EXPECT_LE(0, dlt_file_init(&file, 0));
-// EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
// while (dlt_file_read(&file,0)>=0){}
// for(int i=0;i<file.counter;i++)
// {
-// EXPECT_LE(0, dlt_file_message(&file, i, 0));
-// EXPECT_GE(-1, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
// }
-// EXPECT_LE(0, dlt_file_free(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_hex, nullpointer)
{
@@ -1773,18 +1772,18 @@ TEST(t_dlt_message_print_hex, nullpointer)
/*---------------------------------------*/
// NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_message_print_hex(NULL,NULL,0,0));
- EXPECT_GE(-1, dlt_message_print_hex(NULL,NULL,0,1));
- EXPECT_GE(-1, dlt_message_print_hex(NULL,NULL,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_hex(NULL,NULL,DLT_DAEMON_TEXTSIZE,1));
- EXPECT_GE(-1, dlt_message_print_hex(NULL,text,0,0));
- EXPECT_GE(-1, dlt_message_print_hex(NULL,text,0,1));
- EXPECT_GE(-1, dlt_message_print_hex(NULL,text,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_hex(NULL,text,DLT_DAEMON_TEXTSIZE,1));
- EXPECT_GE(-1, dlt_message_print_hex(&file.msg,NULL,0,0));
- EXPECT_GE(-1, dlt_message_print_hex(&file.msg,NULL,0,1));
- EXPECT_GE(-1, dlt_message_print_hex(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_hex(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(NULL,NULL,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(NULL,NULL,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(NULL,NULL,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(NULL,NULL,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(NULL,text,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(NULL,text,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(NULL,text,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(NULL,text,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(&file.msg,NULL,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(&file.msg,NULL,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_hex(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,1));
}
/* End Method: dlt_common::dlt_message_print_hex */
@@ -1809,23 +1808,23 @@ TEST(t_dlt_message_print_hex_with_filter, normal)
/*---------------------------------------*/
// Normal Use-Case, expect 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_filter_init(&filter, 0));
- EXPECT_LE(0, dlt_filter_load(&filter, openfilter, 0));
- EXPECT_LE(0, dlt_file_set_filter(&file, &filter, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_filter_init(&filter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_filter_load(&filter, openfilter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_set_filter(&file, &filter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_hex(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_hex_with_filter, abnormal)
{
@@ -1854,20 +1853,20 @@ TEST(t_dlt_message_print_mixed_plain, normal)
/*---------------------------------------*/
// Normal Use-Case, expected 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_mixed_plain, abnormal)
{
@@ -1882,21 +1881,21 @@ TEST(t_dlt_message_print_mixed_plain, abnormal)
/*---------------------------------------*/
// No messages read, expected -1
-// EXPECT_GE(-1, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
-// EXPECT_GE(-1, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
// Set verbose to 12345678
-// EXPECT_GE(-1, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
-// EXPECT_LE(0, dlt_file_init(&file, 0));
-// EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
// while (dlt_file_read(&file,0)>=0){}
// for(int i=0;i<file.counter;i++)
// {
-// EXPECT_LE(0, dlt_file_message(&file, i, 0));
-// EXPECT_GE(-1, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
// }
-// EXPECT_LE(0, dlt_file_free(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_mixed_plain, nullpointer)
{
@@ -1911,18 +1910,18 @@ TEST(t_dlt_message_print_mixed_plain, nullpointer)
/*---------------------------------------*/
// NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_message_print_mixed_plain(NULL,NULL,0,0));
- EXPECT_GE(-1, dlt_message_print_mixed_plain(NULL,NULL,0,1));
- EXPECT_GE(-1, dlt_message_print_mixed_plain(NULL,NULL,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_mixed_plain(NULL,NULL,DLT_DAEMON_TEXTSIZE,1));
- EXPECT_GE(-1, dlt_message_print_mixed_plain(NULL,text,0,0));
- EXPECT_GE(-1, dlt_message_print_mixed_plain(NULL,text,0,1));
- EXPECT_GE(-1, dlt_message_print_mixed_plain(NULL,text,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_mixed_plain(NULL,text,DLT_DAEMON_TEXTSIZE,1));
- EXPECT_GE(-1, dlt_message_print_mixed_plain(&file.msg,NULL,0,0));
- EXPECT_GE(-1, dlt_message_print_mixed_plain(&file.msg,NULL,0,1));
- EXPECT_GE(-1, dlt_message_print_mixed_plain(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_mixed_plain(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(NULL,NULL,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(NULL,NULL,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(NULL,NULL,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(NULL,NULL,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(NULL,text,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(NULL,text,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(NULL,text,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(NULL,text,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(&file.msg,NULL,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(&file.msg,NULL,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_plain(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,1));
}
/* End Method: dlt_common::dlt_message_print_mixed_pain */
@@ -1947,23 +1946,23 @@ TEST(t_dlt_message_print_mixed_plain_with_filter, normal)
/*---------------------------------------*/
// Normal Use-Case, expect 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_filter_init(&filter, 0));
- EXPECT_LE(0, dlt_filter_load(&filter, openfilter, 0));
- EXPECT_LE(0, dlt_file_set_filter(&file, &filter, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_filter_init(&filter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_filter_load(&filter, openfilter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_set_filter(&file, &filter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_mixed_plain(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_mixed_plain_with_filter, abnormal)
{
@@ -1991,20 +1990,20 @@ TEST(t_dlt_message_print_mixed_html, normal)
/*---------------------------------------*/
// Normal Use-Case, expected 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_mixed_html, abnormal)
{
@@ -2019,21 +2018,21 @@ TEST(t_dlt_message_print_mixed_html, abnormal)
/*---------------------------------------*/
// No messages read, expected -1
-// EXPECT_GE(-1, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
-// EXPECT_GE(-1, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
// Set verbose to 12345678
-// EXPECT_GE(-1, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
-// EXPECT_LE(0, dlt_file_init(&file, 0));
-// EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
// while (dlt_file_read(&file,0)>=0){}
// for(int i=0;i<file.counter;i++)
// {
-// EXPECT_LE(0, dlt_file_message(&file, i, 0));
-// EXPECT_GE(-1, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
// }
-// EXPECT_LE(0, dlt_file_free(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_mixed_html, nullpointer)
{
@@ -2048,18 +2047,18 @@ TEST(t_dlt_message_print_mixed_html, nullpointer)
/*---------------------------------------*/
// NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_message_print_mixed_html(NULL,NULL,0,0));
- EXPECT_GE(-1, dlt_message_print_mixed_html(NULL,NULL,0,1));
- EXPECT_GE(-1, dlt_message_print_mixed_html(NULL,NULL,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_mixed_html(NULL,NULL,DLT_DAEMON_TEXTSIZE,1));
- EXPECT_GE(-1, dlt_message_print_mixed_html(NULL,text,0,0));
- EXPECT_GE(-1, dlt_message_print_mixed_html(NULL,text,0,1));
- EXPECT_GE(-1, dlt_message_print_mixed_html(NULL,text,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_mixed_html(NULL,text,DLT_DAEMON_TEXTSIZE,1));
- EXPECT_GE(-1, dlt_message_print_mixed_html(&file.msg,NULL,0,0));
- EXPECT_GE(-1, dlt_message_print_mixed_html(&file.msg,NULL,0,1));
- EXPECT_GE(-1, dlt_message_print_mixed_html(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,0));
- EXPECT_GE(-1, dlt_message_print_mixed_html(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(NULL,NULL,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(NULL,NULL,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(NULL,NULL,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(NULL,NULL,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(NULL,text,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(NULL,text,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(NULL,text,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(NULL,text,DLT_DAEMON_TEXTSIZE,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(&file.msg,NULL,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(&file.msg,NULL,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_print_mixed_html(&file.msg,NULL,DLT_DAEMON_TEXTSIZE,1));
}
/* End Method: dlt_common::dlt_message_print_mixed_html */
@@ -2083,23 +2082,23 @@ TEST(t_dlt_message_print_mixed_html_with_filter, normal)
/*---------------------------------------*/
// Normal Use-Case, expect 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_filter_init(&filter, 0));
- EXPECT_LE(0, dlt_filter_load(&filter, openfilter, 0));
- EXPECT_LE(0, dlt_file_set_filter(&file, &filter, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_filter_init(&filter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_filter_load(&filter, openfilter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_set_filter(&file, &filter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_print_mixed_html(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_print_mixed_html_with_filter, abnormal)
{
@@ -2130,23 +2129,23 @@ TEST(t_dlt_message_filter_check, normal)
/*---------------------------------------*/
// Normal Use-Case, expected > 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_filter_init(&filter, 0));
- EXPECT_LE(0, dlt_filter_load(&filter, openfilter, 0));
- EXPECT_LE(0, dlt_file_set_filter(&file, &filter, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_filter_init(&filter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_filter_load(&filter, openfilter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_set_filter(&file, &filter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_filter_check(&file.msg, &filter, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_filter_check(&file.msg, &filter, 0));
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_filter_check(&file.msg, &filter, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_filter_check(&file.msg, &filter, 1));
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_filter_check, abnormal)
{
@@ -2163,21 +2162,21 @@ TEST(t_dlt_message_filter_check, abnormal)
/*---------------------------------------*/
// No messages read, expected -1
-// EXPECT_GE(-1, dlt_message_filter_check(&file.msg, &filter, 0));
-// EXPECT_GE(-1, dlt_message_filter_check(&file.msg, &filter, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_filter_check(&file.msg, &filter, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_filter_check(&file.msg, &filter, 1));
// Set verbose to 12345678
-// EXPECT_GE(-1, dlt_message_filter_check(&file.msg, &filter, 12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_filter_check(&file.msg, &filter, 12345678));
-// EXPECT_LE(0, dlt_file_init(&file, 0));
-// EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
// while (dlt_file_read(&file,0)>=0){}
// for(int i=0;i<file.counter;i++)
// {
-// EXPECT_LE(0, dlt_file_message(&file, i, 0));
-// EXPECT_GE(-1, dlt_message_filter_check(&file.msg, &filter, 12345678));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_filter_check(&file.msg, &filter, 12345678));
// }
-// EXPECT_LE(0, dlt_file_free(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_filter_check, nullpointer)
{
@@ -2194,12 +2193,12 @@ TEST(t_dlt_message_filter_check, nullpointer)
/*---------------------------------------*/
// NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_message_filter_check(NULL, NULL, 0));
- EXPECT_GE(-1, dlt_message_filter_check(NULL, NULL, 1));
- EXPECT_GE(-1, dlt_message_filter_check(NULL, &filter, 0));
- EXPECT_GE(-1, dlt_message_filter_check(NULL, &filter, 1));
- EXPECT_GE(-1, dlt_message_filter_check(&file.msg, NULL, 0));
- EXPECT_GE(-1, dlt_message_filter_check(&file.msg, NULL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_filter_check(NULL, NULL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_filter_check(NULL, NULL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_filter_check(NULL, &filter, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_filter_check(NULL, &filter, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_filter_check(&file.msg, NULL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_filter_check(&file.msg, NULL, 1));
}
/* End Method:dlt_common::dlt_message_filter_check */
@@ -2219,20 +2218,20 @@ TEST(t_dlt_message_get_extraparamters, normal)
/*---------------------------------------*/
// Normal Use-Case, expect >0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_get_extraparameters(&file.msg, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_get_extraparameters(&file.msg, 0));
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_get_extraparameters(&file.msg, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_get_extraparameters(&file.msg, 1));
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_get_extraparamters, abnormal)
{
@@ -2246,27 +2245,27 @@ TEST(t_dlt_message_get_extraparamters, abnormal)
/*---------------------------------------*/
// Uninizialised, expected -1
-// EXPECT_GE(-1, dlt_message_get_extraparameters(&file.msg, 0));
-// EXPECT_GE(-1, dlt_message_get_extraparameters(&file.msg, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_get_extraparameters(&file.msg, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_get_extraparameters(&file.msg, 1));
// set verbose to 12345678, expected -1
-// EXPECT_GE(-1, dlt_message_get_extraparameters(&file.msg, 12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_get_extraparameters(&file.msg, 12345678));
-// EXPECT_LE(0, dlt_file_init(&file, 0));
-// EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
// while (dlt_file_read(&file,0)>=0){}
// for(int i=0;i<file.counter;i++)
// {
-// EXPECT_LE(0, dlt_file_message(&file, i, 0));
-// EXPECT_GE(-1, dlt_message_get_extraparameters(&file.msg, 12345678));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_get_extraparameters(&file.msg, 12345678));
// }
-// EXPECT_LE(0, dlt_file_free(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_get_extraparamters, nullpointer)
{
// NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_message_get_extraparameters(NULL, 0));
- EXPECT_GE(-1, dlt_message_get_extraparameters(NULL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_get_extraparameters(NULL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_get_extraparameters(NULL, 1));
}
/* End Method:dlt_common::dlt_message_get_extraparameters */
@@ -2287,22 +2286,22 @@ TEST(t_dlt_message_header, normal)
/*---------------------------------------*/
// Normal Use-Case, expect 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
printf("%s \n",text);
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
printf("%s \n",text);
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_header, abnormal)
{
@@ -2317,22 +2316,22 @@ TEST(t_dlt_message_header, abnormal)
/*---------------------------------------*/
// Uninizialised, expected -1
-// EXPECT_GE(-1, dlt_message_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
-// EXPECT_GE(-1, dlt_message_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 1));
// set verbose to 12345678, expected -1
-// EXPECT_GE(-1, dlt_message_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
-// EXPECT_LE(0, dlt_file_init(&file, 0));
-// EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
// while (dlt_file_read(&file,0)>=0){}
// for(int i=0;i<file.counter;i++)
// {
-// EXPECT_LE(0, dlt_file_message(&file, i, 0));
-// EXPECT_GE(-1, dlt_message_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(&file.msg, text, DLT_DAEMON_TEXTSIZE, 12345678));
// printf("%s \n",text);
// }
-// EXPECT_LE(0, dlt_file_free(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_header, nullpointer)
{
@@ -2347,20 +2346,20 @@ TEST(t_dlt_message_header, nullpointer)
/*---------------------------------------*/
// NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_message_header(NULL, NULL, 0, 0));
- EXPECT_GE(-1, dlt_message_header(NULL, NULL, 0, 1));
- EXPECT_GE(-1, dlt_message_header(NULL, NULL, DLT_DAEMON_TEXTSIZE, 0));
- EXPECT_GE(-1, dlt_message_header(NULL, NULL, DLT_DAEMON_TEXTSIZE, 1));
- EXPECT_GE(-1, dlt_message_header(NULL, text, 0, 0));
- EXPECT_GE(-1, dlt_message_header(NULL, text, 0, 1));
- EXPECT_GE(-1, dlt_message_header(NULL, text, DLT_DAEMON_TEXTSIZE, 0));
- EXPECT_GE(-1, dlt_message_header(NULL, text, DLT_DAEMON_TEXTSIZE, 1));
- EXPECT_GE(-1, dlt_message_header(&file.msg, NULL, 0, 0));
- EXPECT_GE(-1, dlt_message_header(&file.msg, NULL, 0, 1));
- EXPECT_GE(-1, dlt_message_header(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, 0));
- EXPECT_GE(-1, dlt_message_header(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, 1));
- EXPECT_GE(-1, dlt_message_header(&file.msg, text, 0, 0));
- EXPECT_GE(-1, dlt_message_header(&file.msg, text, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(NULL, NULL, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(NULL, NULL, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(NULL, NULL, DLT_DAEMON_TEXTSIZE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(NULL, NULL, DLT_DAEMON_TEXTSIZE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(NULL, text, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(NULL, text, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(NULL, text, DLT_DAEMON_TEXTSIZE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(NULL, text, DLT_DAEMON_TEXTSIZE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(&file.msg, NULL, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(&file.msg, NULL, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(&file.msg, text, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header(&file.msg, text, 0, 1));
}
/* End Method:dlt_common::dlt_message_header */
@@ -2397,66 +2396,66 @@ TEST(t_dlt_message_header_flags, normal)
/*---------------------------------------*/
// Normal Use-Case, expected 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 0));
printf("%s \n",text);
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 1));
printf("%s \n",text);
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_header_flags, abnormal)
{
@@ -2471,44 +2470,44 @@ TEST(t_dlt_message_header_flags, abnormal)
/*---------------------------------------*/
// Uninizialised, expected -1
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 0));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 0));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 0));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 0));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 0));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 0));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 0));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 0));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 0));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 0));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 0));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 1));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 1));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 1));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 1));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 1));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 1));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 1));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 1));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 1));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 1));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 1));
// USE own DLT_HEADER_SHOW , expected -1
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0x1234, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0x1234, 0));
-// EXPECT_LE(0, dlt_file_init(&file, 0));
-// EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
// while (dlt_file_read(&file,0)>=0){}
// for(int i=0;i<file.counter;i++)
// {
-// EXPECT_LE(0, dlt_file_message(&file, i, 0));
-// EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0x1234, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0x1234, 0));
// printf("%s \n",text);
// }
-// EXPECT_LE(0, dlt_file_free(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_header_flags, nullpointer)
{
@@ -2523,188 +2522,188 @@ TEST(t_dlt_message_header_flags, nullpointer)
/*---------------------------------------*/
// NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, 0, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, 0, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_NONE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_TIME, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_TMSTP, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_MSGCNT, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_ECUID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_APID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_CTID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_MSGTYPE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_VNVSTATUS, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_NOARG, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_ALL, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_NONE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_TIME, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_TMSTP, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_MSGCNT, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_ECUID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_APID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_CTID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_MSGTYPE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_VNVSTATUS, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_NOARG, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_ALL, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, 0, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, 0, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, 0, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, 0, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_NONE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_TIME, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_TMSTP, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_MSGCNT, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_ECUID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_APID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_CTID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_MSGTYPE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_VNVSTATUS, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_NOARG, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_ALL, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_NONE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_TIME, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_TMSTP, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_MSGCNT, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_ECUID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_APID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_CTID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_MSGTYPE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_VNVSTATUS, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_NOARG, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_ALL, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, 0, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, 0, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 0));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 1));
- EXPECT_GE(-1, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, 0, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, 0, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_NONE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_TIME, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_TMSTP, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_MSGCNT, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_ECUID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_APID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_CTID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_MSGTYPE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_VNVSTATUS, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_NOARG, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_ALL, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_NONE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_TIME, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_TMSTP, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_MSGCNT, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_ECUID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_APID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_CTID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_MSGTYPE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_VNVSTATUS, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_NOARG, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_ALL, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, 0, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, 0, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, 0, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, 0, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_NONE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_TIME, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_TMSTP, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_MSGCNT, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_ECUID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_APID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_CTID, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_MSGTYPE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_VNVSTATUS, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_NOARG, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_ALL, 0));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_NONE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_TIME, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_TMSTP, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_MSGCNT, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_ECUID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_APID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_CTID, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_MSGTYPE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_VNVSTATUS, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_NOARG, 1));
- EXPECT_GE(-1, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_ALL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_NONE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_TIME, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_TMSTP, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_MSGCNT, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_ECUID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_APID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_CTID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_MSGTYPE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_VNVSTATUS, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_NOARG, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_ALL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_NONE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_TIME, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_TMSTP, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_MSGCNT, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_ECUID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_APID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_CTID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_MSGTYPE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_VNVSTATUS, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_NOARG, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, 0, DLT_HEADER_SHOW_ALL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_NONE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_TIME, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_TMSTP, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_MSGCNT, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_ECUID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_APID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_CTID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_MSGTYPE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_VNVSTATUS, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_NOARG, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_ALL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_NONE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_TIME, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_TMSTP, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_MSGCNT, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_ECUID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_APID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_CTID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_MSGTYPE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_VNVSTATUS, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_NOARG, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, 0, DLT_HEADER_SHOW_ALL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_NONE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_TIME, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_TMSTP, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_MSGCNT, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_ECUID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_APID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_CTID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_MSGTYPE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_VNVSTATUS, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_NOARG, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_ALL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_NONE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_TIME, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_TMSTP, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_MSGCNT, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_ECUID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_APID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_CTID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_MSGTYPE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_VNVSTATUS, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_NOARG, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, 0, DLT_HEADER_SHOW_ALL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NONE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TIME, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_TMSTP, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGCNT, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ECUID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_APID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_CTID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGTYPE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_VNVSTATUS, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_NOARG, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_HEADER_SHOW_ALL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_NONE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_TIME, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_TMSTP, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_MSGCNT, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_ECUID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_APID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_CTID, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_MSGTYPE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_VNVSTATUS, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_NOARG, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_ALL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_NONE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_TIME, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_TMSTP, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_MSGCNT, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_ECUID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_APID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_CTID, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_MSGTYPE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_MSGSUBTYPE, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_VNVSTATUS, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_NOARG, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_header_flags(&file.msg, text, 0, DLT_HEADER_SHOW_ALL, 1));
}
/* End Method:dlt_common::dlt_message_header_flags */
@@ -2733,38 +2732,38 @@ TEST(t_dlt_message_payload, normal)
/*---------------------------------------*/
// Normal Use-Case, expected 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 0));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 0));
printf("%s \n",text);
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 1));
printf("%s \n",text);
- EXPECT_LE(0, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 1));
printf("%s \n",text);
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_payload, abnormal)
{
@@ -2779,45 +2778,45 @@ TEST(t_dlt_message_payload, abnormal)
/*---------------------------------------*/
// Uninizialised, expected -1
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 0));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 0));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 0));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 0));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 1));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 1));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 1));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 1));
// USE own DLT_HEADER_SHOW , expected -1
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, 99, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, 99, 0));
-// EXPECT_LE(0, dlt_file_init(&file, 0));
-// EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
// while (dlt_file_read(&file,0)>=0){}
// for(int i=0;i<file.counter;i++)
// {
-// EXPECT_LE(0, dlt_file_message(&file, i, 0));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, 99, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, 99, 0));
// printf("%s \n",text);
// }
-// EXPECT_LE(0, dlt_file_free(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
// set verbose to 12345678
-// EXPECT_LE(0, dlt_file_init(&file, 0));
-// EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
// while (dlt_file_read(&file,0)>=0){}
// for(int i=0;i<file.counter;i++)
// {
-// EXPECT_LE(0, dlt_file_message(&file, i, 0));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 12345678));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 12345678));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 12345678));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 12345678));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 12345678));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 12345678));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 12345678));
// }
-// EXPECT_LE(0, dlt_file_free(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_payload, nullpointer)
{
@@ -2825,90 +2824,90 @@ TEST(t_dlt_message_payload, nullpointer)
static char text[DLT_DAEMON_TEXTSIZE];
// NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, 0, 0, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, 0, 0, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_HEX, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_ASCII, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_MIXED_FOR_HTML, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_ASCII_LIMITED, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_HEX, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_ASCII, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_MIXED_FOR_HTML, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_ASCII_LIMITED, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, 0, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, 0, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, 0, 0, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, 0, 0, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_HEX, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_ASCII, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_MIXED_FOR_HTML, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_ASCII_LIMITED, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_HEX, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_ASCII, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_MIXED_FOR_HTML, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_ASCII_LIMITED, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, 0, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, 0, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 0));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 1));
- EXPECT_GE(-1, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, 0, 0, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, 0, 0, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_HEX, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_ASCII, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_MIXED_FOR_HTML, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_ASCII_LIMITED, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_HEX, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_ASCII, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_MIXED_FOR_HTML, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_ASCII_LIMITED, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, 0, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, 0, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, text, 0, 0, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, text, 0, 0, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_HEX, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_ASCII, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_MIXED_FOR_HTML, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_ASCII_LIMITED, 0));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_HEX, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_ASCII, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_MIXED_FOR_HTML, 1));
- EXPECT_GE(-1, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_ASCII_LIMITED, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, 0, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, 0, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_HEX, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_ASCII, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_MIXED_FOR_HTML, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_ASCII_LIMITED, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_HEX, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_ASCII, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_MIXED_FOR_HTML, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, 0, DLT_OUTPUT_ASCII_LIMITED, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, 0, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, 0, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_HEX, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_ASCII, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_MIXED_FOR_HTML, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_ASCII_LIMITED, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_HEX, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_ASCII, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_MIXED_FOR_HTML, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, 0, DLT_OUTPUT_ASCII_LIMITED, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(NULL, text, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, 0, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, 0, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_HEX, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_ASCII, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_MIXED_FOR_HTML, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_ASCII_LIMITED, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_HEX, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_ASCII, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_MIXED_FOR_HTML, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, 0, DLT_OUTPUT_ASCII_LIMITED, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_HEX, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_MIXED_FOR_HTML, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, NULL, DLT_DAEMON_TEXTSIZE, DLT_OUTPUT_ASCII_LIMITED, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, 0, 0, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, 0, 0, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_HEX, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_ASCII, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_MIXED_FOR_HTML, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_ASCII_LIMITED, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_HEX, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_ASCII, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_MIXED_FOR_PLAIN, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_MIXED_FOR_HTML, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, 0, DLT_OUTPUT_ASCII_LIMITED, 1));
// file.msg is not initialised which causes problems when textsize is > 0 but
// we don't have text:
@@ -2916,8 +2915,8 @@ TEST(t_dlt_message_payload, nullpointer)
// (gdb) p ptr
// $28 = (uint8_t *) 0x5124010337d46c00 <error: Cannot access memory at address 0x5124010337d46c00>
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0, 0));
-// EXPECT_GE(-1, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_payload(&file.msg, text, DLT_DAEMON_TEXTSIZE, 0, 1));
}
/* End Method:dlt_common::dlt_message_payload */
@@ -2936,20 +2935,20 @@ TEST(t_dlt_message_set_extraparamters, normal)
/*---------------------------------------*/
// Normal Use-Case, expect 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_set_extraparameters(&file.msg, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_set_extraparameters(&file.msg, 0));
}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(0, dlt_message_set_extraparameters(&file.msg, 1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_message_set_extraparameters(&file.msg, 1));
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_set_extraparamters, abnormal)
{
@@ -2962,25 +2961,25 @@ TEST(t_dlt_message_set_extraparamters, abnormal)
/*---------------------------------------*/
// Uninizialised, expected -1
-// EXPECT_GE(-1, dlt_message_set_extraparameters(&file.msg, 0));
-// EXPECT_GE(-1, dlt_message_set_extraparameters(&file.msg, 1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_set_extraparameters(&file.msg, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_set_extraparameters(&file.msg, 1));
// set verbos to 12345678
-// EXPECT_LE(0, dlt_file_init(&file, 0));
-// EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
// while (dlt_file_read(&file,0)>=0){}
// for(int i=0;i<file.counter;i++)
// {
-// EXPECT_LE(0, dlt_file_message(&file, i, 0));
-// EXPECT_GE(-1, dlt_message_set_extraparameters(&file.msg, 12345678));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_set_extraparameters(&file.msg, 12345678));
// }
-// EXPECT_LE(0, dlt_file_free(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_set_extraparamters, nullpointer)
{
// NULL-Pointer, expect -1
- EXPECT_GE(-1, dlt_message_set_extraparameters(NULL, 0));
- EXPECT_GE(-1, dlt_message_set_extraparameters(NULL, 1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_set_extraparameters(NULL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_set_extraparameters(NULL, 1));
}
/* End Method:dlt_common::dlt_message_set_extraparameters */
@@ -3002,27 +3001,27 @@ TEST(t_dlt_message_read, normal)
DltBuffer buf;
char *buffer = NULL;
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(-1, dlt_message_read(&file.msg,(unsigned char*) buffer,255,0,1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_ERROR, dlt_message_read(&file.msg,(unsigned char*) buffer,255,0,1));
}
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
- EXPECT_LE(0, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_init_dynamic(&buf, DLT_USER_RINGBUFFER_MIN_SIZE, DLT_USER_RINGBUFFER_MAX_SIZE, DLT_USER_RINGBUFFER_STEP_SIZE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
- EXPECT_LE(-1, dlt_message_read(&file.msg,(unsigned char *) buffer,255,1,1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_ERROR, dlt_message_read(&file.msg,(unsigned char *) buffer,255,1,1));
}
- EXPECT_LE(0, dlt_buffer_free_dynamic(&buf));
+ EXPECT_LE(DLT_RETURN_OK, dlt_buffer_free_dynamic(&buf));
}
TEST(t_dlt_message_read, abnormal)
{
@@ -3041,10 +3040,10 @@ TEST(t_dlt_message_read, nullpointer)
DltBuffer buf;
// NULL_Pointer, expected -1
- EXPECT_GE(-1, dlt_message_read(NULL, NULL, 0,0,0));
- EXPECT_GE(-1, dlt_message_read(NULL, (u_int8_t *)&buf, 0,0,0));
- EXPECT_GE(-1, dlt_message_read(&file.msg, NULL, 0,0,0));
- EXPECT_GE(-1, dlt_message_read(&file.msg, (u_int8_t *)&buf, 0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_read(NULL, NULL, 0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_read(NULL, (u_int8_t *)&buf, 0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_read(&file.msg, NULL, 0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_read(&file.msg, (u_int8_t *)&buf, 0,0,0));
}
/* End Method:dlt_common::dlt_message_read */
@@ -3069,35 +3068,35 @@ TEST(t_dlt_message_argument_print, normal)
int32_t *pdatalength;
// Normal Use-Case, expect 0
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
ptr = file.msg.databuffer;
datalength = file.msg.datasize;
pptr = &ptr;
pdatalength = &datalength;
- EXPECT_GE(0, dlt_message_argument_print(&file.msg,DLT_TYPE_INFO_BOOL,pptr,pdatalength,text,DLT_DAEMON_TEXTSIZE,0,1));
+ EXPECT_GE(DLT_RETURN_OK, dlt_message_argument_print(&file.msg,DLT_TYPE_INFO_BOOL,pptr,pdatalength,text,DLT_DAEMON_TEXTSIZE,0,1));
//printf("### ARGUMENT:%s\n", text);
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
- EXPECT_LE(0, dlt_file_init(&file, 0));
- EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
while (dlt_file_read(&file,0)>=0){}
for(int i=0;i<file.counter;i++)
{
- EXPECT_LE(0, dlt_file_message(&file, i, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
ptr = file.msg.databuffer;
datalength = file.msg.datasize;
pptr = &ptr;
pdatalength = &datalength;
- EXPECT_GE(0, dlt_message_argument_print(&file.msg,DLT_TYPE_INFO_RAWD,pptr,pdatalength,text,DLT_DAEMON_TEXTSIZE,0,1));
+ EXPECT_GE(DLT_RETURN_OK, dlt_message_argument_print(&file.msg,DLT_TYPE_INFO_RAWD,pptr,pdatalength,text,DLT_DAEMON_TEXTSIZE,0,1));
//printf("### ARGUMENT:%s\n", text);
}
- EXPECT_LE(0, dlt_file_free(&file, 0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_argument_print, abnormal)
@@ -3116,23 +3115,23 @@ TEST(t_dlt_message_argument_print, abnormal)
// int32_t *pdatalength;
// Uninizialised, expected -1
-// EXPECT_GE(-1, dlt_message_argument_print(&file.msg,12345678,pptr,pdatalength,text,DLT_DAEMON_TEXTSIZE,0,1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(&file.msg,12345678,pptr,pdatalength,text,DLT_DAEMON_TEXTSIZE,0,1));
// Use a non defined type_info, expected -1
-// EXPECT_LE(0, dlt_file_init(&file, 0));
-// EXPECT_LE(0, dlt_file_open(&file, openfile, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_init(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_open(&file, openfile, 0));
// while (dlt_file_read(&file,0)>=0){}
// for(int i=0;i<file.counter;i++)
// {
-// EXPECT_LE(0, dlt_file_message(&file, i, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_message(&file, i, 0));
// ptr = file.msg.databuffer;
// datalength = file.msg.datasize;
// pptr = &ptr;
// pdatalength = &datalength;
-// EXPECT_GE(-1, dlt_message_argument_print(&file.msg,12345678,pptr,pdatalength,text,DLT_DAEMON_TEXTSIZE,0,1));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(&file.msg,12345678,pptr,pdatalength,text,DLT_DAEMON_TEXTSIZE,0,1));
// //printf("### ARGUMENT:%s\n", text);
// }
-// EXPECT_LE(0, dlt_file_free(&file, 0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_file_free(&file, 0));
}
TEST(t_dlt_message_argument_print, nullpointer)
{
@@ -3152,22 +3151,22 @@ TEST(t_dlt_message_argument_print, nullpointer)
pdatalength = &datalength;
// NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_message_argument_print(NULL,0,NULL,NULL,NULL,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(NULL,0,NULL,NULL,text,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(NULL,0,NULL,pdatalength,NULL,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(NULL,0,NULL,pdatalength,text,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(NULL,0,pptr,NULL,NULL,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(NULL,0,pptr,NULL,text,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(NULL,0,pptr,pdatalength,NULL,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(NULL,0,pptr,pdatalength,text,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(&file.msg,0,NULL,NULL,NULL,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(&file.msg,0,NULL,NULL,text,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(&file.msg,0,NULL,pdatalength,NULL,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(&file.msg,0,NULL,pdatalength,text,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(&file.msg,0,pptr,NULL,NULL,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(&file.msg,0,pptr,NULL,text,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(&file.msg,0,pptr,pdatalength,NULL,0,0,0));
- EXPECT_GE(-1, dlt_message_argument_print(&file.msg,0,pptr,pdatalength,text,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(NULL,0,NULL,NULL,NULL,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(NULL,0,NULL,NULL,text,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(NULL,0,NULL,pdatalength,NULL,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(NULL,0,NULL,pdatalength,text,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(NULL,0,pptr,NULL,NULL,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(NULL,0,pptr,NULL,text,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(NULL,0,pptr,pdatalength,NULL,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(NULL,0,pptr,pdatalength,text,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(&file.msg,0,NULL,NULL,NULL,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(&file.msg,0,NULL,NULL,text,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(&file.msg,0,NULL,pdatalength,NULL,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(&file.msg,0,NULL,pdatalength,text,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(&file.msg,0,pptr,NULL,NULL,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(&file.msg,0,pptr,NULL,text,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(&file.msg,0,pptr,pdatalength,NULL,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_message_argument_print(&file.msg,0,pptr,pdatalength,text,0,0,0));
}
/* End Method:dlt_common::dlt_message_argument_print */
@@ -3299,14 +3298,14 @@ TEST(t_dlt_log_free, nullpointer)
TEST(t_dlt_log, normal)
{
/* Possible Falgs */
- // #define LOG_EMERG 0
- // #define LOG_ALERT 1
- // #define LOG_CRIT 2
- // #define LOG_ERR 3
- // #define LOG_WARNING 4
- // #define LOG_NOTICE 5
- // #define LOG_INFO 6
- // #define LOG_DEBUG 7
+ // #define LOG_EMERG 0
+ // #define LOG_ALERT 1
+ // #define LOG_CRIT 2
+ // #define LOG_ERR 3
+ // #define LOG_WARNING 4
+ // #define LOG_NOTICE 5
+ // #define LOG_INFO 6
+ // #define LOG_DEBUG 7
const char * EMERG = "SYSLOG EMERG\n";
const char * ALERT = "SYSLOG ALERT\n";
@@ -3319,36 +3318,36 @@ TEST(t_dlt_log, normal)
// Normal Use-Case, expected 0
dlt_log_init(DLT_LOG_TO_CONSOLE);
- EXPECT_LE(0, dlt_log(LOG_EMERG, (char *) EMERG));
- EXPECT_LE(0, dlt_log(LOG_ALERT, (char *) ALERT));
- EXPECT_LE(0, dlt_log(LOG_CRIT, (char *) CRIT));
- EXPECT_LE(0, dlt_log(LOG_ERR, (char *) ERR));
- EXPECT_LE(0, dlt_log(LOG_WARNING, (char *) WARNING));
- EXPECT_LE(0, dlt_log(LOG_NOTICE, (char *) NOTICE));
- EXPECT_LE(0, dlt_log(LOG_INFO, (char *) INFO));
- EXPECT_LE(0, dlt_log(LOG_DEBUG, (char *) DEBUG));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_EMERG, (char *) EMERG));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_ALERT, (char *) ALERT));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_CRIT, (char *) CRIT));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_ERR, (char *) ERR));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_WARNING, (char *) WARNING));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_NOTICE, (char *) NOTICE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_INFO, (char *) INFO));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_DEBUG, (char *) DEBUG));
dlt_log_init(DLT_LOG_DROPPED);
- EXPECT_LE(0, dlt_log(LOG_EMERG, (char *) EMERG));
- EXPECT_LE(0, dlt_log(LOG_ALERT, (char *) ALERT));
- EXPECT_LE(0, dlt_log(LOG_CRIT, (char *) CRIT));
- EXPECT_LE(0, dlt_log(LOG_ERR, (char *) ERR));
- EXPECT_LE(0, dlt_log(LOG_WARNING, (char *) WARNING));
- EXPECT_LE(0, dlt_log(LOG_NOTICE, (char *) NOTICE));
- EXPECT_LE(0, dlt_log(LOG_INFO, (char *) INFO));
- EXPECT_LE(0, dlt_log(LOG_DEBUG, (char *) DEBUG));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_EMERG, (char *) EMERG));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_ALERT, (char *) ALERT));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_CRIT, (char *) CRIT));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_ERR, (char *) ERR));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_WARNING, (char *) WARNING));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_NOTICE, (char *) NOTICE));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_INFO, (char *) INFO));
+ EXPECT_LE(DLT_RETURN_OK, dlt_log(LOG_DEBUG, (char *) DEBUG));
}
TEST(t_dlt_log, abnormal)
{
// LOG MODE don't exists, expected -1
// int DLT_LOG_DONT_EXISTS = 123456789;
// const char * EXIST = "SYSLOG DONT EXISTS\n";
-// EXPECT_GE(-1, dlt_log(DLT_LOG_DONT_EXISTS, (char *) EXIST));
+// EXPECT_GE(DLT_RETURN_ERROR, dlt_log(DLT_LOG_DONT_EXISTS, (char *) EXIST));
}
TEST(t_dlt_log, nullpointer)
{
// NULL-Pointer, expected -1
- EXPECT_GE(-1, dlt_log(0, NULL));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_log(0, NULL));
}
/* End Method: dlt_common::dlt_log_init_init */
@@ -3414,7 +3413,7 @@ TEST(t_dlt_print_hex_string, normal)
// Normal Use-Case, exptect 0
const char * test1 = "HELLO_HEX";
char text1[DLT_DAEMON_TEXTSIZE];
- EXPECT_LE(0, dlt_print_hex_string(text1, DLT_DAEMON_TEXTSIZE, (unsigned char *)test1, strlen(test1)));
+ EXPECT_LE(DLT_RETURN_OK, dlt_print_hex_string(text1, DLT_DAEMON_TEXTSIZE, (unsigned char *)test1, strlen(test1)));
//printf("text:%s\n", text1);
// convert text1 to an ascii string to compare with the original
char * converted = (char*) malloc(strlen(test1) +1);
@@ -3435,7 +3434,7 @@ TEST(t_dlt_print_hex_string, normal)
const char * test2 = "qwertzuiopasdfghjklyxcvbnm1234567890";
char text2[DLT_DAEMON_TEXTSIZE];
- EXPECT_LE(0, dlt_print_hex_string(text2,DLT_DAEMON_TEXTSIZE,(unsigned char *)test2, strlen(test2)));
+ EXPECT_LE(DLT_RETURN_OK, dlt_print_hex_string(text2,DLT_DAEMON_TEXTSIZE,(unsigned char *)test2, strlen(test2)));
//printf("text:%s\n", text2);
// convert text2 to an ascii string to compare with the original
converted = (char*) malloc(strlen(test2) +1);
@@ -3459,7 +3458,7 @@ TEST(t_dlt_print_hex_string, abnormal)
// print special characters, expected 0
// const char * test3 = "^°!\"§$%&/()=?`´¹²³¼½¬{[]}\\¸@€üöä+#*'~`,.-;:_·…–<>|";
// char text3[DLT_DAEMON_TEXTSIZE];
-// EXPECT_LE(0, dlt_print_hex_string(text3,DLT_DAEMON_TEXTSIZE,(unsigned char *)test3, strlen(test3)));
+// EXPECT_LE(DLT_RETURN_OK, dlt_print_hex_string(text3,DLT_DAEMON_TEXTSIZE,(unsigned char *)test3, strlen(test3)));
//printf("text:%s\n", text3);
// convert text3 to an ascii string to compare with the original
// char * converted = (char*) malloc(strlen(test3) +1);
@@ -3476,12 +3475,12 @@ TEST(t_dlt_print_hex_string, abnormal)
// converted[strlen(test3)] = '\0';
//printf("%s\n", converted);
// EXPECT_STREQ(test3, converted);
-// free(converted);
+// free(converted);
// Empty char *, expect 0
// const char * test4 = "";
// char text4[DLT_DAEMON_TEXTSIZE];
-// EXPECT_LE(0, dlt_print_hex_string(text4,DLT_DAEMON_TEXTSIZE,(unsigned char *)test4, strlen(test4)));
+// EXPECT_LE(DLT_RETURN_OK, dlt_print_hex_string(text4,DLT_DAEMON_TEXTSIZE,(unsigned char *)test4, strlen(test4)));
//printf("text:%s\n", text4);
// convert text4 to an ascii string to compare with the original
// converted = (char*) malloc(strlen(test4) +1);
@@ -3498,16 +3497,16 @@ TEST(t_dlt_print_hex_string, abnormal)
// converted[strlen(test4)] = '\0';
//printf("%s\n", converted);
// EXPECT_STREQ(test4, converted);
-// free(converted);
+// free(converted);
}
TEST(t_dlt_print_hex_string, nullpointer)
{
const char * test5 = "HELLO";
char text5[DLT_DAEMON_TEXTSIZE];
- EXPECT_GE(-1, dlt_print_hex_string(NULL,0,NULL, 0));
- EXPECT_GE(-1, dlt_print_hex_string(NULL,0,(unsigned char *)test5, 0));
- EXPECT_GE(-1, dlt_print_hex_string(text5,0,NULL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_print_hex_string(NULL,0,NULL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_print_hex_string(NULL,0,(unsigned char *)test5, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_print_hex_string(text5,0,NULL, 0));
}
/* End Method:dlt_common::dlt_print_hex_string */
@@ -3519,44 +3518,44 @@ TEST(t_dlt_print_mixed_string, normal)
{
const char * test1 = "HELLO_MIXED";
char text1[DLT_DAEMON_TEXTSIZE];
- EXPECT_LE(0, dlt_print_mixed_string(text1,DLT_DAEMON_TEXTSIZE,(unsigned char *)test1,strlen(test1),0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_print_mixed_string(text1,DLT_DAEMON_TEXTSIZE,(unsigned char *)test1,strlen(test1),0));
printf("%s\n", text1);
const char * test2 = "HELLO_MIXED";
char text2[DLT_DAEMON_TEXTSIZE];
- EXPECT_LE(0, dlt_print_mixed_string(text2,DLT_DAEMON_TEXTSIZE,(unsigned char *)test2,strlen(test2),1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_print_mixed_string(text2,DLT_DAEMON_TEXTSIZE,(unsigned char *)test2,strlen(test2),1));
printf("%s\n", text2);
const char * test3 = "qwertzuiopasdfghjklyxcvbnm1234567890";
char text3[DLT_DAEMON_TEXTSIZE];
- EXPECT_LE(0, dlt_print_mixed_string(text3,DLT_DAEMON_TEXTSIZE,(unsigned char *)test3,strlen(test3),0));
+ EXPECT_LE(DLT_RETURN_OK, dlt_print_mixed_string(text3,DLT_DAEMON_TEXTSIZE,(unsigned char *)test3,strlen(test3),0));
printf("%s\n", text3);
const char * test4 = "qwertzuiopasdfghjklyxcvbnm1234567890";
char text4[DLT_DAEMON_TEXTSIZE];
- EXPECT_LE(0, dlt_print_mixed_string(text4,DLT_DAEMON_TEXTSIZE,(unsigned char *)test4,strlen(test4),1));
+ EXPECT_LE(DLT_RETURN_OK, dlt_print_mixed_string(text4,DLT_DAEMON_TEXTSIZE,(unsigned char *)test4,strlen(test4),1));
printf("%s\n", text4);
}
TEST(t_dlt_print_mixed_string, abnormal)
{
// const char * test5 = "^°!\"§$%&/()=?`´¹²³¼½¬{[]}\\¸@€üöä+#*'~`,.-;:_·…–<>|";
// char text5[DLT_DAEMON_TEXTSIZE];
-// EXPECT_LE(0, dlt_print_mixed_string(text5,DLT_DAEMON_TEXTSIZE,(unsigned char *)test5,strlen(test5),0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_print_mixed_string(text5,DLT_DAEMON_TEXTSIZE,(unsigned char *)test5,strlen(test5),0));
// printf("%s\n", text5);
// const char * test6 = "^°!\"§$%&/()=?`´¹²³¼½¬{[]}\\¸@€üöä+#*'~`,.-;:_·…–<>|";
// char text6[DLT_DAEMON_TEXTSIZE];
-// EXPECT_LE(0, dlt_print_mixed_string(text6,DLT_DAEMON_TEXTSIZE,(unsigned char *)test6,strlen(test6),1));
+// EXPECT_LE(DLT_RETURN_OK, dlt_print_mixed_string(text6,DLT_DAEMON_TEXTSIZE,(unsigned char *)test6,strlen(test6),1));
// printf("%s\n", text6);
// const char * test7 = "";
// char text7[DLT_DAEMON_TEXTSIZE];
-// EXPECT_LE(0, dlt_print_mixed_string(text7,DLT_DAEMON_TEXTSIZE,(unsigned char *)test7,strlen(test7),0));
+// EXPECT_LE(DLT_RETURN_OK, dlt_print_mixed_string(text7,DLT_DAEMON_TEXTSIZE,(unsigned char *)test7,strlen(test7),0));
// printf("%s\n", text7);
// const char * test8 = "";
// char text8[DLT_DAEMON_TEXTSIZE];
-// EXPECT_LE(0, dlt_print_mixed_string(text8,DLT_DAEMON_TEXTSIZE,(unsigned char *)test8,strlen(test8),1));
+// EXPECT_LE(DLT_RETURN_OK, dlt_print_mixed_string(text8,DLT_DAEMON_TEXTSIZE,(unsigned char *)test8,strlen(test8),1));
// printf("%s\n", text8);
}
TEST(t_dlt_print_mixed_string, nullpointer)
@@ -3564,12 +3563,12 @@ TEST(t_dlt_print_mixed_string, nullpointer)
const char * test9 = "";
char text9[DLT_DAEMON_TEXTSIZE];
- EXPECT_GE(-1, dlt_print_mixed_string(NULL,0,0,0,0));
- EXPECT_GE(-1, dlt_print_mixed_string(NULL,0,0,0,1));
- EXPECT_GE(-1, dlt_print_mixed_string(NULL,0,(unsigned char *)test9,0,0));
- EXPECT_GE(-1, dlt_print_mixed_string(NULL,0,(unsigned char *)test9,0,1));
- EXPECT_GE(-1, dlt_print_mixed_string(text9,0,NULL,0,0));
- EXPECT_GE(-1, dlt_print_mixed_string(text9,0,NULL,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_print_mixed_string(NULL,0,0,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_print_mixed_string(NULL,0,0,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_print_mixed_string(NULL,0,(unsigned char *)test9,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_print_mixed_string(NULL,0,(unsigned char *)test9,0,1));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_print_mixed_string(text9,0,NULL,0,0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_print_mixed_string(text9,0,NULL,0,1));
}
/* End Method:dlt_common::dlt_print_mixed_string */
@@ -3583,14 +3582,14 @@ TEST(t_dlt_print_char_string, normal)
const char * test1 = "HELLO";
char text1[DLT_DAEMON_TEXTSIZE];
char * ptr1 = text1;
- EXPECT_LE(0, dlt_print_char_string(&ptr1,DLT_DAEMON_TEXTSIZE,(unsigned char *)test1, strlen(test1)));
+ EXPECT_LE(DLT_RETURN_OK, dlt_print_char_string(&ptr1,DLT_DAEMON_TEXTSIZE,(unsigned char *)test1, strlen(test1)));
printf("text:%s\n", text1);
EXPECT_STREQ(text1, test1);
const char * test2 = "qwertzuiopasdfghjklyxcvbnm1234567890";
char text2[DLT_DAEMON_TEXTSIZE];
char * ptr2 = text2;
- EXPECT_LE(0, dlt_print_char_string(&ptr2,DLT_DAEMON_TEXTSIZE,(unsigned char *)test2, strlen(test2)));
+ EXPECT_LE(DLT_RETURN_OK, dlt_print_char_string(&ptr2,DLT_DAEMON_TEXTSIZE,(unsigned char *)test2, strlen(test2)));
printf("text:%s\n", text2);
EXPECT_STREQ(text2, test2);
}
@@ -3600,7 +3599,7 @@ TEST(t_dlt_print_char_string, abnormal)
// const char * test3 = "^°!\"§$%&/()=?`´¹²³¼½¬{[]}\\¸@€üöä+#*'~`,.-;:_·…–<>|";
// char text3[DLT_DAEMON_TEXTSIZE];
// char * ptr3 = text3;
-// EXPECT_LE(0, dlt_print_char_string(&ptr3,DLT_DAEMON_TEXTSIZE,(unsigned char *)test3, strlen(test3)));
+// EXPECT_LE(DLT_RETURN_OK, dlt_print_char_string(&ptr3,DLT_DAEMON_TEXTSIZE,(unsigned char *)test3, strlen(test3)));
// printf("text:%s\n", text3);
// EXPECT_STREQ(text3, test3);
@@ -3608,7 +3607,7 @@ TEST(t_dlt_print_char_string, abnormal)
// const char * test4 = "";
// char text4[DLT_DAEMON_TEXTSIZE];
// char * ptr4 = text4;
-// EXPECT_LE(0, dlt_print_char_string(&ptr4,DLT_DAEMON_TEXTSIZE,(unsigned char *)test4, strlen(test4)));
+// EXPECT_LE(DLT_RETURN_OK, dlt_print_char_string(&ptr4,DLT_DAEMON_TEXTSIZE,(unsigned char *)test4, strlen(test4)));
// printf("text:%s\n", text4);
// EXPECT_STREQ(text4, test4);
}
@@ -3618,9 +3617,9 @@ TEST(t_dlt_print_char_string, nullpointer)
char text5[DLT_DAEMON_TEXTSIZE];
char * ptr5 = text5;
- EXPECT_GE(-1, dlt_print_char_string(NULL,0,NULL, 0));
- EXPECT_GE(-1, dlt_print_char_string(NULL,0,(unsigned char *)test5, 0));
- EXPECT_GE(-1, dlt_print_char_string(&ptr5,0,NULL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_print_char_string(NULL,0,NULL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_print_char_string(NULL,0,(unsigned char *)test5, 0));
+ EXPECT_GE(DLT_RETURN_ERROR, dlt_print_char_string(&ptr5,0,NULL, 0));
}
/* End Method:dlt_common::dlt_print_char_string */
diff --git a/tests/gtest_dlt_daemon_common.cpp b/tests/gtest_dlt_daemon_common.cpp
index 58cc77e..07b0aa7 100644
--- a/tests/gtest_dlt_daemon_common.cpp
+++ b/tests/gtest_dlt_daemon_common.cpp
@@ -125,7 +125,7 @@ TEST(t_dlt_daemon_application_add, abnormal)
// EXPECT_STREQ(tmp, app->apid);
// dlt_daemon_application_del(&daemon, app, 0);
// dlt_daemon_applications_clear(&daemon, 0);
-// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
+// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
}
TEST(t_dlt_daemon_application_add, nullpointer)
@@ -159,7 +159,7 @@ TEST(t_dlt_daemon_application_del, normal)
// Normal Use-Case, retrun type cannot be tested, only apid and desc
EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
app = dlt_daemon_application_add(&daemon,(char *) apid, pid, (char *) desc, 0);
- EXPECT_LE(0,dlt_daemon_application_del(&daemon,app, 0));
+ EXPECT_LE(0, dlt_daemon_application_del(&daemon,app, 0));
EXPECT_LE(0, dlt_daemon_applications_clear(&daemon, 0));
EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
}
@@ -248,7 +248,7 @@ TEST(t_dlt_daemon_application_find, abnormal)
// EXPECT_EQ((DltDaemonApplication *) 0, dlt_daemon_application_find(&daemon, (char *) apid, 123456789));
// dlt_daemon_application_del(&daemon, app, 0);
// dlt_daemon_applications_clear(&daemon, 0);
-// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
+// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
}
TEST(t_dlt_daemon_application_find, nullpointer)
@@ -285,14 +285,14 @@ TEST(t_dlt_daemon_applications_clear, abnormal)
// pid_t pid = 0;
// No applications added, expect < -1
-// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
+// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
// EXPECT_GE(-1, dlt_daemon_applications_clear(&daemon, 0));
// Verbose != 0 or 1, expect error
// dlt_daemon_application_add(&daemon, (char *) "TEST", pid, (char *) "Test clear", 0);
// EXPECT_GE(-1, dlt_daemon_applications_clear(&daemon, 123456789));
// dlt_daemon_applications_clear(&daemon, 0);
-// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
+// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
}
TEST(t_dlt_daemon_applications_clear, nullpointer)
{
@@ -329,7 +329,7 @@ TEST(t_dlt_daemon_applications_invalidate_fd, abnormal)
// DltDaemonApplication *app;
// Daemon isn't initialized, expected error
-// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
+// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
// EXPECT_GE(-1, dlt_daemon_applications_invalidate_fd(&daemon, 0, 0));
// Verbose != 0 or 1, expect error
@@ -337,7 +337,7 @@ TEST(t_dlt_daemon_applications_invalidate_fd, abnormal)
// EXPECT_GE(-1, dlt_daemon_applications_invalidate_fd(&daemon, app->user_handle, 123456789));
// dlt_daemon_application_del(&daemon, app, 0);
// dlt_daemon_applications_clear(&daemon, 0);
-// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
+// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
}
TEST(t_dlt_daemon_applications_invalidate_fd, nullpointer)
{
@@ -377,7 +377,7 @@ TEST(t_dlt_daemon_applications_save, abnormal)
// const char * filename = "/tmp/dlt-runtime.cfg";
// Uninitialized
-// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
+// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
// EXPECT_GE(-1, dlt_daemon_applications_save(&daemon, (char *) filename, 0));
// Verbose != 1 or 0, expect error
@@ -391,7 +391,7 @@ TEST(t_dlt_daemon_applications_save, abnormal)
// EXPECT_GE(-1, dlt_daemon_applications_save(&daemon, (char *) "PATH_DONT_EXIST", 0));
// dlt_daemon_application_del(&daemon, app, 0);
// dlt_daemon_applications_clear(&daemon, 0);
-// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
+// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
}
TEST(t_dlt_daemon_applications_save, nullpointer)
{
@@ -429,7 +429,7 @@ TEST(t_dlt_daemon_applications_load, abnormal)
// const char * filename = "/tmp/dlt-runtime.cfg";
// Uninitialized
-// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
+// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
// EXPECT_GE(-1, dlt_daemon_applications_load(&daemon, (char *) filename, 0));
// Verbose != 1 or 0, expect error
@@ -443,7 +443,7 @@ TEST(t_dlt_daemon_applications_load, abnormal)
// EXPECT_GE(-1, dlt_daemon_applications_load(&daemon, (char *) "PATH_DONT_EXIST", 0));
// dlt_daemon_application_del(&daemon, app, 0);
// dlt_daemon_applications_clear(&daemon, 0);
-// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
+// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
}
TEST(t_dlt_daemon_applications_load, nullpointer)
{
@@ -471,19 +471,19 @@ TEST(t_dlt_daemon_applications_load, nullpointer)
TEST(t_dlt_daemon_context_add, normal)
{
// Log Level
-// 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_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 */
// Trace Status
-// 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_DEFAULT = -1, /**< Default trace status */
+// DLT_TRACE_STATUS_OFF = 0x00, /**< Trace status: Off */
+// DLT_TRACE_STATUS_ON = 0x01 /**< Trace status: On */
DltDaemon daemon;
ID4 apid = "TES";
@@ -837,7 +837,7 @@ TEST(t_dlt_daemon_contexts_clear, abnormal)
// DltDaemonApplication *app;
// No context added
-// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
+// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
// EXPECT_GE(-1, dlt_daemon_contexts_clear(&daemon, 0));
// Verbose != 0 or 1
@@ -847,7 +847,7 @@ TEST(t_dlt_daemon_contexts_clear, abnormal)
// dlt_daemon_application_del(&daemon, app, 0);
// EXPECT_LE(0, dlt_daemon_contexts_clear(&daemon, 123456789));
// dlt_daemon_applications_clear(&daemon, 0);
-// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
+// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
}
TEST(t_dlt_daemon_contexts_clear, nullpointer)
{
@@ -890,7 +890,7 @@ TEST(t_dlt_daemon_contexts_invalidate_fd, abnormal)
// DltDaemonApplication *app;
// Uninitialized
-// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
+// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
// EXPECT_GE(-1, dlt_daemon_contexts_invalidate_fd(&daemon, app->user_handle, 0));
// Verbose != 0 or 1
@@ -901,7 +901,7 @@ TEST(t_dlt_daemon_contexts_invalidate_fd, abnormal)
// dlt_daemon_application_del(&daemon, app, 0);
// dlt_daemon_contexts_clear(&daemon, 0);
// dlt_daemon_applications_clear(&daemon, 0);
-// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
+// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
}
TEST(t_dlt_daemon_contexts_invalidate_fd, nullpointer)
{
@@ -946,7 +946,7 @@ TEST(t_dlt_daemon_contexts_save, abnormal)
// const char * filename = "/tmp/dlt-runtime-context.cfg";
// Uninitialized
-// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
+// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
// EXPECT_GE(-1, dlt_daemon_contexts_save(&daemon, filename, 0));
// Verbose != 1 or 0, expect error
@@ -966,7 +966,7 @@ TEST(t_dlt_daemon_contexts_save, abnormal)
// dlt_daemon_application_del(&daemon, app, 0);
// dlt_daemon_contexts_clear(&daemon, 0);
// dlt_daemon_applications_clear(&daemon, 0);
-// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
+// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
}
TEST(t_dlt_daemon_contexts_save, nullpointer)
{
@@ -1016,7 +1016,7 @@ TEST(t_dlt_daemon_contexts_load, abnormal)
// const char * filename = "/tmp/dlt-runtime-context.cfg";
// Uninitialized
-// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
+// EXPECT_EQ(0, dlt_daemon_init(&daemon, DLT_DAEMON_RINGBUFFER_MIN_SIZE, DLT_DAEMON_RINGBUFFER_MAX_SIZE, DLT_DAEMON_RINGBUFFER_STEP_SIZE, DLT_RUNTIME_DEFAULT_DIRECTORY,0));
// EXPECT_GE(-1, dlt_daemon_contexts_load(&daemon, filename, 0));
// Verbose != 1 or 0, expect error
@@ -1036,7 +1036,7 @@ TEST(t_dlt_daemon_contexts_load, abnormal)
// dlt_daemon_application_del(&daemon, app, 0);
// dlt_daemon_contexts_clear(&daemon, 0);
// dlt_daemon_applications_clear(&daemon, 0);
-// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
+// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
}
TEST(t_dlt_daemon_contexts_load, nullpointer)
{
@@ -1246,7 +1246,7 @@ TEST(t_dlt_daemon_user_send_log_state, abnormal)
// dlt_daemon_contexts_clear(&daemon, 0);
// dlt_daemon_applications_clear(&daemon, 0);
// close(app->user_handle);
-// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
+// EXPECT_EQ(0, dlt_daemon_free(&daemon, 0));
}
TEST(t_dlt_daemon_user_send_log_state, nullpointer)
{
diff --git a/tests/gtest_dlt_user.cpp b/tests/gtest_dlt_user.cpp
index e58a648..74af337 100644
--- a/tests/gtest_dlt_user.cpp
+++ b/tests/gtest_dlt_user.cpp
@@ -31,7 +31,6 @@
#include <limits.h>
extern "C" {
-#include "dlt_common.h"
#include "dlt_user.h"
}
@@ -196,7 +195,7 @@ int dlt_nonverbose_mode(void);
// start initial dlt
TEST(t_dlt_init, onetime)
{
- EXPECT_EQ(0, dlt_init());
+ EXPECT_EQ(DLT_RETURN_OK, dlt_init());
}
/////////////////////////////////////////
@@ -207,50 +206,50 @@ TEST(t_dlt_user_log_write_start, normal)
DltContextData contextData;
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start normal"));
// the defined enum values for log level
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_OFF));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_FATAL));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_ERROR));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_WARN));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_INFO));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEBUG));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_VERBOSE));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
-
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_OFF));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_FATAL));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_ERROR));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_WARN));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_INFO));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEBUG));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_VERBOSE));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_start, abnormal)
{
DltContext context;
- // TODO: DltContextData contextData;
+ DltContextData contextData;
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start abnormal"));
// undefined values for DltLogLevelType
// shouldn't it return -1?
- // TODO: EXPECT_GE(-1,dlt_user_log_write_start(&context, &contextData, (DltLogLevelType)-100));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_start(&context, &contextData, (DltLogLevelType)-10));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_start(&context, &contextData, (DltLogLevelType)10));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_start(&context, &contextData, (DltLogLevelType)100));
+ EXPECT_EQ(DLT_RETURN_WRONG_PARAMETER,dlt_user_log_write_start(&context, &contextData, (DltLogLevelType)-100));
+ EXPECT_EQ(DLT_RETURN_WRONG_PARAMETER,dlt_user_log_write_start(&context, &contextData, (DltLogLevelType)-10));
+ EXPECT_EQ(DLT_RETURN_WRONG_PARAMETER,dlt_user_log_write_start(&context, &contextData, (DltLogLevelType)10));
+ EXPECT_EQ(DLT_RETURN_WRONG_PARAMETER,dlt_user_log_write_start(&context, &contextData, (DltLogLevelType)100));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_start, startstartfinish)
@@ -260,15 +259,15 @@ TEST(t_dlt_user_log_write_start, startstartfinish)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start startstartfinish"));
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start startstartfinish"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
// shouldn't it return -1, because it is already started?
- // TODO: EXPECT_GE(-1,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_start, nullpointer)
@@ -277,17 +276,17 @@ TEST(t_dlt_user_log_write_start, nullpointer)
DltContextData contextData;
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start nullpointer"));
// NULL's
- EXPECT_GE(-1,dlt_user_log_write_start(NULL, &contextData, DLT_LOG_DEFAULT));
- //EXPECT_GE(-1,dlt_user_log_write_finish(&contextData));
- EXPECT_GE(-1,dlt_user_log_write_start(NULL, NULL, DLT_LOG_DEFAULT));
- EXPECT_GE(-1,dlt_user_log_write_start(&context, NULL, DLT_LOG_DEFAULT));
- //EXPECT_GE(-1,dlt_user_log_write_finish(&contextData));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_start(NULL, &contextData, DLT_LOG_DEFAULT));
+ //EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_finish(&contextData));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_start(NULL, NULL, DLT_LOG_DEFAULT));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_start(&context, NULL, DLT_LOG_DEFAULT));
+ //EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -300,48 +299,48 @@ TEST(t_dlt_user_log_write_start_id, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start_id normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start_id normal"));
// the defined enum values for log level
messageid = UINT32_MIN;
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_DEFAULT, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_OFF, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_FATAL, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_ERROR, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_WARN, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_INFO, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_DEBUG, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_VERBOSE, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_DEFAULT, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_OFF, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_FATAL, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_ERROR, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_WARN, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_INFO, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_DEBUG, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_VERBOSE, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
messageid = UINT32_MAX;
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_DEFAULT, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_OFF, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_FATAL, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_ERROR, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_WARN, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_INFO, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_DEBUG, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_VERBOSE, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
-
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_DEFAULT, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_OFF, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_FATAL, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_ERROR, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_WARN, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_INFO, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_DEBUG, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_VERBOSE, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
+
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_start_id, abnormal)
@@ -352,19 +351,19 @@ TEST(t_dlt_user_log_write_start_id, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start_id abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start_id abnormal"));
// undefined values for DltLogLevelType
// shouldn't it return -1?
// TODO: messageid = UINT32_MIN;
- // TODO: EXPECT_GE(-1,dlt_user_log_write_start_id(&context, &contextData, (DltLogLevelType)-100, messageid));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_start_id(&context, &contextData, (DltLogLevelType)-10, messageid));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_start_id(&context, &contextData, (DltLogLevelType)10, messageid));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_start_id(&context, &contextData, (DltLogLevelType)100, messageid));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_start_id(&context, &contextData, (DltLogLevelType)-100, messageid));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_start_id(&context, &contextData, (DltLogLevelType)-10, messageid));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_start_id(&context, &contextData, (DltLogLevelType)10, messageid));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_start_id(&context, &contextData, (DltLogLevelType)100, messageid));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_start_id, startstartfinish)
@@ -375,17 +374,17 @@ TEST(t_dlt_user_log_write_start_id, startstartfinish)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start_id startstartfinish"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start_id startstartfinish"));
messageid = UINT32_MIN;
- EXPECT_LE(0,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_DEFAULT, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_DEFAULT, messageid));
// shouldn't it return -1, because it is already started?
- // TODO: EXPECT_GE(-1,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_DEFAULT, messageid));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_start_id(&context, &contextData, DLT_LOG_DEFAULT, messageid));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_start_id, nullpointer)
@@ -396,18 +395,18 @@ TEST(t_dlt_user_log_write_start_id, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start_id nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start_id nullpointer"));
// NULL's
messageid = UINT32_MIN;
- EXPECT_GE(-1,dlt_user_log_write_start_id(NULL, &contextData, DLT_LOG_DEFAULT, messageid));
- //EXPECT_GE(-1,dlt_user_log_write_finish(&contextData));
- EXPECT_GE(-1,dlt_user_log_write_start_id(NULL, NULL, DLT_LOG_DEFAULT, messageid));
- EXPECT_GE(-1,dlt_user_log_write_start_id(&context, NULL, DLT_LOG_DEFAULT, messageid));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_start_id(NULL, &contextData, DLT_LOG_DEFAULT, messageid));
+ //EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_finish(&contextData));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_start_id(NULL, NULL, DLT_LOG_DEFAULT, messageid));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_start_id(&context, NULL, DLT_LOG_DEFAULT, messageid));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -419,28 +418,28 @@ TEST(t_dlt_user_log_write_finish, finish)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start finish"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_start finish"));
// finish without start
- // TODO: EXPECT_GE(-1,dlt_user_log_write_finish(NULL));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_finish(&contextData));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_finish(NULL));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_finish finish"));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_finish finish"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_finish(&contextData));
// finish with start and initialized context
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
// 2nd finish
- // TODO: EXPECT_GE(-1,dlt_user_log_write_finish(&contextData));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -453,19 +452,19 @@ TEST(t_dlt_user_log_write_bool, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_bool normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_bool normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = true;
- EXPECT_LE(0,dlt_user_log_write_bool(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_bool(&contextData, data));
data = false;
- EXPECT_LE(0,dlt_user_log_write_bool(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_bool(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_bool, abnormal)
@@ -476,21 +475,21 @@ TEST(t_dlt_user_log_write_bool, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_bool abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_bool abnormal"));
// abnormal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
// TODO: data = 2;
- // TODO: EXPECT_GE(-1,dlt_user_log_write_bool(&contextData, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_bool(&contextData, data));
// TODO: data = 100;
- // TODO: EXPECT_GE(-1,dlt_user_log_write_bool(&contextData, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_bool(&contextData, data));
// TODO: data = UINT8_MAX;
- // TODO: EXPECT_GE(-1,dlt_user_log_write_bool(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_bool(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_bool, nullpointer)
@@ -500,15 +499,15 @@ TEST(t_dlt_user_log_write_bool, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_bool nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_bool nullpointer"));
// NULL
data = true;
- EXPECT_GE(-1,dlt_user_log_write_bool(NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_bool(NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -521,27 +520,27 @@ TEST(t_dlt_user_log_write_float32, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_float32 normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_float32 normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = 3.141592653589793238;
- EXPECT_LE(0,dlt_user_log_write_float32(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_float32(&contextData, data));
data = -3.141592653589793238;
- EXPECT_LE(0,dlt_user_log_write_float32(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_float32(&contextData, data));
data = 0.;
- EXPECT_LE(0,dlt_user_log_write_float32(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_float32(&contextData, data));
data = -0.;
- EXPECT_LE(0,dlt_user_log_write_float32(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_float32(&contextData, data));
data = FLT_MIN;
- EXPECT_LE(0,dlt_user_log_write_float32(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_float32(&contextData, data));
data = FLT_MAX;
- EXPECT_LE(0,dlt_user_log_write_float32(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_float32(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_float32, nullpointer)
@@ -551,15 +550,15 @@ TEST(t_dlt_user_log_write_float32, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_float32 nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_float32 nullpointer"));
// NULL
data = 1.;
- EXPECT_GE(-1,dlt_user_log_write_float32(NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_float32(NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -572,27 +571,27 @@ TEST(t_dlt_user_log_write_float64, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_float64 normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_float64 normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = 3.14159265358979323846;
- EXPECT_LE(0,dlt_user_log_write_float64(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_float64(&contextData, data));
data = -3.14159265358979323846;
- EXPECT_LE(0,dlt_user_log_write_float64(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_float64(&contextData, data));
data = 0.;
- EXPECT_LE(0,dlt_user_log_write_float64(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_float64(&contextData, data));
data = -0.;
- EXPECT_LE(0,dlt_user_log_write_float64(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_float64(&contextData, data));
data = DBL_MIN;
- EXPECT_LE(0,dlt_user_log_write_float64(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_float64(&contextData, data));
data = DBL_MAX;
- EXPECT_LE(0,dlt_user_log_write_float64(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_float64(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_float64, nullpointer)
@@ -602,15 +601,15 @@ TEST(t_dlt_user_log_write_float64, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_float64 nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_float64 nullpointer"));
// NULL
data = 1.;
- EXPECT_GE(-1,dlt_user_log_write_float64(NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_float64(NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -623,21 +622,21 @@ TEST(t_dlt_user_log_write_uint, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = UINT_MIN;
- EXPECT_LE(0,dlt_user_log_write_uint(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint(&contextData, data));
data = 1;
- EXPECT_LE(0,dlt_user_log_write_uint(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint(&contextData, data));
data = UINT_MAX;
- EXPECT_LE(0,dlt_user_log_write_uint(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_uint, abnormal)
@@ -648,17 +647,17 @@ TEST(t_dlt_user_log_write_uint, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint abnormal"));
// abnormal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
// TODO: data = -1;
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_uint, nullpointer)
@@ -668,15 +667,15 @@ TEST(t_dlt_user_log_write_uint, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint nullpointer"));
// NULL
data = 1;
- EXPECT_GE(-1,dlt_user_log_write_uint(NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint(NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -689,21 +688,21 @@ TEST(t_dlt_user_log_write_uint8, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint8 normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint8 normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = UINT8_MIN;
- EXPECT_LE(0,dlt_user_log_write_uint8(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8(&contextData, data));
data = 1;
- EXPECT_LE(0,dlt_user_log_write_uint8(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8(&contextData, data));
data = UINT8_MAX;
- EXPECT_LE(0,dlt_user_log_write_uint8(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_uint8, nullpointer)
@@ -713,15 +712,15 @@ TEST(t_dlt_user_log_write_uint8, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint8 nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint8 nullpointer"));
// NULL
data = 1;
- EXPECT_GE(-1,dlt_user_log_write_uint8(NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint8(NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -734,21 +733,21 @@ TEST(t_dlt_user_log_write_uint16, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint16 normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint16 normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = UINT16_MIN;
- EXPECT_LE(0,dlt_user_log_write_uint16(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16(&contextData, data));
data = 1;
- EXPECT_LE(0,dlt_user_log_write_uint16(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16(&contextData, data));
data = UINT16_MAX;
- EXPECT_LE(0,dlt_user_log_write_uint16(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_uint16, nullpointer)
@@ -758,15 +757,15 @@ TEST(t_dlt_user_log_write_uint16, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint16 nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint16 nullpointer"));
// NULL
data = 1;
- EXPECT_GE(-1,dlt_user_log_write_uint16(NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint16(NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -779,21 +778,21 @@ TEST(t_dlt_user_log_write_uint32, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint32 normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint32 normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = UINT32_MIN;
- EXPECT_LE(0,dlt_user_log_write_uint32(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32(&contextData, data));
data = 1;
- EXPECT_LE(0,dlt_user_log_write_uint32(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32(&contextData, data));
data = UINT32_MAX;
- EXPECT_LE(0,dlt_user_log_write_uint32(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_uint32, nullpointer)
@@ -803,15 +802,15 @@ TEST(t_dlt_user_log_write_uint32, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint32 nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint32 nullpointer"));
// NULL
data = 1;
- EXPECT_GE(-1,dlt_user_log_write_uint32(NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint32(NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -824,21 +823,21 @@ TEST(t_dlt_user_log_write_uint64, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint64 normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint64 normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = UINT64_MIN;
- EXPECT_LE(0,dlt_user_log_write_uint64(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64(&contextData, data));
data = 1;
- EXPECT_LE(0,dlt_user_log_write_uint64(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64(&contextData, data));
data = UINT64_MAX;
- EXPECT_LE(0,dlt_user_log_write_uint64(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_uint64, nullpointer)
@@ -848,15 +847,15 @@ TEST(t_dlt_user_log_write_uint64, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint64 nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint64 nullpointer"));
// NULL
data = 1;
- EXPECT_GE(-1,dlt_user_log_write_uint64(NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint64(NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -869,39 +868,39 @@ TEST(t_dlt_user_log_write_uint8_formatted, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint8_formatted normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint8_formatted normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = UINT8_MIN;
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX8));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX16));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX32));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX64));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_BIN8));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_BIN16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX32));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX64));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_BIN8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_BIN16));
data = 1;
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX8));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX16));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX32));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX64));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_BIN8));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_BIN16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX32));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX64));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_BIN8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_BIN16));
data = UINT8_MAX;
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX8));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX16));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX32));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX64));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_BIN8));
- EXPECT_LE(0,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_BIN16));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX32));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_HEX64));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_BIN8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint8_formatted(&contextData, data, DLT_FORMAT_BIN16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_uint8_formatted, abnormal)
@@ -912,20 +911,20 @@ TEST(t_dlt_user_log_write_uint8_formatted, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint8_formatted abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint8_formatted abnormal"));
// abnormal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
// TODO: data = 1;
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint8_formatted(&contextData, data, (DltFormatType)-100));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint8_formatted(&contextData, data, (DltFormatType)-10));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint8_formatted(&contextData, data, (DltFormatType)10));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint8_formatted(&contextData, data, (DltFormatType)100));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint8_formatted(&contextData, data, (DltFormatType)-100));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint8_formatted(&contextData, data, (DltFormatType)-10));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint8_formatted(&contextData, data, (DltFormatType)10));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint8_formatted(&contextData, data, (DltFormatType)100));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_uint8_formatted, nullpointer)
@@ -935,21 +934,21 @@ TEST(t_dlt_user_log_write_uint8_formatted, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint8_formatted nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint8_formatted nullpointer"));
// NULL
data = 1;
- EXPECT_GE(-1,dlt_user_log_write_uint8_formatted(NULL, data, DLT_FORMAT_DEFAULT));
- EXPECT_GE(-1,dlt_user_log_write_uint8_formatted(NULL, data, DLT_FORMAT_HEX8));
- EXPECT_GE(-1,dlt_user_log_write_uint8_formatted(NULL, data, DLT_FORMAT_HEX16));
- EXPECT_GE(-1,dlt_user_log_write_uint8_formatted(NULL, data, DLT_FORMAT_HEX32));
- EXPECT_GE(-1,dlt_user_log_write_uint8_formatted(NULL, data, DLT_FORMAT_HEX64));
- EXPECT_GE(-1,dlt_user_log_write_uint8_formatted(NULL, data, DLT_FORMAT_BIN8));
- EXPECT_GE(-1,dlt_user_log_write_uint8_formatted(NULL, data, DLT_FORMAT_BIN16));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint8_formatted(NULL, data, DLT_FORMAT_DEFAULT));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint8_formatted(NULL, data, DLT_FORMAT_HEX8));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint8_formatted(NULL, data, DLT_FORMAT_HEX16));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint8_formatted(NULL, data, DLT_FORMAT_HEX32));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint8_formatted(NULL, data, DLT_FORMAT_HEX64));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint8_formatted(NULL, data, DLT_FORMAT_BIN8));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint8_formatted(NULL, data, DLT_FORMAT_BIN16));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -962,39 +961,39 @@ TEST(t_dlt_user_log_write_uint16_formatted, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint16_formatted normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint16_formatted normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = UINT16_MIN;
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX8));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX16));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX32));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX64));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_BIN8));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_BIN16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX32));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX64));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_BIN8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_BIN16));
data = 1;
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX8));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX16));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX32));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX64));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_BIN8));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_BIN16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX32));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX64));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_BIN8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_BIN16));
data = UINT16_MAX;
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX8));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX16));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX32));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX64));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_BIN8));
- EXPECT_LE(0,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_BIN16));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX32));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_HEX64));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_BIN8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint16_formatted(&contextData, data, DLT_FORMAT_BIN16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_uint16_formatted, abnormal)
@@ -1005,20 +1004,20 @@ TEST(t_dlt_user_log_write_uint16_formatted, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint16_formatted abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint16_formatted abnormal"));
// abnormal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
// TODO: data = 1;
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint16_formatted(&contextData, data, (DltFormatType)-100));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint16_formatted(&contextData, data, (DltFormatType)-10));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint16_formatted(&contextData, data, (DltFormatType)10));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint16_formatted(&contextData, data, (DltFormatType)100));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint16_formatted(&contextData, data, (DltFormatType)-100));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint16_formatted(&contextData, data, (DltFormatType)-10));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint16_formatted(&contextData, data, (DltFormatType)10));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint16_formatted(&contextData, data, (DltFormatType)100));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_uint16_formatted, nullpointer)
@@ -1028,21 +1027,21 @@ TEST(t_dlt_user_log_write_uint16_formatted, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint16_formatted nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint16_formatted nullpointer"));
// NULL
data = 1;
- EXPECT_GE(-1,dlt_user_log_write_uint16_formatted(NULL, data, DLT_FORMAT_DEFAULT));
- EXPECT_GE(-1,dlt_user_log_write_uint16_formatted(NULL, data, DLT_FORMAT_HEX8));
- EXPECT_GE(-1,dlt_user_log_write_uint16_formatted(NULL, data, DLT_FORMAT_HEX16));
- EXPECT_GE(-1,dlt_user_log_write_uint16_formatted(NULL, data, DLT_FORMAT_HEX32));
- EXPECT_GE(-1,dlt_user_log_write_uint16_formatted(NULL, data, DLT_FORMAT_HEX64));
- EXPECT_GE(-1,dlt_user_log_write_uint16_formatted(NULL, data, DLT_FORMAT_BIN8));
- EXPECT_GE(-1,dlt_user_log_write_uint16_formatted(NULL, data, DLT_FORMAT_BIN16));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint16_formatted(NULL, data, DLT_FORMAT_DEFAULT));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint16_formatted(NULL, data, DLT_FORMAT_HEX8));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint16_formatted(NULL, data, DLT_FORMAT_HEX16));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint16_formatted(NULL, data, DLT_FORMAT_HEX32));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint16_formatted(NULL, data, DLT_FORMAT_HEX64));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint16_formatted(NULL, data, DLT_FORMAT_BIN8));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint16_formatted(NULL, data, DLT_FORMAT_BIN16));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -1055,39 +1054,39 @@ TEST(t_dlt_user_log_write_uint32_formatted, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint32_formatted normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint32_formatted normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = UINT32_MIN;
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX8));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX16));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX32));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX64));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_BIN8));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_BIN16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX32));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX64));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_BIN8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_BIN16));
data = 1;
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX8));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX16));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX32));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX64));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_BIN8));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_BIN16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX32));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX64));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_BIN8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_BIN16));
data = UINT32_MAX;
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX8));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX16));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX32));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX64));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_BIN8));
- EXPECT_LE(0,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_BIN16));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX32));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_HEX64));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_BIN8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint32_formatted(&contextData, data, DLT_FORMAT_BIN16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_uint32_formatted, abnormal)
@@ -1098,20 +1097,20 @@ TEST(t_dlt_user_log_write_uint32_formatted, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint32_formatted abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint32_formatted abnormal"));
// abnormal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
// TODO: data = 1;
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint32_formatted(&contextData, data, (DltFormatType)-100));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint32_formatted(&contextData, data, (DltFormatType)-10));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint32_formatted(&contextData, data, (DltFormatType)10));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint32_formatted(&contextData, data, (DltFormatType)100));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint32_formatted(&contextData, data, (DltFormatType)-100));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint32_formatted(&contextData, data, (DltFormatType)-10));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint32_formatted(&contextData, data, (DltFormatType)10));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint32_formatted(&contextData, data, (DltFormatType)100));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_uint32_formatted, nullpointer)
@@ -1121,21 +1120,21 @@ TEST(t_dlt_user_log_write_uint32_formatted, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint32_formatted nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint32_formatted nullpointer"));
// NULL
data = 1;
- EXPECT_GE(-1,dlt_user_log_write_uint32_formatted(NULL, data, DLT_FORMAT_DEFAULT));
- EXPECT_GE(-1,dlt_user_log_write_uint32_formatted(NULL, data, DLT_FORMAT_HEX8));
- EXPECT_GE(-1,dlt_user_log_write_uint32_formatted(NULL, data, DLT_FORMAT_HEX16));
- EXPECT_GE(-1,dlt_user_log_write_uint32_formatted(NULL, data, DLT_FORMAT_HEX32));
- EXPECT_GE(-1,dlt_user_log_write_uint32_formatted(NULL, data, DLT_FORMAT_HEX64));
- EXPECT_GE(-1,dlt_user_log_write_uint32_formatted(NULL, data, DLT_FORMAT_BIN8));
- EXPECT_GE(-1,dlt_user_log_write_uint32_formatted(NULL, data, DLT_FORMAT_BIN16));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint32_formatted(NULL, data, DLT_FORMAT_DEFAULT));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint32_formatted(NULL, data, DLT_FORMAT_HEX8));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint32_formatted(NULL, data, DLT_FORMAT_HEX16));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint32_formatted(NULL, data, DLT_FORMAT_HEX32));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint32_formatted(NULL, data, DLT_FORMAT_HEX64));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint32_formatted(NULL, data, DLT_FORMAT_BIN8));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint32_formatted(NULL, data, DLT_FORMAT_BIN16));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -1148,39 +1147,39 @@ TEST(t_dlt_user_log_write_uint64_formatted, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint64_formatted normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint64_formatted normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = UINT64_MIN;
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX8));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX16));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX32));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX64));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_BIN8));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_BIN16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX32));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX64));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_BIN8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_BIN16));
data = 1;
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX8));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX16));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX32));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX64));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_BIN8));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_BIN16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX32));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX64));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_BIN8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_BIN16));
data = UINT64_MAX;
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX8));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX16));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX32));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX64));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_BIN8));
- EXPECT_LE(0,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_BIN16));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX32));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_HEX64));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_BIN8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_uint64_formatted(&contextData, data, DLT_FORMAT_BIN16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_uint64_formatted, abnormal)
@@ -1191,20 +1190,20 @@ TEST(t_dlt_user_log_write_uint64_formatted, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint64_formatted abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint64_formatted abnormal"));
// abnormal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
// TODO: data = 1;
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint64_formatted(&contextData, data, (DltFormatType)-100));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint64_formatted(&contextData, data, (DltFormatType)-10));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint64_formatted(&contextData, data, (DltFormatType)10));
- // TODO: EXPECT_GE(-1,dlt_user_log_write_uint64_formatted(&contextData, data, (DltFormatType)100));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint64_formatted(&contextData, data, (DltFormatType)-100));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint64_formatted(&contextData, data, (DltFormatType)-10));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint64_formatted(&contextData, data, (DltFormatType)10));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint64_formatted(&contextData, data, (DltFormatType)100));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_uint64_formatted, nullpointer)
@@ -1214,21 +1213,21 @@ TEST(t_dlt_user_log_write_uint64_formatted, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint64_formatted nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_uint64_formatted nullpointer"));
// NULL
data = 1;
- EXPECT_GE(-1,dlt_user_log_write_uint64_formatted(NULL, data, DLT_FORMAT_DEFAULT));
- EXPECT_GE(-1,dlt_user_log_write_uint64_formatted(NULL, data, DLT_FORMAT_HEX8));
- EXPECT_GE(-1,dlt_user_log_write_uint64_formatted(NULL, data, DLT_FORMAT_HEX16));
- EXPECT_GE(-1,dlt_user_log_write_uint64_formatted(NULL, data, DLT_FORMAT_HEX32));
- EXPECT_GE(-1,dlt_user_log_write_uint64_formatted(NULL, data, DLT_FORMAT_HEX64));
- EXPECT_GE(-1,dlt_user_log_write_uint64_formatted(NULL, data, DLT_FORMAT_BIN8));
- EXPECT_GE(-1,dlt_user_log_write_uint64_formatted(NULL, data, DLT_FORMAT_BIN16));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint64_formatted(NULL, data, DLT_FORMAT_DEFAULT));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint64_formatted(NULL, data, DLT_FORMAT_HEX8));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint64_formatted(NULL, data, DLT_FORMAT_HEX16));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint64_formatted(NULL, data, DLT_FORMAT_HEX32));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint64_formatted(NULL, data, DLT_FORMAT_HEX64));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint64_formatted(NULL, data, DLT_FORMAT_BIN8));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_uint64_formatted(NULL, data, DLT_FORMAT_BIN16));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -1241,25 +1240,25 @@ TEST(t_dlt_user_log_write_int, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = -1;
- EXPECT_LE(0,dlt_user_log_write_int(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int(&contextData, data));
data = 0;
- EXPECT_LE(0,dlt_user_log_write_int(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int(&contextData, data));
data = 1;
- EXPECT_LE(0,dlt_user_log_write_int(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int(&contextData, data));
data = INT_MIN;
- EXPECT_LE(0,dlt_user_log_write_int(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int(&contextData, data));
data = INT_MAX;
- EXPECT_LE(0,dlt_user_log_write_int(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_int, nullpointer)
@@ -1269,15 +1268,15 @@ TEST(t_dlt_user_log_write_int, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int nullpointer"));
// NULL
data = 1;
- EXPECT_GE(-1,dlt_user_log_write_int(NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_int(NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -1290,25 +1289,25 @@ TEST(t_dlt_user_log_write_int8, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int8 normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int8 normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = -1;
- EXPECT_LE(0,dlt_user_log_write_int8(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int8(&contextData, data));
data = 0;
- EXPECT_LE(0,dlt_user_log_write_int8(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int8(&contextData, data));
data = 1;
- EXPECT_LE(0,dlt_user_log_write_int8(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int8(&contextData, data));
data = INT8_MIN;
- EXPECT_LE(0,dlt_user_log_write_int8(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int8(&contextData, data));
data = INT8_MAX;
- EXPECT_LE(0,dlt_user_log_write_int8(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int8(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_int8, nullpointer)
@@ -1318,15 +1317,15 @@ TEST(t_dlt_user_log_write_int8, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int8 nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int8 nullpointer"));
// NULL
data = 1;
- EXPECT_GE(-1,dlt_user_log_write_int8(NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_int8(NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -1339,25 +1338,25 @@ TEST(t_dlt_user_log_write_int16, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int16 normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int16 normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = -1;
- EXPECT_LE(0,dlt_user_log_write_int16(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int16(&contextData, data));
data = 0;
- EXPECT_LE(0,dlt_user_log_write_int16(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int16(&contextData, data));
data = 1;
- EXPECT_LE(0,dlt_user_log_write_int16(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int16(&contextData, data));
data = INT16_MIN;
- EXPECT_LE(0,dlt_user_log_write_int16(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int16(&contextData, data));
data = INT16_MAX;
- EXPECT_LE(0,dlt_user_log_write_int16(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int16(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_int16, nullpointer)
@@ -1367,15 +1366,15 @@ TEST(t_dlt_user_log_write_int16, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int16 nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int16 nullpointer"));
// NULL
data = 1;
- EXPECT_GE(-1,dlt_user_log_write_int16(NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_int16(NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -1388,25 +1387,25 @@ TEST(t_dlt_user_log_write_int32, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int32 normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int32 normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = -1;
- EXPECT_LE(0,dlt_user_log_write_int32(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int32(&contextData, data));
data = 0;
- EXPECT_LE(0,dlt_user_log_write_int32(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int32(&contextData, data));
data = 1;
- EXPECT_LE(0,dlt_user_log_write_int32(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int32(&contextData, data));
data = INT32_MIN;
- EXPECT_LE(0,dlt_user_log_write_int32(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int32(&contextData, data));
data = INT32_MAX;
- EXPECT_LE(0,dlt_user_log_write_int32(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int32(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_int32, nullpointer)
@@ -1416,15 +1415,15 @@ TEST(t_dlt_user_log_write_int32, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int32 nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int32 nullpointer"));
// NULL
data = 1;
- EXPECT_GE(-1,dlt_user_log_write_int32(NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_int32(NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -1437,25 +1436,25 @@ TEST(t_dlt_user_log_write_int64, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int64 normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int64 normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
data = -1;
- EXPECT_LE(0,dlt_user_log_write_int64(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int64(&contextData, data));
data = 0;
- EXPECT_LE(0,dlt_user_log_write_int64(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int64(&contextData, data));
data = 1;
- EXPECT_LE(0,dlt_user_log_write_int64(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int64(&contextData, data));
data = INT64_MIN;
- EXPECT_LE(0,dlt_user_log_write_int64(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int64(&contextData, data));
data = INT64_MAX;
- EXPECT_LE(0,dlt_user_log_write_int64(&contextData, data));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_int64(&contextData, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_int64, nullpointer)
@@ -1465,15 +1464,15 @@ TEST(t_dlt_user_log_write_int64, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int64 nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_int64 nullpointer"));
// NULL
data = 1;
- EXPECT_GE(-1,dlt_user_log_write_int64(NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_int64(NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -1485,19 +1484,19 @@ TEST(t_dlt_user_log_write_string, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_string normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_string normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
const char *text1 = "test1";
- EXPECT_LE(0,dlt_user_log_write_string(&contextData, text1));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_string(&contextData, text1));
const char *text2 = "";
- EXPECT_LE(0,dlt_user_log_write_string(&contextData, text2));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_string(&contextData, text2));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_string, nullpointer)
@@ -1507,19 +1506,19 @@ TEST(t_dlt_user_log_write_string, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_string nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_string nullpointer"));
// NULL
const char *text1 = "test1";
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
- EXPECT_GE(-1,dlt_user_log_write_string(NULL, text1));
- EXPECT_GE(-1,dlt_user_log_write_string(NULL, NULL));
- EXPECT_GE(-1,dlt_user_log_write_string(&contextData, NULL));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_string(NULL, text1));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_string(NULL, NULL));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_string(&contextData, NULL));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -1531,19 +1530,19 @@ TEST(t_dlt_user_log_write_constant_string, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_constant_string normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_constant_string normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
const char *text1 = "test1";
- EXPECT_LE(0,dlt_user_log_write_constant_string(&contextData, text1));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_constant_string(&contextData, text1));
const char *text2 = "";
- EXPECT_LE(0,dlt_user_log_write_constant_string(&contextData, text2));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_constant_string(&contextData, text2));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_constant_string, nullpointer)
@@ -1553,19 +1552,19 @@ TEST(t_dlt_user_log_write_constant_string, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_constant_string nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_constant_string nullpointer"));
// NULL
const char *text1 = "test1";
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
- EXPECT_GE(-1,dlt_user_log_write_constant_string(NULL, text1));
- EXPECT_GE(-1,dlt_user_log_write_constant_string(NULL, NULL));
- EXPECT_GE(-1,dlt_user_log_write_constant_string(&contextData, NULL));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_constant_string(NULL, text1));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_constant_string(NULL, NULL));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_constant_string(&contextData, NULL));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -1577,19 +1576,19 @@ TEST(t_dlt_user_log_write_utf8_string, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_utf8_string normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_utf8_string normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
const char *text1 = "test1";
- EXPECT_LE(0,dlt_user_log_write_utf8_string(&contextData, text1));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_utf8_string(&contextData, text1));
const char *text2 = "";
- EXPECT_LE(0,dlt_user_log_write_utf8_string(&contextData, text2));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_utf8_string(&contextData, text2));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_utf8_string, nullpointer)
@@ -1599,19 +1598,19 @@ TEST(t_dlt_user_log_write_utf8_string, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_utf8_string nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_utf8_string nullpointer"));
// NULL
const char *text1 = "test1";
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
- EXPECT_GE(-1,dlt_user_log_write_utf8_string(NULL, text1));
- EXPECT_GE(-1,dlt_user_log_write_utf8_string(NULL, NULL));
- EXPECT_GE(-1,dlt_user_log_write_utf8_string(&contextData, NULL));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_utf8_string(NULL, text1));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_utf8_string(NULL, NULL));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_utf8_string(&contextData, NULL));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -1623,19 +1622,19 @@ TEST(t_dlt_user_log_write_raw, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_raw normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_raw normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
char text1[6] = "test1";
- EXPECT_LE(0,dlt_user_log_write_raw(&contextData, text1, 6));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw(&contextData, text1, 6));
char text2[1] = "";
- EXPECT_LE(0,dlt_user_log_write_raw(&contextData, text2, 0));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw(&contextData, text2, 0));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_raw, nullpointer)
@@ -1645,20 +1644,20 @@ TEST(t_dlt_user_log_write_raw, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_raw nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_raw nullpointer"));
// NULL
char text1[6] = "test1";
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
- EXPECT_GE(-1,dlt_user_log_write_raw(NULL, text1, 6));
- EXPECT_GE(-1,dlt_user_log_write_raw(NULL, NULL, 0));
- EXPECT_GE(-1,dlt_user_log_write_raw(&contextData, NULL, 0));
- EXPECT_GE(-1,dlt_user_log_write_raw(&contextData, NULL, 1));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_raw(NULL, text1, 6));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_raw(NULL, NULL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_raw(&contextData, NULL, 0));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_raw(&contextData, NULL, 1));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -1670,31 +1669,31 @@ TEST(t_dlt_user_log_write_raw_formatted, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_raw_formatted normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_raw_formatted normal"));
// normal values
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
char text1[6] = "test1";
- EXPECT_LE(0,dlt_user_log_write_raw_formatted(&contextData, text1, 6, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_raw_formatted(&contextData, text1, 6, DLT_FORMAT_HEX8));
- EXPECT_LE(0,dlt_user_log_write_raw_formatted(&contextData, text1, 6, DLT_FORMAT_HEX16));
- EXPECT_LE(0,dlt_user_log_write_raw_formatted(&contextData, text1, 6, DLT_FORMAT_HEX32));
- EXPECT_LE(0,dlt_user_log_write_raw_formatted(&contextData, text1, 6, DLT_FORMAT_HEX64));
- EXPECT_LE(0,dlt_user_log_write_raw_formatted(&contextData, text1, 6, DLT_FORMAT_BIN8));
- EXPECT_LE(0,dlt_user_log_write_raw_formatted(&contextData, text1, 6, DLT_FORMAT_BIN16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw_formatted(&contextData, text1, 6, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw_formatted(&contextData, text1, 6, DLT_FORMAT_HEX8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw_formatted(&contextData, text1, 6, DLT_FORMAT_HEX16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw_formatted(&contextData, text1, 6, DLT_FORMAT_HEX32));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw_formatted(&contextData, text1, 6, DLT_FORMAT_HEX64));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw_formatted(&contextData, text1, 6, DLT_FORMAT_BIN8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw_formatted(&contextData, text1, 6, DLT_FORMAT_BIN16));
char text2[1] = "";
- EXPECT_LE(0,dlt_user_log_write_raw_formatted(&contextData, text2, 0, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_raw_formatted(&contextData, text2, 0, DLT_FORMAT_HEX8));
- EXPECT_LE(0,dlt_user_log_write_raw_formatted(&contextData, text2, 0, DLT_FORMAT_HEX16));
- EXPECT_LE(0,dlt_user_log_write_raw_formatted(&contextData, text2, 0, DLT_FORMAT_HEX32));
- EXPECT_LE(0,dlt_user_log_write_raw_formatted(&contextData, text2, 0, DLT_FORMAT_HEX64));
- EXPECT_LE(0,dlt_user_log_write_raw_formatted(&contextData, text2, 0, DLT_FORMAT_BIN8));
- EXPECT_LE(0,dlt_user_log_write_raw_formatted(&contextData, text2, 0, DLT_FORMAT_BIN16));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw_formatted(&contextData, text2, 0, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw_formatted(&contextData, text2, 0, DLT_FORMAT_HEX8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw_formatted(&contextData, text2, 0, DLT_FORMAT_HEX16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw_formatted(&contextData, text2, 0, DLT_FORMAT_HEX32));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw_formatted(&contextData, text2, 0, DLT_FORMAT_HEX64));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw_formatted(&contextData, text2, 0, DLT_FORMAT_BIN8));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_raw_formatted(&contextData, text2, 0, DLT_FORMAT_BIN16));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_raw_formatted, abnormal)
@@ -1704,19 +1703,19 @@ TEST(t_dlt_user_log_write_raw_formatted, abnormal)
//
//
//
-// EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
-// EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_raw_formatted abnormal"));
+// EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+// EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_raw_formatted abnormal"));
// undefined values for DltFormatType
// shouldn't it return -1?
// char text1[6] = "test1";
-// EXPECT_GE(-1,dlt_user_log_write_raw_formatted(&contextData, text1, 6, (DltFormatType)-100));
-// EXPECT_GE(-1,dlt_user_log_write_raw_formatted(&contextData, text1, 6, (DltFormatType)-10));
-// EXPECT_GE(-1,dlt_user_log_write_raw_formatted(&contextData, text1, 6, (DltFormatType)10));
-// EXPECT_GE(-1,dlt_user_log_write_raw_formatted(&contextData, text1, 6, (DltFormatType)100));
+// EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_raw_formatted(&contextData, text1, 6, (DltFormatType)-100));
+// EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_raw_formatted(&contextData, text1, 6, (DltFormatType)-10));
+// EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_raw_formatted(&contextData, text1, 6, (DltFormatType)10));
+// EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_raw_formatted(&contextData, text1, 6, (DltFormatType)100));
//
-// EXPECT_LE(0,dlt_unregister_context(&context));
-// EXPECT_LE(0,dlt_unregister_app());
+// EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+// EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_log_write_raw_formatted, nullpointer)
@@ -1726,20 +1725,20 @@ TEST(t_dlt_user_log_write_raw_formatted, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_raw_formatted nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_raw_formatted nullpointer"));
// NULL
char text1[6] = "test1";
- EXPECT_LE(0,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
- EXPECT_GE(-1,dlt_user_log_write_raw_formatted(NULL, text1, 6, DLT_FORMAT_DEFAULT));
- EXPECT_GE(-1,dlt_user_log_write_raw_formatted(NULL, NULL, 0, DLT_FORMAT_DEFAULT));
- EXPECT_GE(-1,dlt_user_log_write_raw_formatted(&contextData, NULL, 0, DLT_FORMAT_DEFAULT));
- EXPECT_GE(-1,dlt_user_log_write_raw_formatted(&contextData, NULL, 1, DLT_FORMAT_DEFAULT));
- EXPECT_LE(0,dlt_user_log_write_finish(&contextData));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_raw_formatted(NULL, text1, 6, DLT_FORMAT_DEFAULT));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_raw_formatted(NULL, NULL, 0, DLT_FORMAT_DEFAULT));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_raw_formatted(&contextData, NULL, 0, DLT_FORMAT_DEFAULT));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_user_log_write_raw_formatted(&contextData, NULL, 1, DLT_FORMAT_DEFAULT));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_log_write_finish(&contextData));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/*
@@ -1760,29 +1759,29 @@ TEST(t_dlt_log_string, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string normal"));
// normal values
const char text1[6] = "test1";
- EXPECT_LE(0,dlt_log_string(&context, DLT_LOG_DEFAULT, text1));
- EXPECT_LE(0,dlt_log_string(&context, DLT_LOG_OFF, text1));
- EXPECT_LE(0,dlt_log_string(&context, DLT_LOG_FATAL, text1));
- EXPECT_LE(0,dlt_log_string(&context, DLT_LOG_ERROR, text1));
- EXPECT_LE(0,dlt_log_string(&context, DLT_LOG_WARN, text1));
- EXPECT_LE(0,dlt_log_string(&context, DLT_LOG_INFO, text1));
- EXPECT_LE(0,dlt_log_string(&context, DLT_LOG_VERBOSE, text1));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string(&context, DLT_LOG_DEFAULT, text1));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string(&context, DLT_LOG_OFF, text1));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string(&context, DLT_LOG_FATAL, text1));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string(&context, DLT_LOG_ERROR, text1));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string(&context, DLT_LOG_WARN, text1));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string(&context, DLT_LOG_INFO, text1));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string(&context, DLT_LOG_VERBOSE, text1));
const char text2[1] = "";
- EXPECT_LE(0,dlt_log_string(&context, DLT_LOG_DEFAULT, text2));
- EXPECT_LE(0,dlt_log_string(&context, DLT_LOG_OFF, text2));
- EXPECT_LE(0,dlt_log_string(&context, DLT_LOG_FATAL, text2));
- EXPECT_LE(0,dlt_log_string(&context, DLT_LOG_ERROR, text2));
- EXPECT_LE(0,dlt_log_string(&context, DLT_LOG_WARN, text2));
- EXPECT_LE(0,dlt_log_string(&context, DLT_LOG_INFO, text2));
- EXPECT_LE(0,dlt_log_string(&context, DLT_LOG_VERBOSE, text2));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string(&context, DLT_LOG_DEFAULT, text2));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string(&context, DLT_LOG_OFF, text2));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string(&context, DLT_LOG_FATAL, text2));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string(&context, DLT_LOG_ERROR, text2));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string(&context, DLT_LOG_WARN, text2));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string(&context, DLT_LOG_INFO, text2));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string(&context, DLT_LOG_VERBOSE, text2));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_log_string, abnormal)
@@ -1791,19 +1790,19 @@ TEST(t_dlt_log_string, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string abnormal"));
// undefined values for DltLogLevelType
// shouldn't it return -1?
// TODO: const char text1[6] = "test1";
- // TODO: EXPECT_GE(-1,dlt_log_string(&context, (DltLogLevelType)-100, text1));
- // TODO: EXPECT_GE(-1,dlt_log_string(&context, (DltLogLevelType)-10, text1));
- // TODO: EXPECT_GE(-1,dlt_log_string(&context, (DltLogLevelType)10, text1));
- // TODO: EXPECT_GE(-1,dlt_log_string(&context, (DltLogLevelType)100, text1));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string(&context, (DltLogLevelType)-100, text1));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string(&context, (DltLogLevelType)-10, text1));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string(&context, (DltLogLevelType)10, text1));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string(&context, (DltLogLevelType)100, text1));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_log_string, nullpointer)
@@ -1812,17 +1811,17 @@ TEST(t_dlt_log_string, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string nullpointer"));
// NULL
char text1[6] = "test1";
- EXPECT_GE(-1,dlt_log_string(NULL, DLT_LOG_DEFAULT, text1));
- EXPECT_GE(-1,dlt_log_string(NULL, DLT_LOG_DEFAULT, NULL));
- EXPECT_GE(-1,dlt_log_string(&context, DLT_LOG_DEFAULT, NULL));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string(NULL, DLT_LOG_DEFAULT, text1));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string(NULL, DLT_LOG_DEFAULT, NULL));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string(&context, DLT_LOG_DEFAULT, NULL));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -1833,39 +1832,39 @@ TEST(t_dlt_log_string_int, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string_int normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string_int normal"));
// normal values
const char text1[6] = "test1";
int data = INT_MIN;
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_DEFAULT, text1, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_OFF, text1, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_FATAL, text1, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_ERROR, text1, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_WARN, text1, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_INFO, text1, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_VERBOSE, text1, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_DEFAULT, text1, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_OFF, text1, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_FATAL, text1, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_ERROR, text1, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_WARN, text1, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_INFO, text1, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_VERBOSE, text1, data));
const char text2[1] = "";
data = 0;
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_DEFAULT, text2, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_OFF, text2, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_FATAL, text2, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_ERROR, text2, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_WARN, text2, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_INFO, text2, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_VERBOSE, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_DEFAULT, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_OFF, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_FATAL, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_ERROR, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_WARN, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_INFO, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_VERBOSE, text2, data));
data = INT_MAX;
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_DEFAULT, text2, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_OFF, text2, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_FATAL, text2, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_ERROR, text2, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_WARN, text2, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_INFO, text2, data));
- EXPECT_LE(0,dlt_log_string_int(&context, DLT_LOG_VERBOSE, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_DEFAULT, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_OFF, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_FATAL, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_ERROR, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_WARN, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_INFO, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_int(&context, DLT_LOG_VERBOSE, text2, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_log_string_int, abnormal)
@@ -1874,20 +1873,20 @@ TEST(t_dlt_log_string_int, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string_int abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string_int abnormal"));
// undefined values for DltLogLevelType
// shouldn't it return -1?
// TODO: const char text1[6] = "test1";
// TODO: int data = 1;
- // TODO: EXPECT_GE(-1,dlt_log_string_int(&context, (DltLogLevelType)-100, text1, data));
- // TODO: EXPECT_GE(-1,dlt_log_string_int(&context, (DltLogLevelType)-10, text1, data));
- // TODO: EXPECT_GE(-1,dlt_log_string_int(&context, (DltLogLevelType)10, text1, data));
- // TODO: EXPECT_GE(-1,dlt_log_string_int(&context, (DltLogLevelType)100, text1, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string_int(&context, (DltLogLevelType)-100, text1, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string_int(&context, (DltLogLevelType)-10, text1, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string_int(&context, (DltLogLevelType)10, text1, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string_int(&context, (DltLogLevelType)100, text1, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_log_string_int, nullpointer)
@@ -1896,18 +1895,18 @@ TEST(t_dlt_log_string_int, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string_int nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string_int nullpointer"));
// NULL
char text1[6] = "test1";
int data = 0;
- EXPECT_GE(-1,dlt_log_string_int(NULL, DLT_LOG_DEFAULT, text1, data));
- EXPECT_GE(-1,dlt_log_string_int(NULL, DLT_LOG_DEFAULT, NULL, data));
- EXPECT_GE(-1,dlt_log_string_int(&context, DLT_LOG_DEFAULT, NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string_int(NULL, DLT_LOG_DEFAULT, text1, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string_int(NULL, DLT_LOG_DEFAULT, NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string_int(&context, DLT_LOG_DEFAULT, NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -1918,39 +1917,39 @@ TEST(t_dlt_log_string_uint, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string_uint normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string_uint normal"));
// normal values
const char text1[6] = "test1";
unsigned int data = UINT_MIN;
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_DEFAULT, text1, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_OFF, text1, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_FATAL, text1, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_ERROR, text1, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_WARN, text1, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_INFO, text1, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_VERBOSE, text1, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_DEFAULT, text1, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_OFF, text1, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_FATAL, text1, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_ERROR, text1, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_WARN, text1, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_INFO, text1, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_VERBOSE, text1, data));
const char text2[1] = "";
data = 0;
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_DEFAULT, text2, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_OFF, text2, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_FATAL, text2, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_ERROR, text2, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_WARN, text2, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_INFO, text2, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_VERBOSE, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_DEFAULT, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_OFF, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_FATAL, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_ERROR, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_WARN, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_INFO, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_VERBOSE, text2, data));
data = UINT_MAX;
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_DEFAULT, text2, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_OFF, text2, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_FATAL, text2, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_ERROR, text2, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_WARN, text2, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_INFO, text2, data));
- EXPECT_LE(0,dlt_log_string_uint(&context, DLT_LOG_VERBOSE, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_DEFAULT, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_OFF, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_FATAL, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_ERROR, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_WARN, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_INFO, text2, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_string_uint(&context, DLT_LOG_VERBOSE, text2, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_log_string_uint, abnormal)
@@ -1959,20 +1958,20 @@ TEST(t_dlt_log_string_uint, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string_uint abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string_uint abnormal"));
// undefined values for DltLogLevelType
// shouldn't it return -1?
// TODO: const char text1[6] = "test1";
// TODO: unsigned int data = 1;
- // TODO: EXPECT_GE(-1,dlt_log_string_uint(&context, (DltLogLevelType)-100, text1, data));
- // TODO: EXPECT_GE(-1,dlt_log_string_uint(&context, (DltLogLevelType)-10, text1, data));
- // TODO: EXPECT_GE(-1,dlt_log_string_uint(&context, (DltLogLevelType)10, text1, data));
- // TODO: EXPECT_GE(-1,dlt_log_string_uint(&context, (DltLogLevelType)100, text1, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string_uint(&context, (DltLogLevelType)-100, text1, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string_uint(&context, (DltLogLevelType)-10, text1, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string_uint(&context, (DltLogLevelType)10, text1, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string_uint(&context, (DltLogLevelType)100, text1, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_log_string_uint, nullpointer)
@@ -1981,18 +1980,18 @@ TEST(t_dlt_log_string_uint, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string_uint nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_string_uint nullpointer"));
// NULL
char text1[6] = "test1";
unsigned int data = 0;
- EXPECT_GE(-1,dlt_log_string_uint(NULL, DLT_LOG_DEFAULT, text1, data));
- EXPECT_GE(-1,dlt_log_string_uint(NULL, DLT_LOG_DEFAULT, NULL, data));
- EXPECT_GE(-1,dlt_log_string_uint(&context, DLT_LOG_DEFAULT, NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string_uint(NULL, DLT_LOG_DEFAULT, text1, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string_uint(NULL, DLT_LOG_DEFAULT, NULL, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_string_uint(&context, DLT_LOG_DEFAULT, NULL, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -2003,37 +2002,37 @@ TEST(t_dlt_log_int, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_int normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_int normal"));
// normal values
int data = INT_MIN;
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_DEFAULT, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_OFF, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_FATAL, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_ERROR, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_WARN, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_INFO, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_VERBOSE, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_DEFAULT, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_OFF, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_FATAL, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_ERROR, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_WARN, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_INFO, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_VERBOSE, data));
data = 0;
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_DEFAULT, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_OFF, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_FATAL, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_ERROR, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_WARN, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_INFO, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_VERBOSE, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_DEFAULT, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_OFF, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_FATAL, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_ERROR, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_WARN, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_INFO, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_VERBOSE, data));
data = INT_MAX;
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_DEFAULT, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_OFF, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_FATAL, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_ERROR, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_WARN, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_INFO, data));
- EXPECT_LE(0,dlt_log_int(&context, DLT_LOG_VERBOSE, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_DEFAULT, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_OFF, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_FATAL, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_ERROR, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_WARN, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_INFO, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_int(&context, DLT_LOG_VERBOSE, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_log_int, abnormal)
@@ -2042,19 +2041,19 @@ TEST(t_dlt_log_int, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_int abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_int abnormal"));
// undefined values for DltLogLevelType
// shouldn't it return -1?
// TODO: int data = 1;
- // TODO: EXPECT_GE(-1,dlt_log_int(&context, (DltLogLevelType)-100, data));
- // TODO: EXPECT_GE(-1,dlt_log_int(&context, (DltLogLevelType)-10, data));
- // TODO: EXPECT_GE(-1,dlt_log_int(&context, (DltLogLevelType)10, data));
- // TODO: EXPECT_GE(-1,dlt_log_int(&context, (DltLogLevelType)100, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_int(&context, (DltLogLevelType)-100, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_int(&context, (DltLogLevelType)-10, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_int(&context, (DltLogLevelType)10, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_int(&context, (DltLogLevelType)100, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_log_int, nullpointer)
@@ -2063,15 +2062,15 @@ TEST(t_dlt_log_int, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_int nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_int nullpointer"));
// NULL
int data = 0;
- EXPECT_GE(-1,dlt_log_int(NULL, DLT_LOG_DEFAULT, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_int(NULL, DLT_LOG_DEFAULT, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -2082,37 +2081,37 @@ TEST(t_dlt_log_uint, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_uint normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_uint normal"));
// normal values
unsigned int data = UINT_MIN;
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_DEFAULT, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_OFF, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_FATAL, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_ERROR, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_WARN, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_INFO, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_VERBOSE, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_DEFAULT, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_OFF, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_FATAL, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_ERROR, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_WARN, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_INFO, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_VERBOSE, data));
data = 0;
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_DEFAULT, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_OFF, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_FATAL, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_ERROR, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_WARN, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_INFO, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_VERBOSE, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_DEFAULT, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_OFF, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_FATAL, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_ERROR, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_WARN, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_INFO, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_VERBOSE, data));
data = UINT_MAX;
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_DEFAULT, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_OFF, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_FATAL, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_ERROR, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_WARN, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_INFO, data));
- EXPECT_LE(0,dlt_log_uint(&context, DLT_LOG_VERBOSE, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_DEFAULT, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_OFF, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_FATAL, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_ERROR, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_WARN, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_INFO, data));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_uint(&context, DLT_LOG_VERBOSE, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_log_uint, abnormal)
@@ -2121,19 +2120,19 @@ TEST(t_dlt_log_uint, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_uint abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_uint abnormal"));
// undefined values for DltLogLevelType
// shouldn't it return -1?
// TODO: unsigned int data = 1;
- // TODO: EXPECT_GE(-1,dlt_log_uint(&context, (DltLogLevelType)-100, data));
- // TODO: EXPECT_GE(-1,dlt_log_uint(&context, (DltLogLevelType)-10, data));
- // TODO: EXPECT_GE(-1,dlt_log_uint(&context, (DltLogLevelType)10, data));
- // TODO: EXPECT_GE(-1,dlt_log_uint(&context, (DltLogLevelType)100, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_uint(&context, (DltLogLevelType)-100, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_uint(&context, (DltLogLevelType)-10, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_uint(&context, (DltLogLevelType)10, data));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_uint(&context, (DltLogLevelType)100, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_log_uint, nullpointer)
@@ -2142,15 +2141,15 @@ TEST(t_dlt_log_uint, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_uint nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_uint nullpointer"));
// NULL
unsigned int data = 0;
- EXPECT_GE(-1,dlt_log_uint(NULL, DLT_LOG_DEFAULT, data));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_uint(NULL, DLT_LOG_DEFAULT, data));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -2161,22 +2160,22 @@ TEST(t_dlt_log_raw, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_raw normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_raw normal"));
// normal values
char data[5] = "test";
uint16_t length = 4;
- EXPECT_LE(0,dlt_log_raw(&context, DLT_LOG_DEFAULT, data, length));
- EXPECT_LE(0,dlt_log_raw(&context, DLT_LOG_OFF, data, length));
- EXPECT_LE(0,dlt_log_raw(&context, DLT_LOG_FATAL, data, length));
- EXPECT_LE(0,dlt_log_raw(&context, DLT_LOG_ERROR, data, length));
- EXPECT_LE(0,dlt_log_raw(&context, DLT_LOG_WARN, data, length));
- EXPECT_LE(0,dlt_log_raw(&context, DLT_LOG_INFO, data, length));
- EXPECT_LE(0,dlt_log_raw(&context, DLT_LOG_VERBOSE, data, length));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_raw(&context, DLT_LOG_DEFAULT, data, length));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_raw(&context, DLT_LOG_OFF, data, length));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_raw(&context, DLT_LOG_FATAL, data, length));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_raw(&context, DLT_LOG_ERROR, data, length));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_raw(&context, DLT_LOG_WARN, data, length));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_raw(&context, DLT_LOG_INFO, data, length));
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_raw(&context, DLT_LOG_VERBOSE, data, length));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_log_raw, abnormal)
@@ -2185,27 +2184,27 @@ TEST(t_dlt_log_raw, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_raw abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_raw abnormal"));
// undefined values for DltLogLevelType
// shouldn't it return -1?
char data[5] = "test";
// TODO: uint16_t length = 4;
- // TODO: EXPECT_GE(-1,dlt_log_raw(&context, (DltLogLevelType)-100, data, length));
- // TODO: EXPECT_GE(-1,dlt_log_raw(&context, (DltLogLevelType)-10, data, length));
- // TODO: EXPECT_GE(-1,dlt_log_raw(&context, (DltLogLevelType)10, data, length));
- // TODO: EXPECT_GE(-1,dlt_log_raw(&context, (DltLogLevelType)100, data, length));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_raw(&context, (DltLogLevelType)-100, data, length));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_raw(&context, (DltLogLevelType)-10, data, length));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_raw(&context, (DltLogLevelType)10, data, length));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_raw(&context, (DltLogLevelType)100, data, length));
// zero length
- // TODO: EXPECT_GE(-1,dlt_log_raw(&context, DLT_LOG_DEFAULT, data, 0));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_log_raw(&context, DLT_LOG_DEFAULT, data, 0));
// negative length
- EXPECT_GE(-1,dlt_log_raw(&context, DLT_LOG_DEFAULT, data, -1));
- EXPECT_GE(-1,dlt_log_raw(&context, DLT_LOG_DEFAULT, data, -100));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_raw(&context, DLT_LOG_DEFAULT, data, -1));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_raw(&context, DLT_LOG_DEFAULT, data, -100));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_log_raw, nullpointer)
@@ -2214,18 +2213,18 @@ TEST(t_dlt_log_raw, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_raw nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_raw nullpointer"));
// NULL
char data[5] = "test";
uint16_t length = 4;
- EXPECT_GE(-1,dlt_log_raw(NULL, DLT_LOG_DEFAULT, data, length));
- EXPECT_GE(-1,dlt_log_raw(NULL, DLT_LOG_DEFAULT, NULL, length));
- EXPECT_GE(-1,dlt_log_raw(&context, DLT_LOG_DEFAULT, NULL, length));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_raw(NULL, DLT_LOG_DEFAULT, data, length));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_raw(NULL, DLT_LOG_DEFAULT, NULL, length));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_log_raw(&context, DLT_LOG_DEFAULT, NULL, length));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -2236,14 +2235,14 @@ TEST(t_dlt_log_marker, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_marker normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_log_marker normal"));
// normal
- EXPECT_LE(0,dlt_log_marker());
+ EXPECT_LE(DLT_RETURN_OK,dlt_log_marker());
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -2252,37 +2251,37 @@ TEST(t_dlt_register_app, normal)
{
- EXPECT_LE(0,dlt_register_app("T", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_unregister_app());
- EXPECT_LE(0,dlt_register_app("TU", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_unregister_app());
- EXPECT_LE(0,dlt_register_app("TUS", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_unregister_app());
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("T", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TU", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUS", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_register_app, abnormal)
{
- EXPECT_GE(-1,dlt_register_app("", "dlt_user.c tests"));
- EXPECT_GE(-1,dlt_unregister_app());
- // TODO: EXPECT_GE(-1,dlt_register_app("TUSR1", "dlt_user.c tests"));
- // TODO: EXPECT_GE(-1,dlt_unregister_app());
- // TODO: EXPECT_GE(-1,dlt_register_app("TUSR123445667", "dlt_user.c tests"));
- // TODO: EXPECT_GE(-1,dlt_unregister_app());
- // TODO: EXPECT_GE(-1,dlt_register_app("TUSR", ""));
- // TODO: EXPECT_GE(-1,dlt_unregister_app());
- // TODO: EXPECT_GE(-1,dlt_register_app("TUSR", NULL));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_app("", "dlt_user.c tests"));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_app());
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_app("TUSR1", "dlt_user.c tests"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_app());
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_app("TUSR123445667", "dlt_user.c tests"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_app());
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_app("TUSR", ""));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_app());
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_app("TUSR", NULL));
}
TEST(t_dlt_register_app, nullpointer)
{
- EXPECT_GE(-1,dlt_register_app(NULL, NULL));
- EXPECT_GE(-1,dlt_register_app(NULL, "dlt_user.c tests"));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_app(NULL, NULL));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_app(NULL, "dlt_user.c tests"));
}
@@ -2292,29 +2291,29 @@ TEST(t_dlt_unregister_app, normal)
{
- EXPECT_LE(0,dlt_register_app("T", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_unregister_app());
- EXPECT_LE(0,dlt_register_app("TU", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_unregister_app());
- EXPECT_LE(0,dlt_register_app("TUS", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_unregister_app());
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("T", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TU", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUS", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_unregister_app, abnormal)
{
- EXPECT_GE(-1,dlt_unregister_app());
- EXPECT_GE(-1,dlt_register_app("", "dlt_user.c tests"));
- EXPECT_GE(-1,dlt_unregister_app());
- // TODO: EXPECT_GE(-1,dlt_register_app("TUSR1", "dlt_user.c tests"));
- // TODO: EXPECT_GE(-1,dlt_unregister_app());
- // TODO: EXPECT_GE(-1,dlt_register_app("TUSR123445667", "dlt_user.c tests"));
- // TODO: EXPECT_GE(-1,dlt_unregister_app());
- // TODO: EXPECT_GE(-1,dlt_register_app("TUSR", ""));
- // TODO: EXPECT_GE(-1,dlt_unregister_app());
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_app());
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_app("", "dlt_user.c tests"));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_app());
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_app("TUSR1", "dlt_user.c tests"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_app());
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_app("TUSR123445667", "dlt_user.c tests"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_app());
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_app("TUSR", ""));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -2325,12 +2324,12 @@ TEST(t_dlt_register_context, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_context normal"));
- EXPECT_LE(0,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_context normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_register_context, abnormal)
@@ -2339,31 +2338,31 @@ TEST(t_dlt_register_context, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_GE(-1,dlt_register_context(&context, "", "d"));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "T", ""));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- EXPECT_GE(-1,dlt_register_context(&context, "", ""));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST1", ""));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST1", "1"));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST1234567890", ""));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST1234567890", "1"));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "", "d"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "T", ""));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "", ""));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST1", ""));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST1", "1"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST1234567890", ""));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST1234567890", "1"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_context normal"));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_context normal"));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_context normal"));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_context normal"));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_context normal"));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST", NULL));
- EXPECT_LE(0,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_context normal"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_context normal"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_context normal"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_context normal"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_context normal"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST", NULL));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_register_context, nullpointer)
@@ -2371,15 +2370,15 @@ TEST(t_dlt_register_context, nullpointer)
DltContext context;
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_GE(-1,dlt_register_context(&context, NULL, "dlt_user.c t_dlt_register_context normal"));
- EXPECT_GE(-1,dlt_register_context(&context, NULL, NULL));
- EXPECT_GE(-1,dlt_register_context(NULL, "TEST", NULL));
- EXPECT_GE(-1,dlt_register_context(NULL, NULL, "dlt_user.c t_dlt_register_context normal"));
- EXPECT_GE(-1,dlt_register_context(NULL, NULL, NULL));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, NULL, "dlt_user.c t_dlt_register_context normal"));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, NULL, NULL));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(NULL, "TEST", NULL));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(NULL, NULL, "dlt_user.c t_dlt_register_context normal"));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(NULL, NULL, NULL));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
@@ -2391,38 +2390,38 @@ TEST(t_dlt_register_context_ll_ts, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_OFF));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_FATAL, DLT_TRACE_STATUS_OFF));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_ERROR, DLT_TRACE_STATUS_OFF));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_WARN, DLT_TRACE_STATUS_OFF));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_INFO, DLT_TRACE_STATUS_OFF));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_DEBUG, DLT_TRACE_STATUS_OFF));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_VERBOSE, DLT_TRACE_STATUS_OFF));
- EXPECT_LE(0,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_OFF));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_FATAL, DLT_TRACE_STATUS_OFF));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_ERROR, DLT_TRACE_STATUS_OFF));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_WARN, DLT_TRACE_STATUS_OFF));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_INFO, DLT_TRACE_STATUS_OFF));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_DEBUG, DLT_TRACE_STATUS_OFF));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_VERBOSE, DLT_TRACE_STATUS_OFF));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_FATAL, DLT_TRACE_STATUS_ON));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_ERROR, DLT_TRACE_STATUS_ON));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_WARN, DLT_TRACE_STATUS_ON));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_INFO, DLT_TRACE_STATUS_ON));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_DEBUG, DLT_TRACE_STATUS_ON));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_FATAL, DLT_TRACE_STATUS_ON));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_ERROR, DLT_TRACE_STATUS_ON));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_WARN, DLT_TRACE_STATUS_ON));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_INFO, DLT_TRACE_STATUS_ON));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_DEBUG, DLT_TRACE_STATUS_ON));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_register_context_ll_ts, abnormal)
@@ -2431,49 +2430,50 @@ TEST(t_dlt_register_context_ll_ts, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "", "d", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "T", "", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "", "", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST1", "", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST1", "1", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST1234567890", "", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST1234567890", "1", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "", "d", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "T", "", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "", "", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "TEST1", "", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "TEST1", "1", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "TEST1234567890", "", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "TEST1234567890", "1", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
- EXPECT_LE(0,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
- // TODO: EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
- // TODO: EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
- // TODO: EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
- // TODO: EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
- EXPECT_LE(0,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_ON));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
// DLT_LOG_DEFAULT and DLT_TRACE_STATUS_DEFAULT not allowed
- EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_DEFAULT, DLT_TRACE_STATUS_OFF));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_DEFAULT));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
+ // TODO: Why not?
+// EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_DEFAULT, DLT_TRACE_STATUS_OFF));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+// EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+// EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_DEFAULT));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
// abnormal values for loglevel and tracestatus
- EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", -1, DLT_TRACE_STATUS_OFF));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", 100, DLT_TRACE_STATUS_OFF));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, -1));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, 100));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context_ll_ts(&context, "TEST", NULL, DLT_LOG_OFF, DLT_TRACE_STATUS_OFF));
+ EXPECT_EQ(DLT_RETURN_WRONG_PARAMETER,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", -3, DLT_TRACE_STATUS_OFF));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ EXPECT_EQ(DLT_RETURN_WRONG_PARAMETER,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", 100, DLT_TRACE_STATUS_OFF));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ EXPECT_EQ(DLT_RETURN_WRONG_PARAMETER,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, -3));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ EXPECT_EQ(DLT_RETURN_WRONG_PARAMETER,dlt_register_context_ll_ts(&context, "TEST", "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, 100));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, "TEST", NULL, DLT_LOG_OFF, DLT_TRACE_STATUS_OFF));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_register_context_ll_ts, nullpointer)
@@ -2482,15 +2482,15 @@ TEST(t_dlt_register_context_ll_ts, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_GE(-1,dlt_register_context_ll_ts(&context, NULL, "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_OFF));
- EXPECT_GE(-1,dlt_register_context_ll_ts(&context, NULL, NULL, DLT_LOG_OFF, DLT_TRACE_STATUS_OFF));
- EXPECT_GE(-1,dlt_register_context_ll_ts(NULL, "TEST", NULL, DLT_LOG_OFF, DLT_TRACE_STATUS_OFF));
- EXPECT_GE(-1,dlt_register_context_ll_ts(NULL, NULL, "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_OFF));
- EXPECT_GE(-1,dlt_register_context_ll_ts(NULL, NULL, NULL, DLT_LOG_OFF, DLT_TRACE_STATUS_OFF));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, NULL, "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_OFF));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(&context, NULL, NULL, DLT_LOG_OFF, DLT_TRACE_STATUS_OFF));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(NULL, "TEST", NULL, DLT_LOG_OFF, DLT_TRACE_STATUS_OFF));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(NULL, NULL, "dlt_user.c t_dlt_register_context_ll_ts normal", DLT_LOG_OFF, DLT_TRACE_STATUS_OFF));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context_ll_ts(NULL, NULL, NULL, DLT_LOG_OFF, DLT_TRACE_STATUS_OFF));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
/////////////////////////////////////////
@@ -2501,12 +2501,12 @@ TEST(t_dlt_unregister_context, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_unregister_context normal"));
- EXPECT_LE(0,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_unregister_context normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_unregister_context, abnormal)
@@ -2515,31 +2515,31 @@ TEST(t_dlt_unregister_context, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_GE(-1,dlt_register_context(&context, "", "d"));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "T", ""));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- EXPECT_GE(-1,dlt_register_context(&context, "", ""));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST1", ""));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST1", "1"));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST1234567890", ""));
- // TODO: EXPECT_GE(-1,dlt_unregister_context(&context));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST1234567890", "1"));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "", "d"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "T", ""));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "", ""));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST1", ""));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST1", "1"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST1234567890", ""));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_unregister_context(&context));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST1234567890", "1"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_unregister_context normal"));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_unregister_context normal"));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_unregister_context normal"));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_unregister_context normal"));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_unregister_context normal"));
- // TODO: EXPECT_GE(-1,dlt_register_context(&context, "TEST", NULL));
- EXPECT_LE(0,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_unregister_context normal"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_unregister_context normal"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_unregister_context normal"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_unregister_context normal"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_unregister_context normal"));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, "TEST", NULL));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_unregister_context, nullpointer)
@@ -2548,15 +2548,15 @@ TEST(t_dlt_unregister_context, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_GE(-1,dlt_register_context(&context, NULL, "dlt_user.c t_dlt_unregister_context normal"));
- EXPECT_GE(-1,dlt_register_context(&context, NULL, NULL));
- EXPECT_GE(-1,dlt_register_context(NULL, "TEST", NULL));
- EXPECT_GE(-1,dlt_register_context(NULL, NULL, "dlt_user.c t_dlt_unregister_context normal"));
- EXPECT_GE(-1,dlt_register_context(NULL, NULL, NULL));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, NULL, "dlt_user.c t_dlt_unregister_context normal"));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(&context, NULL, NULL));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(NULL, "TEST", NULL));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(NULL, NULL, "dlt_user.c t_dlt_unregister_context normal"));
+ EXPECT_GE(DLT_RETURN_ERROR,dlt_register_context(NULL, NULL, NULL));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
@@ -2574,14 +2574,14 @@ TEST(t_dlt_register_injection_callback, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_injection_callback normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_injection_callback normal"));
// TODO: service_id = 0x123;
- // TODO: EXPECT_LE(0,dlt_register_injection_callback(&context, service_id, dlt_user_injection_callback));
+ // TODO: EXPECT_LE(DLT_RETURN_OK,dlt_register_injection_callback(&context, service_id, dlt_user_injection_callback));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
@@ -2599,13 +2599,13 @@ TEST(t_dlt_register_log_level_changed_callback, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_log_level_changed_callback normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_register_log_level_changed_callback normal"));
- EXPECT_LE(0,dlt_register_log_level_changed_callback(&context, dlt_user_log_level_changed_callback));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_log_level_changed_callback(&context, dlt_user_log_level_changed_callback));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
@@ -2618,8 +2618,8 @@ TEST(t_dlt_user_trace_network, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network normal"));
char header[16];
for(char i = 0; i < 16; ++i)
@@ -2632,13 +2632,13 @@ TEST(t_dlt_user_trace_network, normal)
payload[(int)i] = i;
}
- EXPECT_LE(0,dlt_user_trace_network(&context, DLT_NW_TRACE_IPC, 16, header, 32, payload));
- EXPECT_LE(0,dlt_user_trace_network(&context, DLT_NW_TRACE_CAN, 16, header, 32, payload));
- EXPECT_LE(0,dlt_user_trace_network(&context, DLT_NW_TRACE_FLEXRAY, 16, header, 32, payload));
- EXPECT_LE(0,dlt_user_trace_network(&context, DLT_NW_TRACE_MOST, 16, header, 32, payload));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network(&context, DLT_NW_TRACE_IPC, 16, header, 32, payload));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network(&context, DLT_NW_TRACE_CAN, 16, header, 32, payload));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network(&context, DLT_NW_TRACE_FLEXRAY, 16, header, 32, payload));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network(&context, DLT_NW_TRACE_MOST, 16, header, 32, payload));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_trace_network, abnormal)
@@ -2647,8 +2647,8 @@ TEST(t_dlt_user_trace_network, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network abnormal"));
// TODO: char header[16];
// TODO: for(char i = 0; i < 16; ++i)
@@ -2662,18 +2662,18 @@ TEST(t_dlt_user_trace_network, abnormal)
// TODO: }
// data length = 0. Does this make sense?
- // TODO: EXPECT_GE(-1,dlt_user_trace_network(&context, DLT_NW_TRACE_IPC, 0, header, 32, payload));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network(&context, DLT_NW_TRACE_CAN, 0, header, 0, payload));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network(&context, DLT_NW_TRACE_FLEXRAY, 16, header, 0, payload));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network(&context, DLT_NW_TRACE_IPC, 0, header, 32, payload));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network(&context, DLT_NW_TRACE_CAN, 0, header, 0, payload));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network(&context, DLT_NW_TRACE_FLEXRAY, 16, header, 0, payload));
// invalid DltNetworkTraceType value
- // TODO: EXPECT_GE(-1,dlt_user_trace_network(&context, (DltNetworkTraceType)-100, 16, header, 32, payload));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network(&context, (DltNetworkTraceType)-10, 16, header, 32, payload));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network(&context, (DltNetworkTraceType)10, 16, header, 32, payload));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network(&context, (DltNetworkTraceType)100, 16, header, 32, payload));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network(&context, (DltNetworkTraceType)-100, 16, header, 32, payload));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network(&context, (DltNetworkTraceType)-10, 16, header, 32, payload));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network(&context, (DltNetworkTraceType)10, 16, header, 32, payload));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network(&context, (DltNetworkTraceType)100, 16, header, 32, payload));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_trace_network, nullpointer)
@@ -2682,8 +2682,8 @@ TEST(t_dlt_user_trace_network, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network nullpointer"));
char header[16];
for(char i = 0; i < 16; ++i)
@@ -2697,12 +2697,12 @@ TEST(t_dlt_user_trace_network, nullpointer)
}
// what to expect when giving in NULL pointer?
- EXPECT_LE(0,dlt_user_trace_network(&context, DLT_NW_TRACE_IPC, 16, NULL, 32, payload));
- EXPECT_LE(0,dlt_user_trace_network(&context, DLT_NW_TRACE_CAN, 16, header, 32, NULL));
- EXPECT_LE(0,dlt_user_trace_network(&context, DLT_NW_TRACE_FLEXRAY, 16, NULL, 32, NULL));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network(&context, DLT_NW_TRACE_IPC, 16, NULL, 32, payload));
+ EXPECT_LE(DLT_RETURN_WRONG_PARAMETER,dlt_user_trace_network(&context, DLT_NW_TRACE_CAN, 16, header, 32, NULL));
+ EXPECT_LE(DLT_RETURN_WRONG_PARAMETER,dlt_user_trace_network(&context, DLT_NW_TRACE_FLEXRAY, 16, NULL, 32, NULL));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
@@ -2714,8 +2714,8 @@ TEST(t_dlt_user_trace_network_truncated, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network_truncated normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network_truncated normal"));
char header[16];
for(char i = 0; i < 16; ++i)
@@ -2728,13 +2728,13 @@ TEST(t_dlt_user_trace_network_truncated, normal)
payload[(int)i] = i;
}
- EXPECT_LE(0,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_IPC, 16, header, 32, payload, 0));
- EXPECT_LE(0,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_CAN, 16, header, 32, payload, 1));
- EXPECT_LE(0,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_FLEXRAY, 16, header, 32, payload, -1));
- EXPECT_LE(0,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_MOST, 16, header, 32, payload, 10));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_IPC, 16, header, 32, payload, 0));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_CAN, 16, header, 32, payload, 1));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_FLEXRAY, 16, header, 32, payload, -1));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_MOST, 16, header, 32, payload, 10));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_trace_network_truncated, abnormal)
@@ -2743,8 +2743,8 @@ TEST(t_dlt_user_trace_network_truncated, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network_truncated abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network_truncated abnormal"));
// TODO: char header[16];
// TODO: for(char i = 0; i < 16; ++i)
@@ -2758,18 +2758,18 @@ TEST(t_dlt_user_trace_network_truncated, abnormal)
// TODO: }
// data length = 0. Does this make sense?
- // TODO: EXPECT_GE(-1,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_IPC, 0, header, 32, payload, 0));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_CAN, 0, header, 0, payload, 0));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_FLEXRAY, 16, header, 0, payload, 0));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_IPC, 0, header, 32, payload, 0));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_CAN, 0, header, 0, payload, 0));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_FLEXRAY, 16, header, 0, payload, 0));
// invalid DltNetworkTraceType value
- // TODO: EXPECT_GE(-1,dlt_user_trace_network_truncated(&context, (DltNetworkTraceType)-100, 16, header, 32, payload, 0));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network_truncated(&context, (DltNetworkTraceType)-10, 16, header, 32, payload, 0));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network_truncated(&context, (DltNetworkTraceType)10, 16, header, 32, payload, 0));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network_truncated(&context, (DltNetworkTraceType)100, 16, header, 32, payload, 0));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network_truncated(&context, (DltNetworkTraceType)-100, 16, header, 32, payload, 0));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network_truncated(&context, (DltNetworkTraceType)-10, 16, header, 32, payload, 0));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network_truncated(&context, (DltNetworkTraceType)10, 16, header, 32, payload, 0));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network_truncated(&context, (DltNetworkTraceType)100, 16, header, 32, payload, 0));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_trace_network_truncated, nullpointer)
@@ -2778,8 +2778,8 @@ TEST(t_dlt_user_trace_network_truncated, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network_truncated nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network_truncated nullpointer"));
char header[16];
for(char i = 0; i < 16; ++i)
@@ -2793,12 +2793,12 @@ TEST(t_dlt_user_trace_network_truncated, nullpointer)
}
// what to expect when giving in NULL pointer?
- EXPECT_LE(0,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_IPC, 16, NULL, 32, payload, 0));
- EXPECT_LE(0,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_CAN, 16, header, 32, NULL, 0));
- EXPECT_LE(0,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_FLEXRAY, 16, NULL, 32, NULL, 0));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_IPC, 16, NULL, 32, payload, 0));
+ EXPECT_LE(DLT_RETURN_WRONG_PARAMETER,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_CAN, 16, header, 32, NULL, 0));
+ EXPECT_LE(DLT_RETURN_WRONG_PARAMETER,dlt_user_trace_network_truncated(&context, DLT_NW_TRACE_FLEXRAY, 16, NULL, 32, NULL, 0));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
@@ -2810,8 +2810,8 @@ TEST(t_dlt_user_trace_network_segmented, normal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network_segmented normal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network_segmented normal"));
char header[16];
for(char i = 0; i < 16; ++i)
@@ -2824,13 +2824,13 @@ TEST(t_dlt_user_trace_network_segmented, normal)
payload[(int)i] = i;
}
- EXPECT_LE(0,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_IPC, 16, header, 32, payload));
- EXPECT_LE(0,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_CAN, 16, header, 32, payload));
- EXPECT_LE(0,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_FLEXRAY, 16, header, 32, payload));
- EXPECT_LE(0,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_MOST, 16, header, 32, payload));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_IPC, 16, header, 32, payload));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_CAN, 16, header, 32, payload));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_FLEXRAY, 16, header, 32, payload));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_MOST, 16, header, 32, payload));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_trace_network_segmented, abnormal)
@@ -2839,8 +2839,8 @@ TEST(t_dlt_user_trace_network_segmented, abnormal)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network_segmented abnormal"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network_segmented abnormal"));
// TODO: char header[16];
// TODO: for(char i = 0; i < 16; ++i)
@@ -2854,18 +2854,18 @@ TEST(t_dlt_user_trace_network_segmented, abnormal)
// TODO: }
// data length = 0. Does this make sense?
- // TODO: EXPECT_GE(-1,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_IPC, 0, header, 32, payload));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_CAN, 0, header, 0, payload));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_FLEXRAY, 16, header, 0, payload));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_IPC, 0, header, 32, payload));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_CAN, 0, header, 0, payload));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_FLEXRAY, 16, header, 0, payload));
// invalid DltNetworkTraceType value
- // TODO: EXPECT_GE(-1,dlt_user_trace_network_segmented(&context, (DltNetworkTraceType)-100, 16, header, 32, payload));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network_segmented(&context, (DltNetworkTraceType)-10, 16, header, 32, payload));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network_segmented(&context, (DltNetworkTraceType)10, 16, header, 32, payload));
- // TODO: EXPECT_GE(-1,dlt_user_trace_network_segmented(&context, (DltNetworkTraceType)100, 16, header, 32, payload));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network_segmented(&context, (DltNetworkTraceType)-100, 16, header, 32, payload));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network_segmented(&context, (DltNetworkTraceType)-10, 16, header, 32, payload));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network_segmented(&context, (DltNetworkTraceType)10, 16, header, 32, payload));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_user_trace_network_segmented(&context, (DltNetworkTraceType)100, 16, header, 32, payload));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
TEST(t_dlt_user_trace_network_segmented, nullpointer)
@@ -2874,8 +2874,8 @@ TEST(t_dlt_user_trace_network_segmented, nullpointer)
- EXPECT_LE(0,dlt_register_app("TUSR", "dlt_user.c tests"));
- EXPECT_LE(0,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network_segmented nullpointer"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_app("TUSR", "dlt_user.c tests"));
+ EXPECT_LE(DLT_RETURN_OK,dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_trace_network_segmented nullpointer"));
char header[16];
for(char i = 0; i < 16; ++i)
@@ -2889,12 +2889,12 @@ TEST(t_dlt_user_trace_network_segmented, nullpointer)
}
// what to expect when giving in NULL pointer?
- EXPECT_LE(0,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_IPC, 16, NULL, 32, payload));
- EXPECT_LE(0,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_CAN, 16, header, 32, NULL));
- EXPECT_LE(0,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_FLEXRAY, 16, NULL, 32, NULL));
+ EXPECT_LE(DLT_RETURN_OK,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_IPC, 16, NULL, 32, payload));
+ EXPECT_LE(DLT_RETURN_WRONG_PARAMETER,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_CAN, 16, header, 32, NULL));
+ EXPECT_LE(DLT_RETURN_WRONG_PARAMETER,dlt_user_trace_network_segmented(&context, DLT_NW_TRACE_FLEXRAY, 16, NULL, 32, NULL));
- EXPECT_LE(0,dlt_unregister_context(&context));
- EXPECT_LE(0,dlt_unregister_app());
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_context(&context));
+ EXPECT_LE(DLT_RETURN_OK,dlt_unregister_app());
}
@@ -2905,10 +2905,10 @@ TEST(t_dlt_set_log_mode, normal)
- EXPECT_LE(0,dlt_set_log_mode(DLT_USER_MODE_OFF));
- EXPECT_LE(0,dlt_set_log_mode(DLT_USER_MODE_EXTERNAL));
- EXPECT_LE(0,dlt_set_log_mode(DLT_USER_MODE_INTERNAL));
- EXPECT_LE(0,dlt_set_log_mode(DLT_USER_MODE_BOTH));
+ EXPECT_LE(DLT_RETURN_OK,dlt_set_log_mode(DLT_USER_MODE_OFF));
+ EXPECT_LE(DLT_RETURN_OK,dlt_set_log_mode(DLT_USER_MODE_EXTERNAL));
+ EXPECT_LE(DLT_RETURN_OK,dlt_set_log_mode(DLT_USER_MODE_INTERNAL));
+ EXPECT_LE(DLT_RETURN_OK,dlt_set_log_mode(DLT_USER_MODE_BOTH));
}
@@ -2917,11 +2917,11 @@ TEST(t_dlt_set_log_mode, abnormal)
- // TODO: EXPECT_GE(-1,dlt_set_log_mode(DLT_USER_MODE_UNDEFINED));
- // TODO: EXPECT_GE(-1,dlt_set_log_mode((DltUserLogMode)-100));
- // TODO: EXPECT_GE(-1,dlt_set_log_mode((DltUserLogMode)-10));
- // TODO: EXPECT_GE(-1,dlt_set_log_mode((DltUserLogMode)10));
- // TODO: EXPECT_GE(-1,dlt_set_log_mode((DltUserLogMode)100));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_set_log_mode(DLT_USER_MODE_UNDEFINED));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_set_log_mode((DltUserLogMode)-100));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_set_log_mode((DltUserLogMode)-10));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_set_log_mode((DltUserLogMode)10));
+ // TODO: EXPECT_GE(DLT_RETURN_ERROR,dlt_set_log_mode((DltUserLogMode)100));
}
@@ -2946,7 +2946,7 @@ TEST(t_dlt_verbose_mode, normal)
- EXPECT_LE(0,dlt_verbose_mode());
+ EXPECT_LE(DLT_RETURN_OK,dlt_verbose_mode());
}
@@ -2958,7 +2958,7 @@ TEST(t_dlt_nonverbose_mode, normal)
- EXPECT_LE(0,dlt_nonverbose_mode());
+ EXPECT_LE(DLT_RETURN_OK,dlt_nonverbose_mode());
}
@@ -2966,7 +2966,7 @@ TEST(t_dlt_nonverbose_mode, normal)
// free dlt
TEST(t_dlt_free, onetime)
{
- EXPECT_EQ(0, dlt_free());
+ EXPECT_EQ(DLT_RETURN_OK, dlt_free());
}
/////////////////////////////////////////