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
87 #include <dlt_offline_trace.h>
\r
90 * The flags of a dlt daemon.
\r
94 int aflag; /**< (Boolean) Print DLT messages; payload as ASCII */
\r
95 int sflag; /**< (Boolean) Print DLT messages; payload as hex */
\r
96 int xflag; /**< (Boolean) Print DLT messages; only headers */
\r
97 int vflag; /**< (Boolean) Verbose mode */
\r
98 int dflag; /**< (Boolean) Daemonize */
\r
99 int lflag; /**< (Boolean) Send DLT messages with serial header */
\r
100 int rflag; /**< (Boolean) Send automatic get log info response during context registration */
\r
101 int mflag; /**< (Boolean) Sync to serial header on serial connection */
\r
102 int nflag; /**< (Boolean) Sync to serial header on all TCP connections */
\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 ivalue[256]; /**< (String: Directory) Directory where to store the persistant configuration (Default: /tmp) */
\r
107 char cvalue[256]; /**< (String: Directory) Filename of DLT configuration file (Default: /etc/dlt.conf) */
\r
108 int sharedMemorySize; /**< (int) Size of shared memory (Default: 100000) */
\r
109 int sendMessageTime; /**< (Boolean) Send periodic Message Time if client is connected (Default: 0) */
\r
110 char offlineTraceDirectory[256]; /**< (String: Directory) Store DLT messages to local directory (Default: /etc/dlt.conf) */
\r
111 int offlineTraceFileSize; /**< (int) Maximum size in bytes of one trace file (Default: 1000000) */
\r
112 int offlineTraceMaxSize; /**< (int) Maximum size of all trace files (Default: 4000000) */
\r
113 int loggingMode; /**< (int) The logging console for internal logging of dlt-daemon (Default: 0) */
\r
114 int loggingLevel; /**< (int) The logging level for internal logging of dlt-daemon (Default: 6) */
\r
115 char loggingFilename[256]; /**< (String: Filename) The logging filename if internal logging mode is log to file (Default: /tmp/log) */
\r
119 * The global parameters of a dlt daemon.
\r
123 DltDaemonFlags flags; /**< flags of the daemon */
\r
124 int fp; /**< handle for own fifo */
\r
125 int sock; /**< handle for tcp connection to client */
\r
126 int fdserial; /**< handle for serial connection */
\r
127 int fdmax; /**< highest number of used handles */
\r
128 fd_set master; /**< master set of handles */
\r
129 fd_set read_fds; /**< read set of handles */
\r
130 DltFile file; /**< struct for file access */
\r
131 //int ohandle; /**< handle to output file */
\r
132 DltMessage msg; /**< one dlt message */
\r
133 DltReceiver receiver; /**< receiver for fifo connection */
\r
134 DltReceiver receiverSock; /**< receiver for socket connection */
\r
135 DltReceiver receiverSerial; /**< receiver for serial connection */
\r
136 int client_connections; /**< counter for nr. of client connections */
\r
137 size_t baudrate; /**< Baudrate of serial connection */
\r
138 #ifdef DLT_SHM_ENABLE
\r
139 DltShm dlt_shm; /**< Shared memory handling */
\r
141 DltOfflineTrace offlineTrace; /**< Offline trace handling */
\r
147 unsigned long long wakeups_missed;
\r
148 } DltDaemonPeriodicData;
\r
153 DltDaemonLocal *daemon_local;
\r
154 } DltDaemonTimingPacketThreadData;
\r
156 /* Function prototypes */
\r
157 void dlt_daemon_local_cleanup(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
158 int dlt_daemon_local_init_p1(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
159 int dlt_daemon_local_init_p2(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
160 int dlt_daemon_local_connection_init(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
162 void dlt_daemon_daemonize(int verbose);
\r
163 void dlt_daemon_signal_handler(int sig);
\r
165 int dlt_daemon_process_client_connect(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
166 int dlt_daemon_process_client_messages(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
167 int dlt_daemon_process_client_messages_serial(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
168 int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
170 int dlt_daemon_process_user_message_overflow(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
171 int dlt_daemon_process_user_message_register_application(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
172 int dlt_daemon_process_user_message_unregister_application(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
173 int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
174 int dlt_daemon_process_user_message_unregister_context(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
175 int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
176 #ifdef DLT_SHM_ENABLE
\r
177 int dlt_daemon_process_user_message_log_shm(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
179 int dlt_daemon_process_user_message_set_app_ll_ts(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
180 int dlt_daemon_process_user_message_log_mode(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
182 int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
183 void dlt_daemon_timingpacket_thread(void *ptr);
\r
184 int dlt_daemon_make_periodic (unsigned int period, DltDaemonPeriodicData *info, int verbose);
\r
185 void dlt_daemon_wait_period(DltDaemonPeriodicData *info, int verbose);
\r
187 #endif /* DLT_DAEMON_H */
\r