summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/daemon/dlt-daemon.c10
-rwxr-xr-xsrc/daemon/dlt-daemon.h1
-rwxr-xr-xsrc/daemon/dlt_daemon_common.c26
-rwxr-xr-xsrc/daemon/dlt_daemon_common.h5
-rwxr-xr-xsrc/daemon/dlt_daemon_common_cfg.h6
5 files changed, 36 insertions, 12 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index ad2aa9d..2438368 100755
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -154,6 +154,7 @@ void usage()
printf(" -o filename Store DLT messages to local log file\n");
printf(" -f filename Enable filtering of messages\n");
printf(" -u size Size of the ringbuffer in bytes (Default: 10024)\n");
+ printf(" -i directory Directory where to store the persistant configuration (Default: /tmp)\n");
} /* usage() */
/**
@@ -174,7 +175,7 @@ int option_handling(DltDaemonLocal *daemon_local,int argc, char* argv[])
opterr = 0;
- while ((c = getopt (argc, argv, "hvasxdlrmnf:o:e:b:y:u:")) != -1)
+ while ((c = getopt (argc, argv, "hvasxdlrmnf:o:e:b:y:u:i:")) != -1)
{
switch (c)
{
@@ -253,6 +254,11 @@ int option_handling(DltDaemonLocal *daemon_local,int argc, char* argv[])
daemon_local->flags.uvalue = optarg;
break;
}
+ case 'i':
+ {
+ daemon_local->flags.ivalue = optarg;
+ break;
+ }
case 'h':
{
usage();
@@ -488,7 +494,7 @@ int dlt_daemon_local_init_p2(DltDaemon *daemon, DltDaemonLocal *daemon_local, in
}
/* Daemon data */
- if (dlt_daemon_init(daemon,daemon_local->flags.vflag)==-1)
+ if (dlt_daemon_init(daemon,daemon_local->flags.ivalue,daemon_local->flags.vflag)==-1)
{
dlt_log(LOG_ERR,"Could not initialize daemon data\n");
return -1;
diff --git a/src/daemon/dlt-daemon.h b/src/daemon/dlt-daemon.h
index e229df5..8489ee6 100755
--- a/src/daemon/dlt-daemon.h
+++ b/src/daemon/dlt-daemon.h
@@ -104,6 +104,7 @@ typedef struct
char *bvalue; /**< (String: Baudrate) Serial device baudrate (Default: 115200) */
char *yvalue; /**< (String: Devicename) Additional support for serial device */
char *uvalue; /**< (String: Ringbuffer) Size of the ringbuffer in bytes (Default: 10024) */
+ char *ivalue; /**< (String: Directory) Directory where to store the persistant configuration (Default: /tmp) */
} DltDaemonFlags;
/**
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c
index 4fbfd31..a4d5dba 100755
--- a/src/daemon/dlt_daemon_common.c
+++ b/src/daemon/dlt_daemon_common.c
@@ -131,7 +131,7 @@ static int dlt_daemon_cmp_apid_ctid(const void *m1, const void *m2)
return ret;
}
-int dlt_daemon_init(DltDaemon *daemon,int verbose)
+int dlt_daemon_init(DltDaemon *daemon,const char *runtime_directory, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
@@ -153,9 +153,21 @@ int dlt_daemon_init(DltDaemon *daemon,int verbose)
daemon->runtime_context_cfg_loaded = 0;
+ /* prepare filenames for configuration */
+ if(runtime_directory)
+ strcpy(daemon->runtime_application_cfg,runtime_directory);
+ else
+ strcpy(daemon->runtime_application_cfg,DLT_RUNTIME_DEFAULT_DIRECTORY);
+ strcat(daemon->runtime_application_cfg,DLT_RUNTIME_APPLICATION_CFG);
+ if(runtime_directory)
+ strcpy(daemon->runtime_context_cfg,runtime_directory);
+ else
+ strcpy(daemon->runtime_context_cfg,DLT_RUNTIME_DEFAULT_DIRECTORY);
+ strcat(daemon->runtime_context_cfg,DLT_RUNTIME_CONTEXT_CFG);
+
/* Check for runtime cfg, if it is loadable, load it! */
- if ((dlt_daemon_applications_load(daemon,DLT_RUNTIME_APPLICATION_CFG, verbose)==0) &&
- (dlt_daemon_contexts_load(daemon,DLT_RUNTIME_CONTEXT_CFG, verbose)==0))
+ if ((dlt_daemon_applications_load(daemon,daemon->runtime_application_cfg, verbose)==0) &&
+ (dlt_daemon_contexts_load(daemon,daemon->runtime_context_cfg, verbose)==0))
{
daemon->runtime_context_cfg_loaded = 1;
}
@@ -906,16 +918,16 @@ int dlt_daemon_control_process_control(int sock, DltDaemon *daemon, DltMessage *
}
case DLT_SERVICE_ID_STORE_CONFIG:
{
- if (dlt_daemon_applications_save(daemon, DLT_RUNTIME_APPLICATION_CFG, verbose)==0)
+ if (dlt_daemon_applications_save(daemon, daemon->runtime_application_cfg, verbose)==0)
{
- if (dlt_daemon_contexts_save(daemon, DLT_RUNTIME_CONTEXT_CFG, verbose)==0)
+ if (dlt_daemon_contexts_save(daemon, daemon->runtime_context_cfg, verbose)==0)
{
dlt_daemon_control_service_response(sock, daemon, id, DLT_SERVICE_RESPONSE_OK, verbose);
}
else
{
/* Delete saved files */
- dlt_daemon_control_reset_to_factory_default(daemon, DLT_RUNTIME_APPLICATION_CFG, DLT_RUNTIME_CONTEXT_CFG, verbose);
+ dlt_daemon_control_reset_to_factory_default(daemon, daemon->runtime_application_cfg, daemon->runtime_context_cfg, verbose);
dlt_daemon_control_service_response(sock, daemon, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
}
}
@@ -927,7 +939,7 @@ int dlt_daemon_control_process_control(int sock, DltDaemon *daemon, DltMessage *
}
case DLT_SERVICE_ID_RESET_TO_FACTORY_DEFAULT:
{
- dlt_daemon_control_reset_to_factory_default(daemon, DLT_RUNTIME_APPLICATION_CFG, DLT_RUNTIME_CONTEXT_CFG, verbose);
+ dlt_daemon_control_reset_to_factory_default(daemon, daemon->runtime_application_cfg, daemon->runtime_context_cfg, verbose);
dlt_daemon_control_service_response(sock, daemon, id, DLT_SERVICE_RESPONSE_OK, verbose);
break;
}
diff --git a/src/daemon/dlt_daemon_common.h b/src/daemon/dlt_daemon_common.h
index fa0fe53..1d16a85 100755
--- a/src/daemon/dlt_daemon_common.h
+++ b/src/daemon/dlt_daemon_common.h
@@ -149,16 +149,19 @@ typedef struct
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 */
DltRingBuffer client_ringbuffer; /**< Ring-buffer for storing received logs while no client connection is available */
+ char runtime_application_cfg[256]; /**< Path and filename of persistent application configuration */
+ char runtime_context_cfg[256]; /**< Path and filename of persistent context configuration */
} DltDaemon;
/**
* Initialise the dlt daemon structure
* This function must be called before using further dlt daemon structure
* @param daemon pointer to dlt daemon structure
+ * @param runtime_directory Directory of persistent configuration
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
-int dlt_daemon_init(DltDaemon *daemon,int verbose);
+int dlt_daemon_init(DltDaemon *daemon,const char *runtime_directory,int verbose);
/**
* De-Initialise the dlt daemon structure
* @param daemon pointer to dlt daemon structure
diff --git a/src/daemon/dlt_daemon_common_cfg.h b/src/daemon/dlt_daemon_common_cfg.h
index 57db30e..0d076fe 100755
--- a/src/daemon/dlt_daemon_common_cfg.h
+++ b/src/daemon/dlt_daemon_common_cfg.h
@@ -84,10 +84,12 @@
/* Changable */
/*************/
+/* Default Path for runtime configuration */
+#define DLT_RUNTIME_DEFAULT_DIRECTORY "/tmp"
/* Path and filename for runtime configuration (applications) */
-#define DLT_RUNTIME_APPLICATION_CFG "/tmp/dlt-runtime-application.cfg"
+#define DLT_RUNTIME_APPLICATION_CFG "/dlt-runtime-application.cfg"
/* Path and filename for runtime configuration (contexts) */
-#define DLT_RUNTIME_CONTEXT_CFG "/tmp/dlt-runtime-context.cfg"
+#define DLT_RUNTIME_CONTEXT_CFG "/dlt-runtime-context.cfg"
/* Size of text buffer */
#define DLT_DAEMON_TEXTBUFSIZE 255