Bug 44 - Don't print "Buffer full" message from DLT daemon for each trace.
[profile/ivi/dlt-daemon.git] / src / daemon / dlt_daemon_common.h
old mode 100755 (executable)
new mode 100644 (file)
index 3dcd596..b93f0c2
@@ -13,9 +13,9 @@
  * this file, You can obtain one at http://mozilla.org/MPL/2.0/.\r
  *\r
  *\r
- * \author Alexander Wenzel <alexander.wenzel@bmw.de> BMW 2011-2012\r
+ * \author Alexander Wenzel <alexander.aw.wenzel@bmw.de> BMW 2011-2012\r
  *\r
- * \file <FILE>\r
+ * \file dlt_daemon_common.h\r
  * For further information see http://www.genivi.org/.\r
  * @licence end@\r
  */\r
@@ -73,6 +73,7 @@
   \{\r
 */\r
 \r
+#include <limits.h>\r
 #include <semaphore.h>\r
 #include "dlt_common.h"\r
 #include "dlt_user.h"\r
@@ -81,9 +82,9 @@
 extern "C" {\r
 #endif\r
 \r
-#define DLT_DAEMON_RINGBUFFER_MIN_SIZE  100000 /**< Ring buffer size for storing log messages while no client is connected */\r
-#define DLT_DAEMON_RINGBUFFER_MAX_SIZE  500000 /**< Ring buffer size for storing log messages while no client is connected */\r
-#define DLT_DAEMON_RINGBUFFER_STEP_SIZE 100000 /**< Ring buffer size for storing log messages while no client is connected */\r
+#define DLT_DAEMON_RINGBUFFER_MIN_SIZE    500000 /**< Ring buffer size for storing log messages while no client is connected */\r
+#define DLT_DAEMON_RINGBUFFER_MAX_SIZE  10000000 /**< Ring buffer size for storing log messages while no client is connected */\r
+#define DLT_DAEMON_RINGBUFFER_STEP_SIZE   500000 /**< Ring buffer size for storing log messages while no client is connected */\r
 \r
 #define DLT_DAEMON_STORE_TO_BUFFER -2   /**< Constant value to identify the command "store to buffer" */\r
 \r
@@ -132,16 +133,18 @@ typedef struct
        int8_t default_log_level;          /**< Default log level (of daemon) */\r
        int8_t default_trace_status;       /**< Default trace status (of daemon) */\r
        int message_buffer_overflow;   /**< Set to one, if buffer overflow has occured, zero otherwise */\r
+       unsigned int overflow_counter;   /**< counts the number of lost messages. */\r
        int runtime_context_cfg_loaded;         /**< Set to one, if runtime context configuration has been loaded, zero otherwise */\r
        char ecuid[DLT_ID_SIZE];       /**< ECU ID of daemon */\r
        int sendserialheader;          /**< 1: send serial header; 0 don't send serial header */\r
        int timingpackets;              /**< 1: send continous timing packets; 0 don't send continous timing packets */\r
        DltBuffer client_ringbuffer; /**< Ring-buffer for storing received logs while no client connection is available */\r
-       char runtime_application_cfg[256]; /**< Path and filename of persistent application configuration */\r
-       char runtime_context_cfg[256]; /**< Path and filename of persistent context configuration */\r
-       char runtime_configuration[256]; /**< Path and filename of persistent configuration */\r
+    char runtime_application_cfg[PATH_MAX + 1]; /**< Path and filename of persistent application configuration. Set to path max, as it specifies a full path*/\r
+    char runtime_context_cfg[PATH_MAX + 1]; /**< Path and filename of persistent context configuration */\r
+    char runtime_configuration[PATH_MAX + 1]; /**< Path and filename of persistent configuration */\r
     DltUserLogMode mode;       /**< Mode used for tracing: off, external, internal, both */\r
     char state;                                /**< state for tracing: 0 = no client connected, 1 = client connected */\r
+    char *ECUVersionString; /**< Version string to send to client. Loaded from a file at startup. May be null. */\r
 } DltDaemon;\r
 \r
 /**\r
@@ -204,6 +207,14 @@ int dlt_daemon_applications_load(DltDaemon *daemon,const char *filename, int ver
  */\r
 int dlt_daemon_applications_save(DltDaemon *daemon,const char *filename, int verbose);\r
 /**\r
+ * Invalidate all applications fd, if fd is reused\r
+ * @param daemon pointer to dlt daemon structure\r
+ * @param fd file descriptor\r
+ * @param verbose if set to true verbose information is printed out.\r
+ * @return negative value if there was an error\r
+ */\r
+int dlt_daemon_applications_invalidate_fd(DltDaemon *daemon,int fd,int verbose);\r
+/**\r
  * Clear all applications in internal application management\r
  * @param daemon pointer to dlt daemon structure\r
  * @param verbose if set to true verbose information is printed out.\r
@@ -243,6 +254,14 @@ int dlt_daemon_context_del(DltDaemon *daemon, DltDaemonContext* context, int ver
  */\r
 DltDaemonContext* dlt_daemon_context_find(DltDaemon *daemon,char *apid,char *ctid,int verbose);\r
 /**\r
+ * Invalidate all contexts fd, if fd is reused\r
+ * @param daemon pointer to dlt daemon structure\r
+ * @param fd file descriptor\r
+ * @param verbose if set to true verbose information is printed out.\r
+ * @return negative value if there was an error\r
+ */\r
+int dlt_daemon_contexts_invalidate_fd(DltDaemon *daemon,int fd,int verbose);\r
+/**\r
  * Clear all contexts in internal context management\r
  * @param daemon pointer to dlt daemon structure\r
  * @param verbose if set to true verbose information is printed out.\r
@@ -342,8 +361,9 @@ void dlt_daemon_control_service_response(int sock, DltDaemon *daemon, uint32_t s
  * @param appid pointer to application id to be used in response message\r
  * @param contid pointer to context id to be used in response message\r
  * @param verbose if set to true verbose information is printed out.\r
+ * @return -1 if there is an error or buffer is full\r
  */\r
-void dlt_daemon_control_send_control_message(int sock, DltDaemon *daemon, DltMessage *msg, char* appid, char* contid, int verbose);\r
+int dlt_daemon_control_send_control_message(int sock, DltDaemon *daemon, DltMessage *msg, char* appid, char* contid, int verbose);\r
 \r
 /**\r
  * Process and generate response to received sw injection control message\r
@@ -420,8 +440,9 @@ void dlt_daemon_control_get_log_info(int sock, DltDaemon *daemon, DltMessage *ms
  * @param sock connection handle used for sending response\r
  * @param daemon pointer to dlt daemon structure\r
  * @param verbose if set to true verbose information is printed out.\r
+ * @return -1 if there is an error or buffer overflow, else 0\r
  */\r
-void dlt_daemon_control_message_buffer_overflow(int sock, DltDaemon *daemon, int verbose);\r
+int dlt_daemon_control_message_buffer_overflow(int sock, DltDaemon *daemon, unsigned int overflow_counter,char* apid, int verbose);\r
 /**\r
  * Process reset to factory default control message\r
  * @param daemon pointer to dlt daemon structure\r
@@ -437,7 +458,6 @@ void dlt_daemon_control_reset_to_factory_default(DltDaemon *daemon,const char *f
  * @param verbose if set to true verbose information is printed out.\r
  */\r
 void dlt_daemon_control_message_time(int sock, DltDaemon *daemon, int verbose);\r
-\r
 #ifdef __cplusplus\r
 }\r
 #endif\r