2 * Dlt- Diagnostic Log and Trace daemon
\r
5 * Copyright (C) 2011, BMW AG - Alexander Wenzel <alexander.wenzel@bmw.de>
7 * This program is free software; you can redistribute it and/or modify it under the terms of the
8 * GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
11 * Public License, version 2.1, for more details.
13 * You should have received a copy of the GNU Lesser General Public License, version 2.1, along
14 * with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
16 * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may
17 * also be applicable to programs even in cases in which the program is not a library in the technical sense.
19 * Linking DLT statically or dynamically with other modules is making a combined work based on DLT. You may
20 * license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to
21 * license your linked modules under the GNU Lesser General Public License, version 2.1, you
22 * may use the program under the following exception.
24 * As a special exception, the copyright holders of DLT give you permission to combine DLT
25 * with software programs or libraries that are released under any license unless such a combination is not
26 * permitted by the license of such a software program or library. You may copy and distribute such a
27 * system following the terms of the GNU Lesser General Public License, version 2.1, including this
28 * special exception, for DLT and the licenses of the other code concerned.
30 * Note that people who make modified versions of DLT are not obligated to grant this special exception
31 * for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License,
32 * version 2.1, gives permission to release a modified version without this exception; this exception
33 * also makes it possible to release a modified version which carries forward this exception.
39 /*******************************************************************************
\r
41 ** SRC-MODULE: dlt-daemon.h **
\r
43 ** TARGET : linux **
\r
47 ** AUTHOR : Alexander Wenzel Alexander.AW.Wenzel@bmw.de **
\r
54 ** PLATFORM DEPENDANT [yes/no]: yes **
\r
56 ** TO BE CHANGED BY USER [yes/no]: no **
\r
58 *******************************************************************************/
\r
60 /*******************************************************************************
\r
61 ** Author Identity **
\r
62 ********************************************************************************
\r
64 ** Initials Name Company **
\r
65 ** -------- ------------------------- ---------------------------------- **
\r
66 ** aw Alexander Wenzel BMW **
\r
67 ** mk Markus Klein Fraunhofer ESK **
\r
68 *******************************************************************************/
\r
70 /*******************************************************************************
\r
71 ** Author Identity **
\r
72 ********************************************************************************
\r
74 ** Initials Name Company **
\r
75 ** -------- ------------------------- ---------------------------------- **
\r
76 ** aw Alexander Wenzel BMW **
\r
77 ** mk Markus Klein Fraunhofer ESK **
\r
78 *******************************************************************************/
\r
80 #ifndef DLT_DAEMON_H
\r
81 #define DLT_DAEMON_H
\r
83 #include "dlt_daemon_common.h"
\r
84 #include "dlt_user_shared.h"
\r
85 #include "dlt_user_shared_cfg.h"
\r
88 * The flags of a dlt daemon.
\r
92 int aflag; /**< (Boolean) Print DLT messages; payload as ASCII */
\r
93 int sflag; /**< (Boolean) Print DLT messages; payload as hex */
\r
94 int xflag; /**< (Boolean) Print DLT messages; only headers */
\r
95 int vflag; /**< (Boolean) Verbose mode */
\r
96 int dflag; /**< (Boolean) Daemonize */
\r
97 int lflag; /**< (Boolean) Send DLT messages with serial header */
\r
98 int rflag; /**< (Boolean) Send automatic get log info response during context registration */
\r
99 int mflag; /**< (Boolean) Sync to serial header on serial connection */
\r
100 int nflag; /**< (Boolean) Sync to serial header on all TCP connections */
\r
101 char ovalue[256]; /**< (String: Filename) Store DLT messages to local log file */
\r
102 char fvalue[256]; /**< (String: Filename) Enable filtering of messages */
\r
103 char evalue[256]; /**< (String: ECU ID) Set ECU ID (Default: ECU1) */
\r
104 char bvalue[256]; /**< (String: Baudrate) Serial device baudrate (Default: 115200) */
\r
105 char yvalue[256]; /**< (String: Devicename) Additional support for serial device */
\r
106 char uvalue[256]; /**< (String: Ringbuffer) Size of the ringbuffer in bytes (Default: 10024) */
\r
107 char ivalue[256]; /**< (String: Directory) Directory where to store the persistant configuration (Default: /tmp) */
\r
108 char cvalue[256]; /**< (String: Directory) Filename of DLT configuration file (Default: /etc/dlt.conf) */
\r
112 * The global parameters of a dlt daemon.
\r
116 DltDaemonFlags flags; /**< flags of the daemon */
\r
117 int fp; /**< handle for own fifo */
\r
118 int sock; /**< handle for tcp connection to client */
\r
119 int fdserial; /**< handle for serial connection */
\r
120 int fdmax; /**< highest number of used handles */
\r
121 fd_set master; /**< master set of handles */
\r
122 fd_set read_fds; /**< read set of handles */
\r
123 DltFile file; /**< struct for file access */
\r
124 DltFilter filter; /**< struct for filter access */
\r
125 int ohandle; /**< handle to output file */
\r
126 DltMessage msg; /**< one dlt message */
\r
127 DltReceiver receiver; /**< receiver for fifo connection */
\r
128 DltReceiver receiverSock; /**< receiver for socket connection */
\r
129 DltReceiver receiverSerial; /**< receiver for serial connection */
\r
130 int client_connections; /**< counter for nr. of client connections */
\r
131 size_t baudrate; /**< Baudrate of serial connection */
\r
132 size_t ringbufferSize; /**< Size of the ringbuffer */
\r
139 unsigned long long wakeups_missed;
\r
140 } DltDaemonPeriodicData;
\r
145 DltDaemonLocal *daemon_local;
\r
146 } DltDaemonTimingPacketThreadData;
\r
148 /* Function prototypes */
\r
149 void dlt_daemon_local_cleanup(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
150 int dlt_daemon_local_init_p1(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
151 int dlt_daemon_local_init_p2(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
152 int dlt_daemon_local_connection_init(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
154 void dlt_daemon_daemonize(int verbose);
\r
155 void dlt_daemon_signal_handler(int sig);
\r
157 int dlt_daemon_process_client_connect(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
158 int dlt_daemon_process_client_messages(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
159 int dlt_daemon_process_client_messages_serial(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
160 int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
162 int dlt_daemon_process_user_message_overflow(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
163 int dlt_daemon_process_user_message_register_application(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
164 int dlt_daemon_process_user_message_unregister_application(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
165 int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
166 int dlt_daemon_process_user_message_unregister_context(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
167 int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
168 int dlt_daemon_process_user_message_set_app_ll_ts(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
169 int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
171 void dlt_daemon_timingpacket_thread(void *ptr);
\r
172 int dlt_daemon_make_periodic (unsigned int period, DltDaemonPeriodicData *info, int verbose);
\r
173 void dlt_daemon_wait_period(DltDaemonPeriodicData *info, int verbose);
\r
175 #endif /* DLT_DAEMON_H */
\r