Bug 44 - Don't print "Buffer full" message from DLT daemon for each trace.
[profile/ivi/dlt-daemon.git] / src / daemon / dlt-daemon.h
index 04eef6e..f2b1dd9 100755 (executable)
@@ -1,37 +1,22 @@
-/*\r
- * Dlt- Diagnostic Log and Trace daemon\r
- * @licence app begin@
- *
- * Copyright (C) 2011, BMW AG - Alexander Wenzel <alexander.wenzel@bmw.de>
- * 
- * This program is free software; you can redistribute it and/or modify it under the terms of the 
- * GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 
- * Public License, version 2.1, for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along 
- * with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * 
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may 
- * also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * 
- * Linking DLT statically or dynamically with other modules is making a combined work based on DLT. You may 
- * license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to 
- * license your linked modules under the GNU Lesser General Public License, version 2.1, you 
- * may use the program under the following exception.
- * 
- * As a special exception, the copyright holders of DLT give you permission to combine DLT 
- * with software programs or libraries that are released under any license unless such a combination is not
- * permitted by the license of such a software program or library. You may copy and distribute such a 
- * system following the terms of the GNU Lesser General Public License, version 2.1, including this
- * special exception, for DLT and the licenses of the other code concerned.
- * 
- * Note that people who make modified versions of DLT are not obligated to grant this special exception 
- * for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, 
- * version 2.1, gives permission to release a modified version without this exception; this exception 
- * also makes it possible to release a modified version which carries forward this exception.
- *
+/**\r
+ * @licence app begin@\r
+ * Copyright (C) 2012  BMW AG\r
+ *\r
+ * This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps.\r
+ *\r
+ * Contributions are licensed to the GENIVI Alliance under one or more\r
+ * Contribution License Agreements.\r
+ *\r
+ * \copyright\r
+ * This Source Code Form is subject to the terms of the\r
+ * Mozilla Public License, v. 2.0. If a  copy of the MPL was not distributed with\r
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.\r
+ *\r
+ *\r
+ * \author Alexander Wenzel <alexander.aw.wenzel@bmw.de> BMW 2011-2012\r
+ *\r
+ * \file dlt-daemon.h\r
+ * For further information see http://www.genivi.org/.\r
  * @licence end@\r
  */\r
 \r
 #ifndef DLT_DAEMON_H\r
 #define DLT_DAEMON_H\r
 \r
+#include <limits.h> /* for NAME_MAX */\r
+\r
 #include "dlt_daemon_common.h"\r
 #include "dlt_user_shared.h"\r
 #include "dlt_user_shared_cfg.h"\r
 \r
+\r
+#include <dlt_offline_trace.h>\r
+#include <sys/time.h>\r
+\r
+\r
 /**\r
  * The flags of a dlt daemon.\r
  */\r
@@ -98,13 +90,21 @@ typedef struct
     int rflag;      /**< (Boolean) Send automatic get log info response during context registration */\r
     int mflag;      /**< (Boolean) Sync to serial header on serial connection */\r
     int nflag;      /**< (Boolean) Sync to serial header on all TCP connections */\r
