summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Lipka <clipka@jp.adit-jv.com>2016-10-12 12:20:55 +0900
committerChristoph Lipka <clipka@jp.adit-jv.com>2016-10-24 13:39:56 +0900
commit3894a8d101a7be0f67262de8af3746a768433fed (patch)
tree179f8c486d834e3f2e53826b03bcb8fc9e51123e
parentc739c8ce49e9a285de6cf2c5df73c974dd8bab2e (diff)
downloadDLT-daemon-3894a8d101a7be0f67262de8af3746a768433fed.tar.gz
MultiNode: Specify config file location in dlt.conf
Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
-rw-r--r--src/daemon/dlt-daemon.c14
-rw-r--r--src/daemon/dlt-daemon.h1
-rw-r--r--src/daemon/dlt.conf12
-rw-r--r--src/gateway/dlt_gateway.c15
4 files changed, 33 insertions, 9 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index d3df90f..9288d33 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -249,6 +249,9 @@ int option_file_parser(DltDaemonLocal *daemon_local)
DLT_DAEMON_DEFAULT_CTRL_SOCK_PATH,
sizeof(daemon_local->flags.ctrlSockPath) - 1);
daemon_local->flags.gatewayMode = 0;
+ strncpy(daemon_local->flags.gatewayConfigFile,
+ DLT_GATEWAY_CONFIG_PATH,
+ DLT_DAEMON_FLAG_MAX - 1);
daemon_local->flags.autoResponseGetLogInfoOption = 7;
daemon_local->flags.contextLogLevel = DLT_LOG_INFO;
daemon_local->flags.contextTraceStatus = DLT_TRACE_STATUS_OFF;
@@ -503,6 +506,17 @@ int option_file_parser(DltDaemonLocal *daemon_local)
daemon_local->flags.gatewayMode = atoi(value);
//printf("Option: %s=%s\n",token,value);
}
+ else if(strcmp(token,"GatewayConfigFile")==0)
+ {
+ memset(
+ daemon_local->flags.gatewayConfigFile,
+ 0,
+ DLT_DAEMON_FLAG_MAX);
+ strncpy(
+ daemon_local->flags.gatewayConfigFile,
+ value,
+ DLT_DAEMON_FLAG_MAX-1);
+ }
else if(strcmp(token,"ContextLogLevel")==0)
{
int const intval = atoi(value);
diff --git a/src/daemon/dlt-daemon.h b/src/daemon/dlt-daemon.h
index a20af75..03b062e 100644
--- a/src/daemon/dlt-daemon.h
+++ b/src/daemon/dlt-daemon.h
@@ -124,6 +124,7 @@ typedef struct
unsigned int port; /**< port number */
char ctrlSockPath[DLT_DAEMON_FLAG_MAX]; /**< Path to Control socket */
int gatewayMode; /**< (Boolean) Gateway Mode */
+ char gatewayConfigFile[DLT_DAEMON_FLAG_MAX]; /**< Gateway config file path */
int autoResponseGetLogInfoOption; /**< (int) The Option of automatic get log info response during context registration. (Default: 7)*/
int contextLogLevel; /**< (int) log level sent to context if registered with default log-level or if enforced*/
int contextTraceStatus; /**< (int) trace status sent to context if registered with default trace status or if enforced*/
diff --git a/src/daemon/dlt.conf b/src/daemon/dlt.conf
index 383cbab..1e4f566 100644
--- a/src/daemon/dlt.conf
+++ b/src/daemon/dlt.conf
@@ -28,9 +28,6 @@ SendContextRegistration = 1
# Set ECU ID (Default: ECU1)
ECUId = ECU1
-# Enable Gateway mode (Default: 0)
-# GatewayMode = 1
-
# Size of shared memory (Default: 100000)
SharedMemorySize = 100000
@@ -76,6 +73,15 @@ RingbufferStepSize = 500000
# ForceContextLogLevelAndTraceStatus = 1
########################################################################
+# Gateway Configuration #
+########################################################################
+# Enable Gateway mode (Default: 0)
+# GatewayMode = 1
+
+# Read gateway configuration from another location
+# GatewayConfigFile = /etc/dlt_gateway.conf
+
+########################################################################
# Control Application #
########################################################################
ControlSocketPath = /tmp/dlt-ctrl.sock
diff --git a/src/gateway/dlt_gateway.c b/src/gateway/dlt_gateway.c
index edae0c7..99eabd8 100644
--- a/src/gateway/dlt_gateway.c
+++ b/src/gateway/dlt_gateway.c
@@ -442,11 +442,12 @@ int dlt_gateway_store_connection(DltGateway *gateway,
/**
* Read configuration file and initialize connection data structures
*
- * @param g DltGateway
- * @param verbose verbose flag
+ * @param gateway DltGateway
+ * @param config_file Gateway configuration
+ * @param verbose verbose flag
* @return 0 on success, -1 otherwise
*/
-int dlt_gateway_configure(DltGateway *gateway, int verbose)
+int dlt_gateway_configure(DltGateway *gateway, char *config_file, int verbose)
{
int ret = 0;
int i = 0;
@@ -454,13 +455,13 @@ int dlt_gateway_configure(DltGateway *gateway, int verbose)
PRINT_FUNCTION_VERBOSE(verbose);
- if (gateway == NULL)
+ if (gateway == NULL || config_file == 0 || config_file[0] == '\0')
{
return -1;
}
/* read configuration file */
- file = dlt_config_file_init(DLT_GATEWAY_CONFIG_PATH);
+ file = dlt_config_file_init(config_file);
/* get number of entries and allocate memory to store information */
ret = dlt_config_file_get_num_sections(file, &gateway->num_connections);
@@ -584,7 +585,9 @@ int dlt_gateway_init(DltDaemonLocal *daemon_local, int verbose)
/* Get default value from daemon_local */
gateway->send_serial = daemon_local->flags.lflag;
- if (dlt_gateway_configure(gateway, verbose) != 0)
+ if (dlt_gateway_configure(gateway,
+ daemon_local->flags.gatewayConfigFile,
+ verbose) != 0)
{
dlt_log(LOG_ERR, "Gateway initialization failed\n");
return -1;