summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Fix macro code to use boolean value in while instruction (false) (#469)michael-methner2023-05-084-37/+41
| | | | | * Fix macro code to use boolean value in while instruction (false) Signed-off-by: Michael Methner <mmethner@de.adit-jv.com>
* dlt_multiple_files: remove superfluous mode bits and add header file to ↵Minh Quang Luu2023-04-121-1/+1
| | | | | header list (#462) Signed-off-by: LUU QUANG MINH <Minh.LuuQuang@vn.bosch.com>
* logfile: exhance internal dlt logging by introducing size limits (#369)Daniel Weber2023-03-103-90/+222
| | | | | | | | | | | Enhance dlt logging such that multiple files are used as it is done for the offline traces. Add limit-specific config values for logging. For this purpose the pattern of index-based file names is used only. This approach of logging to multiple files and rotating in order to keep the limits ensures that dlt logs take care of available space on the underlying file system and do not grow infinitely. Signed-off-by: Daniel Weber <daniel.w.weber@daimler.com> Co-authored-by: Oleg Tropmann <oleg.tropmann@daimler.com>
* Avoid memory corruption behind buffer wp in function ↵michael-methner2022-10-111-2/+15
| | | | | | | | | | | | dlt_getloginfo_conv_ascii_to_id (#411) * Avoid memory corruption behind buffer wp in function dlt_getloginfo_conv_ascii_to_id - Introduced new function dlt_getloginfo_conv_ascii_to_string for '\0' terminated strings - Avoid printing garbage characters in dlt-control after APID and CTID (which are not null terminated anymore) - Added unit test for dlt_client_parse_get_log_info_resp_text and dlt_getloginfo_conv_ascii_to_string - Use dlt_getloginfo_conv_ascii_to_string to get '\0' terminated for app_description and context_description Signed-off-by: Michael Methner <mmethner@de.adit-jv.com>
* internal-logging: Fix issues with file logging (#378)Alexander Mohr2022-10-051-1/+1
| | | | | | | | | | | | | This commit fixes the following issues if access to the internal log file is not possible (logging_mode = DLT_LOG_TO_FILE) * dlt_log_free tried to call fclose on a nullptr Added a nullcheck for this * Access to log file might be denied but access to logs is still wanted Add a new CMake option WITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK If this is set to ON and the logging moe is set to file, the dlt-daemon will fall back to syslog if opening the internal log file failed Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
* dlt_common: improve function descriptionDarian Biastoch2021-10-051-1/+11
| | | | | | | | The describtion of dlt_init_common was pretty meaningless, that's why an additional sentence and a list of all parsed evironment variables was added. Signed-off-by: Darian Biastoch <dbiastoch@de.adit-jv.com>
* cmake: Correct added subdirectoriesSaya Sugiura2021-10-051-1/+2
| | | | Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
* header: Adapt to DLT_DISABLE_MACROSaya Sugiura2021-10-052-1/+9
| | | | | | | | | If dlt.h is included in external application, it needed to include -DDLT_DISABLE_MACRO to make ifdef switch work. This commit adds DLT_DISABLE_MACRO in dlt_user.h so that no additional definition is needed in application. Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
* include: Refactor CMakeLists.txtSaya Sugiura2021-10-051-10/+14
| | | | Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
* lib: Add new interfaces with given bufferSaya Sugiura2021-10-051-0/+34
| | | | | | | | | | | | This commit adds new interfaces: - dlt_user_log_write_start_w_given_buffer(): accepts a log buffer as an input. - dlt_user_log_write_finish_w_given_buffer(): finalizes logging and send the message to corresponding output This is to reduce DLT API calls in DLT application as much as possible and avoid allocating dynamic memory within DLT library. The log buffer has to be prepared in DLT application in order to use these interfaces. Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
* lib: Add MaxFileSize handlingNarasimhaiah Suprathik (RBEI/ECF3)2021-10-052-0/+10
| | | | Signed-Off By: Saya Sugiura <ssugiura@jp.adit-jv.com>
* console: provides args option to enable send/receive serial headerVo Trung Chi2021-10-051-1/+12
| | | | | | | Provides argument option to enable send and resync serial header via command line. Signed-off-by: Vo Trung Chi <Chi.VoTrung@vn.bosch.com>
* fix malformed printf format strings (#295)Radek Kaczorowski2021-10-051-36/+32
| | | Co-authored-by: Saya Sugiura <39760799+ssugiura@users.noreply.github.com>
* file-transfer: Abort file transfer if get serial number failedAlexander Mohr2021-08-061-0/+2
| | | | | | | | | | | If a file is deleted while a file transfer is ongoing, the file transfer tries to seek through the whole file. This is due to the fact the the file handle is held open. getFileSerialNumber is already validating the file by using stat. If this call returns a negative value, we know that a stat to the file is not possible anymore, therefore further reading can be aborted.
* Update document and fix conversion warningDinh Cong Toan2021-06-301-2/+0
| | | | Signed-off-by: Dinh Cong Toan <toan.dinhcong@vn.bosch.com>
* Alternative solutions for json-c dependencyBiastoch, Darian (ADITG/ESM)2021-06-301-16/+0
| | | | | | | json-c dependency was removed from libdlt ('dlt_common') and shifted into 'dlt-control-common'. By this only the command line tools have a dependency on json-c. dlt-control-common is now built as a static library, so that it can be linked against json-c. Command line tools that included only the .c file of dlt-control-common before, are now linked against this static libarary (see console/CMakeLists.txt). Signed-off-by: dbiastoch <dbiastoch@de.adit-jv.com>
* dlt-receive:Fix compiler warningdbiastoch2021-06-301-0/+1
| | | | | | | | dlt_common.c: -Check if filter file fits into read buffer -Cast 'filename' into non-const to make it json-c API conform Signed-off-by: dbiastoch <dbiastoch@de.adit-jv.com>
* dlt-receive: Enabled more filtering by using json filter filesdbiastoch2021-06-301-4/+36
| | | | | | | | | | | | | | | -Added '-j' flag to dlt-receive for reading a json filter file -Added more attributes to DltFilter (LogLevel, MaxPayload, MinPayload) for extended message filtering, when using old filters these values are set to default. Same behaviour, when they are not defined in json filter file. -extended dlt_common.c to support json filter files and new DltFilter attributes +add dlt_json_filter_load to parse a json filter file into a DltFilter +add dlt_json_filter_save to print a DltFilter into a json file -Two new libraries are used to parse the json filter files: json-c for Linux based systems and the QNX internal libjson for QNX systems -gtest_dlt_common was modified to test the new function 'dlt_json_filter_load' +add testfile_extended.dlt that contains a bigger varity of messages (different context/app IDs, lengths and log levels) +add testfilter.json which is a valid json filter file -New dependency on library was added to related CMakeLists and is described in README.md Signed-off-by: dbiastoch <dbiastoch@de.adit-jv.com>
* dlt message header brokenDinh Cong Toan2021-06-302-13/+13
| | | | | | | | | | | | | This commit is to revert the following commits: - de4a4234 - fb9ff078 - db9917b3 - e4467f0e - a567e01d Those commits are from improvement but they seem to break the dlt message header in some cases. Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
* Add missing string functions (#309)Martin Willers2021-05-312-4/+98
| | | Signed-off-by: Martin Willers <M.Willers@gmx.net>
* Make nonverbose mode non exclusive (#300)Martin Willers2021-05-171-0/+4
| | | | | | | | | | | | | | | | * Make Non-Verbose mode non-exclusive Switching to global Non-Verbose mode now does not force Verbose messages to also be sent as Non-Verbose ones anymore. That would not make any sense, because Verbose messages don't have a MessageId and thus are all getting the same MessageId of 65535. Instead, setting global "Non-Verbose" mode will allow both Verbose and Non-Verbose messages to be sent in a single session. The "Verbose-APIs" (e.g. dlt_user_log_write_start()) will then only write Verbose messages, whereas the "Non-Verbose APIs" (e.g. dlt_user_log_write_start_id()) will then only write Non-Verbose messages. Signed-off-by: Martin Willers <M.Willers@gmx.net>
* Add verbose mode attribute handling (#292)Martin Willers2021-03-163-1/+364
| | | | | | dlt_user_log_write_*_attr() enables to writing these types, but also support adding "attributes" for them, i.e. a "name" and a "unit". Signed-off-by: Martin Willers <M.Willers@gmx.net>
* dlt_client_main_loop running in an infinite loop restricts graceful exit of ↵Sreeharsha Ramanavarapu2021-01-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | DLT Client code (#284) Issue: ------ dlt_client_main_loop currently uses an infinite loop ("while (1)"). This creates problems when a DLT client is running in a thread as part of a larger application. Graceful exit (for example: during object destruction) is not possible because a thread is running dlt_client_main_loop in the background. It is also not possible to exit the client, if we want it to fetch only a pre-decided number of messages. Solution: --------- Allow user to define a callback function to check whether the next message should be fetched. dlt-test-client.c has a new option to fetch a pre-decided number of messages, after which the client will exit. Signed-off-by: Sreeharsha Ramanavarapu <sreeharsha.r@gmail.com>
* other: fix remaining conversion warningsDinh Cong Toan2021-01-061-2/+2
| | | | | | | | | | | - Converting datatype to the correct one. - As macro do not perform type-checking before, so these functions used it with different datatype could create a lot of conversion warnings. For this reason, these warnings could be consider as normal information and will not be fixed. Signed-off-by: Dinh Cong Toan <toan.dinhcong@vn.bosch.com>
* library: fix conversion warningsDinh Cong Toan(RBVH/ECM12)2021-01-061-1/+1
| | | | | | | | | | | | - Change the data type of variable 'size' in DltContextData struct (dlt_user.h.in). Variable 'size' was used repeated with function 'sizeof()' many time, so change type to 'size_t' can avoid a lot of warnings. - Adding temporary variable to calculate the datasize header (define in dlt_common.h) in 'dlt_common.c' file. Signed-off-by: Dinh Cong Toan(RBVH/ECM12) <Toan.DinhCong@vn.bosch.com>
* shared: fix conversion warningsiod1hc2021-01-061-5/+5
| | | | | | | | | | | - Data type of 'textlength' create a lot of warnings while using in function 'snprintf()', so change data type to 'size_t' will resolve these warnings. - Change data type of variable 'size' to the right type 'unsigned int', which is located in struct DltBuffer in dlt_common.h (line 832). Signed-off-by: Dinh Cong Toan <toan.dinhcong@vn.bosch.com> Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
* gateway: fix compile warningsDinh Cong Toan(RBVH/ECM12)2021-01-061-6/+6
| | | | | | | | | - Correct the data type of 'headersize' and 'datasize' variables in header 'dlt_common.h', then config those functions using this library. - Explicit the data type. Signed-off-by: Dinh Cong Toan(RBVH/ECM12) <Toan.DinhCong@vn.bosch.com>
* logstorage: Implement general config to maintain logstorage loglevelSaya Sugiura2021-01-061-0/+7
| | | | | | | | | | | | Runtime log level setting from dlt-viewer or dlt-control doesn't work when logstorage is enabled. Adding MaintainLogstorageLogLevel=ON/OFF to [General] session of dlt_logstorage.conf to keep the current behaviour (=ON or 1 or not defined), or allow to change log level from dlt-viewer or dlt-control when the logstorage is enabled (=OFF or 0). Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com> Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
* dlt_common: Execute system command using execvpKHANH LUONG HONG DUY2021-01-061-0/+8
| | | | | | | Add function dlt_execute_command() to execute system command using execvp. Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
* libdlt: disable injection msg via env varBui Nguyen Quoc Thanh2021-01-061-0/+1
| | | | | | | | | | | | | | In order to disable injection message at dlt user, set DLT_DISABLE_INJECTION_MSG_AT_USER to any value. When injection message is disabled, libdlt won't poll any data from receiver. It means libdlt will ignore all data/messages from dlt-daemon. By default, variable is unset so that dlt users are able to handle data/messages from dlt-daemon. Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
* Add support for logging with VSOCK (#255)Martin Ejdestig2020-12-143-17/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For more information about VSOCK, see "man vsock" ( https://man7.org/linux/man-pages/man7/vsock.7.html ). Makes it possible for processes in a virtual machine to log directly in DLT running on host without setting up a network connection between guest and host. It is also probably more efficient. Have not done any performance measurements (not main reason for patch), but no forwarding is required as when running DLT in a multi-node setup. When building dlt-daemon for host, WITH_DLT_DAEMON_VSOCK_IPC should be enabled for daemon to listen on incoming VSOCK requests. Local communication method between applications and daemon is still determined with DLT_IPC. When building for guest, WITH_DLT_LIB_VSOCK_IPC should be enabled and DLT_IPC will be ignored, which will make libdlt open a VSOCK socket to the deamon for logging messages. VSOCK can be tested without a virtual machine. Since VMADDR_CID_HOST is used by libdlt when connecting, see vsock man page, clients can be run on host to test VSOCK communication. Some modifications has been done to be able to handle logging through FIFO pipe and socket in the same build of dlt-daemon: - dlt_receiver_init/free_unix_socket() is renamed to dlt_receiver_init/free_global_buffer() and used for FIFO as well. Also fixes memory leak since dlt_receiver_free_unix_socket() was used regardless of whether DLT_USE_UNIX_SOCKET was defined or not. - Pass type to dlt_receiver_init() instead of dlt_receiver_receive(). And remove preprocessor conditionals for handling DLT_CONNECTION_APP_MSG in dlt_daemon_process_user_messages(). Also fixes wrong enum type being passed to dlt_receiver_receive() in dlt_client.c (DltClient::mode was used as a DltReceiverType enum but it is a DltClientMode enum). - Add a flag to DltDaemonApplication to indicate whether file descriptor is "owned" by the DltDaemonApplication or not. When dlt_daemon_application_add() is called due to message received on a socket, fd is passed as an argument (app does not own fd). For FIFO, a per application FIFO is opened (app owns the fd). Also fixes so that user handle is reset for both application and all its contexts when resetting any. Prevents fd from being used by accident after it has been closed. dlt_mkdir_recursive() is moved to src/daemon since it is only used in the daemon. Minimizes use of DLT_USE_UNIX_SOCKET_IPC. Other bugfixes: - Call DLT_SEM_FREE() if setting socket to O_NONBLOCK fails in src/lib/dlt_user.c:dlt_initialize_socket_connection(). - Close socket if dlt_receiver_init() fails in src/lib/dlt_user.c:dlt_initialize_socket_connection(). Signed-off-by: Martin Ejdestig <martin.ejdestig@volvocars.com>
* Avoid memory access errors with 4-chars context ids (#250)Martin Willers2020-11-171-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | For a 4-chars CTXID, i.e. one that does not include a null character, the strlen() calls were happily accessing memory until they eventually encountered a null character somewhere in memory. This was detected by valgrind, which reported a memory error when using a CTXID such as "INTM": ==21924== Conditional jump or move depends on uninitialised value(s) ==21924== at 0x4C30F78: strlen (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21924== by 0x4E4B5A0: dlt_print_id (dlt_common.c:303) ==21924== by 0x4E4CF47: dlt_message_header_flags (dlt_common.c:687) ==21924== by 0x4E51434: dlt_message_print_ascii (dlt_common.c:3169) ==21924== by 0x4E4247A: dlt_user_print_msg (dlt_user.c:4108) ==21924== by 0x4E46D92: dlt_user_log_send_log (dlt_user.c:3670) ==21924== by 0x4E46F14: dlt_user_log_write_finish (dlt_user.c:1611) Sanitize some code Using memset() and memcpy() is always preferable to hand-rolled loops, because compilers have built-in support for them. Signed-off-by: Martin Willers <M.Willers@gmx.net>
* Implement DLTClient for UDP multicast (#240)João Sousa2020-08-312-6/+27
| | | | | | | | | * Add UDP multicast support on client side UDP multicast support is already present on server side. This patch add seemless support for UDP multicast on client side in dlt-receive. Signed-off-by: Joao Sousa <joao.sa.sousa@ctw.bmwgroup.com>
* set DLT_NETWORK_TRACE_ENABLE by cmakedefineFelix Herrmann2020-07-062-2/+9
| | | | | Signed-off-by: Felix Herrmann <fherrmann@de.adit-jv.com> Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
* common: Isolate FIFO/Unix socketLUONG HONG DUY KHANH(RBVH/ENG42)2020-07-061-0/+9
| | | | | | | | | | | | | | dlt_common - Add preprocessor DLT_USE_UNIX_SOCKET_IPC for dlt_log_set_fifo_basedir() and dltFifoBaseDir variable - Rename input parameter of dlt_log_set_fifo_basedir() dlt-daemon - Replace setting dltFifoBaseDir by dlt_log_set_fifo_basedir() and add preproc DLT_USE_UNIX_SOCKET_IPC - Update -h opt and flags.loggingFilename based on IPC type Signed-off-by: LUONG HONG DUY KHANH(RBVH/ENG42) <KHANH.LUONGHONGDUY@vn.bosch.com>
* network trace: Include necessary headersSaya Sugiura2020-07-061-0/+3
| | | | | | | | | | | Some components which links dlt seem to depend on following headers, which will be included by mqueue.h. - sys/types.h - fcntl.h So explicitly include them if mqueue interface is not supported in dlt_user.h. Also two headers are removed if dlt_used.h is included. Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
* network trace: Add mqueue verificationSaya Sugiura2020-07-061-2/+2
| | | | | | | | | | There is some OS (e.g. Android) which doesn't support message queue. Since network trace uses it as IPC, we need to disable it if following calls are not available: mq_open, mq_close, mq_unlink, mq_send, mq_receive Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com> Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
* Improve performance of DLT file parsingBui Nguyen Quoc Thanh2020-07-061-0/+14
| | | | | | Introduce new API to support quick parsing a DLT file. Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
* Redirect stdout to stderrLUONG HONG DUY KHANH(RBVH/ENG42)2020-07-061-2/+9
| | | | | | | | | | | | - daemon: New feature for LoggingMode at /etc/dlt.conf to be able to set value at 3 in order to redirect all stdout messages to stderr. - libdlt: New feature for DLT_LOG_MODE environment variable to be able to set value at 3 in order to redirect all stdout messages to stderr. - unit test: Add test cases for DLT_LOG_TO_STDERR Signed-off-by: LUONG HONG DUY KHANH(RBVH/ENG42) <KHANH.LUONGHONGDUY@vn.bosch.com>
* fix clang warnings about GNU stuffFelix Herrmann2020-07-061-8/+8
| | | | | Signed-off-by: Felix Herrmann <fherrmann@de.adit-jv.com> Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
* Android: Enable Android buildFelix Herrmann2020-07-061-1/+6
| | | | | Signed-off-by: Felix Herrmann <fherrmann@de.adit-jv.com> Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
* Remove DLT_PACKED redefinition guard in dlt_common.hFelix Herrmann2020-07-061-3/+1
| | | | Signed-off-by: Felix Herrmann <fherrmann@de.adit-jv.com>
* rename definition PACKED to DLT_PACKEDFelix Herrmann2020-07-061-30/+27
| | | | | Signed-off-by: Felix Herrmann <external.Felix.Herrmann3@de.bosch.com> Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
* Add macro wrappers for new sized string functionsMartin Willers2020-05-181-0/+33
| | | | Signed-off-by: Martin Willers <M.Willers@gmx.net>
* Add functions for writing strings with known sizesMartin Willers2020-05-181-0/+34
| | | | Signed-off-by: Martin Willers <M.Willers@gmx.net>
* Remove naming of variadic macro parametersTed Lyngmo2020-02-061-8/+8
| | | | | | | The GNU preprocessor supports naming of the variadic macro parameter, but not preprocessors does. Signed-off-by: Ted Lyngmo <ted@lyncon.se>
* dlt_user.h: fix build when musl is the libc implementation, by adding a ↵Gianfranco Costamagna2020-01-271-0/+1
| | | | | | | | | | | missing include for pthread_t reference: see https://errors.yoctoproject.org/Errors/Details/308000/ for details Thanks Khem Raj <raj.khem@gmail.com> for the report Signed-off-by: Gianfranco Costamagna <costamagnagianfranco@yahoo.it> Signed-off-by: Gianfranco Costamagna <locutusofborg@debian.org>
* BugFix: SEGFAULT when using AppArmor (#192)Sebastian Kloska2019-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * Symptome: If access to the trace directory is not granted by AppArmor access(...) still reports otherwise. dlt_offline_trace_get_total_size(...) tries to open the dir via opendir(...) and tries a readdir without any further check, which results in an SEGFAULT * Solution: (1) Make dlt_offline_trace_get_total_size return ssize_t instead of unsigned long, which gives us a chance to return an error state (2) Check the return value from opendir(...) and bail out on error. Use this to return DLT_RETURN_ERROR in dlt_offline_trace_check_size. * ToDo: (1) Error state is not yet checked and reported back. On Error we just don't generate any offline log files without any further complain. (2) Find a replacement for access(...) which reports properly under AppArmor. (3) Report the confusing behaviour of access(...) to the AppArmor team. Signed-off-by: Sebastian Kloska <seebastian.kloska@snafu.de>
* Change the DLT_CHECK_RCV_DATA_SIZE macro to an internal function (#191)Sebastian Lipponer2019-11-251-11/+7
| | | | | | | | | The use of this macro in a if condition is actually non-standard C++ code. GCC issues a warning that ISO C++ forbids braced-groups within expressions when compiled with -Wpedantic. Other compilers fail with an error. Change the macro to an internal function in order to improve the portability to other platforms (i.e. MSVC, proprietary embedded). Signed-off-by: Sebastian Lipponer <mail@sebastianlipponer.de>
* Provide DLT_GET_APPID macro (#187) (#188)Vo Trung Chi2019-11-142-0/+14
| | | Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>