summaryrefslogtreecommitdiff
path: root/src/gateway
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/gateway
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/gateway')
-rw-r--r--src/gateway/dlt_gateway.c25
-rw-r--r--src/gateway/dlt_gateway.h1
-rw-r--r--src/gateway/dlt_gateway_internal.h99
-rw-r--r--src/gateway/dlt_gateway_types.h18
4 files changed, 122 insertions, 21 deletions
diff --git a/src/gateway/dlt_gateway.c b/src/gateway/dlt_gateway.c
index 7edf6b7..7597b70 100644
--- a/src/gateway/dlt_gateway.c
+++ b/src/gateway/dlt_gateway.c
@@ -39,6 +39,7 @@
#include <limits.h>
#include <errno.h>
#include "dlt_gateway.h"
+#include "dlt_gateway_internal.h"
#include "dlt_config_file_parser.h"
#include "dlt_common.h"
#include "dlt-daemon_cfg.h"
@@ -48,23 +49,6 @@
#include "dlt_daemon_client.h"
#include "dlt_daemon_offline_logstorage.h"
-typedef struct {
- char *key; /* The configuration key*/
- int (*func)(DltGatewayConnection *con, char *value); /* Conf handler */
- int is_opt; /* If the configuration is optional or not */
-} DltGatewayConf;
-typedef enum {
- GW_CONF_IP_ADDRESS = 0,
- GW_CONF_PORT,
- GW_CONF_ECUID,
- GW_CONF_CONNECT,
- GW_CONF_TIMEOUT,
- GW_CONF_SEND_CONTROL,
- GW_CONF_SEND_PERIODIC_CONTROL,
- GW_CONF_SEND_SERIAL_HEADER,
- GW_CONF_COUNT
-} DltGatewayConfType;
-
/**
* Check if given string is a valid IP address
*
@@ -631,9 +615,7 @@ int dlt_gateway_store_connection(DltGateway *gateway,
dlt_log(LOG_CRIT, "dlt_client_init_port() failed for gateway connection\n");
return DLT_RETURN_ERROR;
}
- dlt_receiver_init(&gateway->connections[i].client.receiver,
- gateway->connections[i].client.sock,
- DLT_DAEMON_RCVBUFSIZESOCK);
+
/* setup DltClient Structure */
if(dlt_client_set_server_ip(&gateway->connections[i].client,
gateway->connections[i].ip_address) == -1)
@@ -1280,7 +1262,7 @@ DltReturnValue dlt_gateway_process_passive_node_messages(DltDaemon *daemon,
int i = 0;
DltGateway *gateway = NULL;
DltGatewayConnection *con = NULL;
- DltMessage msg;
+ DltMessage msg = {0};
if ((daemon == NULL) || (daemon_local == NULL) || (receiver == NULL))
{
@@ -1694,6 +1676,7 @@ int dlt_gateway_process_on_demand_request(DltGateway *gateway,
{
con->status = DLT_GATEWAY_DISCONNECTED;
+ con->trigger = DLT_GATEWAY_ON_DEMAND;
if (dlt_event_handler_unregister_connection(&daemon_local->pEvent,
daemon_local,
con->client.sock) != 0)
diff --git a/src/gateway/dlt_gateway.h b/src/gateway/dlt_gateway.h
index c3c7324..7108253 100644
--- a/src/gateway/dlt_gateway.h
+++ b/src/gateway/dlt_gateway.h
@@ -190,4 +190,5 @@ DltGatewayConnection *dlt_gateway_get_connection(DltGateway *g,
/* _ONLY_ for development purposes */
void print_gateway_connection_details(const DltGateway *g);
+
#endif
diff --git a/src/gateway/dlt_gateway_internal.h b/src/gateway/dlt_gateway_internal.h
new file mode 100644
index 0000000..3b665e1
--- /dev/null
+++ b/src/gateway/dlt_gateway_internal.h
@@ -0,0 +1,99 @@
+/*
+ * @licence app begin@
+ * SPDX license identifier: MPL-2.0
+ *
+ * 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.
+ *
+ * This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
+ *
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License (MPL), 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/.
+ *
+ * For further information see http://www.genivi.org/.
+ * @licence end@
+ */
+
+/*!
+ * \author
+ * Aditya Paluri <venkataaditya.paluri@in.bosch.com>
+ *
+ * \copyright Copyright © 2017 Advanced Driver Information Technology. \n
+ * License MPL-2.0: Mozilla Public License version 2.0 http://mozilla.org/MPL/2.0/.
+ *
+ * \file dlt_gateway_internal.h
+ */
+
+/*******************************************************************************
+** **
+** SRC-MODULE: dlt_gateway_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_GATEWAY_INTERNAL_H_
+#define DLT_GATEWAY_INTERNAL_H_
+
+DLT_STATIC int dlt_gateway_check_ip(DltGatewayConnection *con, char *value);
+
+DLT_STATIC int dlt_gateway_check_port(DltGatewayConnection *con, char *value);
+
+DLT_STATIC int dlt_gateway_check_ecu(DltGatewayConnection *con, char *value);
+
+DLT_STATIC int dlt_gateway_check_connect_trigger(DltGatewayConnection *con,
+ char *value);
+
+DLT_STATIC int dlt_gateway_check_timeout(DltGatewayConnection *con, char *value);
+
+DLT_STATIC int dlt_gateway_check_send_serial(DltGatewayConnection *con, char *value);
+
+DLT_STATIC int dlt_gateway_allocate_control_messages(DltGatewayConnection *con);
+
+DLT_STATIC int dlt_gateway_check_control_messages(DltGatewayConnection *con,
+ char *value);
+
+DLT_STATIC int dlt_gateway_check_periodic_control_messages(DltGatewayConnection *con,
+ char *value);
+
+DLT_STATIC int dlt_gateway_check_param(DltGateway *gateway,
+ DltGatewayConnection *con,
+ DltGatewayConfType ctype,
+ char *value);
+
+int dlt_gateway_configure(DltGateway *gateway, char *config_file, int verbose);
+
+int dlt_gateway_store_connection(DltGateway *gateway,
+ DltGatewayConnection *tmp,
+ int verbose);
+
+DLT_STATIC int dlt_gateway_parse_get_log_info(DltDaemon *daemon,
+ char *ecu,
+ DltMessage *msg,
+ int req,
+ int verbose);
+
+#endif
diff --git a/src/gateway/dlt_gateway_types.h b/src/gateway/dlt_gateway_types.h
index 4d0de0d..20d21f9 100644
--- a/src/gateway/dlt_gateway_types.h
+++ b/src/gateway/dlt_gateway_types.h
@@ -143,4 +143,22 @@ typedef struct
int num_connections; /* number of connections */
} DltGateway;
+typedef struct {
+ char *key; /* The configuration key*/
+ int (*func)(DltGatewayConnection *con, char *value); /* Conf handler */
+ int is_opt; /* If the configuration is optional or not */
+} DltGatewayConf;
+
+typedef enum {
+ GW_CONF_IP_ADDRESS = 0,
+ GW_CONF_PORT,
+ GW_CONF_ECUID,
+ GW_CONF_CONNECT,
+ GW_CONF_TIMEOUT,
+ GW_CONF_SEND_CONTROL,
+ GW_CONF_SEND_PERIODIC_CONTROL,
+ GW_CONF_SEND_SERIAL_HEADER,
+ GW_CONF_COUNT
+} DltGatewayConfType;
+
#endif /* DLT_GATEWAY_TYPES_H_ */