summaryrefslogtreecommitdiff
path: root/src/gateway/dlt_gateway.h
diff options
context:
space:
mode:
authorChristoph Lipka <clipka@jp.adit-jv.com>2015-10-16 16:55:27 +0900
committerLutz Helwing <lutz_helwing@mentor.com>2015-12-07 10:07:26 +0100
commit5acb7dd008a57f6da3bf7b9cf85cfc2c86cac151 (patch)
treeb6ddea5671215bc52b43d69a4b37b8481aa10d23 /src/gateway/dlt_gateway.h
parent280afb856b74e6089cdd2aa1af7f50c628583475 (diff)
downloadDLT-daemon-5acb7dd008a57f6da3bf7b9cf85cfc2c86cac151.tar.gz
Dlt MultiNode
MultiNode allows to connect DLT Daemons running on different operating systems, e.g. in a virtualized environment. The central component is the Gateway DLT Daemon which connects external DLT Clients, like the DLT Viewer running on a host computer, with Passive DLT Daemons running on nodes without a physical connection to external DLT clients. The Gateway DLT Daemon itself acts as a DLT client when connecting to a Passive DLT Daemon. To use the Gateway functionality, it has to be enabled in dlt.conf: GatewayMode = 1 All communication between passive nodes and DLT Viewer has to be send via the Gateway node. The Gateway node forwards log messages coming from passive nodes to all connected DLT clients. It also forwards command and control requests coming from DLT clients to the corresponding passive node. The Gateway DLT Daemon read a configuration file (dlt_gateway.conf) at startup with information about Passive DLT Daemon connections. Afterwards, the Daemon will try to connect to the passive DLT Daemons. If the connection cannot be established after the configured timeout, the Gateway DLT Daemon will give up connecting. The configuration file has to contain the following information about a passive node: [PassiveNode1] IPaddress = 192.168.2.35 Port = 3490 EcuID = ECU2 Connect = OnStartup ; timeout in seconds Timeout = 10 Precondition is, that the passive node is configured with the correct ECU id, ECU2 in this case. If the passive node sends messages with another than configured ECU id, the Gateway DLT Daemon will shut down the connection. It is also possible to connect to a passive DLT daemon using the dlt-passive-node-ctrl application. In this case "Connect=OnDemand" has to be configured in the configuration file. To connect to PassiveNode1, "dlt-passive-node-ctrl -n ECU2 -c 1" has to be executed. With "dlt-passive-node-ctrl -s" the status of passive node connections can be retrieved. Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
Diffstat (limited to 'src/gateway/dlt_gateway.h')
-rw-r--r--src/gateway/dlt_gateway.h169
1 files changed, 169 insertions, 0 deletions
diff --git a/src/gateway/dlt_gateway.h b/src/gateway/dlt_gateway.h
new file mode 100644
index 0000000..eacdf0b
--- /dev/null
+++ b/src/gateway/dlt_gateway.h
@@ -0,0 +1,169 @@
+/*
+ * @licence app begin@
+ * SPDX license identifier: MPL-2.0
+ *
+ * Copyright (C) 2015 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
+ * Christoph Lipka <clipka@jp.adit-jv.com>
+ *
+ * \copyright Copyright © 2015 Advanced Driver Information Technology. \n
+ * License MPL-2.0: Mozilla Public License version 2.0 http://mozilla.org/MPL/2.0/.
+ *
+ * \file dlt_gateway.h
+ */
+
+/*******************************************************************************
+** **
+** SRC-MODULE: dlt_gateway.h **
+** **
+** TARGET : linux **
+** **
+** PROJECT : DLT **
+** **
+** AUTHOR : Christoph Lipka clipka@jp.adit-jv.com **
+** PURPOSE : **
+** **
+** REMARKS : **
+** **
+** PLATFORM DEPENDANT [yes/no]: yes **
+** **
+** TO BE CHANGED BY USER [yes/no]: no **
+** **
+*******************************************************************************/
+
+/*******************************************************************************
+** Author Identity **
+********************************************************************************
+** **
+** Initials Name Company **
+** -------- ------------------------- ---------------------------------- **
+** cl Christoph Lipka ADIT **
+*******************************************************************************/
+
+#ifndef DLT_GATEWAY_H_
+#define DLT_GATEWAY_H_
+
+#include "dlt-daemon.h"
+#include "dlt_gateway_types.h"
+
+/**
+ * Initialize the gateway to passive nodes
+ *
+ * TODO: Make path to configuration file configurable
+ *
+ * @param daemon_local pointer to DltDaemonLocal
+ * @param verbose verbose flag
+ * @return 0 on success, -1 on error
+ */
+int dlt_gateway_init(DltDaemonLocal *daemon_local, int verbose);
+
+/**
+ * De-initialize the gateway. All internal data will be freed.
+ *
+ * @param g DltGateway pointer
+ * @param verbose verbose flag
+ */
+void dlt_gateway_deinit(DltGateway *g, int verbose);
+
+/**
+ * Establish all connections to passive nodes that are configured to be started
+ * on daemon startup and add this connections to the main event loop.
+ *
+ * TODO: This function is called during gateway initialization and in main loop
+ * whenever the epoll returns. This may need to be improved.
+ *
+ * @param g DltGateway
+ * @param daemon_local DltDaemonLocal
+ * @param verbose verbose flag
+ * @return 0 on success, -1 on error
+ */
+int dlt_gateway_establish_connections(DltGateway *g,
+ DltDaemonLocal *daemon_local,
+ int verbose);
+
+/**
+ * Return the receiver for a given file descriptor
+ *
+ * @param g DltGateway
+ * @param fd file descriptor
+ * @return Pointer to DltReceiver on success, NULL otherwise
+ */
+DltReceiver *dlt_gateway_get_connection_receiver(DltGateway *g, int fd);
+
+
+/**
+ * Process incoming messages from passive nodes
+ *
+ * @param daemon DltDaemon
+ * @param daemon_local DltDaemonLocal
+ * @param recv DltReceiver structure
+ * @param verbose verbose flag
+ * @return 0 on success, -1 otherwise
+ */
+int dlt_gateway_process_passive_node_messages(DltDaemon *daemon,
+ DltDaemonLocal *daemon_local,
+ DltReceiver *recv,
+ int verbose);
+
+/**
+ * Process gateway timer
+ *
+ * @param daemon DltDaemon
+ * @param daemon_loocal DltDaemonLocal
+ * @param verbose verbose flag
+ * @return 0 on success, -1 otherwise
+ */
+int dlt_gateway_process_gateway_timer(DltDaemon *daemon,
+ DltDaemonLocal *daemon_local,
+ DltReceiver *rec,
+ int verbose);
+
+/**
+ * Forward control messages to the specified passive node DLT Daemon.
+ *
+ * @param g DltGateway
+ * @param daemon_local DltDaemonLocal
+ * @param msg DltMessage
+ * @param ecu Identifier of the passive node
+ * @param verbose verbose flag
+ * @return 0 on success, -1 otherwise
+ */
+int dlt_gateway_forward_control_message(DltGateway *g,
+ DltDaemonLocal *daemon_local,
+ DltMessage *msg,
+ char *ecu,
+ int verbose);
+
+/**
+ * Process on demand connect/disconnect of passive nodes
+ *
+ * @param g DltGateway
+ * @param node_id Passive Node identifier
+ * @param connection_status Connection status
+ * @return 0 on success, -1 otherwise
+ */
+int dlt_gateway_process_on_demand_request(DltGateway *g,
+ DltDaemonLocal *daemon_local,
+ char *node_id,
+ int connection_status,
+ int verbose);
+
+/* _ONLY_ for development purposes */
+void print_gateway_connection_details(const DltGateway *g);
+
+#endif