automotive-dlt
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include "dlt_daemon_offline_logstorage.h"
Go to the source code of this file.
Functions | |
int | dlt_logstorage_split_key (char *key, char *appid, char *ctxid) |
int | dlt_logstorage_update_all_contexts (DltDaemon *daemon, char *id, int curr_log_level, int cmp_flag, int verbose) |
int | dlt_logstorage_update_context (DltDaemon *daemon, char *apid, char *ctxid, int curr_log_level, int verbose) |
int | dlt_logstorage_update_context_loglevel (DltDaemon *daemon, char *key, int curr_log_level, int verbose) |
void | dlt_daemon_logstorage_reset_application_loglevel (DltDaemon *daemon, int dev_num, int max_device, int verbose) |
void | dlt_daemon_logstorage_update_application_loglevel (DltDaemon *daemon, int dev_num, int verbose) |
int | dlt_daemon_logstorage_get_loglevel (DltDaemon *daemon, int max_device, char *apid, char *ctid) |
void | dlt_daemon_logstorage_write (DltDaemon *daemon, DltDaemonFlags *user_config, unsigned char *data1, int size1, unsigned char *data2, int size2, unsigned char *data3, int size3) |
int | dlt_daemon_logstorage_setup_internal_storage (DltDaemon *daemon, char *path, int verbose) |
void | dlt_daemon_logstorage_set_logstorage_cache_size (unsigned int size) |
int | dlt_daemon_logstorage_cleanup (DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose) |
int | dlt_daemon_logstorage_sync_cache (DltDaemon *daemon, DltDaemonLocal *daemon_local, char *mnt_point, int verbose) |
DltLogStorage * | dlt_daemon_logstorage_get_device (DltDaemon *daemon, DltDaemonLocal *daemon_local, char *mnt_point, int verbose) |
app begin@ Copyright (C) 2013 - 2015 Advanced Driver Information Technology. This code is developed by Advanced Driver Information Technology. Copyright of Advanced Driver Information Technology, Bosch and DENSO.
DLT offline log storage functionality source file.
For further information see http://www.genivi.org/. end@
Definition in file dlt_daemon_offline_logstorage.c.
int dlt_daemon_logstorage_cleanup | ( | DltDaemon * | daemon, |
DltDaemonLocal * | daemon_local, | ||
int | verbose | ||
) |
Cleanup dlt logstorage
daemon | Pointer to Dlt Daemon structure |
daemon_local | Pointer to Dlt Daemon Local structure |
verbose | If set to true verbose information is printed out |
Definition at line 579 of file dlt_daemon_offline_logstorage.c.
References DltLogStorage::connection_type, dlt_logstorage_device_disconnected(), DLT_LOGSTORAGE_SYNC_ON_DAEMON_EXIT, DLT_OFFLINE_LOGSTORAGE_DEVICE_CONNECTED, DltDaemonLocal::flags, NULL, DltDaemonFlags::offlineLogstorageMaxDevices, PRINT_FUNCTION_VERBOSE, and DltDaemon::storage_handle.
Referenced by dlt_daemon_local_cleanup().
DltLogStorage* dlt_daemon_logstorage_get_device | ( | DltDaemon * | daemon, |
DltDaemonLocal * | daemon_local, | ||
char * | mnt_point, | ||
int | verbose | ||
) |
dlt_logstorage_get_device
Get a Logstorage device handle for given the mount point.
daemon | Pointer to Dlt Daemon structure |
daemon_local | Pointer to Dlt Daemon Local structure |
mount_point | Logstorage device mount point |
verbose | If set to true verbose information is printed out |
Definition at line 658 of file dlt_daemon_offline_logstorage.c.
References DltLogStorage::device_mount_point, DltDaemonLocal::flags, NULL, DltDaemonFlags::offlineLogstorageMaxDevices, PRINT_FUNCTION_VERBOSE, and DltDaemon::storage_handle.
Referenced by dlt_daemon_logstorage_sync_cache().
int dlt_daemon_logstorage_get_loglevel | ( | DltDaemon * | daemon, |
int | max_device, | ||
char * | apid, | ||
char * | ctid | ||
) |
dlt_daemon_logstorage_get_loglevel
Obtain log level as a union of all configured storage devices and filters for the provided application id and context id
daemon | Pointer to DLT Daemon structure |
max_device | Maximum storage devices setup by the daemon |
apid | Application ID |
ctid | Context ID |
Definition at line 431 of file dlt_daemon_offline_logstorage.c.
References config, DltLogStorage::config_status, dlt_logstorage_get_config(), DLT_OFFLINE_LOGSTORAGE_CONFIG_DONE, DLT_OFFLINE_LOGSTORAGE_MAX, DltLogStorageConfigData::log_level, NULL, and DltDaemon::storage_handle.
Referenced by dlt_daemon_process_user_message_register_context().
void dlt_daemon_logstorage_reset_application_loglevel | ( | DltDaemon * | daemon, |
int | dev_num, | ||
int | max_device, | ||
int | verbose | ||
) |
dlt_daemon_logstorage_reset_application_loglevel
Reset storage log level of all running applications 2 steps for resetting
daemon | Pointer to DLT Daemon structure |
dev_num | Number of attached DLT Logstorage device |
max_device | Maximum storage devices setup by the daemon |
verbose | If set to true verbose information is printed out |
Definition at line 303 of file dlt_daemon_offline_logstorage.c.
References DltLogStorage::config_status, DltLogStorage::connection_type, DLT_DAEMON_LOGSTORAGE_RESET_LOGLEVEL, DLT_DAEMON_LOGSTORAGE_RESET_SEND_LOGLEVEL, dlt_daemon_logstorage_update_application_loglevel(), dlt_log(), dlt_logstorage_update_context_loglevel(), DLT_OFFLINE_LOGSTORAGE_CONFIG_DONE, DLT_OFFLINE_LOGSTORAGE_DEVICE_CONNECTED, DLT_OFFLINE_LOGSTORAGE_MAX_KEY_LEN, DltLogStorage::filter_keys, NULL, DltLogStorage::num_filter_keys, PRINT_FUNCTION_VERBOSE, and DltDaemon::storage_handle.
Referenced by dlt_daemon_control_service_logstorage().
void dlt_daemon_logstorage_set_logstorage_cache_size | ( | unsigned int | size | ) |
Set max size of logstorage cache. Stored internally in bytes
size | Size of logstorage cache [in KB] |
Definition at line 573 of file dlt_daemon_offline_logstorage.c.
References g_logstorage_cache_max.
Referenced by option_file_parser().
int dlt_daemon_logstorage_setup_internal_storage | ( | DltDaemon * | daemon, |
char * | path, | ||
int | verbose | ||
) |
dlt_daemon_logstorage_setup_internal_storage
Setup user defined path as offline log storage device
daemon | Pointer to Dlt Daemon structure |
path | User configured internal storage path |
verbose | If set to true verbose information is printed out |
Definition at line 541 of file dlt_daemon_offline_logstorage.c.
References dlt_daemon_logstorage_update_application_loglevel(), dlt_log(), dlt_logstorage_device_connected(), dlt_logstorage_load_config(), NULL, and DltDaemon::storage_handle.
Referenced by main().
int dlt_daemon_logstorage_sync_cache | ( | DltDaemon * | daemon, |
DltDaemonLocal * | daemon_local, | ||
char * | mnt_point, | ||
int | verbose | ||
) |
Sync logstorage caches
daemon | Pointer to Dlt Daemon structure |
daemon_local | Pointer to Dlt Daemon Local structure |
mount_point | Logstorage device mount point |
verbose | If set to true verbose information is printed out |
Definition at line 607 of file dlt_daemon_offline_logstorage.c.
References DltLogStorage::connection_type, dlt_daemon_logstorage_get_device(), dlt_logstorage_sync_caches(), DLT_OFFLINE_LOGSTORAGE_DEVICE_CONNECTED, DltDaemonLocal::flags, NULL, DltDaemonFlags::offlineLogstorageMaxDevices, PRINT_FUNCTION_VERBOSE, and DltDaemon::storage_handle.
Referenced by dlt_daemon_control_service_logstorage().
void dlt_daemon_logstorage_update_application_loglevel | ( | DltDaemon * | daemon, |
int | dev_num, | ||
int | verbose | ||
) |
dlt_daemon_logstorage_update_application_loglevel
Update log level of all running applications with new filter configuration available due to newly attached DltLogstorage device. The log level is only updated when the current application log level is less than the log level obtained from the storage configuration file
daemon | Pointer to DLT Daemon structure |
dev_num | Number of attached DLT Logstorage device |
verbose | If set to true verbose information is printed out |
Definition at line 374 of file dlt_daemon_offline_logstorage.c.
References DltLogStorage::config_status, DltLogStorage::connection_type, dlt_log(), dlt_logstorage_get_loglevel_by_key(), dlt_logstorage_update_context_loglevel(), DLT_OFFLINE_LOGSTORAGE_CONFIG_DONE, DLT_OFFLINE_LOGSTORAGE_DEVICE_CONNECTED, DLT_OFFLINE_LOGSTORAGE_MAX_KEY_LEN, DltLogStorage::filter_keys, NULL, DltLogStorage::num_filter_keys, PRINT_FUNCTION_VERBOSE, and DltDaemon::storage_handle.
Referenced by dlt_daemon_control_service_logstorage(), dlt_daemon_logstorage_reset_application_loglevel(), and dlt_daemon_logstorage_setup_internal_storage().
void dlt_daemon_logstorage_write | ( | DltDaemon * | daemon, |
DltDaemonFlags * | user_config, | ||
unsigned char * | data1, | ||
int | size1, | ||
unsigned char * | data2, | ||
int | size2, | ||
unsigned char * | data3, | ||
int | size3 | ||
) |
dlt_daemon_logstorage_write
Write log message to all attached storage device. If the called dlt_logstorage_write function is not able to write to the device, DltDaemon will disconnect this device.
daemon | Pointer to Dlt Daemon structure |
user_config | DltDaemon configuration |
data1 | message header buffer |
size1 | message header buffer size |
data2 | message extended header buffer |
size2 | message extended header size |
data3 | message data buffer |
size3 | message data size |
Definition at line 477 of file dlt_daemon_offline_logstorage.c.
References DltLogStorage::config_status, dlt_log(), dlt_logstorage_device_disconnected(), DLT_LOGSTORAGE_SYNC_ON_DEVICE_DISCONNECT, dlt_logstorage_write(), DLT_OFFLINE_LOGSTORAGE_CONFIG_DONE, DltLogStorageUserConfig::logfile_counteridxlen, DltLogStorageUserConfig::logfile_delimiter, DltLogStorageUserConfig::logfile_maxcounter, DltLogStorageUserConfig::logfile_timestamp, NULL, DltDaemonFlags::offlineLogstorageDelimiter, DltDaemonFlags::offlineLogstorageMaxCounter, DltDaemonFlags::offlineLogstorageMaxCounterIdx, DltDaemonFlags::offlineLogstorageMaxDevices, DltDaemonFlags::offlineLogstorageTimestamp, and DltDaemon::storage_handle.
Referenced by dlt_daemon_client_send().
int dlt_logstorage_split_key | ( | char * | key, |
char * | appid, | ||
char * | ctxid | ||
) |
dlt_logstorage_split_key
Split a given key into appid and ctxid. If APID: - appid = APID and ctxid = .* If :CTID - ctxid = CTID and appid = .* Else appid = APID and ctxid = CTID
key | Given key of filter hash map |
appid | Application id |
ctxid | Context id |
Definition at line 44 of file dlt_daemon_offline_logstorage.c.
References DLT_ID_SIZE, DLT_OFFLINE_LOGSTORAGE_MAX_KEY_LEN, and NULL.
Referenced by dlt_logstorage_update_context_loglevel().
int dlt_logstorage_update_all_contexts | ( | DltDaemon * | daemon, |
char * | id, | ||
int | curr_log_level, | ||
int | cmp_flag, | ||
int | verbose | ||
) |
dlt_logstorage_update_all_contexts
Update log level of all contexts of the application by updating the daemon internal table The compare flags (cmp_flag) indicates if Id has to be compared with application ID or Context id of the daemon internal table The log levels are reset if current log level provided is -1 (not sent to application in this case) Reset and sent to application if current log level provided is 0
daemon | DltDaemon structure |
id | application id or context id |
curr_log_level | log level to be set to context |
cmp_flag | compare flag (1 id is apid, 2 id is ctxid) |
verbose | If set to true verbose information is printed out |
Definition at line 121 of file dlt_daemon_offline_logstorage.c.
References DltDaemonContext::apid, DltDaemon::contexts, DltDaemonContext::ctid, DLT_DAEMON_LOGSTORAGE_RESET_SEND_LOGLEVEL, dlt_daemon_user_send_log_level(), DLT_ID_SIZE, dlt_log(), DLT_OFFLINE_LOGSTORAGE_MAX, dlt_set_id(), NULL, DltDaemon::num_contexts, and DltDaemonContext::storage_log_level.
Referenced by dlt_logstorage_update_context_loglevel().
int dlt_logstorage_update_context | ( | DltDaemon * | daemon, |
char * | apid, | ||
char * | ctxid, | ||
int | curr_log_level, | ||
int | verbose | ||
) |
dlt_logstorage_update_context
Update log level of a context by updating the daemon internal table The log levels are reset if current log level provided is -1 (not sent to application in this case) Reset and sent to application if current log level provided is 0
daemon | DltDaemon structure |
apid | application id |
ctxid | context id |
curr_log_level | log level to be set to context |
verbose | If set to true verbose information is printed out |
Definition at line 193 of file dlt_daemon_offline_logstorage.c.
References dlt_daemon_context_find(), DLT_DAEMON_LOGSTORAGE_RESET_SEND_LOGLEVEL, dlt_daemon_user_send_log_level(), dlt_log(), DLT_OFFLINE_LOGSTORAGE_MAX, NULL, and DltDaemonContext::storage_log_level.
Referenced by dlt_logstorage_update_context_loglevel().
int dlt_logstorage_update_context_loglevel | ( | DltDaemon * | daemon, |
char * | key, | ||
int | curr_log_level, | ||
int | verbose | ||
) |
dlt_logstorage_update_context_loglevel
Update all contexts or particular context depending provided key
daemon | Pointer to DLT Daemon structure |
key | Filter key stored in Hash Map |
curr_log_level | log level to be set to context |
verbose | If set to true verbose information is printed out |
Definition at line 247 of file dlt_daemon_offline_logstorage.c.
References DLT_ID_SIZE, dlt_log(), dlt_logstorage_split_key(), dlt_logstorage_update_all_contexts(), dlt_logstorage_update_context(), NULL, and PRINT_FUNCTION_VERBOSE.
Referenced by dlt_daemon_logstorage_reset_application_loglevel(), and dlt_daemon_logstorage_update_application_loglevel().