summaryrefslogtreecommitdiff
path: root/src/offlinelogstorage
diff options
context:
space:
mode:
authorManikandanC <Manikandan.Chockalingam@in.bosch.com>2016-10-18 15:43:44 +0530
committerChristoph Lipka <clipka@users.noreply.github.com>2018-12-21 10:16:46 +0100
commite3c2501313d98ff9f4519116e6d2f36314e0240e (patch)
treed1472ee7047b598b4b25bb7c06748eaa6f9f61cf /src/offlinelogstorage
parent2262f8b3406ac903a37f96a63c6250de215d1866 (diff)
downloadDLT-daemon-e3c2501313d98ff9f4519116e6d2f36314e0240e.tar.gz
UnitTest: Updates
Gateway Logstorage Event Handler Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com> Signed-off-by: S. Hameed <shameed@jp.adit-jv.com> Signed-off-by: Aditya Paluri <venkataaditya.paluri@in.bosch.com> Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com>
Diffstat (limited to 'src/offlinelogstorage')
-rw-r--r--src/offlinelogstorage/dlt_offline_logstorage.c31
-rw-r--r--src/offlinelogstorage/dlt_offline_logstorage.h31
-rw-r--r--src/offlinelogstorage/dlt_offline_logstorage_behavior.c1
-rw-r--r--src/offlinelogstorage/dlt_offline_logstorage_behavior_internal.h95
-rw-r--r--src/offlinelogstorage/dlt_offline_logstorage_internal.h119
5 files changed, 247 insertions, 30 deletions
diff --git a/src/offlinelogstorage/dlt_offline_logstorage.c b/src/offlinelogstorage/dlt_offline_logstorage.c
index 80dd3ec..c85af6e 100644
--- a/src/offlinelogstorage/dlt_offline_logstorage.c
+++ b/src/offlinelogstorage/dlt_offline_logstorage.c
@@ -32,6 +32,7 @@
#include <time.h>
#include "dlt_offline_logstorage.h"
+#include "dlt_offline_logstorage_internal.h"
#include "dlt_offline_logstorage_behavior.h"
#include "dlt_config_file_parser.h"
@@ -41,36 +42,6 @@
#define GENERAL_BASE_NAME "General"
-typedef struct {
- char *key; /* The configuration key */
- int (*func)(DltLogStorage *handle, char *value); /* conf handler */
- int is_opt; /* If configuration is optional or not */
-} DltLogstorageGeneralConf;
-
-typedef enum {
- DLT_LOGSTORAGE_GENERAL_CONF_COUNT = 0
-} DltLogstorageGeneralConfType;
-
-typedef struct {
- char *key; /* Configuration key */
- int (*func)(DltLogStorageFilterConfig *config, char *value); /* conf handler */
- int is_opt; /* If configuration is optional or not */
-} DltLogstorageFilterConf;
-
-typedef enum {
- DLT_LOGSTORAGE_FILTER_CONF_LOGAPPNAME = 0,
- DLT_LOGSTORAGE_FILTER_CONF_CONTEXTNAME,
- DLT_LOGSTORAGE_FILTER_CONF_LOGLEVEL,
- DLT_LOGSTORAGE_FILTER_CONF_RESET_LOGLEVEL,
- DLT_LOGSTORAGE_FILTER_CONF_FILE,
- DLT_LOGSTORAGE_FILTER_CONF_FILESIZE,
- DLT_LOGSTORAGE_FILTER_CONF_NOFILES,
- DLT_LOGSTORAGE_FILTER_CONF_SYNCBEHAVIOR,
- DLT_LOGSTORAGE_FILTER_CONF_ECUID,
- DLT_LOGSTORAGE_FILTER_CONF_SPECIFIC_SIZE,
- DLT_LOGSTORAGE_FILTER_CONF_COUNT
-} DltLogstorageFilterConfType;
-
DLT_STATIC void dlt_logstorage_filter_config_free(DltLogStorageFilterConfig *data)
{
DltLogStorageFileList *n = NULL;
diff --git a/src/offlinelogstorage/dlt_offline_logstorage.h b/src/offlinelogstorage/dlt_offline_logstorage.h
index b3f7dd3..5020042 100644
--- a/src/offlinelogstorage/dlt_offline_logstorage.h
+++ b/src/offlinelogstorage/dlt_offline_logstorage.h
@@ -208,6 +208,37 @@ typedef struct
int write_errors; /* number of write errors */
}DltLogStorage;
+typedef struct {
+ char *key; /* The configuration key */
+ int (*func)(DltLogStorage *handle, char *value); /* conf handler */
+ int is_opt; /* If configuration is optional or not */
+} DltLogstorageGeneralConf;
+
+typedef enum {
+ DLT_LOGSTORAGE_GENERAL_CONF_BLOCKMODE = 0,
+ DLT_LOGSTORAGE_GENERAL_CONF_COUNT
+} DltLogstorageGeneralConfType;
+
+typedef struct {
+ char *key; /* Configuration key */
+ int (*func)(DltLogStorageFilterConfig *config, char *value); /* conf handler */
+ int is_opt; /* If configuration is optional or not */
+} DltLogstorageFilterConf;
+
+typedef enum {
+ DLT_LOGSTORAGE_FILTER_CONF_LOGAPPNAME = 0,
+ DLT_LOGSTORAGE_FILTER_CONF_CONTEXTNAME,
+ DLT_LOGSTORAGE_FILTER_CONF_LOGLEVEL,
+ DLT_LOGSTORAGE_FILTER_CONF_RESET_LOGLEVEL,
+ DLT_LOGSTORAGE_FILTER_CONF_FILE,
+ DLT_LOGSTORAGE_FILTER_CONF_FILESIZE,
+ DLT_LOGSTORAGE_FILTER_CONF_NOFILES,
+ DLT_LOGSTORAGE_FILTER_CONF_SYNCBEHAVIOR,
+ DLT_LOGSTORAGE_FILTER_CONF_ECUID,
+ DLT_LOGSTORAGE_FILTER_CONF_SPECIFIC_SIZE,
+ DLT_LOGSTORAGE_FILTER_CONF_COUNT
+} DltLogstorageFilterConfType;
+
/**
* dlt_logstorage_device_connected
*
diff --git a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
index 4648159..cc31ff5 100644
--- a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
+++ b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
@@ -31,6 +31,7 @@
#include "dlt_offline_logstorage.h"
#include "dlt_offline_logstorage_behavior.h"
+#include "dlt_offline_logstorage_behavior_internal.h"
/**
* dlt_logstorage_log_file_name
diff --git a/src/offlinelogstorage/dlt_offline_logstorage_behavior_internal.h b/src/offlinelogstorage/dlt_offline_logstorage_behavior_internal.h
new file mode 100644
index 0000000..b8c80b2
--- /dev/null
+++ b/src/offlinelogstorage/dlt_offline_logstorage_behavior_internal.h
@@ -0,0 +1,95 @@
+/**
+ * @licence app begin@
+ * Copyright (C) 2017 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 internal header file.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ *
+ * \author Aditya Paluri <venkataaditya.paluri@in.bosch.com> ADIT 2017
+ *
+ * \file: dlt_offline_logstorage_behavior_internal.h
+ * For further information see http://www.genivi.org/.
+ * @licence end@
+ */
+
+/*******************************************************************************
+** **
+** SRC-MODULE: dlt_offline_logstorage_behavior_internal.h **
+** **
+** TARGET : linux **
+** **
+** PROJECT : DLT **
+** **
+** AUTHOR : Aditya Paluri venkataaditya.paluri@in.bosch.com **
+** **
+** PURPOSE : **
+** **
+** REMARKS : **
+** **
+** PLATFORM DEPENDANT [yes/no]: yes **
+** **
+** TO BE CHANGED BY USER [yes/no]: no **
+** **
+*******************************************************************************/
+
+/*******************************************************************************
+** Author Identity **
+********************************************************************************
+** **
+** Initials Name Company **
+** -------- ------------------------- ---------------------------------- **
+** ap Aditya Paluri ADIT **
+*******************************************************************************/
+
+#ifndef DLT_OFFLINELOGSTORAGE_BEHAVIOR_INTERNAL_H_
+#define DLT_OFFLINELOGSTORAGE_BEHAVIOR_INTERNAL_H_
+
+void dlt_logstorage_log_file_name(char *log_file_name,
+ DltLogStorageUserConfig *file_config,
+ char *name,
+ int idx);
+
+void dlt_logstorage_sort_file_name(DltLogStorageFileList **head);
+
+void dlt_logstorage_rearrange_file_name(DltLogStorageFileList **head);
+
+unsigned int dlt_logstorage_get_idx_of_log_file(
+ DltLogStorageUserConfig *file_config,
+ char *file);
+
+int dlt_logstorage_storage_dir_info(DltLogStorageUserConfig *file_config,
+ char *path,
+ DltLogStorageFilterConfig *config);
+
+int dlt_logstorage_open_log_file(DltLogStorageFilterConfig *config,
+ DltLogStorageUserConfig *file_config,
+ char *dev_path,
+ int msg_size);
+
+DLT_STATIC DltReturnValue dlt_logstorage_sync_create_new_file(
+ DltLogStorageFilterConfig *config,
+ DltLogStorageUserConfig *file_config,
+ char *dev_path,
+ unsigned int remain_file_size);
+
+DLT_STATIC DltReturnValue dlt_logstorage_sync_to_file(
+ DltLogStorageFilterConfig *config,
+ DltLogStorageUserConfig *file_config,
+ char *dev_path);
+
+DLT_STATIC DltReturnValue dlt_logstorage_sync_capable_data_to_file(
+ DltLogStorageFilterConfig *config,
+ int index_status);
+
+DLT_STATIC int dlt_logstorage_find_dlt_header(void *ptr,
+ unsigned int offset,
+ unsigned int cnt);
+
+#endif /* DLT_OFFLINELOGSTORAGE_BEHAVIOR_INTERNAL_H_ */
diff --git a/src/offlinelogstorage/dlt_offline_logstorage_internal.h b/src/offlinelogstorage/dlt_offline_logstorage_internal.h
new file mode 100644
index 0000000..11da0dd
--- /dev/null
+++ b/src/offlinelogstorage/dlt_offline_logstorage_internal.h
@@ -0,0 +1,119 @@
+/**
+ * @licence app begin@
+ * Copyright (C) 2017 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 internal header file.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ *
+ * \author Aditya Paluri <venkataaditya.paluri@in.bosch.com> ADIT 2017
+ *
+ * \file: dlt_offline_logstorage_internal.h
+ * For further information see http://www.genivi.org/.
+ * @licence end@
+ */
+
+/*******************************************************************************
+** **
+** SRC-MODULE: dlt_offline_logstorage_internal.h **
+** **
+** TARGET : linux **
+** **
+** PROJECT : DLT **
+** **
+** AUTHOR : Aditya Paluri venkataaditya.paluri@in.bosch.com **
+** PURPOSE : **
+** **
+** REMARKS : **
+** **
+** PLATFORM DEPENDANT [yes/no]: yes **
+** **
+** TO BE CHANGED BY USER [yes/no]: no **
+** **
+*******************************************************************************/
+
+/*******************************************************************************
+** Author Identity **
+********************************************************************************
+** **
+** Initials Name Company **
+** -------- ------------------------- ---------------------------------- **
+** ap Aditya Paluri ADIT **
+*******************************************************************************/
+
+#ifndef DLT_OFFLINE_LOGSTORAGE_INTERNAL_H
+#define DLT_OFFLINE_LOGSTORAGE_INTERNAL_H
+
+DLT_STATIC int dlt_logstorage_list_destroy(DltLogStorageFilterList **list,
+ int reason);
+
+DLT_STATIC int dlt_logstorage_list_add_config(DltLogStorageFilterConfig *data,
+ DltLogStorageFilterConfig **listdata);
+DLT_STATIC int dlt_logstorage_list_add(char *key,
+ DltLogStorageFilterConfig *data,
+ DltLogStorageFilterList **list);
+
+DLT_STATIC void *dlt_logstorage_list_find(char *key,
+ DltLogStorageFilterList **list);
+
+DLT_STATIC int dlt_logstorage_count_ids(const char *str);
+
+DLT_STATIC int dlt_logstorage_read_number(unsigned int *number, char *value);
+
+DLT_STATIC int dlt_logstorage_read_list_of_names(char **names, char *value);
+
+DLT_STATIC int dlt_logstorage_check_apids(DltLogStorageFilterConfig *config, char *value);
+
+DLT_STATIC int dlt_logstorage_check_ctids(DltLogStorageFilterConfig *config, char *value);
+
+DLT_STATIC int dlt_logstorage_check_loglevel(DltLogStorageFilterConfig *config, char *value);
+
+DLT_STATIC int dlt_logstorage_check_filename(DltLogStorageFilterConfig *config, char *value);
+
+DLT_STATIC int dlt_logstorage_check_filesize(DltLogStorageFilterConfig *config, char *value);
+
+DLT_STATIC int dlt_logstorage_check_nofiles(DltLogStorageFilterConfig *config, char *value);
+
+DLT_STATIC int dlt_logstorage_check_sync_strategy(DltLogStorageFilterConfig *config, char *value);
+
+DLT_STATIC int dlt_logstorage_check_ecuid(DltLogStorageFilterConfig *config, char *value);
+
+DLT_STATIC int dlt_logstorage_check_param(DltLogStorageFilterConfig *config,
+ DltLogstorageFilterConfType ctype,
+ char *value);
+
+DLT_STATIC int dlt_logstorage_store_filters(DltLogStorage *handle,
+ char *config_file_name);
+
+void dlt_logstorage_free(DltLogStorage *handle, int reason);
+
+DLT_STATIC int dlt_logstorage_create_keys(char *appids,
+ char *ctxids,
+ char *ecuid,
+ char **keys,
+ int *num_keys);
+
+DLT_STATIC int dlt_logstorage_prepare_table(DltLogStorage *handle,
+ DltLogStorageFilterConfig *data);
+
+DLT_STATIC int dlt_logstorage_validate_filter_name(char *name);
+
+DLT_STATIC void dlt_logstorage_filter_set_strategy(DltLogStorageFilterConfig *config,
+ int strategy);
+
+DLT_STATIC int dlt_logstorage_load_config(DltLogStorage *handle);
+
+DLT_STATIC int dlt_logstorage_filter(DltLogStorage *handle,
+ DltLogStorageFilterConfig **config,
+ char *apid,
+ char *ctid,
+ char *ecuid,
+ int log_level);
+
+#endif /* DLT_OFFLINE_LOGSTORAGE_INTERNAL_H */