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_user_shared.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_USER_SHARED_H
\r
81 #define DLT_USER_SHARED_H
\r
83 #include "dlt_types.h"
\r
84 #include "dlt_user.h"
\r
86 #include <sys/types.h>
\r
89 * This are the return values for the functions dlt_user_log_out2() and dlt_user_log_out3()
\r
93 DLT_RETURN_PIPE_FULL = -3,
94 DLT_RETURN_PIPE_ERROR = -2,
95 DLT_RETURN_ERROR = -1,
100 * This is the header of each message to be exchanged between application and daemon.
\r
104 char pattern[DLT_ID_SIZE]; /**< This pattern should be DUH0x01 */
\r
105 uint32_t message; /**< messsage info */
\r
106 } PACKED DltUserHeader;
\r
109 * This is the internal message content to exchange control msg register app information between application and daemon.
\r
113 char apid[DLT_ID_SIZE]; /**< application id */
\r
114 pid_t pid; /**< process id of user application */
\r
115 uint32_t description_length; /**< length of description */
\r
116 } PACKED DltUserControlMsgRegisterApplication;
\r
119 * This is the internal message content to exchange control msg unregister app information between application and daemon.
\r
123 char apid[DLT_ID_SIZE]; /**< application id */
\r
124 pid_t pid; /**< process id of user application */
\r
125 } PACKED DltUserControlMsgUnregisterApplication;
\r
128 * This is the internal message content to exchange control msg register information between application and daemon.
\r
132 char apid[DLT_ID_SIZE]; /**< application id */
\r
133 char ctid[DLT_ID_SIZE]; /**< context id */
\r
134 int32_t log_level_pos; /**< offset in management structure on user-application side */
\r
135 int8_t log_level; /**< log level */
\r
136 int8_t trace_status; /**< trace status */
\r
137 pid_t pid; /**< process id of user application */
\r
138 uint32_t description_length; /**< length of description */
\r
139 } PACKED DltUserControlMsgRegisterContext;
\r
142 * This is the internal message content to exchange control msg unregister information between application and daemon.
\r
146 char apid[DLT_ID_SIZE]; /**< application id */
\r
147 char ctid[DLT_ID_SIZE]; /**< context id */
\r
148 pid_t pid; /**< process id of user application */
\r
149 } PACKED DltUserControlMsgUnregisterContext;
\r
152 * This is the internal message content to exchange control msg log level information between application and daemon.
\r
156 uint8_t log_level; /**< log level */
\r
157 uint8_t trace_status; /**< trace status */
\r
158 int32_t log_level_pos; /**< offset in management structure on user-application side */
\r
159 } PACKED DltUserControlMsgLogLevel;
\r
162 * This is the internal message content to exchange control msg injection information between application and daemon.
\r
166 int32_t log_level_pos; /**< offset in management structure on user-application side */
\r
167 uint32_t service_id; /**< service id of injection */
\r
168 uint32_t data_length_inject; /**< length of injection message data field */
\r
169 } PACKED DltUserControlMsgInjection;
\r
172 * This is the internal message content to exchange information about application log level and trace stats between
\r
173 * application and daemon.
\r
177 char apid[DLT_ID_SIZE]; /**< application id */
\r
178 uint8_t log_level; /**< log level */
\r
179 uint8_t trace_status; /**< trace status */
\r
180 } PACKED DltUserControlMsgAppLogLevelTraceStatus;
\r
183 * This is the internal message content to set the logging mode: off, external, internal, both.
\r
187 int8_t log_mode; /**< the mode to be used for logging: off, external, internal, both */
\r
188 } PACKED DltUserControlMsgLogMode;
\r
191 * This is the internal message content to get the logging state: 0 = off, 1 = external client connected.
\r
195 int8_t log_state; /**< the state to be used for logging state: 0 = off, 1 = external client connected */
\r
196 } PACKED DltUserControlMsgLogState;
\r
198 /**************************************************************************************************
\r
199 * The folowing functions are used shared between the user lib and the daemon implementation
\r
200 **************************************************************************************************/
\r
203 * Set user header marker and store message type in user header
\r
204 * @param userheader pointer to the userheader
\r
205 * @param mtype user message type of internal message
\r
206 * @return negative value if there was an error {
210 int dlt_user_set_userheader(DltUserHeader *userheader, uint32_t mtype);
\r
213 * Check if user header contains its marker
\r
214 * @param userheader pointer to the userheader
\r
215 * @return 0 no, 1 yes, negative value if there was an error
\r
217 int dlt_user_check_userheader(DltUserHeader *userheader);
\r
220 * Atomic write to file descriptor, using vector of 2 elements
\r
221 * @param handle file descriptor
\r
222 * @param ptr1 generic pointer to first segment of data to be written
\r
223 * @param len1 length of first segment of data to be written
\r
224 * @param ptr2 generic pointer to second segment of data to be written
\r
225 * @param len2 length of second segment of data to be written
\r
226 * @return Value from DltReturnValue enum
\r
228 DltReturnValue dlt_user_log_out2(int handle, void *ptr1, size_t len1, void* ptr2, size_t len2);
\r
231 * Atomic write to file descriptor, using vector of 3 elements
\r
232 * @param handle file descriptor
\r
233 * @param ptr1 generic pointer to first segment of data to be written
\r
234 * @param len1 length of first segment of data to be written
\r
235 * @param ptr2 generic pointer to second segment of data to be written
\r
236 * @param len2 length of second segment of data to be written
\r
237 * @param ptr3 generic pointer to third segment of data to be written
\r
238 * @param len3 length of third segment of data to be written
\r
239 * @return Value from DltReturnValue enum
\r
241 DltReturnValue dlt_user_log_out3(int handle, void *ptr1, size_t len1, void* ptr2, size_t len2, void *ptr3, size_t len3);
\r
243 #endif /* DLT_USER_SHARED_H */
\r