2 * @licence app begin@
\r
3 * Copyright (C) 2012 BMW AG
\r
5 * This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps.
\r
7 * Contributions are licensed to the GENIVI Alliance under one or more
\r
8 * Contribution License Agreements.
\r
11 * This Source Code Form is subject to the terms of the
\r
12 * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
\r
13 * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
\r
16 * \author Alexander Wenzel <alexander.wenzel@bmw.de> BMW 2011-2012
\r
18 * \file dlt-daemon.h
\r
19 * For further information see http://www.genivi.org/.
\r
24 /*******************************************************************************
\r
26 ** SRC-MODULE: dlt-daemon.h **
\r
28 ** TARGET : linux **
\r
32 ** AUTHOR : Alexander Wenzel Alexander.AW.Wenzel@bmw.de **
\r
39 ** PLATFORM DEPENDANT [yes/no]: yes **
\r
41 ** TO BE CHANGED BY USER [yes/no]: no **
\r
43 *******************************************************************************/
\r
45 /*******************************************************************************
\r
46 ** Author Identity **
\r
47 ********************************************************************************
\r
49 ** Initials Name Company **
\r
50 ** -------- ------------------------- ---------------------------------- **
\r
51 ** aw Alexander Wenzel BMW **
\r
52 ** mk Markus Klein Fraunhofer ESK **
\r
53 *******************************************************************************/
\r
55 /*******************************************************************************
\r
56 ** Author Identity **
\r
57 ********************************************************************************
\r
59 ** Initials Name Company **
\r
60 ** -------- ------------------------- ---------------------------------- **
\r
61 ** aw Alexander Wenzel BMW **
\r
62 ** mk Markus Klein Fraunhofer ESK **
\r
63 *******************************************************************************/
\r
65 #ifndef DLT_DAEMON_H
\r
66 #define DLT_DAEMON_H
\r
68 #include "dlt_daemon_common.h"
\r
69 #include "dlt_user_shared.h"
\r
70 #include "dlt_user_shared_cfg.h"
\r
72 #include <dlt_offline_trace.h>
\r
75 * The flags of a dlt daemon.
\r
79 int aflag; /**< (Boolean) Print DLT messages; payload as ASCII */
\r
80 int sflag; /**< (Boolean) Print DLT messages; payload as hex */
\r
81 int xflag; /**< (Boolean) Print DLT messages; only headers */
\r
82 int vflag; /**< (Boolean) Verbose mode */
\r
83 int dflag; /**< (Boolean) Daemonize */
\r
84 int lflag; /**< (Boolean) Send DLT messages with serial header */
\r
85 int rflag; /**< (Boolean) Send automatic get log info response during context registration */
\r
86 int mflag; /**< (Boolean) Sync to serial header on serial connection */
\r
87 int nflag; /**< (Boolean) Sync to serial header on all TCP connections */
\r
88 char evalue[256]; /**< (String: ECU ID) Set ECU ID (Default: ECU1) */
\r
89 char bvalue[256]; /**< (String: Baudrate) Serial device baudrate (Default: 115200) */
\r
90 char yvalue[256]; /**< (String: Devicename) Additional support for serial device */
\r
91 char ivalue[256]; /**< (String: Directory) Directory where to store the persistant configuration (Default: /tmp) */
\r
92 char cvalue[256]; /**< (String: Directory) Filename of DLT configuration file (Default: /etc/dlt.conf) */
\r
93 int sharedMemorySize; /**< (int) Size of shared memory (Default: 100000) */
\r
94 int sendMessageTime; /**< (Boolean) Send periodic Message Time if client is connected (Default: 0) */
\r
95 char offlineTraceDirectory[256]; /**< (String: Directory) Store DLT messages to local directory (Default: /etc/dlt.conf) */
\r
96 int offlineTraceFileSize; /**< (int) Maximum size in bytes of one trace file (Default: 1000000) */
\r
97 int offlineTraceMaxSize; /**< (int) Maximum size of all trace files (Default: 4000000) */
\r
98 int loggingMode; /**< (int) The logging console for internal logging of dlt-daemon (Default: 0) */
\r
99 int loggingLevel; /**< (int) The logging level for internal logging of dlt-daemon (Default: 6) */
\r
100 char loggingFilename[256]; /**< (String: Filename) The logging filename if internal logging mode is log to file (Default: /tmp/log) */
\r
104 * The global parameters of a dlt daemon.
\r
108 DltDaemonFlags flags; /**< flags of the daemon */
\r
109 int fp; /**< handle for own fifo */
\r
110 int sock; /**< handle for tcp connection to client */
\r
111 int fdserial; /**< handle for serial connection */
\r
112 int fdmax; /**< highest number of used handles */
\r
113 fd_set master; /**< master set of handles */
\r
114 fd_set read_fds; /**< read set of handles */
\r
115 DltFile file; /**< struct for file access */
\r
116 //int ohandle; /**< handle to output file */
\r
117 DltMessage msg; /**< one dlt message */
\r
118 DltReceiver receiver; /**< receiver for fifo connection */
\r
119 DltReceiver receiverSock; /**< receiver for socket connection */
\r
120 DltReceiver receiverSerial; /**< receiver for serial connection */
\r
121 int client_connections; /**< counter for nr. of client connections */
\r
122 size_t baudrate; /**< Baudrate of serial connection */
\r
123 #ifdef DLT_SHM_ENABLE
\r
124 DltShm dlt_shm; /**< Shared memory handling */
\r
126 DltOfflineTrace offlineTrace; /**< Offline trace handling */
\r
132 unsigned long long wakeups_missed;
\r
133 } DltDaemonPeriodicData;
\r
138 DltDaemonLocal *daemon_local;
\r
139 } DltDaemonTimingPacketThreadData;
\r
141 /* Function prototypes */
\r
142 void dlt_daemon_local_cleanup(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
143 int dlt_daemon_local_init_p1(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
144 int dlt_daemon_local_init_p2(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
145 int dlt_daemon_local_connection_init(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
147 void dlt_daemon_daemonize(int verbose);
\r
148 void dlt_daemon_signal_handler(int sig);
\r
150 int dlt_daemon_process_client_connect(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
151 int dlt_daemon_process_client_messages(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
152 int dlt_daemon_process_client_messages_serial(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
153 int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
155 int dlt_daemon_process_user_message_overflow(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
156 int dlt_daemon_process_user_message_register_application(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
157 int dlt_daemon_process_user_message_unregister_application(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
158 int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
159 int dlt_daemon_process_user_message_unregister_context(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
160 int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
161 #ifdef DLT_SHM_ENABLE
\r
162 int dlt_daemon_process_user_message_log_shm(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
164 int dlt_daemon_process_user_message_set_app_ll_ts(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
165 int dlt_daemon_process_user_message_log_mode(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
167 int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
\r
168 void dlt_daemon_timingpacket_thread(void *ptr);
\r
169 int dlt_daemon_make_periodic (unsigned int period, DltDaemonPeriodicData *info, int verbose);
\r
170 void dlt_daemon_wait_period(DltDaemonPeriodicData *info, int verbose);
\r
172 #endif /* DLT_DAEMON_H */
\r