Changed license from LGPL to MPLv2.0
[profile/ivi/dlt-daemon.git] / include / dlt / dlt_protocol.h
1 /**\r
2  * @licence app begin@\r
3  * Copyright (C) 2012  BMW AG\r
4  *\r
5  * This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps.\r
6  *\r
7  * Contributions are licensed to the GENIVI Alliance under one or more\r
8  * Contribution License Agreements.\r
9  *\r
10  * \copyright\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
14  *\r
15  *\r
16  * \author Alexander Wenzel <alexander.aw.wenzel@bmw.de> BMW 2011-2012\r
17  *\r
18  * \file dlt_protocal.h\r
19  * For further information see http://www.genivi.org/.\r
20  * @licence end@\r
21  */\r
22 \r
23 \r
24 /*******************************************************************************\r
25 **                                                                            **\r
26 **  SRC-MODULE: dlt_protocol.h                                                **\r
27 **                                                                            **\r
28 **  TARGET    : linux                                                         **
29 **                                                                            **
30 **  PROJECT   : DLT                                                           **
31 **                                                                            **
32 **  AUTHOR    : Alexander Wenzel Alexander.AW.Wenzel@bmw.de                   **
33 **              Markus Klein                                                  **
34 **                                                                            **
35 **  PURPOSE   :                                                               **
36 **                                                                            **
37 **  REMARKS   :                                                               **
38 **                                                                            **
39 **  PLATFORM DEPENDANT [yes/no]: yes                                          **
40 **                                                                            **
41 **  TO BE CHANGED BY USER [yes/no]: no                                        **
42 **                                                                            **
43 *******************************************************************************/
44
45 /*******************************************************************************
46 **                      Author Identity                                       **
47 ********************************************************************************
48 **                                                                            **
49 ** Initials     Name                       Company                            **
50 ** --------     -------------------------  ---------------------------------- **
51 **  aw          Alexander Wenzel           BMW                                **
52 **  mk          Markus Klein               Fraunhofer ESK                     **
53 *******************************************************************************/\r
54 \r
55 /*******************************************************************************\r
56 **                      Revision Control History                              **\r
57 *******************************************************************************/\r
58 \r
59 /*\r
60  * $LastChangedRevision$\r
61  * $LastChangedDate$\r
62  * $LastChangedBy$\r
63  Initials    Date         Comment\r
64  aw          13.01.2010   initial\r
65  */\r
66 #ifndef DLT_PROTOCOL_H\r
67 #define DLT_PROTOCOL_H\r
68 \r
69 /**\r
70   \defgroup protocolapi DLT Protocol API\r
71   \addtogroup protocolapi\r
72   \{\r
73 */\r
74 \r
75 /*\r
76  * Definitions of the htyp parameter in standard header.\r
77  */\r
78 #define DLT_HTYP_UEH  0x01 /**< use extended header */\r
79 #define DLT_HTYP_MSBF 0x02 /**< MSB first */\r
80 #define DLT_HTYP_WEID 0x04 /**< with ECU ID */\r
81 #define DLT_HTYP_WSID 0x08 /**< with session ID */\r
82 #define DLT_HTYP_WTMS 0x10 /**< with timestamp */\r
83 #define DLT_HTYP_VERS 0xe0 /**< version number, 0x1 */\r
84 \r
85 #define DLT_IS_HTYP_UEH(htyp)  ((htyp) & DLT_HTYP_UEH)\r
86 #define DLT_IS_HTYP_MSBF(htyp) ((htyp) & DLT_HTYP_MSBF)\r
87 #define DLT_IS_HTYP_WEID(htyp) ((htyp) & DLT_HTYP_WEID)\r
88 #define DLT_IS_HTYP_WSID(htyp) ((htyp) & DLT_HTYP_WSID)\r
89 #define DLT_IS_HTYP_WTMS(htyp) ((htyp) & DLT_HTYP_WTMS)\r
90 \r
91 #define DLT_HTYP_PROTOCOL_VERSION1 (1<<5)\r
92 \r
93 /*\r
94  * Definitions of msin parameter in extended header.\r
95  */\r
96 #define DLT_MSIN_VERB 0x01 /**< verbose */\r
97 #define DLT_MSIN_MSTP 0x0e /**< message type */\r
98 #define DLT_MSIN_MTIN 0xf0 /**< message type info */\r
99 \r
100 #define DLT_MSIN_MSTP_SHIFT 1 /**< shift right offset to get mstp value */\r
101 #define DLT_MSIN_MTIN_SHIFT 4 /**< shift right offset to get mtin value */\r
102 \r
103 #define DLT_IS_MSIN_VERB(msin)   ((msin) & DLT_MSIN_VERB)\r
104 #define DLT_GET_MSIN_MSTP(msin) (((msin) & DLT_MSIN_MSTP) >> DLT_MSIN_MSTP_SHIFT)\r
105 #define DLT_GET_MSIN_MTIN(msin) (((msin) & DLT_MSIN_MTIN) >> DLT_MSIN_MTIN_SHIFT)\r
106 \r
107 /*\r
108  * Definitions of mstp parameter in extended header.\r
109  */\r
110 #define DLT_TYPE_LOG       0x00 /**< Log message type */\r
111 #define DLT_TYPE_APP_TRACE 0x01 /**< Application trace message type */\r
112 #define DLT_TYPE_NW_TRACE  0x02 /**< Network trace message type */\r
113 #define DLT_TYPE_CONTROL   0x03 /**< Control message type */\r
114 \r
115 /*\r
116  * Definitions of msti parameter in extended header.\r
117  */\r
118 #define DLT_TRACE_VARIABLE     0x01 /**< tracing of a variable */\r
119 #define DLT_TRACE_FUNCTION_IN  0x02 /**< tracing of function calls */\r
120 #define DLT_TRACE_FUNCTION_OUT 0x03 /**< tracing of function return values */\r
121 #define DLT_TRACE_STATE        0x04 /**< tracing of states of a state machine */\r
122 #define DLT_TRACE_VFB          0x05 /**< tracing of virtual function bus */\r
123 \r
124 /*\r
125  * Definitions of msbi parameter in extended header.\r
126  */
127
128 /* see file dlt_user.h */
129 \r
130 /*\r
131  * Definitions of msci parameter in extended header.\r
132  */\r
133 #define DLT_CONTROL_REQUEST    0x01 /**< Request message */\r
134 #define DLT_CONTROL_RESPONSE   0x02 /**< Response to request message */\r
135 #define DLT_CONTROL_TIME       0x03 /**< keep-alive message */\r
136 \r
137 #define DLT_MSIN_CONTROL_REQUEST  ((DLT_TYPE_CONTROL << DLT_MSIN_MSTP_SHIFT) | (DLT_CONTROL_REQUEST  << DLT_MSIN_MTIN_SHIFT))\r
138 #define DLT_MSIN_CONTROL_RESPONSE ((DLT_TYPE_CONTROL << DLT_MSIN_MSTP_SHIFT) | (DLT_CONTROL_RESPONSE << DLT_MSIN_MTIN_SHIFT))
139 #define DLT_MSIN_CONTROL_TIME     ((DLT_TYPE_CONTROL << DLT_MSIN_MSTP_SHIFT) | (DLT_CONTROL_TIME     << DLT_MSIN_MTIN_SHIFT))\r
140 \r
141 /*\r
142  * Definitions of types of arguments in payload.\r
143  */\r
144 #define DLT_TYPE_INFO_TYLE      0x0000000f /**< Length of standard data: 1 = 8bit, 2 = 16bit, 3 = 32 bit, 4 = 64 bit, 5 = 128 bit */\r
145 #define DLT_TYPE_INFO_BOOL      0x00000010 /**< Boolean data */\r
146 #define DLT_TYPE_INFO_SINT      0x00000020 /**< Signed integer data */\r
147 #define DLT_TYPE_INFO_UINT      0x00000040 /**< Unsigned integer data */\r
148 #define DLT_TYPE_INFO_FLOA      0x00000080 /**< Float data */\r
149 #define DLT_TYPE_INFO_ARAY      0x00000100 /**< Array of standard types */\r
150 #define DLT_TYPE_INFO_STRG      0x00000200 /**< String */\r
151 #define DLT_TYPE_INFO_RAWD      0x00000400 /**< Raw data */\r
152 #define DLT_TYPE_INFO_VARI      0x00000800 /**< Set, if additional information to a variable is available */\r
153 #define DLT_TYPE_INFO_FIXP      0x00001000 /**< Set, if quantization and offset are added */\r
154 #define DLT_TYPE_INFO_TRAI      0x00002000 /**< Set, if additional trace information is added */\r
155 #define DLT_TYPE_INFO_STRU      0x00004000 /**< Struct */\r
156 #define DLT_TYPE_INFO_SCOD      0x00038000 /**< coding of the type string: 0 = ASCII, 1 = UTF-8 */\r
157 \r
158 #define DLT_TYLE_8BIT           1\r
159 #define DLT_TYLE_16BIT          2\r
160 #define DLT_TYLE_32BIT          3\r
161 #define DLT_TYLE_64BIT          4\r
162 #define DLT_TYLE_128BIT         5\r
163 \r
164 #define DLT_SCOD_ASCII      0\r
165 #define DLT_SCOD_UTF8       1\r
166 \r
167 /*\r
168  * Definitions of DLT services.\r
169  */\r
170 #define DLT_SERVICE_ID_SET_LOG_LEVEL                   0x01 /**< Service ID: Set log level */\r
171 #define DLT_SERVICE_ID_SET_TRACE_STATUS                0x02 /**< Service ID: Set trace status */\r
172 #define DLT_SERVICE_ID_GET_LOG_INFO                    0x03 /**< Service ID: Get log info */\r
173 #define DLT_SERVICE_ID_GET_DEFAULT_LOG_LEVEL           0x04 /**< Service ID: Get dafault log level */\r
174 #define DLT_SERVICE_ID_STORE_CONFIG                    0x05 /**< Service ID: Store configuration */\r
175 #define DLT_SERVICE_ID_RESET_TO_FACTORY_DEFAULT        0x06 /**< Service ID: Reset to factory defaults */\r
176 #define DLT_SERVICE_ID_SET_COM_INTERFACE_STATUS        0x07 /**< Service ID: Set communication interface status */\r
177 #define DLT_SERVICE_ID_SET_COM_INTERFACE_MAX_BANDWIDTH 0x08 /**< Service ID: Set communication interface maximum bandwidth */\r
178 #define DLT_SERVICE_ID_SET_VERBOSE_MODE                0x09 /**< Service ID: Set verbose mode */\r
179 #define DLT_SERVICE_ID_SET_MESSAGE_FILTERING           0x0A /**< Service ID: Set message filtering */\r
180 #define DLT_SERVICE_ID_SET_TIMING_PACKETS              0x0B /**< Service ID: Set timing packets */\r
181 #define DLT_SERVICE_ID_GET_LOCAL_TIME                  0x0C /**< Service ID: Get local time */\r
182 #define DLT_SERVICE_ID_USE_ECU_ID                      0x0D /**< Service ID: Use ECU id */\r
183 #define DLT_SERVICE_ID_USE_SESSION_ID                  0x0E /**< Service ID: Use session id */\r
184 #define DLT_SERVICE_ID_USE_TIMESTAMP                   0x0F /**< Service ID: Use timestamp */\r
185 #define DLT_SERVICE_ID_USE_EXTENDED_HEADER             0x10 /**< Service ID: Use extended header */\r
186 #define DLT_SERVICE_ID_SET_DEFAULT_LOG_LEVEL           0x11 /**< Service ID: Set default log level */\r
187 #define DLT_SERVICE_ID_SET_DEFAULT_TRACE_STATUS        0x12 /**< Service ID: Set default trace status */\r
188 #define DLT_SERVICE_ID_GET_SOFTWARE_VERSION            0x13 /**< Service ID: Get software version */\r
189 #define DLT_SERVICE_ID_MESSAGE_BUFFER_OVERFLOW         0x14 /**< Service ID: Message buffer overflow */\r
190 #define DLT_SERVICE_ID_CALLSW_CINJECTION              0xFFF /**< Service ID: Message Injection (minimal ID) */\r
191 \r
192 /*\r
193  * Definitions of DLT service response status\r
194  */\r
195 #define DLT_SERVICE_RESPONSE_OK            0x00 /**< Control message response: OK */\r
196 #define DLT_SERVICE_RESPONSE_NOT_SUPPORTED 0x01 /**< Control message response: Not supported */\r
197 #define DLT_SERVICE_RESPONSE_ERROR         0x02 /**< Control message response: Error */\r
198 \r
199 /**\r
200   \}\r
201 */\r
202 \r
203 #endif /* DLT_PROTOCOL_H */\r