-    char ovalue[256];   /**< (String: Filename) Store DLT messages to local log file */\r
-    char fvalue[256];   /**< (String: Filename) Enable filtering of messages */\r
-    char evalue[256];   /**< (String: ECU ID) Set ECU ID (Default: ECU1) */\r
-    char bvalue[256];   /**< (String: Baudrate) Serial device baudrate (Default: 115200) */\r
-    char yvalue[256];   /**< (String: Devicename) Additional support for serial device */\r
-    char uvalue[256];   /**< (String: Ringbuffer) Size of the ringbuffer in bytes (Default: 10024) */\r
-    char ivalue[256];   /**< (String: Directory) Directory where to store the persistant configuration (Default: /tmp) */\r
+    char evalue[NAME_MAX + 1];   /**< (String: ECU ID) Set ECU ID (Default: ECU1) */\r
+    char bvalue[NAME_MAX + 1];   /**< (String: Baudrate) Serial device baudrate (Default: 115200) */\r
+    char yvalue[NAME_MAX + 1];   /**< (String: Devicename) Additional support for serial device */\r
+    char ivalue[NAME_MAX + 1];   /**< (String: Directory) Directory where to store the persistant configuration (Default: /tmp) */\r
+    char cvalue[NAME_MAX + 1];   /**< (String: Directory) Filename of DLT configuration file (Default: /etc/dlt.conf) */\r
+    int  sharedMemorySize;        /**< (int) Size of shared memory (Default: 100000) */\r
+    int  sendMessageTime;         /**< (Boolean) Send periodic Message Time if client is connected (Default: 0) */\r
+    char offlineTraceDirectory[256]; /**< (String: Directory) Store DLT messages to local directory (Default: /etc/dlt.conf) */\r
+    int  offlineTraceFileSize; /**< (int) Maximum size in bytes of one trace file (Default: 1000000) */\r
+    int  offlineTraceMaxSize;  /**< (int) Maximum size of all trace files (Default: 4000000) */\r
+    int  loggingMode;  /**< (int) The logging console for internal logging of dlt-daemon (Default: 0) */\r
+    int  loggingLevel; /**< (int) The logging level for internal logging of dlt-daemon (Default: 6) */\r
+    char loggingFilename[256]; /**< (String: Filename) The logging filename if internal logging mode is log to file (Default: /tmp/log) */\r
+    int  sendECUSoftwareVersion; /**< (Boolean) Send ECU software version perdiodically */\r
+    char pathToECUSoftwareVersion[256]; /**< (String: Filename) The file from which to read the ECU version from. */\r
 } DltDaemonFlags;\r
 \r
 /**\r
@@ -120,15 +120,20 @@ typedef struct
     fd_set master;            /**< master set of handles */\r
     fd_set read_fds;          /**< read set of handles */\r
     DltFile file;             /**< struct for file access */\r
-    DltFilter filter;         /**< struct for filter access */\r
-    int ohandle;          /**< handle to output file */\r
+    //int ohandle;          /**< handle to output file */\r
     DltMessage msg;           /**< one dlt message */\r
     DltReceiver receiver;     /**< receiver for fifo connection */\r
     DltReceiver receiverSock; /**< receiver for socket connection */\r
     DltReceiver receiverSerial; /**< receiver for serial connection */\r
     int client_connections;    /**< counter for nr. of client connections */\r
     size_t baudrate;          /**< Baudrate of serial connection */\r
-    size_t ringbufferSize;    /**< Size of the ringbuffer */\r
+#ifdef DLT_SHM_ENABLE\r
+    DltShm dlt_shm;                            /**< Shared memory handling */\r
+#endif\r
+    DltOfflineTrace offlineTrace; /**< Offline trace handling */\r
+#if defined(DLT_SYSTEMD_WATCHDOG_ENABLE)\r
+    uint32_t lastOperationTime;\r
+#endif\r
 } DltDaemonLocal;\r
 \r
 typedef struct\r
@@ -143,11 +148,14 @@ typedef struct
     DltDaemonLocal *daemon_local;\r
 } DltDaemonTimingPacketThreadData;\r
 \r
+typedef DltDaemonTimingPacketThreadData DltDaemonECUVersionThreadData;\r
+\r
 /* Function prototypes */\r
 void dlt_daemon_local_cleanup(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
 int dlt_daemon_local_init_p1(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
 int dlt_daemon_local_init_p2(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
 int dlt_daemon_local_connection_init(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
+int dlt_daemon_local_ecu_version_init(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
 \r
 void dlt_daemon_daemonize(int verbose);\r
 void dlt_daemon_signal_handler(int sig);\r
@@ -158,15 +166,24 @@ int dlt_daemon_process_client_messages_serial(DltDaemon *daemon, DltDaemonLocal
 int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
 \r
 int dlt_daemon_process_user_message_overflow(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
+int dlt_daemon_send_message_overflow(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
 int dlt_daemon_process_user_message_register_application(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
 int dlt_daemon_process_user_message_unregister_application(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
 int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
 int dlt_daemon_process_user_message_unregister_context(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
 int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
+#ifdef DLT_SHM_ENABLE\r
+int dlt_daemon_process_user_message_log_shm(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
+#endif\r
 int dlt_daemon_process_user_message_set_app_ll_ts(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
-int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
+int dlt_daemon_process_user_message_log_mode(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
 \r
+int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);\r
 void dlt_daemon_timingpacket_thread(void *ptr);\r
+void dlt_daemon_ecu_version_thread(void *ptr);\r
+#if defined(DLT_SYSTEMD_WATCHDOG_ENABLE)\r
+       void dlt_daemon_systemd_watchdog_thread(void *ptr);\r
+#endif\r
 int dlt_daemon_make_periodic (unsigned int period, DltDaemonPeriodicData *info, int verbose);\r
 void dlt_daemon_wait_period(DltDaemonPeriodicData *info, int verbose);\r
 \r