summaryrefslogtreecommitdiff
path: root/src/offlinelogstorage/dlt_offline_logstorage.h
diff options
context:
space:
mode:
authorS. Hameed <shameed@jp.adit-jv.com>2015-08-05 15:22:20 +0900
committerLutz Helwing <lutz_helwing@mentor.com>2015-11-24 09:48:42 +0100
commit8ed28dc15429a736c8404d491ed73fd0b04235e2 (patch)
tree0c1c68a5a58c59c3936986a4495c467798b7964b /src/offlinelogstorage/dlt_offline_logstorage.h
parentda4ac57d87108d8b2690979c273c000a798a59f5 (diff)
downloadDLT-daemon-8ed28dc15429a736c8404d491ed73fd0b04235e2.tar.gz
Offline logstorage: Offline logstorage feature
Features: 1. Offline log storage to internal and external devices (PATH based trigger) 2. File options configurable in dlt.conf a : Appends timestamp in log file name (OfflineLogstorageTimestamp) b : Appends delimiter in log file name (OfflineLogstorageDelimiter) c : Wrap around value for log file count in file name (OfflineLogstorageMaxCounter) 3. Common config file parser support Signed-off-by: S. Hameed <shameed@jp.adit-jv.com> Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
Diffstat (limited to 'src/offlinelogstorage/dlt_offline_logstorage.h')
-rw-r--r--src/offlinelogstorage/dlt_offline_logstorage.h45
1 files changed, 34 insertions, 11 deletions
diff --git a/src/offlinelogstorage/dlt_offline_logstorage.h b/src/offlinelogstorage/dlt_offline_logstorage.h
index bec4fe3..80a75e8 100644
--- a/src/offlinelogstorage/dlt_offline_logstorage.h
+++ b/src/offlinelogstorage/dlt_offline_logstorage.h
@@ -67,7 +67,6 @@
#define DLT_OFFLINE_LOGSTORAGE_MAX_KEY_LEN 10 /* Maximum size for key */
#define DLT_OFFLINE_LOGSTORAGE_MAX_FILE_NAME_LEN 50 /* Maximum file name length of the log file */
-#define DLT_OFFLINE_LOGSTORAGE_MAX_LINE_SIZE 80 /* Maximum length of a line in configuration file */
#define DLT_OFFLINE_LOGSTORAGE_FILE_EXTENSION_LEN 4
#define DLT_OFFLINE_LOGSTORAGE_INDEX_LEN 3
@@ -96,7 +95,6 @@
#define DLT_OFFLINE_LOGSTORAGE_IS_FILTER_PRESENT(A) ((A) & DLT_OFFLINE_LOGSTORAGE_FILTER_PRESENT)
#define DLT_OFFLINE_LOGSTORAGE_CONFIG_DIR_PATH_LEN 50
-#define DLT_OFFLINE_LOGSTORAGE_CONFIG_DIR_PATH "/tmp/dltlogs/dltlogsdev"
#define DLT_OFFLINE_LOGSTORAGE_CONFIG_FILE_NAME "dlt_logstorage.conf"
/* +3 because of device number and \0 */
@@ -107,15 +105,36 @@
#define DLT_OFFLINE_LOGSTORAGE_MIN(A, B) ((A) < (B) ? (A) : (B))
#define DLT_OFFLINE_LOGSTORAGE_MAX_WRITE_ERRORS 5
+#define DLT_OFFLINE_LOGSTORAGE_MAX_KEY_NUM 6
+
+#define DLT_OFFLINE_LOGSTORAGE_CONFIG_SECTION "FILTER"
+
+typedef struct
+{
+ /* File name user configurations */
+ int logfile_timestamp; /* Timestamp set/reset */
+ char logfile_delimiter; /* Choice of delimiter */
+ unsigned int logfile_maxcounter; /* Maximum file index counter */
+ unsigned int logfile_counteridxlen; /* File index counter length */
+}DltLogStorageUserConfig;
+
+typedef struct DltLogStorageFileList
+{
+ /* List for filenames */
+ char *name; /* Filename */
+ unsigned int idx; /* File index */
+ struct DltLogStorageFileList *next;
+}DltLogStorageFileList;
typedef struct
{
/* filter section */
- int log_level; /* Log level number configured for filter */
- char *file_name; /* File name for log storage configured for filter */
- unsigned int file_size; /* MAX FIle size of storage file configured for filter */
- unsigned int num_files; /* MAX number of storage files configured for filters */
- FILE *log; /* current open log file */
+ int log_level; /* Log level number configured for filter */
+ char *file_name; /* File name for log storage configured for filter */
+ unsigned int file_size; /* MAX File size of storage file configured for filter */
+ unsigned int num_files; /* MAX number of storage files configured for filters */
+ FILE *log; /* current open log file */
+ DltLogStorageFileList *records; /* File name list */
}DltLogStorageConfigData;
@@ -132,7 +151,7 @@ typedef struct
DltLogStorageConfig *config_data; /* Configuration data */
char *filter_keys; /* List of all keys stored in config_htab */
int num_filter_keys; /* Number of keys */
- unsigned int device_num; /* Number of device to be used */
+ char device_mount_point[DLT_MOUNT_PATH_MAX]; /* Device mount path */
unsigned int connection_type; /* Type of connection */
unsigned int config_status; /* Status of configuration */
int write_errors; /* number of write errors */
@@ -145,10 +164,10 @@ typedef struct
*
*
* @param handle DLT Logstorage handle
- * @param device_num device number
+ * @param mount_point Device mount path
* @return 0 on success, -1 on error
*/
-extern int dlt_logstorage_device_connected(DltLogStorage *handle, int device_num);
+extern int dlt_logstorage_device_connected(DltLogStorage *handle, char *mount_point);
/**
* dlt_logstorage_load_config
@@ -201,6 +220,7 @@ extern int dlt_logstorage_get_loglevel_by_key(DltLogStorage *handle, char *key);
* Write a message to one or more configured log files, based on filter configuration.
*
* @param handle DltLogStorage handle
+ * @param file_config User configurations for log file
* @param appid Application id of sender
* @param ctxid Context id of sender
* @param log_level log_level of message to store
@@ -210,5 +230,8 @@ extern int dlt_logstorage_get_loglevel_by_key(DltLogStorage *handle, char *key);
* @param size2 Size of message body
* @return 0 on success or write errors < max write errors, -1 on error
*/
-extern int dlt_logstorage_write(DltLogStorage *handle, char *appid, char *ctxid, int loglevel, unsigned char *data1, int size1, unsigned char *data2, int size2, unsigned char *data3, int size3);
+extern int dlt_logstorage_write(DltLogStorage *handle, DltLogStorageUserConfig file_config,
+ char *appid, char *ctxid, int log_level,
+ unsigned char *data1, int size1, unsigned char *data2,
+ int size2, unsigned char *data3, int size3);
#endif /* DLT_OFFLINE_LOGSTORAGE_H */