automotive-dlt
dlt_daemon_common.h
Go to the documentation of this file.
1 /*
2  * @licence app begin@
3  * SPDX license identifier: MPL-2.0
4  *
5  * Copyright (C) 2011-2015, BMW AG
6  *
7  * This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
8  *
9  * This Source Code Form is subject to the terms of the
10  * Mozilla Public License (MPL), v. 2.0.
11  * If a copy of the MPL was not distributed with this file,
12  * You can obtain one at http://mozilla.org/MPL/2.0/.
13  *
14  * For further information see http://www.genivi.org/.
15  * @licence end@
16  */
17 
28 /*******************************************************************************
29 ** **
30 ** SRC-MODULE: dlt_daemon_common.h **
31 ** **
32 ** TARGET : linux **
33 ** **
34 ** PROJECT : DLT **
35 ** **
36 ** AUTHOR : Alexander Wenzel Alexander.AW.Wenzel@bmw.de **
37 ** Markus Klein **
38 ** **
39 ** PURPOSE : **
40 ** **
41 ** REMARKS : **
42 ** **
43 ** PLATFORM DEPENDANT [yes/no]: yes **
44 ** **
45 ** TO BE CHANGED BY USER [yes/no]: no **
46 ** **
47 *******************************************************************************/
48 
49 /*******************************************************************************
50 ** Author Identity **
51 ********************************************************************************
52 ** **
53 ** Initials Name Company **
54 ** -------- ------------------------- ---------------------------------- **
55 ** aw Alexander Wenzel BMW **
56 ** mk Markus Klein Fraunhofer ESK **
57 *******************************************************************************/
58 
59 /*******************************************************************************
60 ** Revision Control History **
61 *******************************************************************************/
62 
63 /*
64  * $LastChangedRevision: 1670 $
65  * $LastChangedDate: 2011-04-08 15:12:06 +0200 (Fr, 08. Apr 2011) $
66  * $LastChangedBy$
67  Initials Date Comment
68  aw 15.02.2010 initial
69  */
70 
71 #ifndef DLT_DAEMON_COMMON_H
72 #define DLT_DAEMON_COMMON_H
73 
80 #include <limits.h>
81 #include <semaphore.h>
82 #include "dlt_common.h"
83 #include "dlt_user.h"
84 #include "dlt_offline_logstorage.h"
85 
86 #ifdef __cplusplus
87 extern "C" {
88 #endif
89 
90 #define DLT_DAEMON_RINGBUFFER_MIN_SIZE 500000
91 #define DLT_DAEMON_RINGBUFFER_MAX_SIZE 10000000
92 #define DLT_DAEMON_RINGBUFFER_STEP_SIZE 500000
94 #define DLT_DAEMON_SEND_TO_ALL -3
95 #define DLT_DAEMON_SEND_FORCE -4
97 /* Use a semaphore or mutex from your OS to prevent concurrent access to the DLT buffer. */
98 
99 #define DLT_DAEMON_SEM_LOCK() { sem_wait(&dlt_daemon_mutex); }
100 #define DLT_DAEMON_SEM_FREE() { sem_post(&dlt_daemon_mutex); }
101 extern sem_t dlt_daemon_mutex;
102 
106 typedef enum
107 {
114 
118 typedef struct
119 {
120  char apid[DLT_ID_SIZE];
121  pid_t pid;
126 
130 typedef struct
131 {
132  char apid[DLT_ID_SIZE];
133  char ctid[DLT_ID_SIZE];
134  int8_t log_level;
135  int8_t trace_status;
141 
145 typedef struct
146 {
153  int8_t force_ll_ts;
154  unsigned int overflow_counter;
156  char ecuid[DLT_ID_SIZE];
160  char runtime_application_cfg[PATH_MAX + 1];
161  char runtime_context_cfg[PATH_MAX + 1];
162  char runtime_configuration[PATH_MAX + 1];
168 } DltDaemon;
169 
184 int dlt_daemon_init(DltDaemon *daemon,unsigned long RingbufferMinSize,unsigned long RingbufferMaxSize,unsigned long RingbufferStepSize,const char *runtime_directory,int InitialContextLogLevel, int InitialContextTraceStatus, int ForceLLTS, int verbose);
191 int dlt_daemon_free(DltDaemon *daemon,int verbose);
192 
202 DltDaemonApplication* dlt_daemon_application_add(DltDaemon *daemon,char *apid,pid_t pid,char *description, int verbose);
210 int dlt_daemon_application_del(DltDaemon *daemon, DltDaemonApplication *application, int verbose);
218 DltDaemonApplication* dlt_daemon_application_find(DltDaemon *daemon,char *apid,int verbose);
226 int dlt_daemon_applications_load(DltDaemon *daemon,const char *filename, int verbose);
234 int dlt_daemon_applications_save(DltDaemon *daemon,const char *filename, int verbose);
242 int dlt_daemon_applications_invalidate_fd(DltDaemon *daemon,int fd,int verbose);
249 int dlt_daemon_applications_clear(DltDaemon *daemon,int verbose);
250 
264 DltDaemonContext* dlt_daemon_context_add(DltDaemon *daemon,char *apid,char *ctid,int8_t log_level,int8_t trace_status,int log_level_pos, int user_handle,char *description,int verbose);
272 int dlt_daemon_context_del(DltDaemon *daemon, DltDaemonContext* context, int verbose);
281 DltDaemonContext* dlt_daemon_context_find(DltDaemon *daemon,char *apid,char *ctid,int verbose);
289 int dlt_daemon_contexts_invalidate_fd(DltDaemon *daemon,int fd,int verbose);
296 int dlt_daemon_contexts_clear(DltDaemon *daemon,int verbose);
304 int dlt_daemon_contexts_load(DltDaemon *daemon,const char *filename, int verbose);
312 int dlt_daemon_contexts_save(DltDaemon *daemon,const char *filename, int verbose);
320 int dlt_daemon_configuration_load(DltDaemon *daemon,const char *filename, int verbose);
328 int dlt_daemon_configuration_save(DltDaemon *daemon,const char *filename, int verbose);
329 
330 
338 int dlt_daemon_user_send_log_level(DltDaemon *daemon,DltDaemonContext *context, int verbose);
339 
348 
355 void dlt_daemon_user_send_default_update(DltDaemon *daemon, int verbose);
356 
364 void dlt_daemon_user_send_all_update(DltDaemon *daemon, int8_t log_level, int verbose);
365 
372 void dlt_daemon_user_send_all_log_state(DltDaemon *daemon, int verbose);
373 
384 void dlt_daemon_control_reset_to_factory_default(DltDaemon *daemon,const char *filename, const char *filename1, int InitialContextLogLevel, int InitialContextTraceStatus, int InitialEnforceLlTsStatus, int verbose);
385 
391 void dlt_daemon_change_state(DltDaemon *daemon, DltDaemonState newState);
392 
393 #ifdef __cplusplus
394 }
395 #endif
396 
401 #endif /* DLT_DAEMON_COMMON_H */
int dlt_daemon_context_del(DltDaemon *daemon, DltDaemonContext *context, int verbose)
int dlt_daemon_contexts_invalidate_fd(DltDaemon *daemon, int fd, int verbose)
#define DLT_ID_SIZE
Definition: dlt_common.h:204
int dlt_daemon_contexts_load(DltDaemon *daemon, const char *filename, int verbose)
char * ECUVersionString
int dlt_daemon_applications_load(DltDaemon *daemon, const char *filename, int verbose)
void dlt_daemon_user_send_all_update(DltDaemon *daemon, int8_t log_level, int verbose)
DltDaemonApplication * applications
DltLogStorage * storage_handle
DltUserLogMode
Definition: dlt_types.h:168
DltDaemonContext * dlt_daemon_context_add(DltDaemon *daemon, char *apid, char *ctid, int8_t log_level, int8_t trace_status, int log_level_pos, int user_handle, char *description, int verbose)
int runtime_context_cfg_loaded
int dlt_daemon_configuration_load(DltDaemon *daemon, const char *filename, int verbose)
int8_t default_trace_status
DltBuffer client_ringbuffer
int dlt_daemon_contexts_clear(DltDaemon *daemon, int verbose)
void dlt_daemon_user_send_all_log_state(DltDaemon *daemon, int verbose)
DltDaemonContext * contexts
DltDaemonApplication * dlt_daemon_application_add(DltDaemon *daemon, char *apid, pid_t pid, char *description, int verbose)
int dlt_daemon_applications_clear(DltDaemon *daemon, int verbose)
int dlt_daemon_free(DltDaemon *daemon, int verbose)
int dlt_daemon_user_send_log_state(DltDaemon *daemon, DltDaemonApplication *app, int verbose)
int8_t force_ll_ts
int dlt_daemon_application_del(DltDaemon *daemon, DltDaemonApplication *application, int verbose)
void dlt_daemon_user_send_default_update(DltDaemon *daemon, int verbose)
void dlt_daemon_control_reset_to_factory_default(DltDaemon *daemon, const char *filename, const char *filename1, int InitialContextLogLevel, int InitialContextTraceStatus, int InitialEnforceLlTsStatus, int verbose)
int dlt_daemon_applications_save(DltDaemon *daemon, const char *filename, int verbose)
void dlt_daemon_change_state(DltDaemon *daemon, DltDaemonState newState)
int dlt_daemon_configuration_save(DltDaemon *daemon, const char *filename, int verbose)
int8_t default_log_level
int dlt_daemon_init(DltDaemon *daemon, unsigned long RingbufferMinSize, unsigned long RingbufferMaxSize, unsigned long RingbufferStepSize, const char *runtime_directory, int InitialContextLogLevel, int InitialContextTraceStatus, int ForceLLTS, int verbose)
DltDaemonApplication * dlt_daemon_application_find(DltDaemon *daemon, char *apid, int verbose)
unsigned int overflow_counter
DltDaemonState state
int dlt_daemon_user_send_log_level(DltDaemon *daemon, DltDaemonContext *context, int verbose)
sem_t dlt_daemon_mutex
int dlt_daemon_contexts_save(DltDaemon *daemon, const char *filename, int verbose)
int dlt_daemon_applications_invalidate_fd(DltDaemon *daemon, int fd, int verbose)
DltDaemonState
DltUserLogMode mode
DltDaemonContext * dlt_daemon_context_find(DltDaemon *daemon, char *apid, char *ctid, int verbose)