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.aw.wenzel@bmw.de> BMW 2011-2012
\r
18 * \file dlt_user_shared.h
\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_BUFFER_FULL = -4,
80 DLT_RETURN_PIPE_FULL = -3,
81 DLT_RETURN_PIPE_ERROR = -2,
82 DLT_RETURN_ERROR = -1,
87 * This is the header of each message to be exchanged between application and daemon.
\r
91 char pattern[DLT_ID_SIZE]; /**< This pattern should be DUH0x01 */
\r
92 uint32_t message; /**< messsage info */
\r
93 } PACKED DltUserHeader;
\r
96 * This is the internal message content to exchange control msg register app information between application and daemon.
\r
100 char apid[DLT_ID_SIZE]; /**< application id */
\r
101 pid_t pid; /**< process id of user application */
\r
102 uint32_t description_length; /**< length of description */
\r
103 } PACKED DltUserControlMsgRegisterApplication;
\r
106 * This is the internal message content to exchange control msg unregister app information between application and daemon.
\r
110 char apid[DLT_ID_SIZE]; /**< application id */
\r
111 pid_t pid; /**< process id of user application */
\r
112 } PACKED DltUserControlMsgUnregisterApplication;
\r
115 * This is the internal message content to exchange control msg register information between application and daemon.
\r
119 char apid[DLT_ID_SIZE]; /**< application id */
\r
120 char ctid[DLT_ID_SIZE]; /**< context id */
\r
121 int32_t log_level_pos; /**< offset in management structure on user-application side */
\r
122 int8_t log_level; /**< log level */
\r
123 int8_t trace_status; /**< trace status */
\r
124 pid_t pid; /**< process id of user application */
\r
125 uint32_t description_length; /**< length of description */
\r
126 } PACKED DltUserControlMsgRegisterContext;
\r
129 * This is the internal message content to exchange control msg unregister information between application and daemon.
\r
133 char apid[DLT_ID_SIZE]; /**< application id */
\r
134 char ctid[DLT_ID_SIZE]; /**< context id */
\r
135 pid_t pid; /**< process id of user application */
\r
136 } PACKED DltUserControlMsgUnregisterContext;
\r
139 * This is the internal message content to exchange control msg log level information between application and daemon.
\r
143 uint8_t log_level; /**< log level */
\r
144 uint8_t trace_status; /**< trace status */
\r
145 int32_t log_level_pos; /**< offset in management structure on user-application side */
\r
146 } PACKED DltUserControlMsgLogLevel;
\r
149 * This is the internal message content to exchange control msg injection information between application and daemon.
\r
153 int32_t log_level_pos; /**< offset in management structure on user-application side */
\r
154 uint32_t service_id; /**< service id of injection */
\r
155 uint32_t data_length_inject; /**< length of injection message data field */
\r
156 } PACKED DltUserControlMsgInjection;
\r
159 * This is the internal message content to exchange information about application log level and trace stats between
\r
160 * application and daemon.
\r
164 char apid[DLT_ID_SIZE]; /**< application id */
\r
165 uint8_t log_level; /**< log level */
\r
166 uint8_t trace_status; /**< trace status */
\r
167 } PACKED DltUserControlMsgAppLogLevelTraceStatus;
\r
170 * This is the internal message content to set the logging mode: off, external, internal, both.
\r
174 int8_t log_mode; /**< the mode to be used for logging: off, external, internal, both */
\r
175 } PACKED DltUserControlMsgLogMode;
\r
178 * This is the internal message content to get the logging state: 0 = off, 1 = external client connected.
\r
182 int8_t log_state; /**< the state to be used for logging state: 0 = off, 1 = external client connected */
\r
183 } PACKED DltUserControlMsgLogState;
\r
185 /**************************************************************************************************
\r
186 * The folowing functions are used shared between the user lib and the daemon implementation
\r
187 **************************************************************************************************/
\r
190 * Set user header marker and store message type in user header
\r
191 * @param userheader pointer to the userheader
\r
192 * @param mtype user message type of internal message
\r
193 * @return negative value if there was an error {
197 int dlt_user_set_userheader(DltUserHeader *userheader, uint32_t mtype);
\r
200 * Check if user header contains its marker
\r
201 * @param userheader pointer to the userheader
\r
202 * @return 0 no, 1 yes, negative value if there was an error
\r
204 int dlt_user_check_userheader(DltUserHeader *userheader);
\r
207 * Atomic write to file descriptor, using vector of 2 elements
\r
208 * @param handle file descriptor
\r
209 * @param ptr1 generic pointer to first segment of data to be written
\r
210 * @param len1 length of first segment of data to be written
\r
211 * @param ptr2 generic pointer to second segment of data to be written
\r
212 * @param len2 length of second segment of data to be written
\r
213 * @return Value from DltReturnValue enum
\r
215 DltReturnValue dlt_user_log_out2(int handle, void *ptr1, size_t len1, void* ptr2, size_t len2);
\r
218 * Atomic write to file descriptor, using vector of 3 elements
\r
219 * @param handle file descriptor
\r
220 * @param ptr1 generic pointer to first segment of data to be written
\r
221 * @param len1 length of first segment of data to be written
\r
222 * @param ptr2 generic pointer to second segment of data to be written
\r
223 * @param len2 length of second segment of data to be written
\r
224 * @param ptr3 generic pointer to third segment of data to be written
\r
225 * @param len3 length of third segment of data to be written
\r
226 * @return Value from DltReturnValue enum
\r
228 DltReturnValue dlt_user_log_out3(int handle, void *ptr1, size_t len1, void* ptr2, size_t len2, void *ptr3, size_t len3);
\r
230 #endif /* DLT_USER_SHARED_H */
\r