summaryrefslogtreecommitdiff
path: root/src/gateway/dlt_gateway_types.h
blob: 7c3d45e4397610ec9ed6c2a6315a1f818b66a992 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
 * @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_types.h
 */

/*******************************************************************************
**                                                                            **
**  SRC-MODULE: dlt_gateway_types.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_TYPES_H_
#define DLT_GATEWAY_TYPES_H_

#include "dlt_client.h"

#define DLT_GATEWAY_CONFIG_PATH CONFIGURATION_FILES_DIR "/dlt_gateway.conf"
#define DLT_GATEWAY_TIMER_INTERVAL 1

#define DLT_GATEWAY_RECONNECT_MAX 1 /* reconnect once after connection loss */

/* maximum number of control messages that can be send after connection is
 * established */
#define DLT_GATEWAY_MAX_STARTUP_CTRL_MSG 10

typedef enum
{
    DLT_GATEWAY_UNINITIALIZED,
    DLT_GATEWAY_INITIALIZED,
    DLT_GATEWAY_CONNECTED,
    DLT_GATEWAY_DISCONNECTED
} connection_status;

typedef enum
{
    DLT_GATEWAY_UNDEFINED = -1,
    DLT_GATEWAY_ON_STARTUP,    /* connect directly on startup */
    DLT_GATEWAY_ON_DEMAND,     /* connect on demand only */
    DLT_GATEWAY_DISABLED       /* disable this connection due to problems */
} connection_trigger;

/* DLT Gateway connection structure */
typedef struct {
    int handle;                 /* connection handle */
    connection_status status;   /* connected/disconnected */
    char *ecuid;                /* name of passive node */
    char *ip_address;           /* IP address */
    int sock_domain;            /* socket domain */
    int sock_type;              /* socket type */
    int sock_protocol;          /* socket protocol */
    int port;                   /* port */
    connection_trigger trigger; /* connection trigger */
    int timeout;                /* connection timeout */
    int timeout_cnt;            /* connection timeout counter */
    int reconnect_cnt;          /* reconnection counter */
    int control_msgs[DLT_GATEWAY_MAX_STARTUP_CTRL_MSG]; /* msg IDs send on startup */
    int send_serial;            /* Send serial header with control messages */
    DltClient client;           /* DltClient structure */
} DltGatewayConnection;

/* DltGateway structure */
typedef struct
{
    int send_serial;     /* Default: Send serial header with control messages */
    DltGatewayConnection *connections; /* pointer to connections */
    int num_connections; /* number of connections */
} DltGateway;

#endif /* DLT_GATEWAY_TYPES_H_ */