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
19 * For further information see http://www.genivi.org/.
\r
25 /*******************************************************************************
\r
27 ** SRC-MODULE: dlt_user_shared.h **
\r
29 ** TARGET : linux **
\r
33 ** AUTHOR : Alexander Wenzel Alexander.AW.Wenzel@bmw.de **
\r
40 ** PLATFORM DEPENDANT [yes/no]: yes **
\r
42 ** TO BE CHANGED BY USER [yes/no]: no **
\r
44 *******************************************************************************/
\r
46 /*******************************************************************************
\r
47 ** Author Identity **
\r
48 ********************************************************************************
\r
50 ** Initials Name Company **
\r
51 ** -------- ------------------------- ---------------------------------- **
\r
52 ** aw Alexander Wenzel BMW **
\r
53 ** mk Markus Klein Fraunhofer ESK **
\r
54 *******************************************************************************/
\r
56 /*******************************************************************************
\r
57 ** Author Identity **
\r
58 ********************************************************************************
\r
60 ** Initials Name Company **
\r
61 ** -------- ------------------------- ---------------------------------- **
\r
62 ** aw Alexander Wenzel BMW **
\r
63 ** mk Markus Klein Fraunhofer ESK **
\r
64 *******************************************************************************/
\r
66 #ifndef DLT_USER_SHARED_H
\r
67 #define DLT_USER_SHARED_H
\r
69 #include "dlt_types.h"
\r
70 #include "dlt_user.h"
\r
72 #include <sys/types.h>
\r
75 * This are the return values for the functions dlt_user_log_out2() and dlt_user_log_out3()
\r
79 DLT_RETURN_PIPE_FULL = -3,
80 DLT_RETURN_PIPE_ERROR = -2,
81 DLT_RETURN_ERROR = -1,
86 * This is the header of each message to be exchanged between application and daemon.
\r
90 char pattern[DLT_ID_SIZE]; /**< This pattern should be DUH0x01 */
\r
91 uint32_t message; /**< messsage info */
\r
92 } PACKED DltUserHeader;
\r
95 * This is the internal message content to exchange control msg register app information between application and daemon.
\r
99 char apid[DLT_ID_SIZE]; /**< application id */
\r
100 pid_t pid; /**< process id of user application */
\r
101 uint32_t description_length; /**< length of description */
\r
102 } PACKED DltUserControlMsgRegisterApplication;
\r
105 * This is the internal message content to exchange control msg unregister app information between application and daemon.
\r
109 char apid[DLT_ID_SIZE]; /**< application id */
\r
110 pid_t pid; /**< process id of user application */
\r
111 } PACKED DltUserControlMsgUnregisterApplication;
\r
114 * This is the internal message content to exchange control msg register information between application and daemon.
\r
118 char apid[DLT_ID_SIZE]; /**< application id */
\r
119 char ctid[DLT_ID_SIZE]; /**< context id */
\r
120 int32_t log_level_pos; /**< offset in management structure on user-application side */
\r
121 int8_t log_level; /**< log level */
\r
122 int8_t trace_status; /**< trace status */
\r
123 pid_t pid; /**< process id of user application */
\r
124 uint32_t description_length; /**< length of description */
\r
125 } PACKED DltUserControlMsgRegisterContext;
\r
128 * This is the internal message content to exchange control msg unregister 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 pid_t pid; /**< process id of user application */
\r
135 } PACKED DltUserControlMsgUnregisterContext;
\r
138 * This is the internal message content to exchange control msg log level information between application and daemon.
\r
142 uint8_t log_level; /**< log level */
\r
143 uint8_t trace_status; /**< trace status */
\r
144 int32_t log_level_pos; /**< offset in management structure on user-application side */
\r
145 } PACKED DltUserControlMsgLogLevel;
\r
148 * This is the internal message content to exchange control msg injection information between application and daemon.
\r
152 int32_t log_level_pos; /**< offset in management structure on user-application side */
\r
153 uint32_t service_id; /**< service id of injection */
\r
154 uint32_t data_length_inject; /**< length of injection message data field */
\r
155 } PACKED DltUserControlMsgInjection;
\r
158 * This is the internal message content to exchange information about application log level and trace stats between
\r
159 * application and daemon.
\r
163 char apid[DLT_ID_SIZE]; /**< application id */
\r
164 uint8_t log_level; /**< log level */
\r
165 uint8_t trace_status; /**< trace status */
\r
166 } PACKED DltUserControlMsgAppLogLevelTraceStatus;
\r
169 * This is the internal message content to set the logging mode: off, external, internal, both.
\r
173 int8_t log_mode; /**< the mode to be used for logging: off, external, internal, both */
\r
174 } PACKED DltUserControlMsgLogMode;
\r
177 * This is the internal message content to get the logging state: 0 = off, 1 = external client connected.
\r
181 int8_t log_state; /**< the state to be used for logging state: 0 = off, 1 = external client connected */
\r
182 } PACKED DltUserControlMsgLogState;
\r
184 /**************************************************************************************************
\r
185 * The folowing functions are used shared between the user lib and the daemon implementation
\r
186 **************************************************************************************************/
\r
189 * Set user header marker and store message type in user header
\r
190 * @param userheader pointer to the userheader
\r
191 * @param mtype user message type of internal message
\r
192 * @return negative value if there was an error {
196 int dlt_user_set_userheader(DltUserHeader *userheader, uint32_t mtype);
\r
199 * Check if user header contains its marker
\r
200 * @param userheader pointer to the userheader
\r
201 * @return 0 no, 1 yes, negative value if there was an error
\r
203 int dlt_user_check_userheader(DltUserHeader *userheader);
\r
206 * Atomic write to file descriptor, using vector of 2 elements
\r
207 * @param handle file descriptor
\r
208 * @param ptr1 generic pointer to first segment of data to be written
\r
209 * @param len1 length of first segment of data to be written
\r
210 * @param ptr2 generic pointer to second segment of data to be written
\r
211 * @param len2 length of second segment of data to be written
\r
212 * @return Value from DltReturnValue enum
\r
214 DltReturnValue dlt_user_log_out2(int handle, void *ptr1, size_t len1, void* ptr2, size_t len2);
\r
217 * Atomic write to file descriptor, using vector of 3 elements
\r
218 * @param handle file descriptor
\r
219 * @param ptr1 generic pointer to first segment of data to be written
\r
220 * @param len1 length of first segment of data to be written
\r
221 * @param ptr2 generic pointer to second segment of data to be written
\r
222 * @param len2 length of second segment of data to be written
\r
223 * @param ptr3 generic pointer to third segment of data to be written
\r
224 * @param len3 length of third segment of data to be written
\r
225 * @return Value from DltReturnValue enum
\r
227 DltReturnValue dlt_user_log_out3(int handle, void *ptr1, size_t len1, void* ptr2, size_t len2, void *ptr3, size_t len3);
\r
229 #endif /* DLT_USER_SHARED_H */
\r