2 * Routines for uds protocol packet disassembly
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
13 #include <epan/packet.h>
15 #include <epan/unit_strings.h>
17 #include <wsutil/array.h>
18 #include "packet-uds.h"
19 #include "packet-doip.h"
20 #include "packet-hsfz.h"
21 #include "packet-iso10681.h"
22 #include "packet-iso15765.h"
23 #include "packet-ber.h"
24 #include "packet-x509af.h"
25 #include <wsutil/utf8_entities.h>
27 void proto_register_uds(void);
28 void proto_reg_handoff_uds(void);
30 #define DATAFILE_UDS_ROUTINE_IDS "UDS_routine_identifiers"
31 #define DATAFILE_UDS_DATA_IDS "UDS_data_identifiers"
32 #define DATAFILE_UDS_DTC_IDS "UDS_dtc_identifiers"
33 #define DATAFILE_UDS_ADDRESSES "UDS_diagnostic_addresses"
35 #define UDS_RESPONSE_CODES_GR 0x10
36 #define UDS_RESPONSE_CODES_SNS 0x11
37 #define UDS_RESPONSE_CODES_SFNS 0x12
38 #define UDS_RESPONSE_CODES_IMLOIF 0x13
39 #define UDS_RESPONSE_CODES_RTL 0x14
40 #define UDS_RESPONSE_CODES_BRR 0x21
41 #define UDS_RESPONSE_CODES_CNC 0x22
42 #define UDS_RESPONSE_CODES_RSE 0x24
43 #define UDS_RESPONSE_CODES_NRFSC 0x25
44 #define UDS_RESPONSE_CODES_FPEORA 0x26
45 #define UDS_RESPONSE_CODES_ROOR 0x31
46 #define UDS_RESPONSE_CODES_SAD 0x33
47 #define UDS_RESPONSE_CODES_AR 0x34
48 #define UDS_RESPONSE_CODES_IK 0x35
49 #define UDS_RESPONSE_CODES_ENOA 0x36
50 #define UDS_RESPONSE_CODES_RTDNE 0x37
51 #define UDS_RESPONSE_CODES_SDTR 0x38
52 #define UDS_RESPONSE_CODES_SDTNA 0x39
53 #define UDS_RESPONSE_CODES_SDTF 0x3A
54 #define UDS_RESPONSE_CODES_CVFITP 0x50
55 #define UDS_RESPONSE_CODES_CVFIS 0x51
56 #define UDS_RESPONSE_CODES_CVFICOT 0x52
57 #define UDS_RESPONSE_CODES_CVFIT 0x53
58 #define UDS_RESPONSE_CODES_CVFIF 0x54
59 #define UDS_RESPONSE_CODES_CVFIC 0x55
60 #define UDS_RESPONSE_CODES_CVFISD 0x56
61 #define UDS_RESPONSE_CODES_CVFICR 0x57
62 #define UDS_RESPONSE_CODES_OVF 0x58
63 #define UDS_RESPONSE_CODES_CCF 0x59
64 #define UDS_RESPONSE_CODES_SARF 0x5A
65 #define UDS_RESPONSE_CODES_SKCDF 0x5B
66 #define UDS_RESPONSE_CODES_CDUF 0x5C
67 #define UDS_RESPONSE_CODES_DAF 0x5D
68 #define UDS_RESPONSE_CODES_UDNA 0x70
69 #define UDS_RESPONSE_CODES_TDS 0x71
70 #define UDS_RESPONSE_CODES_GPF 0x72
71 #define UDS_RESPONSE_CODES_WBSC 0x73
72 #define UDS_RESPONSE_CODES_RCRRP 0x78
73 #define UDS_RESPONSE_CODES_SFNSIAS 0x7E
74 #define UDS_RESPONSE_CODES_SNSIAS 0x7F
75 #define UDS_RESPONSE_CODES_RPMTH 0x81
76 #define UDS_RESPONSE_CODES_RPMTL 0x82
77 #define UDS_RESPONSE_CODES_EIR 0x83
78 #define UDS_RESPONSE_CODES_EINR 0x84
79 #define UDS_RESPONSE_CODES_ERTTL 0x85
80 #define UDS_RESPONSE_CODES_TEMPTH 0x86
81 #define UDS_RESPONSE_CODES_TEMPTL 0x87
82 #define UDS_RESPONSE_CODES_VSTH 0x88
83 #define UDS_RESPONSE_CODES_VSTL 0x89
84 #define UDS_RESPONSE_CODES_TPTH 0x8a
85 #define UDS_RESPONSE_CODES_TPTL 0x8b
86 #define UDS_RESPONSE_CODES_TRNIN 0x8c
87 #define UDS_RESPONSE_CODES_TRNIG 0x8d
88 #define UDS_RESPONSE_CODES_BSNC 0x8f
89 #define UDS_RESPONSE_CODES_SLNIP 0x90
90 #define UDS_RESPONSE_CODES_TCCL 0x91
91 #define UDS_RESPONSE_CODES_VTH 0x92
92 #define UDS_RESPONSE_CODES_VTL 0x93
93 #define UDS_RESPONSE_CODES_RTNA 0x94
95 #define UDS_SUBFUNCTION_MASK 0x7f
96 #define UDS_SUPPRESS_POS_RSP_MSG_IND_MASK 0x80
98 #define UDS_DSC_TYPES_DEFAULT_SESSION 1
99 #define UDS_DSC_TYPES_PROGRAMMING_SESSION 2
100 #define UDS_DSC_TYPES_EXTENDED_DIAGNOSTIC_SESSION 3
101 #define UDS_DSC_TYPES_SAFETY_SYSTEM_DIAGNOSTIC_SESSION 4
103 #define UDS_ER_TYPES_HARD_RESET 1
104 #define UDS_ER_TYPES_KEY_OFF_ON_RESET 2
105 #define UDS_ER_TYPES_SOFT_RESET 3
106 #define UDS_ER_TYPES_ENABLE_RAPID_POWER_SHUTDOWN 4
107 #define UDS_ER_TYPES_DISABLE_RAPID_POWER_SHUTDOWN 5
109 #define UDS_ER_TYPE_ENABLE_RAPID_POWER_SHUTDOWN_INVALID 0xFF
111 #define UDS_RDTCI_TYPES_NUMBER_BY_STATUS_MASK 0x1
112 #define UDS_RDTCI_TYPES_BY_STATUS_MASK 0x2
113 #define UDS_RDTCI_TYPES_SNAPSHOT_IDENTIFICATION 0x3
114 #define UDS_RDTCI_TYPES_SNAPSHOT_RECORD_BY_DTC 0x4
115 #define UDS_RDTCI_TYPES_SNAPSHOT_RECORD_BY_RECORD 0x5
116 #define UDS_RDTCI_TYPES_EXTENDED_RECORD_BY_DTC 0x6
117 #define UDS_RDTCI_TYPES_NUM_DTC_BY_SEVERITY_MASK 0x7
118 #define UDS_RDTCI_TYPES_BY_SEVERITY_MASK 0x8
119 #define UDS_RDTCI_TYPES_SEVERITY_INFO_OF_DTC 0x9
120 #define UDS_RDTCI_TYPES_SUPPORTED_DTC 0xA
121 #define UDS_RDTCI_TYPES_FIRST_TEST_FAILED_DTC 0xB
122 #define UDS_RDTCI_TYPES_FIRST_CONFIRMED_DTC 0xC
123 #define UDS_RDTCI_TYPES_MOST_RECENT_TEST_FAILED 0xD
124 #define UDS_RDTCI_TYPES_MOST_RECENT_CONFIRMED_DTC 0xE
125 #define UDS_RDTCI_TYPES_OUTDATED_RMMDTCBSM 0xF
126 #define UDS_RDTCI_TYPES_OUTDATED_RMMDEDRBDN 0x10
127 #define UDS_RDTCI_TYPES_OUTDATED_RNOMMDTCBSM 0x11
128 #define UDS_RDTCI_TYPES_OUTDATED_RNOOEOBDDTCBSM 0x12
129 #define UDS_RDTCI_TYPES_OUTDATED_ROBDDTCBSM 0x13
130 #define UDS_RDTCI_TYPES_DTC_FAULT_DETECT_CTR 0x14
131 #define UDS_RDTCI_TYPES_DTC_WITH_PERM_STATUS 0x15
132 #define UDS_RDTCI_TYPES_DTC_EXT_DATA_REC_BY_NUM 0x16
133 #define UDS_RDTCI_TYPES_USER_MEM_DTC_BY_STATUS_M 0x17
134 #define UDS_RDTCI_TYPES_USER_MEM_DTC_REC_BY_DTC_N 0x18
135 #define UDS_RDTCI_TYPES_USER_MEM_DTC_EXT_REC_BY_N 0x19
136 #define UDS_RDTCI_TYPES_SUP_DTC_EXT_RECORD 0x1A
137 #define UDS_RDTCI_TYPES_WWH_OBD_DTC_BY_MASK_REC 0x42
138 #define UDS_RDTCI_TYPES_WWH_OBD_DTC_PERM_STATUS 0x55
139 #define UDS_RDTCI_TYPES_WWH_OBD_BY_GROUP_READY 0x56
141 #define UDS_RDTCI_DTC_STATUS_TEST_FAILED 0x01
142 #define UDS_RDTCI_DTC_STATUS_TEST_FAILED_THIS_OPER_CYCLE 0x02
143 #define UDS_RDTCI_DTC_STATUS_PENDING_DTC 0x04
144 #define UDS_RDTCI_DTC_STATUS_CONFIRMED_DTC 0x08
145 #define UDS_RDTCI_DTC_STATUS_TEST_NOT_COMPL_SINCE_LAST_CLEAR 0x10
146 #define UDS_RDTCI_DTC_STATUS_TEST_FAILED_SINCE_LAST_CLEAR 0x20
147 #define UDS_RDTCI_DTC_STATUS_TEST_NOT_COMPL_THIS_OPER_CYCLE 0x40
148 #define UDS_RDTCI_DTC_STATUS_WARNING_INDICATOR_REQUESTED 0x80
150 #define UDS_RSDBI_DATA_TYPE_UNSIGNED_NUM 0x00
151 #define UDS_RSDBI_DATA_TYPE_SIGNED_NUM 0x01
152 #define UDS_RSDBI_DATA_TYPE_BITMAPPED_REPORTED_WO_MAP 0x02
153 #define UDS_RSDBI_DATA_TYPE_BITMAPPED_REPORTED_WITH_MAP 0x03
154 #define UDS_RSDBI_DATA_TYPE_BINARY_CODED_DECIMAL 0x04
155 #define UDS_RSDBI_DATA_TYPE_STATE_ENCODED_VARIABLE 0x05
156 #define UDS_RSDBI_DATA_TYPE_ASCII 0x06
157 #define UDS_RSDBI_DATA_TYPE_SIGNED_FLOAT 0x07
158 #define UDS_RSDBI_DATA_TYPE_PACKET 0x08
159 #define UDS_RSDBI_DATA_TYPE_FORMULA 0x09
160 #define UDS_RSDBI_DATA_TYPE_UNIT_FORMAT 0x0a
161 #define UDS_RSDBI_DATA_TYPE_STATE_AND_CONNECTION_TYPE 0x0b
163 #define UDS_SA_TYPES_RESERVED 0x00
164 #define UDS_SA_TYPES_REQUEST_SEED 0x01
165 #define UDS_SA_TYPES_SEND_KEY 0x02
166 #define UDS_SA_TYPES_REQUEST_SEED_ISO26021 0x03
167 #define UDS_SA_TYPES_SEND_KEY_ISO26021 0x04
168 #define UDS_SA_TYPES_SUPPLIER 0xFE
169 #define UDS_SA_TYPES_UNCLEAR 0xFF
171 #define UDS_CC_TYPES_ENABLE_RX_AND_TX 0
172 #define UDS_CC_TYPES_ENABLE_RX_AND_DISABLE_TX 1
173 #define UDS_CC_TYPES_DISABLE_RX_AND_ENABLE_TX 2
174 #define UDS_CC_TYPES_DISABLE_RX_AND_TX 3
175 #define UDS_CC_TYPES_ENABLE_RX_AND_DISABLE_TX_WITH_ENH_ADDR_INFO 4
176 #define UDS_CC_TYPES_ENABLE_RX_AND_TX_WITH_ENH_ADDR_INFO 5
178 #define UDS_CC_COMM_TYPE_COMM_TYPE_MASK 0x03
179 #define UDS_CC_COMM_TYPE_SUBNET_NUMBER_MASK 0xF0
181 #define UDS_ARS_TYPES_DEAUTHENTICATE 0x00
182 #define UDS_ARS_TYPES_VERIFY_CERT_UNIDIRECTIONAL 0x01
183 #define UDS_ARS_TYPES_VERIFY_CERT_BIDIRECTIONAL 0x02
184 #define UDS_ARS_TYPES_PROOF_OF_OWNERSHIP 0x03
185 #define UDS_ARS_TYPES_TRANSMIT_CERTIFICATE 0x04
186 #define UDS_ARS_TYPES_REQUEST_CHALLENGE_FOR_AUTH 0x05
187 #define UDS_ARS_TYPES_VERIFY_PROOF_OF_OWN_UNIDIR 0x06
188 #define UDS_ARS_TYPES_VERIFY_PROOF_OF_OWN_BIDIR 0x07
189 #define UDS_ARS_TYPES_AUTH_CONFIGURATION 0x08
191 #define UDS_ARS_AUTH_RET_REQUEST_ACCEPTED 0x00
192 #define UDS_ARS_AUTH_RET_GENERAL_REJECT 0x01
193 #define UDS_ARS_AUTH_RET_AUTH_CONFIG_APCE 0x02
194 #define UDS_ARS_AUTH_RET_AUTH_CONFIG_ACR_SYM 0x03
195 #define UDS_ARS_AUTH_RET_AUTH_CONFIG_ACR_ASYM 0x04
196 #define UDS_ARS_AUTH_RET_DEAUTH_SUCCESS 0x10
197 #define UDS_ARS_AUTH_RET_CERT_VER_OWN_VER_NEC 0x11
198 #define UDS_ARS_AUTH_RET_OWN_VER_AUTH_COMPL 0x12
199 #define UDS_ARS_AUTH_RET_CERT_VERIFIED 0x13
201 #define UDS_DDDI_TYPES_DEFINE_BY_IDENTIFIER 0x01
202 #define UDS_DDDI_TYPES_DEFINE_BY_MEM_ADDRESS 0x02
203 #define UDS_DDDI_TYPES_CLEAR_DYN_DEF_DATA_ID 0x03
205 #define UDS_IOCBI_PARAMETERS_RETURN_CONTROL_TO_ECU 0
206 #define UDS_IOCBI_PARAMETERS_RESET_TO_DEFAULT 1
207 #define UDS_IOCBI_PARAMETERS_FREEZE_CURRENT_STATE 2
208 #define UDS_IOCBI_PARAMETERS_SHORT_TERM_ADJUSTMENT 3
210 #define UDS_RC_TYPES_START 1
211 #define UDS_RC_TYPES_STOP 2
212 #define UDS_RC_TYPES_REQUEST 3
214 #define UDS_RD_COMPRESSION_METHOD_MASK 0xF0
215 #define UDS_RD_ENCRYPTING_METHOD_MASK 0x0F
216 #define UDS_RD_MEMORY_SIZE_LENGTH_MASK 0xF0
217 #define UDS_RD_MEMORY_ADDRESS_LENGTH_MASK 0x0F
218 #define UDS_RD_MAX_BLOCK_LEN_LEN_MASK 0xF0
220 #define UDS_RFT_MODE_ADD_FILE 0x01
221 #define UDS_RFT_MODE_DELETE_FILE 0x02
222 #define UDS_RFT_MODE_REPLACE_FILE 0x03
223 #define UDS_RFT_MODE_READ_FILE 0x04
224 #define UDS_RFT_MODE_READ_DIR 0x05
225 #define UDS_RFT_MODE_RESUME_FILE 0x06
227 #define UDS_SDT_ADMIN_PARAM_REQ 0x0001
228 #define UDS_SDT_ADMIN_PARAM_PRE_ESTABL_KEY 0x0008
229 #define UDS_SDT_ADMIN_PARAM_ENCRYPTED 0x0010
230 #define UDS_SDT_ADMIN_PARAM_SIGNED 0x0020
231 #define UDS_SDT_ADMIN_PARAM_SIGN_ON_RESP_REQ 0x0040
233 #define UDS_CDTCS_ACTIONS_ON 1
234 #define UDS_CDTCS_ACTIONS_OFF 2
236 #define UDS_LC_TYPES_VMTWFP 1
237 #define UDS_LC_TYPES_VMTWSP 2
238 #define UDS_LC_TYPES_TM 3
240 #define UDS_DID_BSIDID 0xF180
241 #define UDS_DID_ASIDID 0xF181
242 #define UDS_DID_ADIDID 0xF182
243 #define UDS_DID_BSFPDID 0xF183
244 #define UDS_DID_ASFPDID 0xF184
245 #define UDS_DID_ADFPDID 0xF185
246 #define UDS_DID_ADSDID 0xF186
247 #define UDS_DID_VMSPNDID 0xF187
248 #define UDS_DID_VMECUSNDID 0xF188
249 #define UDS_DID_VMECUSVNDID 0xF189
250 #define UDS_DID_SSIDDID 0xF18A
251 #define UDS_DID_ECUMDDID 0xF18B
252 #define UDS_DID_ECUSNDID 0xF18C
253 #define UDS_DID_SFUDID 0xF18D
254 #define UDS_DID_VMKAPNDID 0xF18E
255 #define UDS_DID_RXSWIN 0xF18F
256 #define UDS_DID_VINDID 0xF190
257 #define UDS_DID_VMECUHNDID 0xF191
258 #define UDS_DID_SSECUHWNDID 0xF192
259 #define UDS_DID_SSECUHWVNDID 0xF193
260 #define UDS_DID_SSECUSWNDID 0xF194
261 #define UDS_DID_SSECUSWVNDID 0xF195
262 #define UDS_DID_EROTANDID 0xF196
263 #define UDS_DID_SNOETDID 0xF197
264 #define UDS_DID_RSCOTSNDID 0xF198
265 #define UDS_DID_PDDID 0xF199
266 #define UDS_DID_CRSCOCESNDID 0xF19A
267 #define UDS_DID_CDDID 0xF19B
268 #define UDS_DID_CESWNDID 0xF19D
269 #define UDS_DID_EIDDID 0xF19D
270 #define UDS_DID_ODXFDID 0xF19E
271 #define UDS_DID_EDID 0xF19F
272 #define UDS_DID_ADDID_FA00 0xFA00
273 #define UDS_DID_ADDID_FA01 0xFA01
274 #define UDS_DID_ADDID_FA02 0xFA02
275 #define UDS_DID_ADDID_FA03 0xFA03
276 #define UDS_DID_ADDID_FA04 0xFA04
277 #define UDS_DID_ADDID_FA05 0xFA05
278 #define UDS_DID_ADDID_FA06 0xFA06
279 #define UDS_DID_ADDID_FA07 0xFA07
280 #define UDS_DID_ADDID_FA08 0xFA08
281 #define UDS_DID_ADDID_FA09 0xFA09
282 #define UDS_DID_ADDID_FA0A 0xFA0A
283 #define UDS_DID_ADDID_FA0B 0xFA0B
284 #define UDS_DID_ADDID_FA0C 0xFA0C
285 #define UDS_DID_ADDID_FA0D 0xFA0D
286 #define UDS_DID_ADDID_FA0E 0xFA0E
287 #define UDS_DID_ADDID_FA0F 0xFA0F
288 #define UDS_DID_NOEDRD 0xFA10
289 #define UDS_DID_EDRI 0xFA11
290 #define UDS_DID_EDRDAI 0xFA12
291 #define UDS_DID_UDSVDID 0xFF00
292 #define UDS_DID_RESRVDCPADLC 0xFF01
294 #define UDS_RID_EXSPLRI_ 0xE200
295 #define UDS_RID_DLRI_ 0xE201
296 #define UDS_RID_EM_ 0xFF00
297 #define UDS_RID_CPD_ 0xFF01
298 #define UDS_RID_FF02 0xFF02
305 static const value_string _uds_services
[]= {
306 {OBD_SERVICES_0x01
, "OBD - Request Current Powertrain Diagnostic Data"},
307 {OBD_SERVICES_0x02
, "OBD - Request Powertrain Freeze Frame Data"},
308 {OBD_SERVICES_0x03
, "OBD - Request Emission-Related Diagnostic Trouble Codes"},
309 {OBD_SERVICES_0x04
, "OBD - Clear/Reset Emission-Related Diagnostic Information"},
310 {OBD_SERVICES_0x05
, "OBD - Request Oxygen Sensor Monitoring Test Results"},
311 {OBD_SERVICES_0x06
, "OBD - Request On-Board Monitoring Test Results for Specific Monitored Systems"},
312 {OBD_SERVICES_0x07
, "OBD - Request Emission-Related Diagnostic Trouble Codes Detected During Current or Last Completed Driving Cycle"},
313 {OBD_SERVICES_0x08
, "OBD - Request Control of On-Board System, Test or Component"},
314 {OBD_SERVICES_0x09
, "OBD - Request Vehicle Information"},
315 {OBD_SERVICES_0x0A
, "OBD - Request Emission-Related Diagnostic Trouble Codes with Permanent Status"},
316 {OBD_SERVICES_0x0B
, "OBD - Unknown Service"},
317 {OBD_SERVICES_0x0C
, "OBD - Unknown Service"},
318 {OBD_SERVICES_0x0D
, "OBD - Unknown Service"},
319 {OBD_SERVICES_0x0E
, "OBD - Unknown Service"},
320 {OBD_SERVICES_0x0F
, "OBD - Unknown Service"},
322 {UDS_SERVICES_DSC
, "Diagnostic Session Control"},
323 {UDS_SERVICES_ER
, "ECU Reset"},
324 {UDS_SERVICES_CDTCI
, "Clear Diagnostic Information"},
325 {UDS_SERVICES_RDTCI
, "Read DTC Information"},
326 {UDS_SERVICES_RDBI
, "Read Data By Identifier"},
327 {UDS_SERVICES_RMBA
, "Read Memory By Address"},
328 {UDS_SERVICES_RSDBI
, "Read Scaling Data By Identifier"},
329 {UDS_SERVICES_SA
, "Security Access"},
330 {UDS_SERVICES_CC
, "Communication Control"},
331 {UDS_SERVICES_ARS
, "Authentication"},
332 {UDS_SERVICES_RDBPI
, "Read Data By Periodic Identifier"},
333 {UDS_SERVICES_DDDI
, "Dynamically Define Data Identifier"},
334 {UDS_SERVICES_WDBI
, "Write Data By Identifier"},
335 {UDS_SERVICES_IOCBI
, "Input Output Control By Identifier"},
336 {UDS_SERVICES_RC
, "Routine Control"},
337 {UDS_SERVICES_RD
, "Request Download"},
338 {UDS_SERVICES_RU
, "Request Upload"},
339 {UDS_SERVICES_TD
, "Transfer Data"},
340 {UDS_SERVICES_RTE
, "Request Transfer Exit"},
341 {UDS_SERVICES_RFT
, "Request File Transfer"},
342 {UDS_SERVICES_WMBA
, "Write Memory By Address"},
343 {UDS_SERVICES_TP
, "Tester Present"},
344 {UDS_SERVICES_ERR
, "Error"},
345 {UDS_SERVICES_SDT
, "Secured Data Transmission"},
346 {UDS_SERVICES_CDTCS
, "Control DTC Setting"},
347 {UDS_SERVICES_ROE
, "Response On Event"},
348 {UDS_SERVICES_LC
, "Link Control"},
351 static value_string_ext uds_services_ext
= VALUE_STRING_EXT_INIT(_uds_services
);
354 static const value_string _uds_response_codes
[]= {
355 {UDS_RESPONSE_CODES_GR
, "General reject"},
356 {UDS_RESPONSE_CODES_SNS
, "Service not supported"},
357 {UDS_RESPONSE_CODES_SFNS
, "SubFunction Not Supported"},
358 {UDS_RESPONSE_CODES_IMLOIF
, "Incorrect Message Length or Invalid Format"},
359 {UDS_RESPONSE_CODES_RTL
, "Response too long"},
360 {UDS_RESPONSE_CODES_BRR
, "Busy repeat request"},
361 {UDS_RESPONSE_CODES_CNC
, "Conditions Not Correct"},
362 {UDS_RESPONSE_CODES_RSE
, "Request Sequence Error"},
363 {UDS_RESPONSE_CODES_NRFSC
, "No response from sub-net component"},
364 {UDS_RESPONSE_CODES_FPEORA
, "Failure prevents execution of requested action"},
365 {UDS_RESPONSE_CODES_ROOR
, "Request Out of Range"},
366 {UDS_RESPONSE_CODES_SAD
, "Security Access Denied"},
367 {UDS_RESPONSE_CODES_AR
, "Authentication Required"},
368 {UDS_RESPONSE_CODES_IK
, "Invalid Key"},
369 {UDS_RESPONSE_CODES_ENOA
, "Exceeded Number Of Attempts"},
370 {UDS_RESPONSE_CODES_RTDNE
, "Required Time Delay Not Expired"},
371 {UDS_RESPONSE_CODES_SDTR
, "Secure Data Transmission Required"},
372 {UDS_RESPONSE_CODES_SDTNA
, "Secure Data Transmission Not Allowed"},
373 {UDS_RESPONSE_CODES_SDTF
, "Secure Data Verification Failed"},
374 {UDS_RESPONSE_CODES_CVFITP
, "Certificate Verification Failed: Invalid Time Period"},
375 {UDS_RESPONSE_CODES_CVFIS
, "Certificate Verification Failed: Invalid Signature"},
376 {UDS_RESPONSE_CODES_CVFICOT
, "Certificate Verification Failed: Invalid Chain of Trust"},
377 {UDS_RESPONSE_CODES_CVFIT
, "Certificate Verification Failed: Invalid Type"},
378 {UDS_RESPONSE_CODES_CVFIF
, "Certificate Verification Failed: Invalid Format"},
379 {UDS_RESPONSE_CODES_CVFIC
, "Certificate Verification Failed: Invalid Content"},
380 {UDS_RESPONSE_CODES_CVFISD
, "Certificate Verification Failed: Invalid Scope"},
381 {UDS_RESPONSE_CODES_CVFICR
, "Certificate Verification Failed: Invalid Certificate (revoked)"},
382 {UDS_RESPONSE_CODES_OVF
, "Ownership Verification Failed"},
383 {UDS_RESPONSE_CODES_CCF
, "Challenge Calculation Failed"},
384 {UDS_RESPONSE_CODES_SARF
, "Setting Access Rights Failed"},
385 {UDS_RESPONSE_CODES_SKCDF
, "Session Key Creation/Derivation Failed"},
386 {UDS_RESPONSE_CODES_CDUF
, "Configuration Data Usage Failed"},
387 {UDS_RESPONSE_CODES_DAF
, "DeAuthentication Failed"},
388 {UDS_RESPONSE_CODES_UDNA
, "Upload/Download not accepted"},
389 {UDS_RESPONSE_CODES_TDS
, "Transfer data suspended"},
390 {UDS_RESPONSE_CODES_GPF
, "General Programming Failure"},
391 {UDS_RESPONSE_CODES_WBSC
, "Wrong Block Sequence Counter"},
392 {UDS_RESPONSE_CODES_RCRRP
, "Request correctly received, but response is pending"},
393 {UDS_RESPONSE_CODES_SFNSIAS
, "Subfunction not supported in active session"},
394 {UDS_RESPONSE_CODES_SNSIAS
, "Service not supported in active session"},
395 {UDS_RESPONSE_CODES_RPMTH
, "RPM Too High"},
396 {UDS_RESPONSE_CODES_RPMTL
, "RPM Too Low"},
397 {UDS_RESPONSE_CODES_EIR
, "Engine Is Running"},
398 {UDS_RESPONSE_CODES_EINR
, "Engine Is Not Running"},
399 {UDS_RESPONSE_CODES_ERTTL
, "Run Time Too Low"},
400 {UDS_RESPONSE_CODES_TEMPTH
, "Temperature Too High"},
401 {UDS_RESPONSE_CODES_TEMPTL
, "Temperature Too Low"},
402 {UDS_RESPONSE_CODES_VSTH
, "Vehicle Speed Too High"},
403 {UDS_RESPONSE_CODES_VSTL
, "Vehicle Speed Too Low"},
404 {UDS_RESPONSE_CODES_TPTH
, "Throttle/Pedal Too High"},
405 {UDS_RESPONSE_CODES_TPTL
, "Throttle/Pedal Too Low"},
406 {UDS_RESPONSE_CODES_TRNIN
, "Transmission Range Not In Neutral"},
407 {UDS_RESPONSE_CODES_TRNIG
, "Transmission Range Not In Gear"},
408 {UDS_RESPONSE_CODES_BSNC
, "Brake Switch(es) Not Closed"},
409 {UDS_RESPONSE_CODES_SLNIP
, "Shifter/Lever Not in Park"},
410 {UDS_RESPONSE_CODES_TCCL
, "Torque Converter Clutch Locked"},
411 {UDS_RESPONSE_CODES_VTH
, "Voltage Too High"},
412 {UDS_RESPONSE_CODES_VTL
, "Voltage Too Low"},
413 {UDS_RESPONSE_CODES_RTNA
, "Resource Temporarily Not Available"},
416 static value_string_ext uds_response_codes_ext
= VALUE_STRING_EXT_INIT(_uds_response_codes
);
419 static const value_string uds_dsc_types
[] = {
421 {UDS_DSC_TYPES_DEFAULT_SESSION
, "Default Session"},
422 {UDS_DSC_TYPES_PROGRAMMING_SESSION
, "Programming Session"},
423 {UDS_DSC_TYPES_EXTENDED_DIAGNOSTIC_SESSION
, "Extended Diagnostic Session"},
424 {UDS_DSC_TYPES_SAFETY_SYSTEM_DIAGNOSTIC_SESSION
, "Safety System Diagnostic Session"},
429 static const value_string uds_er_types
[] = {
431 {UDS_ER_TYPES_HARD_RESET
, "Hard Reset"},
432 {UDS_ER_TYPES_KEY_OFF_ON_RESET
, "Key Off On Reset"},
433 {UDS_ER_TYPES_SOFT_RESET
, "Soft Reset"},
434 {UDS_ER_TYPES_ENABLE_RAPID_POWER_SHUTDOWN
, "Enable Rapid Power Shutdown"},
435 {UDS_ER_TYPES_DISABLE_RAPID_POWER_SHUTDOWN
, "Disable Rapid Power Shutdown"},
440 static const value_string uds_cdtci_group_of_dtc
[] = {
441 {0xffff33, "Emissions-system group"},
442 {0xffffd0, "Safety-system group"},
443 {0xfffffe, "VOBD system"},
444 {0xffffff, "All Groups (all DTCs)"},
449 static const value_string _uds_rdtci_types
[] = {
450 {UDS_RDTCI_TYPES_NUMBER_BY_STATUS_MASK
, "Report Number of DTC by Status Mask"},
451 {UDS_RDTCI_TYPES_BY_STATUS_MASK
, "Report DTC by Status Mask"},
452 {UDS_RDTCI_TYPES_SNAPSHOT_IDENTIFICATION
, "Report DTC Snapshot Identification"},
453 {UDS_RDTCI_TYPES_SNAPSHOT_RECORD_BY_DTC
, "Report DTC Snapshot Record by DTC Number"},
454 {UDS_RDTCI_TYPES_SNAPSHOT_RECORD_BY_RECORD
, "Report DTC Snapshot Record by Record Number"},
455 {UDS_RDTCI_TYPES_EXTENDED_RECORD_BY_DTC
, "Report DTC Extended Data Record by DTC Number"},
456 {UDS_RDTCI_TYPES_NUM_DTC_BY_SEVERITY_MASK
, "Report Number of DTC By Severity Mask"},
457 {UDS_RDTCI_TYPES_BY_SEVERITY_MASK
, "Report DTC by Severity Mask"},
458 {UDS_RDTCI_TYPES_SEVERITY_INFO_OF_DTC
, "Report Severity Information of DTC"},
459 {UDS_RDTCI_TYPES_SUPPORTED_DTC
, "Report Supported DTC"},
460 {UDS_RDTCI_TYPES_FIRST_TEST_FAILED_DTC
, "Report First Test Failed DTC"},
461 {UDS_RDTCI_TYPES_FIRST_CONFIRMED_DTC
, "Report First Confirmed DTC"},
462 {UDS_RDTCI_TYPES_MOST_RECENT_TEST_FAILED
, "Report Most Recent Test Failed DTC"},
463 {UDS_RDTCI_TYPES_MOST_RECENT_CONFIRMED_DTC
, "Report Most Recent Confirmed DTC"},
464 {UDS_RDTCI_TYPES_OUTDATED_RMMDTCBSM
, "Report Mirror Memory DTC By Status Mask (outdated 2013 revision)"},
465 {UDS_RDTCI_TYPES_OUTDATED_RMMDEDRBDN
, "Report Mirror Memory DTC Ext Data Record by DTC Number (outdated 2013 revision)"},
466 {UDS_RDTCI_TYPES_OUTDATED_RNOMMDTCBSM
, "Report Number of Mirror Memory DTC by Status Mask (outdated 2013 revision)"},
467 {UDS_RDTCI_TYPES_OUTDATED_RNOOEOBDDTCBSM
, "Report Number of Emissions OBD DTC by Status Mask (outdated 2013 revision)"},
468 {UDS_RDTCI_TYPES_OUTDATED_ROBDDTCBSM
, "Report Emissions OBD DTC By Status Mask (outdated 2013 revision)"},
469 {UDS_RDTCI_TYPES_DTC_FAULT_DETECT_CTR
, "Report DTC Fault Detection Counter"},
470 {UDS_RDTCI_TYPES_DTC_WITH_PERM_STATUS
, "Report DTC with Permanent Status"},
471 {UDS_RDTCI_TYPES_DTC_EXT_DATA_REC_BY_NUM
, "Report DTC Extended Data Record by Record Number"},
472 {UDS_RDTCI_TYPES_USER_MEM_DTC_BY_STATUS_M
, "Report User Defined Memory DTC By Status Mask"},
473 {UDS_RDTCI_TYPES_USER_MEM_DTC_REC_BY_DTC_N
, "Report User Defined Memory DTC Snapshot Record By DTC Number"},
474 {UDS_RDTCI_TYPES_USER_MEM_DTC_EXT_REC_BY_N
, "Report User Defined Memory DTC Extended Data Record by DTC Number"},
475 {UDS_RDTCI_TYPES_SUP_DTC_EXT_RECORD
, "Report List of DTCs Supporting Specific Extended Data Record"},
476 {UDS_RDTCI_TYPES_WWH_OBD_DTC_BY_MASK_REC
, "Report WWH-OBD DTC By Mask Record"},
477 {UDS_RDTCI_TYPES_WWH_OBD_DTC_PERM_STATUS
, "Report WWH-OBD DTC With Permanent Status"},
478 {UDS_RDTCI_TYPES_WWH_OBD_BY_GROUP_READY
, "Report WWH-OBD DTC By Readiness Group Identifier"},
481 static value_string_ext uds_rdtci_types_ext
= VALUE_STRING_EXT_INIT(_uds_rdtci_types
);
483 static const value_string uds_rdtci_format_id_types
[] = {
484 {0x00, "SAE J2012-DA DTC Format 00"},
485 {0x01, "ISO 14229-1 DTC Format"},
486 {0x02, "SAE J1939-73 DTC Format"},
487 {0x03, "ISO 11992-4 DTC Format"},
488 {0x04, "SAE J2012-DA DTC Format 04"},
493 static const value_string uds_rsdbi_data_types
[] = {
494 {UDS_RSDBI_DATA_TYPE_UNSIGNED_NUM
, "Unsigned Numeric"},
495 {UDS_RSDBI_DATA_TYPE_SIGNED_NUM
, "Signed Numeric"},
496 {UDS_RSDBI_DATA_TYPE_BITMAPPED_REPORTED_WO_MAP
, "Bit Mapped Reported Without Mask"},
497 {UDS_RSDBI_DATA_TYPE_BITMAPPED_REPORTED_WITH_MAP
, "Bit Mapped Reported With Mask"},
498 {UDS_RSDBI_DATA_TYPE_BINARY_CODED_DECIMAL
, "Binary Coded Decimal"},
499 {UDS_RSDBI_DATA_TYPE_STATE_ENCODED_VARIABLE
, "State Encoded Variable"},
500 {UDS_RSDBI_DATA_TYPE_ASCII
, "ASCII"},
501 {UDS_RSDBI_DATA_TYPE_SIGNED_FLOAT
, "Signed Floating Point"},
502 {UDS_RSDBI_DATA_TYPE_PACKET
, "Packet"},
503 {UDS_RSDBI_DATA_TYPE_FORMULA
, "Formula"},
504 {UDS_RSDBI_DATA_TYPE_UNIT_FORMAT
, "Unit/Format"},
505 {UDS_RSDBI_DATA_TYPE_STATE_AND_CONNECTION_TYPE
, "State And Connection Type"},
509 static const value_string uds_rsdbi_formulas
[] = {
510 {0, "y = C0 * x + C1"},
511 {1, "y = C0 * (x + C1)"},
512 {2, "y = C0 / (x + C1) + C2"},
513 {3, "y = x / C0 + C1"},
514 {4, "y = (x + C0) / C1"},
515 {5, "y = (x + C0) / C1 + C2"},
519 {9, "y = x * C0 / C1"},
523 static const value_string _uds_rsdbi_units
[] = {
524 {0x00, "No unit, no prefix"},
529 {0x05, "Mile (English) [mi]"},
531 {0x07, "Ton (metric) [t]"},
532 {0x08, "Second [s]"},
533 {0x09, "Minute [m]"},
537 {0x0d, "Ampere [A]"},
539 {0x0f, "Coulomb [C]"},
541 {0x10, "Ohm [W]"}, /* sic! */
544 {0x13, "Siemens [S]"},
545 {0x14, "Weber [Wb]"},
547 {0x16, "Kelvin [K]"},
548 {0x17, "Celsius [" UTF8_DEGREE_SIGN
"C]"},
549 {0x18, "Fahrenheit [" UTF8_DEGREE_SIGN
"F]"},
550 {0x19, "Candela [cd]"},
551 {0x1a, "Radian [rad]"},
552 {0x1b, "Degree [" UTF8_DEGREE_SIGN
"]"},
553 {0x1c, "Hertz [Hz]"},
555 {0x1e, "Newton [N]"},
556 {0x1f, "Kilopond [kp]"},
558 {0x20, "Pound force [lbf]"},
560 {0x22, "Horse power (metric) [hk]"},
561 {0x23, "Horse power (UK and US) [hp]"},
562 {0x24, "Pascal [Pa]"},
564 {0x26, "Atmosphere [atm]"},
565 {0x27, "Pound force per square inch [psi]"},
566 {0x28, "Becqerel [Bq]"},
567 {0x29, "Lumen [lm]"},
570 {0x2c, "Gallon (British)"},
571 {0x2d, "Gallon (US liq)"},
572 {0x2e, "Cubic inch [cu in]"},
573 {0x2f, "Meter per second [m/s]"},
575 {0x30, "Kilometer per hour [km/h]"},
576 {0x31, "Mile per hour [mph]"},
577 {0x32, "Revolutions per second [rps]"},
578 {0x33, "Revolutions per minute [rpm]"},
581 {0x36, "Milligram per stroke [mg/stroke]"},
582 {0x37, "Meter per square second [m/s" UTF8_SUPERSCRIPT_TWO
"]"},
583 {0x38, "Newton meter [Nm]"},
584 {0x39, "Litre per minute [l/min]"},
585 {0x3a, "Watt per square meter [w/m" UTF8_SUPERSCRIPT_TWO
"]"},
586 {0x3b, "Bar per second [bar/s]"},
587 {0x3c, "Radians per second [rad/s]"},
588 {0x3d, "Radians per square second [rad/s" UTF8_SUPERSCRIPT_TWO
"]"},
589 {0x3e, "Kilogram per square meter [kg/m" UTF8_SUPERSCRIPT_TWO
"]"},
590 {0x3f, "*reserved*"},
592 {0x40, "Exa (prefix) [E]"},
593 {0x41, "Peta (prefix) [P]"},
594 {0x42, "Tera (prefix) [T]"},
595 {0x43, "Giga (prefix) [G]"},
596 {0x44, "Mega (prefix) [M]"},
597 {0x45, "Kilo (prefix) [k]"},
598 {0x46, "Hecto (prefix) [h]"},
599 {0x47, "Deca (prefix) [da]"},
600 {0x48, "Deci (prefix) [d]"},
601 {0x49, "Centi (prefix) [c]"},
602 {0x4a, "Milli (prefix) [m]"},
603 {0x4b, "Micro (prefix) [m]"}, /* SIC! */
604 {0x4c, "Nano (prefix) [n]"},
605 {0x4d, "Pico (prefix) [p]"},
606 {0x4e, "Femto (prefix) [f]"},
607 {0x4f, "Atto (prefix) [a]"},
609 {0x50, "Date1 (Year-Month-Day)"},
610 {0x51, "Date2 (Day/Month/Year)"},
611 {0x52, "Date3 (Month/Day/Year)"},
612 {0x53, "Week (calender week)"},
613 {0x54, "Time1 (UTC Hour/Minute/Second)"},
614 {0x55, "Time2 (Hour/Minute/Second)"},
615 {0x56, "DateAndTime1 (Second/Minute/Hour/Day/Month/Year)"},
616 {0x57, "DateAndTime2 (Second/Minute/Hour/Day/Month/Year/Local minute offset/Local hour offset)"},
617 {0x58, "DateAndTime3 (Second/Minute/Hour/Month/Day/Year)"},
618 {0x59, "DateAndTime4 (Second/Minute/Hour/Month/Day/Year/Local minute offset/Local hour offset)"},
621 static value_string_ext uds_rsdbi_units_ext
= VALUE_STRING_EXT_INIT(_uds_rsdbi_units
);
624 static const value_string uds_cc_types
[] = {
625 {UDS_CC_TYPES_ENABLE_RX_AND_TX
, "Enable RX and TX"},
626 {UDS_CC_TYPES_ENABLE_RX_AND_DISABLE_TX
, "Enable RX and Disable TX"},
627 {UDS_CC_TYPES_DISABLE_RX_AND_ENABLE_TX
, "Disable RX and Enable TX"},
628 {UDS_CC_TYPES_DISABLE_RX_AND_TX
, "Disable RX and TX"},
629 {UDS_CC_TYPES_ENABLE_RX_AND_DISABLE_TX_WITH_ENH_ADDR_INFO
, "Enable RX and Disable TX with Enhanced Address Information"},
630 {UDS_CC_TYPES_ENABLE_RX_AND_TX_WITH_ENH_ADDR_INFO
, "Enable RX and TX with Enhanced Address Information"},
634 static const value_string uds_cc_comm_types
[] = {
636 {1, "Normal Communication Messages"},
637 {2, "Network Management Communication Messages"},
638 {3, "Network Management and Normal Communication Messages"},
642 static const value_string uds_cc_subnet_number_types
[] = {
643 {0x0, "Disable/Enable specified Communication Type "},
644 /* 0x1 .. 0xe specific subnets numbers */
645 {0xf, "Disable/Enable network which request is received on"},
650 static const value_string uds_ars_types
[] = {
651 {UDS_ARS_TYPES_DEAUTHENTICATE
, "DeAuthenticate"},
652 {UDS_ARS_TYPES_VERIFY_CERT_UNIDIRECTIONAL
, "Verify Certificate Unidirectional"},
653 {UDS_ARS_TYPES_VERIFY_CERT_BIDIRECTIONAL
, "Verify Certificate Bidirectional"},
654 {UDS_ARS_TYPES_PROOF_OF_OWNERSHIP
, "Proof of Ownership"},
655 {UDS_ARS_TYPES_TRANSMIT_CERTIFICATE
, "Transmit Certificate"},
656 {UDS_ARS_TYPES_REQUEST_CHALLENGE_FOR_AUTH
, "Request Challenge for Authentication"},
657 {UDS_ARS_TYPES_VERIFY_PROOF_OF_OWN_UNIDIR
, "Verify Proof of Ownership Unidirectional"},
658 {UDS_ARS_TYPES_VERIFY_PROOF_OF_OWN_BIDIR
, "Verify Proof of Ownership Bidirectional"},
659 {UDS_ARS_TYPES_AUTH_CONFIGURATION
, "Authentication Configuration"},
663 static const value_string uds_ars_auth_ret_types
[] = {
664 {UDS_ARS_AUTH_RET_REQUEST_ACCEPTED
, "Request Accepted"},
665 {UDS_ARS_AUTH_RET_GENERAL_REJECT
, "General Reject"},
666 {UDS_ARS_AUTH_RET_AUTH_CONFIG_APCE
, "Authentication Configuration APCE"},
667 {UDS_ARS_AUTH_RET_AUTH_CONFIG_ACR_SYM
, "Authentication Configuration ACR with asymmetric cryptography"},
668 {UDS_ARS_AUTH_RET_AUTH_CONFIG_ACR_ASYM
, "Authentication Configuration ACR with symmetric cryptography"},
669 {UDS_ARS_AUTH_RET_DEAUTH_SUCCESS
, "DeAuthentication successful "},
670 {UDS_ARS_AUTH_RET_CERT_VER_OWN_VER_NEC
, "Certificate Verified, Ownership Verification Necessary"},
671 {UDS_ARS_AUTH_RET_OWN_VER_AUTH_COMPL
, "Ownership Verified, Authentication Complete "},
672 {UDS_ARS_AUTH_RET_CERT_VERIFIED
, "Certificate Verified"},
677 static const value_string uds_rdbpi_transmission_mode
[] = {
679 {1, "Send at Slow Rate"},
680 {2, "Send at Medium Rate"},
681 {3, "Send at Fast Rate"},
687 static const value_string uds_dddi_types
[] = {
688 {UDS_DDDI_TYPES_DEFINE_BY_IDENTIFIER
, "Define by Identifier"},
689 {UDS_DDDI_TYPES_DEFINE_BY_MEM_ADDRESS
, "Define by Memory Address"},
690 {UDS_DDDI_TYPES_CLEAR_DYN_DEF_DATA_ID
, "Clear Dynamically Defined Data Identifier"},
695 static const value_string uds_iocbi_parameters
[] = {
696 {UDS_IOCBI_PARAMETERS_RETURN_CONTROL_TO_ECU
, "Return Control To ECU"},
697 {UDS_IOCBI_PARAMETERS_RESET_TO_DEFAULT
, "Reset To Default"},
698 {UDS_IOCBI_PARAMETERS_FREEZE_CURRENT_STATE
, "Freeze Current State"},
699 {UDS_IOCBI_PARAMETERS_SHORT_TERM_ADJUSTMENT
, "Short Term Adjustment"},
704 static const value_string uds_rc_types
[] = {
706 {UDS_RC_TYPES_START
, "Start routine"},
707 {UDS_RC_TYPES_STOP
, "Stop routine"},
708 {UDS_RC_TYPES_REQUEST
, "Request routine result"},
713 static const value_string uds_rft_mode_types
[] = {
715 {UDS_RFT_MODE_ADD_FILE
, "Add File"},
716 {UDS_RFT_MODE_DELETE_FILE
, "Delete File"},
717 {UDS_RFT_MODE_REPLACE_FILE
, "Replace File"},
718 {UDS_RFT_MODE_READ_FILE
, "Read File"},
719 {UDS_RFT_MODE_READ_DIR
, "Read Dir"},
720 {UDS_RFT_MODE_RESUME_FILE
, "Resume File"},
725 static const value_string uds_cdtcs_types
[] = {
727 {UDS_CDTCS_ACTIONS_ON
, "On"},
728 {UDS_CDTCS_ACTIONS_OFF
, "Off"},
733 static const value_string uds_lc_types
[] = {
735 {UDS_LC_TYPES_VMTWFP
, "Verify Mode Transition with fixed Parameter"},
736 {UDS_LC_TYPES_VMTWSP
, "Verify Mode Transition with specific Parameter"},
737 {UDS_LC_TYPES_TM
, "Transition Mode"},
741 static const value_string uds_lc_lcmi_types
[] = {
743 {0x01, "PC9600Baud"},
744 {0x02, "PC19200Baud"},
745 {0x03, "PC38400Baud"},
746 {0x04, "PC57600Baud"},
747 {0x05, "PC115200Baud"},
748 {0x10, "CAN125000Baud"},
749 {0x11, "CAN250000Baud"},
750 {0x12, "CAN500000Baud"},
751 {0x13, "CAN1000000Baud"},
752 {0x20, "ProgrammingSetup"},
757 static const value_string _uds_standard_did_types
[] = {
758 {UDS_DID_BSIDID
, "BootSoftwareIdentificationDataIdentifier"},
759 {UDS_DID_ASIDID
, "applicationSoftwareIdentificationDataIdentifier"},
760 {UDS_DID_ADIDID
, "applicationDataIdentificationDataIdentifier"},
761 {UDS_DID_BSFPDID
, "bootSoftwareFingerprintDataIdentifier"},
762 {UDS_DID_ASFPDID
, "applicationSoftwareFingerprintDataIdentifier"},
763 {UDS_DID_ADFPDID
, "applicationDataFingerprintDataIdentifier"},
764 {UDS_DID_ADSDID
, "ActiveDiagnosticSessionDataIdentifier"},
765 {UDS_DID_VMSPNDID
, "vehicleManufacturerSparePartNumberDataIdentifier"},
766 {UDS_DID_VMECUSNDID
, "vehicleManufacturerECUSoftwareNumberDataIdentifier"},
767 {UDS_DID_VMECUSVNDID
, "vehicleManufacturerECUSoftwareVersionNumberDataIdentifier"},
768 {UDS_DID_SSIDDID
, "systemSupplierIdentifierDataIdentifier"},
769 {UDS_DID_ECUMDDID
, "ECUManufacturingDateDataIdentifier (year/month/day)"},
770 {UDS_DID_ECUSNDID
, "ECUSerialNumberDataIdentifier"},
771 {UDS_DID_SFUDID
, "supportedFunctionalUnitsDataIdentifier"},
772 {UDS_DID_VMKAPNDID
, "VehicleManufacturerKitAssemblyPartNumberDataIdentifier"},
773 {UDS_DID_RXSWIN
, "RegulationXSoftwareIdentificationNumbers (RxSWIN)"},
774 {UDS_DID_VINDID
, "VINDataIdentifier"},
775 {UDS_DID_VMECUHNDID
, "vehicleManufacturerECUHardwareNumberDataIdentifier"},
776 {UDS_DID_SSECUHWNDID
, "systemSupplierECUHardwareNumberDataIdentifier"},
777 {UDS_DID_SSECUHWVNDID
, "systemSupplierECUHardwareVersionNumberDataIdentifier"},
778 {UDS_DID_SSECUSWNDID
, "systemSupplierECUSoftwareNumberDataIdentifier"},
779 {UDS_DID_SSECUSWVNDID
, "systemSupplierECUSoftwareVersionNumberDataIdentifier"},
780 {UDS_DID_EROTANDID
, "exhaustRegulationOrTypeApprovalNumberDataIdentifier"},
781 {UDS_DID_SNOETDID
, "systemNameOrEngineTypeDataIdentifier"},
782 {UDS_DID_RSCOTSNDID
, "repairShopCodeOrTesterSerialNumberDataIdentifier"},
783 {UDS_DID_PDDID
, "programmingDateDataIdentifier (year/month/day)"},
784 {UDS_DID_CRSCOCESNDID
, "calibrationRepairShopCodeOrCalibrationEquipmentSerialNumberDataIdentifier"},
785 {UDS_DID_CDDID
, "calibrationDateDataIdentifier (year/month/day)"},
786 {UDS_DID_CESWNDID
, "calibrationEquipmentSoftwareNumberDataIdentifier"},
787 {UDS_DID_EIDDID
, "ECUInstallationDateDataIdentifier (year/month/day)"},
788 {UDS_DID_ODXFDID
, "ODXFileDataIdentifier"},
789 {UDS_DID_EDID
, "EntityDataIdentifier"},
790 {UDS_DID_ADDID_FA00
, "AirbagDeployment: Number of PCUs (ISO 26021-2)"},
791 {UDS_DID_ADDID_FA01
, "AirbagDeployment: Deployment Method Version (ISO 26021-2)"},
792 {UDS_DID_ADDID_FA02
, "AirbagDeployment: Address Information of PCU (ISO 26021-2)"},
793 {UDS_DID_ADDID_FA03
, "AirbagDeployment (ISO 26021-2)"},
794 {UDS_DID_ADDID_FA04
, "AirbagDeployment (ISO 26021-2)"},
795 {UDS_DID_ADDID_FA05
, "AirbagDeployment (ISO 26021-2)"},
796 {UDS_DID_ADDID_FA06
, "AirbagDeployment: Deployment Loop Table of PCU (ISO 26021-2)"},
797 {UDS_DID_ADDID_FA07
, "AirbagDeployment: Dismantler Info (ISO 26021-2)"},
798 {UDS_DID_ADDID_FA08
, "AirbagDeployment (ISO 26021-2)"},
799 {UDS_DID_ADDID_FA09
, "AirbagDeployment (ISO 26021-2)"},
800 {UDS_DID_ADDID_FA0A
, "AirbagDeployment (ISO 26021-2)"},
801 {UDS_DID_ADDID_FA0B
, "AirbagDeployment (ISO 26021-2)"},
802 {UDS_DID_ADDID_FA0C
, "AirbagDeployment (ISO 26021-2)"},
803 {UDS_DID_ADDID_FA0D
, "AirbagDeployment (ISO 26021-2)"},
804 {UDS_DID_ADDID_FA0E
, "AirbagDeployment (ISO 26021-2)"},
805 {UDS_DID_ADDID_FA0F
, "AirbagDeployment (ISO 26021-2)"},
806 {UDS_DID_NOEDRD
, "NumberOfEDRDevices"},
807 {UDS_DID_EDRI
, "EDRIdentification"},
808 {UDS_DID_EDRDAI
, "EDRDeviceAddressInformation"},
809 {UDS_DID_UDSVDID
, "UDSVersionDataIdentifier"},
810 {UDS_DID_RESRVDCPADLC
, "ReservedForISO15765-5 (CAN, CAN-FD, CAN+CAN-FD, ...)"},
813 static value_string_ext uds_standard_did_types_ext
= VALUE_STRING_EXT_INIT(_uds_standard_did_types
);
815 /* ReservedForISO15765 */
816 static const value_string uds_did_resrvdcpadlc_types
[] = {
817 {0, "CAN Classic Only"},
819 {2, "CAN Classic and CAN FD"},
824 static const value_string uds_standard_rid_types
[] = {
825 {UDS_RID_EXSPLRI_
, "Execute SPL"},
826 {UDS_RID_DLRI_
, "DeployLoopRoutineID"},
827 {UDS_RID_EM_
, "eraseMemory"},
828 {UDS_RID_CPD_
, "checkProgrammingDependencies"},
829 {UDS_RID_FF02
, "eraseMirrorMemoryDTCs (deprecated)"},
834 static const value_string uds_standard_dtc_types
[] = {
835 /* TODO: Add DTCs! */
844 static int hf_uds_diag_addr
;
845 static int hf_uds_diag_addr_name
;
846 static int hf_uds_diag_source_addr
;
847 static int hf_uds_diag_source_addr_name
;
848 static int hf_uds_diag_target_addr
;
849 static int hf_uds_diag_target_addr_name
;
851 static int hf_uds_service
;
852 static int hf_uds_reply
;
854 static int hf_uds_subfunction
;
855 static int hf_uds_suppress_pos_rsp_msg_ind
;
856 static int hf_uds_data_record
;
858 static int hf_uds_compression_method
;
859 static int hf_uds_encrypting_method
;
860 static int hf_uds_memory_size_length
;
861 static int hf_uds_memory_address_length
;
862 static int hf_uds_memory_address
;
863 static int hf_uds_memory_size
;
864 static int hf_uds_max_block_len_len
;
865 static int hf_uds_max_block_len
;
867 static int hf_uds_dsc_subfunction
;
868 static int hf_uds_dsc_suppress_pos_rsp_msg_ind
;
869 static int hf_uds_dsc_parameter_record
;
870 static int hf_uds_dsc_default_p2_server_timer
;
871 static int hf_uds_dsc_enhanced_p2_server_timer
;
873 static int hf_uds_er_subfunction
;
874 static int hf_uds_er_power_down_time
;
876 static int hf_uds_cdtci_group_of_dtc
;
877 static int hf_uds_cdtci_memory_selection
;
879 static int hf_uds_rdtci_subfunction
;
880 static int hf_uds_rdtci_dtc_status_mask
;
881 static int hf_uds_rdtci_dtc_status_mask_tf
;
882 static int hf_uds_rdtci_dtc_status_mask_tftoc
;
883 static int hf_uds_rdtci_dtc_status_mask_pdtc
;
884 static int hf_uds_rdtci_dtc_status_mask_cdtc
;
885 static int hf_uds_rdtci_dtc_status_mask_tncslc
;
886 static int hf_uds_rdtci_dtc_status_mask_tfslc
;
887 static int hf_uds_rdtci_dtc_status_mask_tnctoc
;
888 static int hf_uds_rdtci_dtc_status_mask_wir
;
889 static int hf_uds_rdtci_dtc_mask_record
;
890 static int hf_uds_rdtci_dtc_snapshot_rec_no
;
891 static int hf_uds_rdtci_dtc_stored_data_rec_no
;
892 static int hf_uds_rdtci_dtc_ext_data_rec_no
;
893 static int hf_uds_rdtci_memory_selection
;
894 static int hf_uds_rdtci_user_def_dtc_snapshot_rec_no
;
895 static int hf_uds_rdtci_dtc_severity_mask
;
896 static int hf_uds_rdtci_functional_group_id
;
897 static int hf_uds_rdtci_dtc_readiness_group_id
;
898 static int hf_uds_rdtci_dtc_status_avail
;
899 static int hf_uds_rdtci_dtc_status_avail_tf
;
900 static int hf_uds_rdtci_dtc_status_avail_tftoc
;
901 static int hf_uds_rdtci_dtc_status_avail_pdtc
;
902 static int hf_uds_rdtci_dtc_status_avail_cdtc
;
903 static int hf_uds_rdtci_dtc_status_avail_tncslc
;
904 static int hf_uds_rdtci_dtc_status_avail_tfslc
;
905 static int hf_uds_rdtci_dtc_status_avail_tnctoc
;
906 static int hf_uds_rdtci_dtc_status_avail_wir
;
907 static int hf_uds_rdtci_dtc_id
;
908 static int hf_uds_rdtci_dtc_status
;
909 static int hf_uds_rdtci_dtc_status_tf
;
910 static int hf_uds_rdtci_dtc_status_tftoc
;
911 static int hf_uds_rdtci_dtc_status_pdtc
;
912 static int hf_uds_rdtci_dtc_status_cdtc
;
913 static int hf_uds_rdtci_dtc_status_tncslc
;
914 static int hf_uds_rdtci_dtc_status_tfslc
;
915 static int hf_uds_rdtci_dtc_status_tnctoc
;
916 static int hf_uds_rdtci_dtc_status_wir
;
917 static int hf_uds_rdtci_dtc_format_id
;
918 static int hf_uds_rdtci_dtc_count
;
919 static int hf_uds_rdtci_dtc_snapshot_record_number_of_ids
;
920 static int hf_uds_rdtci_dtc_stored_data_record_number_of_ids
;
921 static int hf_uds_rdtci_dtc_severity
;
922 static int hf_uds_rdtci_dtc_functional_unit
;
923 static int hf_uds_rdtci_dtc_fault_detect_counter
;
924 static int hf_uds_rdtci_dtc_severity_avail
;
925 static int hf_uds_rdtci_record
;
926 static int hf_uds_rdtci_record_unparsed
;
928 static int hf_uds_rdbi_data_identifier
;
930 static int hf_uds_rsdbi_data_identifier
;
931 static int hf_uds_rsdbi_scaling_byte
;
932 static int hf_uds_rsdbi_scaling_byte_data_type
;
933 static int hf_uds_rsdbi_scaling_byte_num_of_bytes
;
934 static int hf_uds_rsdbi_validity_mask
;
935 static int hf_uds_rsdbi_formula_identifier
;
936 static int hf_uds_rsdbi_formula_constant
;
937 static int hf_uds_rsdbi_formula_constant_exp
;
938 static int hf_uds_rsdbi_formula_constant_mantissa
;
939 static int hf_uds_rsdbi_unit
;
941 static int hf_uds_sa_subfunction
;
942 static int hf_uds_sa_key
;
943 static int hf_uds_sa_seed
;
945 static int hf_uds_cc_subfunction_no_suppress
;
946 static int hf_uds_cc_comm_type_and_subnet_number
;
947 static int hf_uds_cc_communication_type
;
948 static int hf_uds_cc_subnet_number
;
949 static int hf_uds_cc_node_identifier_number
;
951 static int hf_uds_ars_subfunction_no_suppress
;
952 static int hf_uds_ars_comm_config
;
953 static int hf_uds_ars_length_of_cert_client
;
954 static int hf_uds_ars_cert_client
;
955 static int hf_uds_ars_length_of_cert_server
;
956 static int hf_uds_ars_cert_server
;
957 static int hf_uds_ars_length_of_challenge_client
;
958 static int hf_uds_ars_challenge_client
;
959 static int hf_uds_ars_length_of_challenge_server
;
960 static int hf_uds_ars_challenge_server
;
961 static int hf_uds_ars_length_of_proof_of_ownership_client
;
962 static int hf_uds_ars_proof_of_ownership_client
;
963 static int hf_uds_ars_length_of_proof_of_ownership_server
;
964 static int hf_uds_ars_proof_of_ownership_server
;
965 static int hf_uds_ars_length_of_ephemeral_public_key_client
;
966 static int hf_uds_ars_ephemeral_public_key_client
;
967 static int hf_uds_ars_length_of_ephemeral_public_key_server
;
968 static int hf_uds_ars_ephemeral_public_key_server
;
969 static int hf_uds_ars_cert_eval_id
;
970 static int hf_uds_ars_length_of_cert_data
;
971 static int hf_uds_ars_cert_data
;
972 static int hf_uds_ars_algo_indicator
;
973 static int hf_uds_ars_length_of_additional_parameter
;
974 static int hf_uds_ars_additional_parameter
;
975 static int hf_uds_ars_length_of_needed_additional_parameter
;
976 static int hf_uds_ars_needed_additional_parameter
;
977 static int hf_uds_ars_auth_ret_param
;
978 static int hf_uds_ars_length_of_session_key_info
;
979 static int hf_uds_ars_session_key_info
;
981 static int hf_uds_signedCertificate
;
983 static int hf_uds_rdbpi_transmission_mode
;
984 static int hf_uds_rdbpi_periodic_data_identifier
;
986 static int hf_uds_dddi_subfunction_no_suppress
;
987 static int hf_uds_dddi_dyn_defined_data_identifier
;
988 static int hf_uds_dddi_source_data_identifier
;
989 static int hf_uds_dddi_position_in_source_data_record
;
990 static int hf_uds_dddi_memory_size
;
992 static int hf_uds_wdbi_data_identifier
;
994 static int hf_uds_iocbi_data_identifier
;
995 static int hf_uds_iocbi_parameter
;
996 static int hf_uds_iocbi_state
;
998 static int hf_uds_rc_subfunction
;
999 static int hf_uds_rc_identifier
;
1000 static int hf_uds_rc_option_record
;
1001 static int hf_uds_rc_info
;
1002 static int hf_uds_rc_status_record
;
1004 static int hf_uds_td_sequence_counter
;
1005 static int hf_uds_td_record_data
;
1007 static int hf_uds_rte_record_data
;
1009 static int hf_uds_rft_mode_of_operation
;
1010 static int hf_uds_rft_length_of_file_path_and_name
;
1011 static int hf_uds_rft_file_path_and_name
;
1012 static int hf_uds_rft_file_size_param_length
;
1013 static int hf_uds_rft_file_size_uncompressed
;
1014 static int hf_uds_rft_file_size_compressed
;
1015 static int hf_uds_rft_length_format_identifier
;
1016 static int hf_uds_rft_max_num_of_block_length
;
1017 static int hf_uds_rft_file_size_or_dir_info_param_length
;
1018 static int hf_uds_rft_file_size_uncompressed_or_dir_info_length
;
1019 static int hf_uds_rft_file_position
;
1021 static int hf_uds_tp_subfunction_no_suppress
;
1023 static int hf_uds_err_sid
;
1024 static int hf_uds_err_code
;
1026 static int hf_uds_sdt_administrative_param
;
1027 static int hf_uds_sdt_administrative_param_req
;
1028 static int hf_uds_sdt_administrative_param_pre_estab_key
;
1029 static int hf_uds_sdt_administrative_param_encrypted
;
1030 static int hf_uds_sdt_administrative_param_signed
;
1031 static int hf_uds_sdt_administrative_param_resp_sign_req
;
1032 static int hf_uds_sdt_signature_encryption_calculation
;
1033 static int hf_uds_sdt_signature_length
;
1034 static int hf_uds_sdt_anti_replay_counter
;
1035 static int hf_uds_sdt_encapsulated_message
;
1036 static int hf_uds_sdt_encapsulated_message_sid
;
1037 static int hf_uds_sdt_encapsulated_message_sid_reply
;
1038 static int hf_uds_sdt_signature_mac
;
1040 static int hf_uds_cdtcs_subfunction
;
1041 static int hf_uds_cdtcs_subfunction_no_suppress
;
1042 static int hf_uds_cdtcs_subfunction_pos_rsp_msg_ind
;
1043 static int hf_uds_cdtcs_option_record
;
1044 static int hf_uds_cdtcs_type
;
1046 static int hf_uds_lc_subfunction
;
1047 static int hf_uds_lc_subfunction_no_suppress
;
1048 static int hf_uds_lc_subfunction_pos_rsp_msg_ind
;
1049 static int hf_uds_lc_control_mode_id
;
1050 static int hf_uds_lc_link_record
;
1052 static int hf_uds_did_reply_f186_diag_session
;
1053 static int hf_uds_did_reply_f190_vin
;
1054 static int hf_uds_did_reply_ff00_version
;
1055 static int hf_uds_did_reply_ff01_dlc_support
;
1057 static int hf_uds_unparsed_bytes
;
1063 static int ett_uds_subfunction
;
1064 static int ett_uds_dtc_status_entry
;
1065 static int ett_uds_dtc_status_bits
;
1066 static int ett_uds_dtc_snapshot_entry
;
1067 static int ett_uds_dtc_counter_entry
;
1068 static int ett_uds_dsc_parameter_record
;
1069 static int ett_uds_rsdbi_scaling_byte
;
1070 static int ett_uds_rsdbi_formula_constant
;
1071 static int ett_uds_cc_communication_type
;
1072 static int ett_uds_ars_certificate
;
1073 static int ett_uds_ars_algo_indicator
;
1074 static int ett_uds_dddi_entry
;
1075 static int ett_uds_sdt_admin_param
;
1076 static int ett_uds_sdt_encap_message
;
1078 static int proto_uds
;
1080 static dissector_handle_t uds_handle
;
1081 static dissector_handle_t uds_handle_doip
;
1082 static dissector_handle_t uds_handle_hsfz
;
1083 static dissector_handle_t uds_handle_iso10681
;
1084 static dissector_handle_t uds_handle_iso15765
;
1085 static dissector_handle_t obd_ii_handle
;
1087 /*** Subdissectors ***/
1088 static heur_dissector_list_t heur_subdissector_list
;
1089 static heur_dtbl_entry_t
*heur_dtbl_entry
;
1091 /*** Configuration ***/
1092 enum certificate_decoding_strategies
{
1093 cert_parsing_off
= -1,
1094 ber_cert_single_false
= 0,
1095 ber_cert_single_true
= 1,
1096 ber_cert_multi_false
= 2,
1097 ber_cert_multi_true
= 3,
1100 static const enum_val_t certificate_decoding_vals
[] = {
1101 {"0", "BER Certificate w/o implicit tag", ber_cert_single_false
},
1102 {"1", "BER Certificate w implicit tag", ber_cert_single_true
},
1103 {"2", "BER Certificates w/o implicit tag", ber_cert_multi_false
},
1104 {"3", "BER Certificates w implicit tag", ber_cert_multi_true
},
1105 {"off", "Do not parse", cert_parsing_off
},
1109 static int uds_certificate_decoding_config
= (int)cert_parsing_off
;
1111 static bool uds_dissect_small_sids_with_obd_ii
= true;
1112 static bool uds_clear_info_col
= false;
1114 typedef struct _address_string
{
1120 copy_address_string_cb(void *n
, const void *o
, size_t size _U_
) {
1121 address_string_t
*new_rec
= (address_string_t
*)n
;
1122 const address_string_t
*old_rec
= (const address_string_t
*)o
;
1124 new_rec
->name
= g_strdup(old_rec
->name
);
1125 new_rec
->address
= old_rec
->address
;
1130 update_address_string_cb(void *r
, char **err
) {
1131 address_string_t
*rec
= (address_string_t
*)r
;
1133 if (rec
->name
== NULL
|| rec
->name
[0] == 0) {
1134 *err
= g_strdup("Name cannot be empty");
1142 free_address_string_cb(void *r
) {
1143 address_string_t
*rec
= (address_string_t
*)r
;
1145 /* freeing result of g_strdup */
1151 post_update_address_string_cb(address_string_t
*data
, unsigned data_num
, GHashTable
*ht
) {
1153 int64_t *key
= NULL
;
1159 for (i
= 0; i
< data_num
; i
++) {
1160 key
= wmem_new(wmem_epan_scope(), int64_t);
1161 *key
= data
[i
].address
;
1163 g_hash_table_insert(ht
, key
, g_strdup(data
[i
].name
));
1168 typedef struct _generic_addr_id_string
{
1172 } generic_addr_id_string_t
;
1175 copy_generic_one_id_string_cb(void *n
, const void *o
, size_t size _U_
) {
1176 generic_addr_id_string_t
*new_rec
= (generic_addr_id_string_t
*)n
;
1177 const generic_addr_id_string_t
*old_rec
= (const generic_addr_id_string_t
*)o
;
1179 new_rec
->name
= g_strdup(old_rec
->name
);
1180 new_rec
->id
= old_rec
->id
;
1181 new_rec
->address
= old_rec
->address
;
1186 update_generic_addr_16bit_id_var(void *r
, char **err
, uint32_t limit
) {
1187 generic_addr_id_string_t
*rec
= (generic_addr_id_string_t
*)r
;
1189 if (rec
->id
> limit
) {
1190 *err
= ws_strdup_printf("We currently only support identifiers <= %x (Addr: %x ID: %i Name: %s)", limit
, rec
->address
, rec
->id
, rec
->name
);
1194 if (rec
->address
> 0xffff && rec
->address
!= UINT32_MAX
) {
1195 *err
= ws_strdup_printf("We currently only support 16 bit addresses with 0xffffffff = \"don't care\" (Addr: %x ID: %i Name: %s)",
1196 rec
->address
, rec
->id
, rec
->name
);
1200 if (rec
->name
== NULL
|| rec
->name
[0] == 0) {
1201 *err
= g_strdup("Name cannot be empty");
1209 update_generic_addr_16bit_id_16bit(void *r
, char **err
) {
1210 return update_generic_addr_16bit_id_var(r
, err
, 0xffff);
1214 update_generic_addr_16bit_id_24bit(void *r
, char **err
) {
1215 return update_generic_addr_16bit_id_var(r
, err
, 0xffffff);
1219 free_generic_one_id_string_cb(void *r
) {
1220 generic_addr_id_string_t
*rec
= (generic_addr_id_string_t
*)r
;
1222 /* freeing result of g_strdup */
1228 calc_key(uint32_t addr
, uint32_t id
) {
1229 return ((int64_t)id
<< 32) | (int64_t)addr
;
1233 post_update_one_id_string_template_cb(generic_addr_id_string_t
*data
, unsigned data_num
, GHashTable
*ht
) {
1235 int64_t *key
= NULL
;
1237 for (i
= 0; i
< data_num
; i
++) {
1238 key
= wmem_new(wmem_epan_scope(), int64_t);
1239 *key
= calc_key(data
[i
].address
, data
[i
].id
);
1241 g_hash_table_insert(ht
, key
, g_strdup(data
[i
].name
));
1246 generic_lookup_addr_id(uint32_t addr
, uint32_t id
, GHashTable
*ht
) {
1249 uint64_t tmp
= calc_key(addr
, id
);
1255 ret
= (char *)g_hash_table_lookup(ht
, &tmp
);
1257 tmp
= calc_key(UINT32_MAX
, id
);
1258 return (char *)g_hash_table_lookup(ht
, &tmp
);
1265 simple_free_key(void *key
) {
1266 wmem_free(wmem_epan_scope(), key
);
1270 simple_free(void *data
) {
1271 /* we need to free because of the g_strdup in post_update*/
1277 static generic_addr_id_string_t
*uds_uat_routine_ids
;
1278 static unsigned uds_uat_routine_id_num
;
1279 static GHashTable
*uds_ht_routine_ids
;
1281 UAT_HEX_CB_DEF(uds_uat_routine_ids
, address
, generic_addr_id_string_t
)
1282 UAT_HEX_CB_DEF(uds_uat_routine_ids
, id
, generic_addr_id_string_t
)
1283 UAT_CSTRING_CB_DEF(uds_uat_routine_ids
, name
, generic_addr_id_string_t
)
1286 post_update_uds_routine_cb(void) {
1287 /* destroy old hash table, if it exists */
1288 if (uds_ht_routine_ids
) {
1289 g_hash_table_destroy(uds_ht_routine_ids
);
1292 /* create new hash table */
1293 uds_ht_routine_ids
= g_hash_table_new_full(g_int64_hash
, g_int64_equal
, &simple_free_key
, &simple_free
);
1294 post_update_one_id_string_template_cb(uds_uat_routine_ids
, uds_uat_routine_id_num
, uds_ht_routine_ids
);
1298 uds_lookup_routine_name(uint32_t addr
, uint16_t id
) {
1299 const char *tmp
= generic_lookup_addr_id(addr
, id
, uds_ht_routine_ids
);
1302 tmp
= try_val_to_str(id
, uds_standard_rid_types
);
1309 protoitem_append_routine_name(proto_item
*ti
, uint32_t addr
, uint16_t data_identifier
) {
1310 const char *routine_name
= uds_lookup_routine_name(addr
, data_identifier
);
1311 if (routine_name
!= NULL
) {
1312 proto_item_append_text(ti
, " (%s)", routine_name
);
1317 infocol_append_routine_name(packet_info
*pinfo
, uint32_t addr
, uint16_t routine_identifier
) {
1318 const char *routine_name
= uds_lookup_routine_name(addr
, routine_identifier
);
1319 if (routine_name
!= NULL
) {
1320 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " (%s)", routine_name
);
1326 static generic_addr_id_string_t
*uds_uat_data_ids
;
1327 static unsigned uds_uat_data_id_num
;
1328 static GHashTable
*uds_ht_data_ids
;
1330 UAT_HEX_CB_DEF(uds_uat_data_ids
, address
, generic_addr_id_string_t
)
1331 UAT_HEX_CB_DEF(uds_uat_data_ids
, id
, generic_addr_id_string_t
)
1332 UAT_CSTRING_CB_DEF(uds_uat_data_ids
, name
, generic_addr_id_string_t
)
1335 post_update_uds_data_cb(void) {
1336 /* destroy old hash table, if it exists */
1337 if (uds_ht_data_ids
) {
1338 g_hash_table_destroy(uds_ht_data_ids
);
1341 /* create new hash table */
1342 uds_ht_data_ids
= g_hash_table_new_full(g_int64_hash
, g_int64_equal
, &simple_free_key
, &simple_free
);
1343 post_update_one_id_string_template_cb(uds_uat_data_ids
, uds_uat_data_id_num
, uds_ht_data_ids
);
1347 uds_lookup_data_name(uint32_t addr
, uint16_t id
) {
1348 const char *tmp
= generic_lookup_addr_id(addr
, id
, uds_ht_data_ids
);
1351 tmp
= try_val_to_str_ext(id
, &uds_standard_did_types_ext
);
1358 protoitem_append_data_name(proto_item
*ti
, uint32_t addr
, uint16_t data_identifier
) {
1359 const char *data_name
= uds_lookup_data_name(addr
, data_identifier
);
1360 if (data_name
!= NULL
) {
1361 proto_item_append_text(ti
, " (%s)", data_name
);
1366 infocol_append_data_name(packet_info
*pinfo
, uint32_t addr
, uint16_t data_identifier
) {
1367 const char *data_name
= uds_lookup_data_name(addr
, data_identifier
);
1368 if (data_name
!= NULL
) {
1369 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " (%s)", data_name
);
1375 static generic_addr_id_string_t
*uds_uat_dtc_ids
;
1376 static unsigned uds_uat_dtc_id_num
;
1377 static GHashTable
*uds_ht_dtc_ids
;
1379 UAT_HEX_CB_DEF(uds_uat_dtc_ids
, address
, generic_addr_id_string_t
)
1380 UAT_HEX_CB_DEF(uds_uat_dtc_ids
, id
, generic_addr_id_string_t
)
1381 UAT_CSTRING_CB_DEF(uds_uat_dtc_ids
, name
, generic_addr_id_string_t
)
1384 post_update_uds_dtc_cb(void) {
1385 /* destroy old hash table, if it exists */
1386 if (uds_ht_dtc_ids
) {
1387 g_hash_table_destroy(uds_ht_dtc_ids
);
1390 /* create new hash table */
1391 uds_ht_dtc_ids
= g_hash_table_new_full(g_int64_hash
, g_int64_equal
, &simple_free_key
, &simple_free
);
1392 post_update_one_id_string_template_cb(uds_uat_dtc_ids
, uds_uat_dtc_id_num
, uds_ht_dtc_ids
);
1396 uds_lookup_dtc_name(uint32_t addr
, uint32_t id
) {
1397 const char *tmp
= generic_lookup_addr_id(addr
, id
, uds_ht_dtc_ids
);
1400 tmp
= try_val_to_str(id
, uds_standard_dtc_types
);
1407 protoitem_append_dtc_name(proto_item
*ti
, uint32_t addr
, uint32_t dtc_id
) {
1408 const char *dtc_name
= uds_lookup_dtc_name(addr
, dtc_id
);
1409 if (dtc_name
!= NULL
) {
1410 proto_item_append_text(ti
, " (%s)", dtc_name
);
1416 static address_string_t
*uds_uat_addresses
;
1417 static unsigned uds_uat_addresses_num
;
1418 static GHashTable
*uds_ht_addresses
;
1420 UAT_HEX_CB_DEF(uds_uat_addresses
, address
, address_string_t
)
1421 UAT_CSTRING_CB_DEF(uds_uat_addresses
, name
, address_string_t
)
1424 post_update_uds_address_cb(void) {
1425 /* destroy old hash table, if it exists */
1426 if (uds_ht_addresses
) {
1427 g_hash_table_destroy(uds_ht_addresses
);
1430 /* create new hash table */
1431 uds_ht_addresses
= g_hash_table_new_full(g_int64_hash
, g_int64_equal
, &simple_free_key
, &simple_free
);
1432 post_update_address_string_cb(uds_uat_addresses
, uds_uat_addresses_num
, uds_ht_addresses
);
1436 uds_lookup_address_name(uint32_t addr
) {
1439 int64_t tmp
= (int64_t)addr
;
1441 if (uds_ht_addresses
== NULL
) {
1445 ret
= (char *)g_hash_table_lookup(uds_ht_addresses
, &tmp
);
1451 uds_proto_item_append_address_name(proto_item
*ti
, uint32_t addr
) {
1452 char *address_name
= uds_lookup_address_name(addr
);
1453 if (address_name
!= NULL
) {
1454 proto_item_append_text(ti
, " (%s)", address_name
);
1459 uds_proto_tree_add_address_item(proto_tree
*tree
, int hf
, tvbuff_t
*tvb
, const int offset
, const int size
, unsigned addr
, bool generated
, bool hidden
) {
1462 ti
= proto_tree_add_uint(tree
, hf
, tvb
, offset
, size
, addr
);
1463 uds_proto_item_append_address_name(ti
, addr
);
1466 proto_item_set_generated(ti
);
1470 proto_item_set_hidden(ti
);
1477 uds_proto_tree_add_address_name(proto_tree
*tree
, int hf
, tvbuff_t
*tvb
, const int offset
, const int size
, unsigned addr
) {
1479 char *address_name
= uds_lookup_address_name(addr
);
1481 if (address_name
!= NULL
) {
1482 ti
= proto_tree_add_string(tree
, hf
, tvb
, offset
, size
, address_name
);
1484 address_name
= wmem_strdup_printf(wmem_packet_scope(), "%d", addr
);
1485 ti
= proto_tree_add_string(tree
, hf
, tvb
, offset
, size
, address_name
);
1488 proto_item_set_generated(ti
);
1489 proto_item_set_hidden(ti
);
1495 uds_proto_item_append_address_text(proto_item
*ti
, uint8_t address_length
, const char *name
, uint32_t value
) {
1500 switch (address_length
) {
1502 proto_item_append_text(ti
, ", %s: 0x%02x", name
, value
);
1505 proto_item_append_text(ti
, ", %s: 0x%04x", name
, value
);
1510 /*** Configuration End ***/
1513 call_heur_subdissector_uds(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, proto_tree
*uds_tree
, uint8_t service
, bool reply
, uint32_t id
, uint32_t uds_address
)
1515 uds_info_t uds_info
;
1518 uds_info
.uds_address
= uds_address
;
1519 uds_info
.reply
= reply
;
1520 uds_info
.service
= service
;
1522 bool ret
= dissector_try_heuristic(heur_subdissector_list
, tvb
, pinfo
, tree
, &heur_dtbl_entry
, &uds_info
);
1525 if (service
== UDS_SERVICES_RDBI
&& reply
&& id
== UDS_DID_ADSDID
) {
1526 proto_tree_add_item(uds_tree
, hf_uds_did_reply_f186_diag_session
, tvb
, 0, 1, ENC_NA
);
1530 if (service
== UDS_SERVICES_RDBI
&& reply
&& id
== UDS_DID_VINDID
) {
1531 proto_tree_add_item(uds_tree
, hf_uds_did_reply_f190_vin
, tvb
, 0, 17, ENC_ASCII
);
1535 if (service
== UDS_SERVICES_RDBI
&& reply
&& id
== UDS_DID_UDSVDID
) {
1536 uint32_t tmp
= tvb_get_uint32(tvb
, 0, ENC_BIG_ENDIAN
);
1537 proto_tree_add_uint_format(uds_tree
, hf_uds_did_reply_ff00_version
, tvb
, 0, 4, tmp
, "UDS Version: %d.%d.%d.%d",
1538 (tmp
& 0xff000000) >> 24, (tmp
& 0x00ff0000) >> 16, (tmp
& 0x0000ff00) >> 8, tmp
& 0x000000ff);
1542 if (service
== UDS_SERVICES_RDBI
&& reply
&& id
== UDS_DID_RESRVDCPADLC
) {
1543 proto_tree_add_item(uds_tree
, hf_uds_did_reply_ff01_dlc_support
, tvb
, 0, 1, ENC_NA
);
1552 uds_sa_subfunction_to_type(uint8_t subf
) {
1555 if (subf
== 0x00 || ((0x43 <= subf
) && (subf
<= 0x5e)) || (subf
== 0x7f)) {
1556 return UDS_SA_TYPES_RESERVED
;
1560 return UDS_SA_TYPES_REQUEST_SEED_ISO26021
;
1564 return UDS_SA_TYPES_SEND_KEY_ISO26021
;
1567 if ((0x61 <= subf
) && (subf
<= 0x7e)) {
1568 return UDS_SA_TYPES_SUPPLIER
;
1571 if ((subf
& 0x01) == 0x01) {
1572 return UDS_SA_TYPES_REQUEST_SEED
;
1575 if ((subf
& 0x01) == 0x00) {
1576 return UDS_SA_TYPES_SEND_KEY
;
1579 return UDS_SA_TYPES_UNCLEAR
;
1583 uds_sa_subfunction_to_string(uint8_t subf
) {
1584 switch (uds_sa_subfunction_to_type(subf
)) {
1585 case UDS_SA_TYPES_RESERVED
:
1587 case UDS_SA_TYPES_SUPPLIER
:
1588 return "System Supplier Specific";
1589 case UDS_SA_TYPES_REQUEST_SEED
:
1590 return "Request Seed";
1591 case UDS_SA_TYPES_SEND_KEY
:
1593 case UDS_SA_TYPES_REQUEST_SEED_ISO26021
:
1594 return "Request Seed ISO26021";
1595 case UDS_SA_TYPES_SEND_KEY_ISO26021
:
1596 return "Send Key ISO26021";
1603 uds_sa_subfunction_format(char *ret
, uint32_t value
) {
1604 if (uds_sa_subfunction_to_type(value
) == UDS_SA_TYPES_UNCLEAR
) {
1605 snprintf(ret
, ITEM_LABEL_LENGTH
, "0x%02x", value
);
1609 snprintf(ret
, ITEM_LABEL_LENGTH
, "%s (0x%02x)", uds_sa_subfunction_to_string(value
), value
);
1613 dissect_uds_dtc_and_status_record(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*uds_tree
, uint32_t offset
, uint32_t ecu_address
, bool severity_present
, bool func_unit_present
) {
1614 static int * const dtc_status_flags
[] = {
1615 &hf_uds_rdtci_dtc_status_wir
,
1616 &hf_uds_rdtci_dtc_status_tnctoc
,
1617 &hf_uds_rdtci_dtc_status_tfslc
,
1618 &hf_uds_rdtci_dtc_status_tncslc
,
1619 &hf_uds_rdtci_dtc_status_cdtc
,
1620 &hf_uds_rdtci_dtc_status_pdtc
,
1621 &hf_uds_rdtci_dtc_status_tftoc
,
1622 &hf_uds_rdtci_dtc_status_tf
,
1626 proto_item
*ti_status_record
, *ti
;
1627 proto_tree
*entry_tree
;
1629 if (severity_present
) {
1630 entry_tree
= proto_tree_add_subtree(uds_tree
, tvb
, offset
, 4, ett_uds_dtc_status_entry
, &ti_status_record
, "DTC and Severity Record");
1633 proto_tree_add_item_ret_uint(entry_tree
, hf_uds_rdtci_dtc_severity
, tvb
, offset
, 1, ENC_NA
, &severity
);
1636 if (func_unit_present
) {
1637 unsigned functional_unit
;
1638 proto_tree_add_item_ret_uint(entry_tree
, hf_uds_rdtci_dtc_functional_unit
, tvb
, offset
, 1, ENC_NA
, &functional_unit
);
1641 proto_item_append_text(ti_status_record
, ", Severity:0x%02x, Functional Unit:0x%02x", severity
, functional_unit
);
1643 proto_item_append_text(ti_status_record
, ", Severity:0x%02x", severity
);
1646 entry_tree
= proto_tree_add_subtree(uds_tree
, tvb
, offset
, 4, ett_uds_dtc_status_entry
, &ti_status_record
, "DTC and Status Record");
1650 ti
= proto_tree_add_item_ret_uint(entry_tree
, hf_uds_rdtci_dtc_id
, tvb
, offset
, 3, ENC_BIG_ENDIAN
, &dtc_id
);
1651 protoitem_append_dtc_name(ti
, ecu_address
, dtc_id
);
1654 uint64_t dtc_status
;
1655 proto_tree_add_bitmask_with_flags_ret_uint64(entry_tree
, tvb
, offset
, hf_uds_rdtci_dtc_status
, ett_uds_dtc_status_bits
, dtc_status_flags
, ENC_NA
, BMT_NO_APPEND
, &dtc_status
);
1658 const char *dtc_name
= uds_lookup_dtc_name(ecu_address
, dtc_id
);
1659 if (dtc_name
== NULL
) {
1660 proto_item_append_text(ti_status_record
, ", DTC:0x%06x, Status:0x%02x", dtc_id
, (uint32_t)dtc_status
);
1662 proto_item_append_text(ti_status_record
, ", DTC:0x%06x (%s), Status:0x%02x", dtc_id
, dtc_name
, (uint32_t)dtc_status
);
1665 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%06x:0x%02x", dtc_id
, (uint32_t)dtc_status
);
1671 dissect_uds_dtc_and_fault_detection_counter_record(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*uds_tree
, uint32_t offset
, uint32_t ecu_address
) {
1672 proto_item
*ti_status_record
, *ti
;
1673 proto_tree
*entry_tree
;
1675 entry_tree
= proto_tree_add_subtree(uds_tree
, tvb
, offset
, 4, ett_uds_dtc_counter_entry
, &ti_status_record
, "DTC and Fault Detection Counter Record");
1678 ti
= proto_tree_add_item_ret_uint(entry_tree
, hf_uds_rdtci_dtc_id
, tvb
, offset
, 3, ENC_BIG_ENDIAN
, &dtc_id
);
1679 protoitem_append_dtc_name(ti
, ecu_address
, dtc_id
);
1683 proto_tree_add_item_ret_uint(entry_tree
, hf_uds_rdtci_dtc_fault_detect_counter
, tvb
, offset
, 1, ENC_NA
, &counter
);
1686 const char *dtc_name
= uds_lookup_dtc_name(ecu_address
, dtc_id
);
1687 if (dtc_name
== NULL
) {
1688 proto_item_append_text(ti_status_record
, ", DTC:0x%06x, Counter:%04d", dtc_id
, counter
);
1690 proto_item_append_text(ti_status_record
, ", DTC:0x%06x (%s), Counter:%04d", dtc_id
, dtc_name
, counter
);
1693 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%06x:%04d", dtc_id
, counter
);
1699 dissect_uds_subfunction(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*uds_tree
, uint32_t offset
, uint32_t *subfunc_value
, int hf
, const value_string
*vs
, bool suppress_bit
) {
1700 proto_item
*ti
= proto_tree_add_item(uds_tree
, hf_uds_subfunction
, tvb
, offset
, 1, ENC_NA
);
1701 proto_tree
*subfunction_tree
= proto_item_add_subtree(ti
, ett_uds_subfunction
);
1702 proto_tree_add_item_ret_uint(subfunction_tree
, hf
, tvb
, offset
, 1, ENC_NA
, subfunc_value
);
1705 proto_item_append_text(ti
, " (%s)", val_to_str(*subfunc_value
, vs
, "Unknown (0x%02x)"));
1706 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " SubFunction: %s", val_to_str(*subfunc_value
, vs
, "Unknown (0x%02x)"));
1708 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " SubFunction: 0x%02x", *subfunc_value
);
1714 proto_tree_add_item_ret_boolean(subfunction_tree
, hf_uds_suppress_pos_rsp_msg_ind
, tvb
, offset
, 1, ENC_NA
, &suppress
);
1717 col_append_str(pinfo
->cinfo
, COL_INFO
, " (Reply suppressed)");
1726 dissect_uds_rdtci(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*uds_tree
, uint32_t ecu_address
, uint8_t sid
, uint32_t offset
, uint32_t data_length
) {
1729 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_subfunction
, tvb
, offset
, 1, ENC_NA
, &enum_val
);
1730 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", val_to_str_ext(enum_val
, &uds_rdtci_types_ext
, "Unknown (0x%02x)"));
1733 if (sid
& UDS_REPLY_MASK
) {
1734 static int * const dtc_status_avail_mask_flags
[] = {
1735 &hf_uds_rdtci_dtc_status_avail_wir
,
1736 &hf_uds_rdtci_dtc_status_avail_tnctoc
,
1737 &hf_uds_rdtci_dtc_status_avail_tfslc
,
1738 &hf_uds_rdtci_dtc_status_avail_tncslc
,
1739 &hf_uds_rdtci_dtc_status_avail_cdtc
,
1740 &hf_uds_rdtci_dtc_status_avail_pdtc
,
1741 &hf_uds_rdtci_dtc_status_avail_tftoc
,
1742 &hf_uds_rdtci_dtc_status_avail_tf
,
1747 case UDS_RDTCI_TYPES_NUMBER_BY_STATUS_MASK
:
1748 case UDS_RDTCI_TYPES_NUM_DTC_BY_SEVERITY_MASK
:
1749 case UDS_RDTCI_TYPES_OUTDATED_RNOMMDTCBSM
:
1750 case UDS_RDTCI_TYPES_OUTDATED_RNOOEOBDDTCBSM
: {
1751 uint64_t dtc_status_avail_mask
;
1752 proto_tree_add_bitmask_with_flags_ret_uint64(uds_tree
, tvb
, offset
, hf_uds_rdtci_dtc_status_avail
, ett_uds_dtc_status_bits
, dtc_status_avail_mask_flags
, ENC_NA
, BMT_NO_APPEND
, &dtc_status_avail_mask
);
1753 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%02x", (uint32_t)dtc_status_avail_mask
);
1756 uint32_t dtc_format
;
1757 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_dtc_format_id
, tvb
, offset
, 1, ENC_NA
, &dtc_format
);
1758 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", val_to_str(dtc_format
, uds_rdtci_format_id_types
, "Unknown Format (0x%02x)"));
1762 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_dtc_count
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &dtc_count
);
1763 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %d DTCs", dtc_count
);
1768 case UDS_RDTCI_TYPES_BY_STATUS_MASK
:
1769 case UDS_RDTCI_TYPES_SUPPORTED_DTC
:
1770 case UDS_RDTCI_TYPES_FIRST_TEST_FAILED_DTC
:
1771 case UDS_RDTCI_TYPES_FIRST_CONFIRMED_DTC
:
1772 case UDS_RDTCI_TYPES_MOST_RECENT_TEST_FAILED
:
1773 case UDS_RDTCI_TYPES_MOST_RECENT_CONFIRMED_DTC
:
1774 case UDS_RDTCI_TYPES_OUTDATED_RMMDTCBSM
:
1775 case UDS_RDTCI_TYPES_OUTDATED_ROBDDTCBSM
:
1776 case UDS_RDTCI_TYPES_DTC_WITH_PERM_STATUS
: {
1777 uint64_t dtc_status_avail_mask
;
1778 proto_tree_add_bitmask_with_flags_ret_uint64(uds_tree
, tvb
, offset
, hf_uds_rdtci_dtc_status_avail
, ett_uds_dtc_status_bits
, dtc_status_avail_mask_flags
, ENC_NA
, BMT_NO_APPEND
, &dtc_status_avail_mask
);
1779 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%02x", (uint32_t)dtc_status_avail_mask
);
1782 while (offset
+ 4 <= data_length
) {
1783 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, false, false);
1788 case UDS_RDTCI_TYPES_SNAPSHOT_IDENTIFICATION
:
1789 while (offset
+ 4 <= data_length
) {
1790 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, false, false);
1794 case UDS_RDTCI_TYPES_SNAPSHOT_RECORD_BY_DTC
: {
1795 /* this cannot fully be parsed without configuration data (length of DID data) */
1797 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, false, false);
1799 if (offset
< data_length
) {
1800 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_snapshot_rec_no
, tvb
, offset
, 1, ENC_NA
);
1804 if (offset
< data_length
) {
1805 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_snapshot_record_number_of_ids
, tvb
, offset
, 1, ENC_NA
);
1809 if (offset
< data_length
) {
1810 proto_tree_add_item(uds_tree
, hf_uds_rdtci_record_unparsed
, tvb
, offset
, data_length
- offset
, ENC_NA
);
1811 offset
= data_length
;
1816 case UDS_RDTCI_TYPES_SNAPSHOT_RECORD_BY_RECORD
: {
1817 /* this cannot fully be parsed without configuration data (length of DID data) */
1820 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_dtc_stored_data_rec_no
, tvb
, offset
, 1, ENC_NA
, &count
);
1823 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %d Stored Data Records: ", count
);
1826 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, false, false);
1828 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_stored_data_record_number_of_ids
, tvb
, offset
, 1, ENC_NA
);
1831 if (offset
< data_length
) {
1832 proto_tree_add_item(uds_tree
, hf_uds_rdtci_record_unparsed
, tvb
, offset
, data_length
- offset
, ENC_NA
);
1833 offset
= data_length
;
1839 case UDS_RDTCI_TYPES_EXTENDED_RECORD_BY_DTC
:
1840 /* this cannot fully be parsed without configuration data (length of DID data) */
1842 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, false, false);
1844 if (offset
< data_length
) {
1845 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_ext_data_rec_no
, tvb
, offset
, 1, ENC_NA
);
1849 if (offset
< data_length
) {
1850 proto_tree_add_item(uds_tree
, hf_uds_rdtci_record_unparsed
, tvb
, offset
, data_length
- offset
, ENC_NA
);
1851 offset
= data_length
;
1855 case UDS_RDTCI_TYPES_BY_SEVERITY_MASK
:
1856 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, true, true);
1859 case UDS_RDTCI_TYPES_SEVERITY_INFO_OF_DTC
:
1860 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, true, true);
1862 while (offset
+ 6 <= data_length
) {
1863 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, true, true);
1867 case UDS_RDTCI_TYPES_DTC_FAULT_DETECT_CTR
:
1868 while (offset
+ 4 <= data_length
) {
1869 offset
= dissect_uds_dtc_and_fault_detection_counter_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
);
1873 case UDS_RDTCI_TYPES_DTC_EXT_DATA_REC_BY_NUM
:
1874 /* this cannot fully be parsed without configuration data (length of data records) */
1875 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_ext_data_rec_no
, tvb
, offset
, 1, ENC_NA
);
1878 if (offset
< data_length
) {
1879 proto_tree_add_item(uds_tree
, hf_uds_rdtci_record_unparsed
, tvb
, offset
, data_length
- offset
, ENC_NA
);
1880 offset
= data_length
;
1884 case UDS_RDTCI_TYPES_USER_MEM_DTC_BY_STATUS_M
:
1885 proto_tree_add_item(uds_tree
, hf_uds_rdtci_memory_selection
, tvb
, offset
, 1, ENC_NA
);
1888 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_status_avail
, tvb
, offset
, 1, ENC_NA
);
1891 while (offset
+ 4 <= data_length
) {
1892 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, false, false);
1896 case UDS_RDTCI_TYPES_USER_MEM_DTC_REC_BY_DTC_N
:
1897 /* this cannot fully be parsed without configuration data (length of DID data) */
1898 proto_tree_add_item(uds_tree
, hf_uds_rdtci_memory_selection
, tvb
, offset
, 1, ENC_NA
);
1901 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, false, false);
1903 if (offset
< data_length
) {
1904 proto_tree_add_item(uds_tree
, hf_uds_rdtci_record_unparsed
, tvb
, offset
, data_length
- offset
, ENC_NA
);
1905 offset
= data_length
;
1909 case UDS_RDTCI_TYPES_USER_MEM_DTC_EXT_REC_BY_N
:
1910 /* this cannot fully be parsed without configuration data (length of extended data) */
1911 proto_tree_add_item(uds_tree
, hf_uds_rdtci_memory_selection
, tvb
, offset
, 1, ENC_NA
);
1914 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, false, false);
1916 if (offset
< data_length
) {
1917 proto_tree_add_item(uds_tree
, hf_uds_rdtci_record_unparsed
, tvb
, offset
, data_length
- offset
, ENC_NA
);
1918 offset
= data_length
;
1922 case UDS_RDTCI_TYPES_SUP_DTC_EXT_RECORD
: {
1924 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_dtc_status_avail
, tvb
, offset
, 1, ENC_NA
, &status
);
1928 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_dtc_ext_data_rec_no
, tvb
, offset
, 1, ENC_NA
, &rec_no
);
1931 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%02x 0x%02x", status
, rec_no
);
1933 while (offset
+ 4 <= data_length
) {
1934 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, false, false);
1939 case UDS_RDTCI_TYPES_WWH_OBD_DTC_BY_MASK_REC
: {
1940 unsigned func_group
;
1941 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_functional_group_id
, tvb
, offset
, 1, ENC_NA
, &func_group
);
1945 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_dtc_status_avail
, tvb
, offset
, 1, ENC_NA
, &status
);
1949 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_dtc_severity_avail
, tvb
, offset
, 1, ENC_NA
, &severity
);
1953 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_dtc_format_id
, tvb
, offset
, 1, ENC_NA
, &format
);
1956 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%02x 0x%02x 0x%02x 0x%02x", func_group
, status
, severity
, format
);
1958 while (offset
+ 5 <= data_length
) {
1959 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, true, false);
1964 case UDS_RDTCI_TYPES_WWH_OBD_DTC_PERM_STATUS
: {
1965 unsigned func_group
;
1966 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_functional_group_id
, tvb
, offset
, 1, ENC_NA
, &func_group
);
1970 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_dtc_status_avail
, tvb
, offset
, 1, ENC_NA
, &status
);
1974 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_dtc_format_id
, tvb
, offset
, 1, ENC_NA
, &format
);
1977 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%02x 0x%02x 0x%02x", func_group
, status
, format
);
1979 while (offset
+ 4 <= data_length
) {
1980 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, false, false);
1985 case UDS_RDTCI_TYPES_WWH_OBD_BY_GROUP_READY
: {
1986 unsigned func_group
;
1987 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_functional_group_id
, tvb
, offset
, 1, ENC_NA
, &func_group
);
1991 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_dtc_status_avail
, tvb
, offset
, 1, ENC_NA
, &status
);
1995 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_dtc_format_id
, tvb
, offset
, 1, ENC_NA
, &format
);
1999 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdtci_dtc_readiness_group_id
, tvb
, offset
, 1, ENC_NA
, &readiness
);
2002 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%02x 0x%02x 0x%02x 0x%02x", func_group
, status
, format
, readiness
);
2004 while (offset
+ 4 <= data_length
) {
2005 offset
= dissect_uds_dtc_and_status_record(tvb
, pinfo
, uds_tree
, offset
, ecu_address
, false, false);
2011 if (offset
< data_length
) {
2012 proto_tree_add_item(uds_tree
, hf_uds_rdtci_record
, tvb
, offset
, data_length
- offset
, ENC_NA
);
2013 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
2014 offset
= data_length
;
2018 static int * const dtc_status_mask_flags
[] = {
2019 &hf_uds_rdtci_dtc_status_mask_wir
,
2020 &hf_uds_rdtci_dtc_status_mask_tnctoc
,
2021 &hf_uds_rdtci_dtc_status_mask_tfslc
,
2022 &hf_uds_rdtci_dtc_status_mask_tncslc
,
2023 &hf_uds_rdtci_dtc_status_mask_cdtc
,
2024 &hf_uds_rdtci_dtc_status_mask_pdtc
,
2025 &hf_uds_rdtci_dtc_status_mask_tftoc
,
2026 &hf_uds_rdtci_dtc_status_mask_tf
,
2031 case UDS_RDTCI_TYPES_NUMBER_BY_STATUS_MASK
:
2032 case UDS_RDTCI_TYPES_BY_STATUS_MASK
:
2033 case UDS_RDTCI_TYPES_OUTDATED_RMMDTCBSM
:
2034 case UDS_RDTCI_TYPES_OUTDATED_RNOMMDTCBSM
:
2035 case UDS_RDTCI_TYPES_OUTDATED_RNOOEOBDDTCBSM
:
2036 case UDS_RDTCI_TYPES_OUTDATED_ROBDDTCBSM
: {
2037 uint64_t status_mask
;
2038 proto_tree_add_bitmask_with_flags_ret_uint64(uds_tree
, tvb
, offset
, hf_uds_rdtci_dtc_status_mask
, ett_uds_dtc_status_bits
, dtc_status_mask_flags
, ENC_NA
, BMT_NO_APPEND
, &status_mask
);
2041 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%02x", (uint32_t)status_mask
);
2045 case UDS_RDTCI_TYPES_SNAPSHOT_IDENTIFICATION
:
2046 /* no additional params */
2049 case UDS_RDTCI_TYPES_SNAPSHOT_RECORD_BY_DTC
:
2050 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_mask_record
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
2053 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_snapshot_rec_no
, tvb
, offset
, 1, ENC_NA
);
2057 case UDS_RDTCI_TYPES_SNAPSHOT_RECORD_BY_RECORD
:
2058 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_stored_data_rec_no
, tvb
, offset
, 1, ENC_NA
);
2062 case UDS_RDTCI_TYPES_EXTENDED_RECORD_BY_DTC
:
2063 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_mask_record
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
2066 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_ext_data_rec_no
, tvb
, offset
, 1, ENC_NA
);
2070 case UDS_RDTCI_TYPES_NUM_DTC_BY_SEVERITY_MASK
:
2071 case UDS_RDTCI_TYPES_BY_SEVERITY_MASK
:
2072 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_severity_mask
, tvb
, offset
, 1, ENC_NA
);
2075 proto_tree_add_bitmask(uds_tree
, tvb
, offset
, hf_uds_rdtci_dtc_status_mask
, ett_uds_dtc_status_bits
, dtc_status_mask_flags
, ENC_NA
);
2079 case UDS_RDTCI_TYPES_SEVERITY_INFO_OF_DTC
:
2080 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_mask_record
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
2084 case UDS_RDTCI_TYPES_SUPPORTED_DTC
:
2085 case UDS_RDTCI_TYPES_FIRST_TEST_FAILED_DTC
:
2086 case UDS_RDTCI_TYPES_FIRST_CONFIRMED_DTC
:
2087 case UDS_RDTCI_TYPES_MOST_RECENT_TEST_FAILED
:
2088 case UDS_RDTCI_TYPES_MOST_RECENT_CONFIRMED_DTC
:
2089 case UDS_RDTCI_TYPES_DTC_FAULT_DETECT_CTR
:
2090 case UDS_RDTCI_TYPES_DTC_WITH_PERM_STATUS
:
2091 /* no additional params */
2094 case UDS_RDTCI_TYPES_DTC_EXT_DATA_REC_BY_NUM
:
2095 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_ext_data_rec_no
, tvb
, offset
, 1, ENC_NA
);
2099 case UDS_RDTCI_TYPES_USER_MEM_DTC_BY_STATUS_M
:
2100 proto_tree_add_bitmask(uds_tree
, tvb
, offset
, hf_uds_rdtci_dtc_status_mask
, ett_uds_dtc_status_bits
, dtc_status_mask_flags
, ENC_NA
);
2103 proto_tree_add_item(uds_tree
, hf_uds_rdtci_memory_selection
, tvb
, offset
, 1, ENC_NA
);
2107 case UDS_RDTCI_TYPES_USER_MEM_DTC_REC_BY_DTC_N
:
2108 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_mask_record
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
2111 proto_tree_add_item(uds_tree
, hf_uds_rdtci_user_def_dtc_snapshot_rec_no
, tvb
, offset
, 1, ENC_NA
);
2114 proto_tree_add_item(uds_tree
, hf_uds_rdtci_memory_selection
, tvb
, offset
, 1, ENC_NA
);
2118 case UDS_RDTCI_TYPES_USER_MEM_DTC_EXT_REC_BY_N
:
2119 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_mask_record
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
2122 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_ext_data_rec_no
, tvb
, offset
, 1, ENC_NA
);
2125 proto_tree_add_item(uds_tree
, hf_uds_rdtci_memory_selection
, tvb
, offset
, 1, ENC_NA
);
2129 case UDS_RDTCI_TYPES_SUP_DTC_EXT_RECORD
:
2130 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_ext_data_rec_no
, tvb
, offset
, 1, ENC_NA
);
2134 case UDS_RDTCI_TYPES_WWH_OBD_DTC_BY_MASK_REC
:
2135 proto_tree_add_item(uds_tree
, hf_uds_rdtci_functional_group_id
, tvb
, offset
, 1, ENC_NA
);
2138 proto_tree_add_bitmask(uds_tree
, tvb
, offset
, hf_uds_rdtci_dtc_status_mask
, ett_uds_dtc_status_bits
, dtc_status_mask_flags
, ENC_NA
);
2141 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_severity_mask
, tvb
, offset
, 1, ENC_NA
);
2145 case UDS_RDTCI_TYPES_WWH_OBD_DTC_PERM_STATUS
:
2146 proto_tree_add_item(uds_tree
, hf_uds_rdtci_functional_group_id
, tvb
, offset
, 1, ENC_NA
);
2150 case UDS_RDTCI_TYPES_WWH_OBD_BY_GROUP_READY
:
2151 proto_tree_add_item(uds_tree
, hf_uds_rdtci_functional_group_id
, tvb
, offset
, 1, ENC_NA
);
2154 proto_tree_add_item(uds_tree
, hf_uds_rdtci_dtc_readiness_group_id
, tvb
, offset
, 1, ENC_NA
);
2159 if (offset
< data_length
) {
2160 proto_tree_add_item(uds_tree
, hf_uds_rdtci_record
, tvb
, offset
, data_length
- offset
, ENC_NA
);
2161 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
2162 offset
= data_length
;
2171 dissect_uds_memory_addr_size(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*uds_tree
, uint32_t offset
, bool withDataFormatIdentifier
) {
2172 uint32_t compression
, encrypting
;
2174 if (withDataFormatIdentifier
) {
2175 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_compression_method
, tvb
, offset
, 1, ENC_NA
, &compression
);
2176 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_encrypting_method
, tvb
, offset
, 1, ENC_NA
, &encrypting
);
2180 uint32_t memory_size_length
, memory_address_length
;
2181 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_memory_size_length
, tvb
, offset
, 1, ENC_NA
, &memory_size_length
);
2182 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_memory_address_length
, tvb
, offset
, 1, ENC_NA
, &memory_address_length
);
2185 uint64_t memory_address
;
2186 proto_tree_add_item_ret_uint64(uds_tree
, hf_uds_memory_address
, tvb
, offset
, memory_address_length
, ENC_BIG_ENDIAN
, &memory_address
);
2187 offset
+= memory_address_length
;
2189 uint64_t memory_size
;
2190 proto_tree_add_item_ret_uint64(uds_tree
, hf_uds_memory_size
, tvb
, offset
, memory_size_length
, ENC_BIG_ENDIAN
, &memory_size
);
2191 offset
+= memory_size_length
;
2193 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%" PRIx64
" bytes at 0x%" PRIx64
, memory_size
, memory_address
);
2195 if (withDataFormatIdentifier
) {
2196 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " (Compression:0x%x Encrypting:0x%x)", compression
, encrypting
);
2203 dissect_uds_certificates_into_tree(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, proto_item
*ti
, uint32_t offset
, unsigned length
) {
2204 asn1_ctx_t asn1_ctx
;
2206 if (!tree
|| !tvb
|| !ti
|| length
== 0 || uds_certificate_decoding_config
== cert_parsing_off
) {
2210 tvbuff_t
*sub_tvb
= tvb_new_subset_length(tvb
, offset
, length
);
2212 asn1_ctx_init(&asn1_ctx
, ASN1_ENC_BER
, true, pinfo
);
2213 proto_tree
*cert_tree
= proto_item_add_subtree(ti
, ett_uds_ars_certificate
);
2215 switch (uds_certificate_decoding_config
) {
2216 case ber_cert_single_false
:
2217 return dissect_x509af_Certificate(false, sub_tvb
, 0, &asn1_ctx
, cert_tree
, hf_uds_signedCertificate
);
2219 case ber_cert_single_true
:
2220 return dissect_x509af_Certificate(true, sub_tvb
, 0, &asn1_ctx
, cert_tree
, hf_uds_signedCertificate
);
2222 case ber_cert_multi_false
:
2223 return dissect_x509af_Certificates(false, sub_tvb
, 0, &asn1_ctx
, cert_tree
, hf_uds_signedCertificate
);
2225 case ber_cert_multi_true
:
2226 return dissect_x509af_Certificates(true, sub_tvb
, 0, &asn1_ctx
, cert_tree
, hf_uds_signedCertificate
);
2233 dissect_uds_internal(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint16_t source_address
, uint16_t target_address
, uint8_t number_of_addresses_valid
, uint8_t address_size
) {
2234 proto_tree
*uds_tree
;
2235 proto_tree
*subfunction_tree
;
2237 uint8_t sid
, service
;
2239 const char *service_name
;
2240 uint32_t ecu_address
;
2241 uint32_t data_length
= tvb_reported_length(tvb
);
2242 tvbuff_t
*payload_tvb
;
2244 uint32_t offset
= 0;
2246 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "UDS");
2248 if (uds_clear_info_col
) {
2249 col_clear(pinfo
->cinfo
, COL_INFO
);
2251 col_append_str(pinfo
->cinfo
, COL_INFO
, " ");
2254 sid
= tvb_get_uint8(tvb
, offset
);
2255 service
= sid
& UDS_SID_MASK
;
2257 if (service
< UDS_SERVICES_MIN
&& uds_dissect_small_sids_with_obd_ii
&& (obd_ii_handle
!= NULL
)) {
2258 return call_dissector(obd_ii_handle
, tvb_new_subset_length_caplen(tvb
, offset
, -1, -1), pinfo
, tree
);
2261 service_name
= val_to_str_ext(service
, &uds_services_ext
, "Unknown (0x%02x)");
2263 col_append_fstr(pinfo
->cinfo
, COL_INFO
, "%-7s %-36s", (sid
& UDS_REPLY_MASK
)? "Reply": "Request", service_name
);
2265 ti
= proto_tree_add_item(tree
, proto_uds
, tvb
, offset
, -1, ENC_NA
);
2266 uds_tree
= proto_item_add_subtree(ti
, ett_uds
);
2268 if (sid
& UDS_REPLY_MASK
) {
2269 ecu_address
= source_address
;
2271 ecu_address
= target_address
;
2274 switch (number_of_addresses_valid
) {
2276 ecu_address
= UINT32_MAX
;
2279 uds_proto_item_append_address_text(ti
, address_size
, "Address", source_address
);
2280 uds_proto_item_append_address_name(ti
, source_address
);
2282 uds_proto_tree_add_address_item(uds_tree
, hf_uds_diag_addr
, tvb
, 0, 0, source_address
, true, false);
2283 uds_proto_tree_add_address_name(uds_tree
, hf_uds_diag_addr_name
, tvb
, 0, 0, source_address
);
2286 uds_proto_item_append_address_text(ti
, address_size
, "Source", source_address
);
2287 uds_proto_item_append_address_name(ti
, source_address
);
2288 uds_proto_item_append_address_text(ti
, address_size
, "Target", target_address
);
2289 uds_proto_item_append_address_name(ti
, target_address
);
2291 uds_proto_tree_add_address_item(uds_tree
, hf_uds_diag_source_addr
, tvb
, 0, 0, source_address
, true, false);
2292 uds_proto_tree_add_address_name(uds_tree
, hf_uds_diag_source_addr_name
, tvb
, 0, 0, source_address
);
2294 uds_proto_tree_add_address_item(uds_tree
, hf_uds_diag_addr
, tvb
, 0, 0, source_address
, true, true);
2295 uds_proto_tree_add_address_name(uds_tree
, hf_uds_diag_addr_name
, tvb
, 0, 0, source_address
);
2297 uds_proto_tree_add_address_item(uds_tree
, hf_uds_diag_target_addr
, tvb
, 0, 0, target_address
, true, false);
2298 uds_proto_tree_add_address_name(uds_tree
, hf_uds_diag_target_addr_name
, tvb
, 0, 0, target_address
);
2300 uds_proto_tree_add_address_item(uds_tree
, hf_uds_diag_addr
, tvb
, 0, 0, target_address
, true, true);
2301 uds_proto_tree_add_address_name(uds_tree
, hf_uds_diag_addr_name
, tvb
, 0, 0, target_address
);
2305 proto_tree_add_item(uds_tree
, hf_uds_service
, tvb
, offset
, 1, ENC_NA
);
2306 proto_tree_add_item(uds_tree
, hf_uds_reply
, tvb
, offset
, 1, ENC_NA
);
2310 case UDS_SERVICES_DSC
:
2313 proto_tree_add_item_ret_boolean(uds_tree
, hf_uds_dsc_suppress_pos_rsp_msg_ind
, tvb
, offset
, 1, ENC_NA
, &suppress
);
2314 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_dsc_subfunction
, tvb
, offset
, 1, ENC_NA
, &enum_val
);
2315 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", val_to_str(enum_val
, uds_dsc_types
, "Unknown (0x%02x)"));
2317 col_append_str(pinfo
->cinfo
, COL_INFO
, " (Reply suppressed)");
2322 if (sid
& UDS_REPLY_MASK
) {
2323 ti
= proto_tree_add_item(uds_tree
, hf_uds_dsc_parameter_record
, tvb
, offset
, data_length
- offset
, ENC_NA
);
2324 proto_tree
*param_tree
= proto_item_add_subtree(ti
, ett_uds_dsc_parameter_record
);
2326 uint32_t default_p2
;
2327 proto_tree_add_item_ret_uint(param_tree
, hf_uds_dsc_default_p2_server_timer
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &default_p2
);
2330 uint32_t enhanced_p2
= tvb_get_uint16(tvb
, offset
, ENC_BIG_ENDIAN
) * 10;
2331 proto_tree_add_uint(param_tree
, hf_uds_dsc_enhanced_p2_server_timer
, tvb
, offset
, 2, enhanced_p2
);
2334 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " P2-default:%5dms P2-enhanced:%6dms", default_p2
, enhanced_p2
);
2338 case UDS_SERVICES_ER
:
2339 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_er_subfunction
, tvb
, offset
, 1, ENC_NA
, &enum_val
);
2340 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", val_to_str(enum_val
, uds_er_types
, "Unknown (0x%02x)"));
2343 if ((sid
& UDS_REPLY_MASK
) && (enum_val
== UDS_ER_TYPES_ENABLE_RAPID_POWER_SHUTDOWN
)) {
2345 ti
= proto_tree_add_item_ret_uint(uds_tree
, hf_uds_er_power_down_time
, tvb
, offset
, 1, ENC_NA
, &tmp
);
2346 if (tmp
== UDS_ER_TYPE_ENABLE_RAPID_POWER_SHUTDOWN_INVALID
) {
2347 proto_item_append_text(ti
, " (Failure or time not available!)");
2353 case UDS_SERVICES_CDTCI
:
2354 if (sid
& UDS_REPLY_MASK
) {
2357 proto_tree_add_item(uds_tree
, hf_uds_cdtci_group_of_dtc
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
2360 if (offset
+ 1 <= data_length
) {
2361 proto_tree_add_item(uds_tree
, hf_uds_cdtci_memory_selection
, tvb
, offset
, 1, ENC_NA
);
2366 case UDS_SERVICES_RDTCI
:
2367 offset
= dissect_uds_rdtci(tvb
, pinfo
, uds_tree
, ecu_address
, sid
, offset
, data_length
);
2370 case UDS_SERVICES_RDBI
:
2371 if (sid
& UDS_REPLY_MASK
) {
2372 /* Can't know the size of the data for each identifier, Decode like if there is only one identifier */
2373 uint32_t data_identifier
;
2374 ti
= proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdbi_data_identifier
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &data_identifier
);
2375 protoitem_append_data_name(ti
, ecu_address
, (uint16_t)data_identifier
);
2378 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%04x", data_identifier
);
2379 infocol_append_data_name(pinfo
, ecu_address
, data_identifier
);
2381 bool dissection_ok
= false;
2382 if (data_length
> offset
) {
2383 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
2385 payload_tvb
= tvb_new_subset_length(tvb
, offset
, data_length
- offset
);
2386 dissection_ok
= call_heur_subdissector_uds(payload_tvb
, pinfo
, tree
, uds_tree
, service
, true, data_identifier
, ecu_address
);
2389 if (!dissection_ok
) {
2390 /* ISO14229: at least one byte for data record. Just make sure, we show an error, if less than 1 byte left! */
2391 proto_tree_add_item(uds_tree
, hf_uds_data_record
, tvb
, offset
, MAX(1, data_length
- offset
), ENC_NA
);
2394 offset
= data_length
;
2398 /* ISO14229: data identifiers are 2 bytes and at least one has to be present. */
2400 uint32_t data_identifier
;
2401 ti
= proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdbi_data_identifier
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &data_identifier
);
2402 protoitem_append_data_name(ti
, ecu_address
, (uint16_t)data_identifier
);
2404 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%04x", data_identifier
);
2405 infocol_append_data_name(pinfo
, ecu_address
, data_identifier
);
2407 } while (data_length
>= offset
+ 2);
2411 case UDS_SERVICES_RMBA
:
2412 if (sid
& UDS_REPLY_MASK
) {
2413 if (offset
< data_length
) {
2414 proto_tree_add_item(uds_tree
, hf_uds_data_record
, tvb
, offset
, data_length
- offset
, ENC_NA
);
2415 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
2416 offset
= data_length
;
2419 offset
= dissect_uds_memory_addr_size(tvb
, pinfo
, uds_tree
, offset
, false);
2423 case UDS_SERVICES_RSDBI
:
2424 proto_tree_add_item(uds_tree
, hf_uds_rsdbi_data_identifier
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2427 if (sid
& UDS_REPLY_MASK
) {
2429 proto_tree
*tmp_tree
;
2430 ti
= proto_tree_add_item(uds_tree
, hf_uds_rsdbi_scaling_byte
, tvb
, offset
, 1, ENC_NA
);
2431 tmp_tree
= proto_item_add_subtree(ti
, ett_uds_rsdbi_scaling_byte
);
2432 unsigned data_type
, num_of_bytes
;
2433 proto_tree_add_item_ret_uint(tmp_tree
, hf_uds_rsdbi_scaling_byte_data_type
, tvb
, offset
, 1, ENC_NA
, &data_type
);
2434 proto_tree_add_item_ret_uint(tmp_tree
, hf_uds_rsdbi_scaling_byte_num_of_bytes
, tvb
, offset
, 1, ENC_NA
, &num_of_bytes
);
2435 proto_item_append_text(ti
, ", %s, %d", val_to_str(data_type
, uds_rsdbi_data_types
, "Unknown (0x%x)"), num_of_bytes
);
2438 /* lets parse the extension, if needed... */
2440 switch (data_type
) {
2441 case UDS_RSDBI_DATA_TYPE_BITMAPPED_REPORTED_WO_MAP
:
2442 proto_tree_add_item(uds_tree
, hf_uds_rsdbi_validity_mask
, tvb
, offset
, num_of_bytes
, ENC_NA
);
2443 offset
+= num_of_bytes
;
2445 case UDS_RSDBI_DATA_TYPE_FORMULA
:
2446 proto_tree_add_item(uds_tree
, hf_uds_rsdbi_formula_identifier
, tvb
, offset
, 1, ENC_NA
);
2447 next_pos
= offset
+ num_of_bytes
;
2448 while (offset
+ 2 <= next_pos
) {
2449 ti
= proto_tree_add_item(uds_tree
, hf_uds_rsdbi_formula_constant
, tvb
, offset
, 2, ENC_NA
);
2450 proto_tree
*const_tree
= proto_item_add_subtree(ti
, ett_uds_rsdbi_formula_constant
);
2451 proto_tree_add_item(const_tree
, hf_uds_rsdbi_formula_constant_exp
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2452 proto_tree_add_item(const_tree
, hf_uds_rsdbi_formula_constant_mantissa
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2456 case UDS_RSDBI_DATA_TYPE_UNIT_FORMAT
:
2457 proto_tree_add_item(uds_tree
, hf_uds_rsdbi_unit
, tvb
, offset
, 1, ENC_NA
);
2458 offset
+= num_of_bytes
;
2461 } while (offset
< data_length
);
2466 case UDS_SERVICES_SA
:
2467 ti
= proto_tree_add_item_ret_uint(uds_tree
, hf_uds_sa_subfunction
, tvb
, offset
, 1, ENC_NA
, &enum_val
);
2468 proto_item_append_text(ti
, " (%s)", uds_sa_subfunction_to_string(enum_val
));
2469 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s (0x%02x)", uds_sa_subfunction_to_string(enum_val
), enum_val
);
2472 if (data_length
> offset
) {
2473 if (sid
& UDS_REPLY_MASK
) {
2474 switch (uds_sa_subfunction_to_type(enum_val
)) {
2475 case UDS_SA_TYPES_SEND_KEY
: /* fall through */
2476 case UDS_SA_TYPES_SEND_KEY_ISO26021
:
2479 case UDS_SA_TYPES_REQUEST_SEED
: /* fall through */
2480 case UDS_SA_TYPES_REQUEST_SEED_ISO26021
:
2481 proto_tree_add_item(uds_tree
, hf_uds_sa_seed
, tvb
, offset
, data_length
- offset
, ENC_NA
);
2482 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
2485 proto_tree_add_item(uds_tree
, hf_uds_data_record
, tvb
, offset
, data_length
- offset
, ENC_NA
);
2486 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
2489 switch (uds_sa_subfunction_to_type(enum_val
)) {
2490 case UDS_SA_TYPES_SEND_KEY
: /* fall through */
2491 case UDS_SA_TYPES_SEND_KEY_ISO26021
:
2492 proto_tree_add_item(uds_tree
, hf_uds_sa_key
, tvb
, offset
, data_length
- offset
, ENC_NA
);
2493 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
2495 case UDS_SA_TYPES_REQUEST_SEED
: /* fall through */
2496 case UDS_SA_TYPES_REQUEST_SEED_ISO26021
:
2498 proto_tree_add_item(uds_tree
, hf_uds_data_record
, tvb
, offset
, data_length
- offset
, ENC_NA
);
2499 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
2502 offset
= data_length
;
2506 case UDS_SERVICES_CC
:
2507 if (sid
& UDS_REPLY_MASK
) {
2508 offset
= dissect_uds_subfunction(tvb
, pinfo
, uds_tree
, offset
, &enum_val
, hf_uds_cc_subfunction_no_suppress
, uds_cc_types
, false);
2510 offset
= dissect_uds_subfunction(tvb
, pinfo
, uds_tree
, offset
, &enum_val
, hf_uds_cc_subfunction_no_suppress
, uds_cc_types
, true);
2512 proto_tree
*comm_type_tree
;
2513 ti
= proto_tree_add_item(uds_tree
, hf_uds_cc_comm_type_and_subnet_number
, tvb
, offset
, 1, ENC_NA
);
2514 comm_type_tree
= proto_item_add_subtree(ti
, ett_uds_cc_communication_type
);
2515 proto_tree_add_item(comm_type_tree
, hf_uds_cc_communication_type
, tvb
, offset
, 1, ENC_NA
);
2516 proto_tree_add_item(comm_type_tree
, hf_uds_cc_subnet_number
, tvb
, offset
, 1, ENC_NA
);
2519 if (enum_val
== UDS_CC_TYPES_ENABLE_RX_AND_DISABLE_TX_WITH_ENH_ADDR_INFO
|| enum_val
== UDS_CC_TYPES_ENABLE_RX_AND_TX_WITH_ENH_ADDR_INFO
) {
2520 proto_tree_add_item(uds_tree
, hf_uds_cc_node_identifier_number
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2526 case UDS_SERVICES_ARS
:
2527 if (sid
& UDS_REPLY_MASK
) {
2528 unsigned length_field
;
2529 proto_tree
*algo_tree
;
2531 offset
= dissect_uds_subfunction(tvb
, pinfo
, uds_tree
, offset
, &enum_val
, hf_uds_ars_subfunction_no_suppress
, uds_ars_types
, false);
2534 case UDS_ARS_TYPES_DEAUTHENTICATE
: /* fall through */
2535 case UDS_ARS_TYPES_TRANSMIT_CERTIFICATE
: /* fall through */
2536 case UDS_ARS_TYPES_AUTH_CONFIGURATION
:
2537 proto_tree_add_item(uds_tree
, hf_uds_ars_auth_ret_param
, tvb
, offset
, 1, ENC_NA
);
2541 case UDS_ARS_TYPES_VERIFY_CERT_UNIDIRECTIONAL
:
2542 proto_tree_add_item(uds_tree
, hf_uds_ars_auth_ret_param
, tvb
, offset
, 1, ENC_NA
);
2545 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_challenge_server
, tvb
, offset
, 2, ENC_NA
, &length_field
);
2548 proto_tree_add_item(uds_tree
, hf_uds_ars_challenge_server
, tvb
, offset
, length_field
, ENC_NA
);
2549 offset
+= length_field
;
2551 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_ephemeral_public_key_server
, tvb
, offset
, 2, ENC_NA
, &length_field
);
2554 if (length_field
> 0) {
2555 proto_tree_add_item(uds_tree
, hf_uds_ars_ephemeral_public_key_server
, tvb
, offset
, length_field
, ENC_NA
);
2556 offset
+= length_field
;
2560 case UDS_ARS_TYPES_VERIFY_CERT_BIDIRECTIONAL
:
2561 proto_tree_add_item(uds_tree
, hf_uds_ars_auth_ret_param
, tvb
, offset
, 1, ENC_NA
);
2564 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_challenge_server
, tvb
, offset
, 2, ENC_NA
, &length_field
);
2567 proto_tree_add_item(uds_tree
, hf_uds_ars_challenge_server
, tvb
, offset
, length_field
, ENC_NA
);
2568 offset
+= length_field
;
2570 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_cert_server
, tvb
, offset
, 2, ENC_NA
, &length_field
);
2573 ti
= proto_tree_add_item(uds_tree
, hf_uds_ars_cert_server
, tvb
, offset
, length_field
, ENC_NA
);
2574 dissect_uds_certificates_into_tree(tvb
, pinfo
, uds_tree
, ti
, offset
, length_field
);
2575 offset
+= length_field
;
2577 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_proof_of_ownership_server
, tvb
, offset
, 2, ENC_NA
, &length_field
);
2580 proto_tree_add_item(uds_tree
, hf_uds_ars_proof_of_ownership_server
, tvb
, offset
, length_field
, ENC_NA
);
2581 offset
+= length_field
;
2583 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_ephemeral_public_key_server
, tvb
, offset
, 2, ENC_NA
, &length_field
);
2586 if (length_field
> 0) {
2587 proto_tree_add_item(uds_tree
, hf_uds_ars_ephemeral_public_key_server
, tvb
, offset
, length_field
, ENC_NA
);
2588 offset
+= length_field
;
2592 case UDS_ARS_TYPES_PROOF_OF_OWNERSHIP
:
2593 proto_tree_add_item(uds_tree
, hf_uds_ars_auth_ret_param
, tvb
, offset
, 1, ENC_NA
);
2596 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_session_key_info
, tvb
, offset
, 2, ENC_NA
, &length_field
);
2599 if (length_field
> 0) {
2600 proto_tree_add_item(uds_tree
, hf_uds_ars_session_key_info
, tvb
, offset
, length_field
, ENC_NA
);
2601 offset
+= length_field
;
2605 case UDS_ARS_TYPES_REQUEST_CHALLENGE_FOR_AUTH
:
2606 proto_tree_add_item(uds_tree
, hf_uds_ars_auth_ret_param
, tvb
, offset
, 1, ENC_NA
);
2609 ti
= proto_tree_add_item(uds_tree
, hf_uds_ars_algo_indicator
, tvb
, offset
, 16, ENC_NA
);
2610 algo_tree
= proto_item_add_subtree(ti
, ett_uds_ars_algo_indicator
);
2611 dissect_unknown_ber(pinfo
, tvb
, offset
, algo_tree
);
2614 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_challenge_server
, tvb
, offset
, 2, ENC_NA
, &length_field
);
2617 proto_tree_add_item(uds_tree
, hf_uds_ars_challenge_server
, tvb
, offset
, length_field
, ENC_NA
);
2618 offset
+= length_field
;
2620 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_needed_additional_parameter
, tvb
, offset
, 2, ENC_NA
, &length_field
);
2623 if (length_field
> 0) {
2624 proto_tree_add_item(uds_tree
, hf_uds_ars_needed_additional_parameter
, tvb
, offset
, length_field
, ENC_NA
);
2625 offset
+= length_field
;
2629 case UDS_ARS_TYPES_VERIFY_PROOF_OF_OWN_UNIDIR
:
2630 proto_tree_add_item(uds_tree
, hf_uds_ars_auth_ret_param
, tvb
, offset
, 1, ENC_NA
);
2633 ti
= proto_tree_add_item(uds_tree
, hf_uds_ars_algo_indicator
, tvb
, offset
, 16, ENC_NA
);
2634 algo_tree
= proto_item_add_subtree(ti
, ett_uds_ars_algo_indicator
);
2635 dissect_unknown_ber(pinfo
, tvb
, offset
, algo_tree
);
2638 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_session_key_info
, tvb
, offset
, 2, ENC_NA
, &length_field
);
2641 if (length_field
> 0) {
2642 proto_tree_add_item(uds_tree
, hf_uds_ars_session_key_info
, tvb
, offset
, length_field
, ENC_NA
);
2643 offset
+= length_field
;
2647 case UDS_ARS_TYPES_VERIFY_PROOF_OF_OWN_BIDIR
:
2648 proto_tree_add_item(uds_tree
, hf_uds_ars_auth_ret_param
, tvb
, offset
, 1, ENC_NA
);
2651 ti
= proto_tree_add_item(uds_tree
, hf_uds_ars_algo_indicator
, tvb
, offset
, 16, ENC_NA
);
2652 algo_tree
= proto_item_add_subtree(ti
, ett_uds_ars_algo_indicator
);
2653 dissect_unknown_ber(pinfo
, tvb
, offset
, algo_tree
);
2656 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_proof_of_ownership_server
, tvb
, offset
, 2, ENC_NA
, &length_field
);
2659 proto_tree_add_item(uds_tree
, hf_uds_ars_proof_of_ownership_server
, tvb
, offset
, length_field
, ENC_NA
);
2660 offset
+= length_field
;
2662 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_session_key_info
, tvb
, offset
, 2, ENC_NA
, &length_field
);
2665 if (length_field
> 0) {
2666 proto_tree_add_item(uds_tree
, hf_uds_ars_session_key_info
, tvb
, offset
, length_field
, ENC_NA
);
2667 offset
+= length_field
;
2673 proto_tree
*algo_tree
;
2674 offset
= dissect_uds_subfunction(tvb
, pinfo
, uds_tree
, offset
, &enum_val
, hf_uds_ars_subfunction_no_suppress
, uds_ars_types
, true);
2677 case UDS_ARS_TYPES_DEAUTHENTICATE
: /* fall through */
2678 case UDS_ARS_TYPES_AUTH_CONFIGURATION
:
2682 case UDS_ARS_TYPES_VERIFY_CERT_UNIDIRECTIONAL
: /* fall through */
2683 case UDS_ARS_TYPES_VERIFY_CERT_BIDIRECTIONAL
: {
2684 proto_tree_add_item(uds_tree
, hf_uds_ars_comm_config
, tvb
, offset
, 1, ENC_NA
);
2687 unsigned length_cert_client
;
2688 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_cert_client
, tvb
, offset
, 2, ENC_NA
, &length_cert_client
);
2691 ti
= proto_tree_add_item(uds_tree
, hf_uds_ars_cert_client
, tvb
, offset
, length_cert_client
, ENC_NA
);
2692 dissect_uds_certificates_into_tree(tvb
, pinfo
, uds_tree
, ti
, offset
, length_cert_client
);
2693 offset
+= length_cert_client
;
2695 unsigned length_challenge_client
;
2696 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_challenge_client
, tvb
, offset
, 2, ENC_NA
, &length_challenge_client
);
2699 if (length_challenge_client
> 0 || enum_val
== UDS_ARS_TYPES_VERIFY_CERT_BIDIRECTIONAL
) {
2700 proto_tree_add_item(uds_tree
, hf_uds_ars_challenge_client
, tvb
, offset
, length_challenge_client
, ENC_NA
);
2701 offset
+= length_challenge_client
;
2706 case UDS_ARS_TYPES_PROOF_OF_OWNERSHIP
: {
2707 unsigned length_proof_of_ownership_client
;
2708 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_proof_of_ownership_client
, tvb
, offset
, 2, ENC_NA
, &length_proof_of_ownership_client
);
2711 proto_tree_add_item(uds_tree
, hf_uds_ars_proof_of_ownership_client
, tvb
, offset
, length_proof_of_ownership_client
, ENC_NA
);
2712 offset
+= length_proof_of_ownership_client
;
2714 unsigned length_ephemeral_public_key_client
;
2715 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_ephemeral_public_key_client
, tvb
, offset
, 2, ENC_NA
, &length_ephemeral_public_key_client
);
2718 if (length_ephemeral_public_key_client
> 0) {
2719 proto_tree_add_item(uds_tree
, hf_uds_ars_ephemeral_public_key_client
, tvb
, offset
, length_ephemeral_public_key_client
, ENC_NA
);
2720 offset
+= length_ephemeral_public_key_client
;
2726 case UDS_ARS_TYPES_TRANSMIT_CERTIFICATE
: {
2727 proto_tree_add_item(uds_tree
, hf_uds_ars_cert_eval_id
, tvb
, offset
, 2, ENC_NA
);
2730 unsigned length_cert_data
;
2731 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_cert_data
, tvb
, offset
, 2, ENC_NA
, &length_cert_data
);
2734 proto_tree_add_item(uds_tree
, hf_uds_ars_cert_data
, tvb
, offset
, length_cert_data
, ENC_NA
);
2735 offset
+= length_cert_data
;
2739 case UDS_ARS_TYPES_REQUEST_CHALLENGE_FOR_AUTH
: {
2740 proto_tree_add_item(uds_tree
, hf_uds_ars_comm_config
, tvb
, offset
, 1, ENC_NA
);
2743 ti
= proto_tree_add_item(uds_tree
, hf_uds_ars_algo_indicator
, tvb
, offset
, 16, ENC_NA
);
2744 algo_tree
= proto_item_add_subtree(ti
, ett_uds_ars_algo_indicator
);
2745 dissect_unknown_ber(pinfo
, tvb
, offset
, algo_tree
);
2750 case UDS_ARS_TYPES_VERIFY_PROOF_OF_OWN_UNIDIR
: /* fall through */
2751 case UDS_ARS_TYPES_VERIFY_PROOF_OF_OWN_BIDIR
: {
2752 ti
= proto_tree_add_item(uds_tree
, hf_uds_ars_algo_indicator
, tvb
, offset
, 16, ENC_NA
);
2753 algo_tree
= proto_item_add_subtree(ti
, ett_uds_ars_algo_indicator
);
2754 dissect_unknown_ber(pinfo
, tvb
, offset
, algo_tree
);
2757 unsigned length_proof_of_ownership_client
;
2758 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_proof_of_ownership_client
, tvb
, offset
, 2, ENC_NA
, &length_proof_of_ownership_client
);
2761 proto_tree_add_item(uds_tree
, hf_uds_ars_proof_of_ownership_client
, tvb
, offset
, length_proof_of_ownership_client
, ENC_NA
);
2762 offset
+= length_proof_of_ownership_client
;
2764 unsigned length_challenge_client
;
2765 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_challenge_client
, tvb
, offset
, 2, ENC_NA
, &length_challenge_client
);
2768 if (length_challenge_client
> 0 || enum_val
== UDS_ARS_TYPES_VERIFY_PROOF_OF_OWN_BIDIR
) {
2769 proto_tree_add_item(uds_tree
, hf_uds_ars_challenge_client
, tvb
, offset
, length_challenge_client
, ENC_NA
);
2770 offset
+= length_challenge_client
;
2773 unsigned length_additional_parameter
;
2774 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_ars_length_of_additional_parameter
, tvb
, offset
, 2, ENC_NA
, &length_additional_parameter
);
2777 if (length_additional_parameter
> 0) {
2778 proto_tree_add_item(uds_tree
, hf_uds_ars_additional_parameter
, tvb
, offset
, length_additional_parameter
, ENC_NA
);
2779 offset
+= length_additional_parameter
;
2787 case UDS_SERVICES_RDBPI
:
2788 if (sid
& UDS_REPLY_MASK
) {
2789 proto_tree_add_item(uds_tree
, hf_uds_rdbpi_periodic_data_identifier
, tvb
, offset
, 1, ENC_NA
);
2792 proto_tree_add_item(uds_tree
, hf_uds_data_record
, tvb
, offset
, data_length
- offset
, ENC_NA
);
2793 offset
= data_length
;
2795 unsigned transmission_mode
;
2796 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rdbpi_transmission_mode
, tvb
, offset
, 1, ENC_NA
, &transmission_mode
);
2799 /* For transmission mode 1 (send at slow rate), mode 2 (medium rate), and mode 3 (fast rate), require at least 1 pdid! */
2800 if (1 <= transmission_mode
&& transmission_mode
<= 3) {
2801 proto_tree_add_item(uds_tree
, hf_uds_rdbpi_periodic_data_identifier
, tvb
, offset
, 1, ENC_NA
);
2805 while (offset
< data_length
) {
2806 proto_tree_add_item(uds_tree
, hf_uds_rdbpi_periodic_data_identifier
, tvb
, offset
, 1, ENC_NA
);
2812 case UDS_SERVICES_DDDI
:
2813 if (sid
& UDS_REPLY_MASK
) {
2814 offset
= dissect_uds_subfunction(tvb
, pinfo
, uds_tree
, offset
, &enum_val
, hf_uds_dddi_subfunction_no_suppress
, uds_dddi_types
, false);
2816 if (offset
+ 2 <= data_length
) {
2817 proto_tree_add_item(uds_tree
, hf_uds_dddi_dyn_defined_data_identifier
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2821 offset
= dissect_uds_subfunction(tvb
, pinfo
, uds_tree
, offset
, &enum_val
, hf_uds_dddi_subfunction_no_suppress
, uds_dddi_types
, true);
2824 case UDS_DDDI_TYPES_DEFINE_BY_IDENTIFIER
:
2825 proto_tree_add_item(uds_tree
, hf_uds_dddi_dyn_defined_data_identifier
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2829 proto_tree
*tmp_tree
;
2830 tmp_tree
= proto_tree_add_subtree(uds_tree
, tvb
, offset
, 4, ett_uds_dddi_entry
, &ti
, "Element");
2832 unsigned source_data_id
;
2833 proto_tree_add_item_ret_uint(tmp_tree
, hf_uds_dddi_source_data_identifier
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &source_data_id
);
2837 proto_tree_add_item_ret_uint(tmp_tree
, hf_uds_dddi_position_in_source_data_record
, tvb
, offset
, 1, ENC_NA
, &position
);
2841 proto_tree_add_item_ret_uint(tmp_tree
, hf_uds_dddi_memory_size
, tvb
, offset
, 1, ENC_NA
, &mem_size
);
2844 proto_item_append_text(ti
, " %d with Source ID 0x%04x and %d byte(s)", position
, source_data_id
, mem_size
);
2845 } while (offset
+ 4 <= data_length
);
2849 case UDS_DDDI_TYPES_DEFINE_BY_MEM_ADDRESS
:
2850 proto_tree_add_item(uds_tree
, hf_uds_dddi_dyn_defined_data_identifier
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2853 uint32_t memory_size_length
, memory_address_length
;
2854 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_memory_size_length
, tvb
, offset
, 1, ENC_NA
, &memory_size_length
);
2855 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_memory_address_length
, tvb
, offset
, 1, ENC_NA
, &memory_address_length
);
2859 uint64_t memory_address
;
2860 proto_tree_add_item_ret_uint64(uds_tree
, hf_uds_memory_address
, tvb
, offset
, memory_address_length
, ENC_BIG_ENDIAN
, &memory_address
);
2861 offset
+= memory_address_length
;
2863 uint64_t memory_size
;
2864 proto_tree_add_item_ret_uint64(uds_tree
, hf_uds_memory_size
, tvb
, offset
, memory_size_length
, ENC_BIG_ENDIAN
, &memory_size
);
2865 offset
+= memory_size_length
;
2866 } while (offset
+ memory_address_length
+ memory_size_length
<= data_length
);
2869 case UDS_DDDI_TYPES_CLEAR_DYN_DEF_DATA_ID
:
2870 if (offset
+ 2 <= data_length
) {
2871 proto_tree_add_item(uds_tree
, hf_uds_dddi_dyn_defined_data_identifier
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
2879 case UDS_SERVICES_WDBI
:
2880 ti
= proto_tree_add_item_ret_uint(uds_tree
, hf_uds_wdbi_data_identifier
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &enum_val
);
2881 protoitem_append_data_name(ti
, ecu_address
, (uint16_t)enum_val
);
2882 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%04x", enum_val
);
2883 infocol_append_data_name(pinfo
, ecu_address
, enum_val
);
2886 if (!(sid
& UDS_REPLY_MASK
)) {
2887 bool dissection_ok
= false;
2888 if (data_length
> offset
) {
2889 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
2891 payload_tvb
= tvb_new_subset_length(tvb
, offset
, data_length
- offset
);
2892 dissection_ok
= call_heur_subdissector_uds(payload_tvb
, pinfo
, tree
, uds_tree
, service
, false, enum_val
, ecu_address
);
2895 if (!dissection_ok
) {
2896 /* ISO14229: at least one byte for data record. Just make sure, we show an error, if less than 1 byte left! */
2897 proto_tree_add_item(uds_tree
, hf_uds_data_record
, tvb
, offset
, MAX(1, data_length
- offset
), ENC_NA
);
2900 offset
= data_length
;
2904 case UDS_SERVICES_IOCBI
: {
2905 uint32_t data_identifier
;
2906 ti
= proto_tree_add_item_ret_uint(uds_tree
, hf_uds_iocbi_data_identifier
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &data_identifier
);
2907 protoitem_append_data_name(ti
, ecu_address
, (uint16_t)data_identifier
);
2908 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%04x", data_identifier
);
2909 infocol_append_data_name(pinfo
, ecu_address
, data_identifier
);
2912 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_iocbi_parameter
, tvb
, offset
, 1, ENC_NA
, &enum_val
);
2913 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", val_to_str(enum_val
, uds_iocbi_parameters
, "Unknown (0x%02x)"));
2916 /* The exact format depends on vehicle manufacturer and config. Not much we can do here. */
2917 if (data_length
> offset
) {
2918 proto_tree_add_item(uds_tree
, hf_uds_iocbi_state
, tvb
, offset
, data_length
- offset
, ENC_NA
);
2919 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
2921 offset
= data_length
;
2925 case UDS_SERVICES_RC
: {
2926 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rc_subfunction
, tvb
, offset
, 1, ENC_NA
, &enum_val
);
2927 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", val_to_str(enum_val
, uds_rc_types
, "Unknown (0x%02x)"));
2930 uint32_t identifier
;
2931 ti
= proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rc_identifier
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &identifier
);
2932 protoitem_append_routine_name(ti
, ecu_address
, identifier
);
2933 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%04x", identifier
);
2934 infocol_append_routine_name(pinfo
, ecu_address
, identifier
);
2937 if (sid
& UDS_REPLY_MASK
) {
2938 if (data_length
> offset
) {
2940 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rc_info
, tvb
, offset
, 1, ENC_NA
, &info
);
2941 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " 0x%x", info
);
2944 if (data_length
> offset
) {
2945 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
2947 payload_tvb
= tvb_new_subset_length(tvb
, offset
, data_length
- offset
);
2948 if (!call_heur_subdissector_uds(payload_tvb
, pinfo
, tree
, uds_tree
, service
, true, identifier
, ecu_address
)) {
2949 proto_tree_add_item(uds_tree
, hf_uds_rc_status_record
, tvb
, offset
, data_length
- offset
, ENC_NA
);
2952 offset
= data_length
;
2956 if (data_length
> offset
) {
2957 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
2959 payload_tvb
= tvb_new_subset_length(tvb
, offset
, data_length
- offset
);
2960 if (!call_heur_subdissector_uds(payload_tvb
, pinfo
, tree
, uds_tree
, service
, false, identifier
, ecu_address
)) {
2961 proto_tree_add_item(uds_tree
, hf_uds_rc_option_record
, tvb
, offset
, data_length
- offset
, ENC_NA
);
2964 offset
= data_length
;
2970 case UDS_SERVICES_RD
: /* fall through */
2971 case UDS_SERVICES_RU
:
2972 if (sid
& UDS_REPLY_MASK
) {
2973 uint32_t max_block_length_length
;
2974 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_max_block_len_len
, tvb
, offset
, 1, ENC_NA
, &max_block_length_length
);
2977 uint64_t max_block_length
;
2978 proto_tree_add_item_ret_uint64(uds_tree
, hf_uds_max_block_len
, tvb
, offset
, max_block_length_length
, ENC_BIG_ENDIAN
, &max_block_length
);
2979 offset
+= max_block_length_length
;
2981 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " Max Block Length 0x%" PRIx64
, max_block_length
);
2983 offset
= dissect_uds_memory_addr_size(tvb
, pinfo
, uds_tree
, offset
, true);
2987 case UDS_SERVICES_TD
: {
2988 uint32_t sequence_no
;
2989 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_td_sequence_counter
, tvb
, offset
, 1, ENC_NA
, &sequence_no
);
2990 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " Block Sequence Counter %d", sequence_no
);
2993 if (data_length
> offset
) {
2994 proto_tree_add_item(uds_tree
, hf_uds_td_record_data
, tvb
, offset
, data_length
- offset
, ENC_NA
);
2995 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
2996 offset
= data_length
;
3001 case UDS_SERVICES_RTE
:
3002 if (data_length
> offset
) {
3003 proto_tree_add_item(uds_tree
, hf_uds_rte_record_data
, tvb
, offset
, data_length
- offset
, ENC_NA
);
3004 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
3005 offset
= data_length
;
3009 case UDS_SERVICES_RFT
: {
3010 unsigned mode_of_op
;
3011 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rft_mode_of_operation
, tvb
, offset
, 1, ENC_NA
, &mode_of_op
);
3014 if (sid
& UDS_REPLY_MASK
) {
3015 if (mode_of_op
!= UDS_RFT_MODE_DELETE_FILE
) {
3016 uint32_t length_max_num_block_len
;
3017 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rft_length_format_identifier
, tvb
, offset
, 1, ENC_NA
, &length_max_num_block_len
);
3020 proto_tree_add_item(uds_tree
, hf_uds_rft_max_num_of_block_length
, tvb
, offset
, length_max_num_block_len
, ENC_BIG_ENDIAN
);
3021 offset
+= length_max_num_block_len
;
3024 if (mode_of_op
!= UDS_RFT_MODE_DELETE_FILE
) {
3025 proto_tree_add_item(uds_tree
, hf_uds_compression_method
, tvb
, offset
, 1, ENC_NA
);
3026 proto_tree_add_item(uds_tree
, hf_uds_encrypting_method
, tvb
, offset
, 1, ENC_NA
);
3030 if (mode_of_op
!= UDS_RFT_MODE_ADD_FILE
&& mode_of_op
!= UDS_RFT_MODE_DELETE_FILE
&& mode_of_op
!= UDS_RFT_MODE_REPLACE_FILE
&& mode_of_op
!= UDS_RFT_MODE_RESUME_FILE
) {
3031 unsigned length_field
;
3032 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rft_file_size_or_dir_info_param_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &length_field
);
3035 proto_tree_add_item(uds_tree
, hf_uds_rft_file_size_uncompressed_or_dir_info_length
, tvb
, offset
, length_field
, ENC_BIG_ENDIAN
);
3036 offset
+= length_field
;
3038 if (mode_of_op
!= UDS_RFT_MODE_READ_DIR
) {
3039 proto_tree_add_item(uds_tree
, hf_uds_rft_file_size_compressed
, tvb
, offset
, length_field
, ENC_BIG_ENDIAN
);
3040 offset
+= length_field
;
3044 if (mode_of_op
!= UDS_RFT_MODE_ADD_FILE
&& mode_of_op
!= UDS_RFT_MODE_DELETE_FILE
&& mode_of_op
!= UDS_RFT_MODE_REPLACE_FILE
&& mode_of_op
!= UDS_RFT_MODE_READ_FILE
3045 && mode_of_op
!= UDS_RFT_MODE_READ_DIR
) {
3046 proto_tree_add_item(uds_tree
, hf_uds_rft_file_position
, tvb
, offset
, 8, ENC_BIG_ENDIAN
);
3050 unsigned length_field
;
3051 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rft_length_of_file_path_and_name
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &length_field
);
3054 proto_tree_add_item(uds_tree
, hf_uds_rft_file_path_and_name
, tvb
, offset
, length_field
, ENC_ASCII
);
3055 offset
+= length_field
;
3057 if (mode_of_op
!= UDS_RFT_MODE_DELETE_FILE
&& mode_of_op
!= UDS_RFT_MODE_READ_DIR
) {
3058 proto_tree_add_item(uds_tree
, hf_uds_compression_method
, tvb
, offset
, 1, ENC_NA
);
3059 proto_tree_add_item(uds_tree
, hf_uds_encrypting_method
, tvb
, offset
, 1, ENC_NA
);
3063 if (mode_of_op
!= UDS_RFT_MODE_DELETE_FILE
&& mode_of_op
!= UDS_RFT_MODE_READ_FILE
&& mode_of_op
!= UDS_RFT_MODE_READ_DIR
) {
3064 uint32_t fileSizeParameterLength
;
3065 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_rft_file_size_param_length
, tvb
, offset
, 1, ENC_NA
, &fileSizeParameterLength
);
3068 uint64_t filesize_uncompressed
, filesize_compressed
;
3069 proto_tree_add_item_ret_uint64(uds_tree
, hf_uds_rft_file_size_uncompressed
, tvb
, offset
, fileSizeParameterLength
, ENC_BIG_ENDIAN
, &filesize_uncompressed
);
3070 offset
+= fileSizeParameterLength
;
3072 proto_tree_add_item_ret_uint64(uds_tree
, hf_uds_rft_file_size_compressed
, tvb
, offset
, fileSizeParameterLength
, ENC_BIG_ENDIAN
, &filesize_compressed
);
3073 offset
+= fileSizeParameterLength
;
3080 case UDS_SERVICES_WMBA
:
3081 offset
= dissect_uds_memory_addr_size(tvb
, pinfo
, uds_tree
, offset
, false);
3083 if (sid
& UDS_REPLY_MASK
) {
3086 if (offset
< data_length
) {
3087 proto_tree_add_item(uds_tree
, hf_uds_data_record
, tvb
, offset
, data_length
- offset
, ENC_NA
);
3088 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
3089 offset
= data_length
;
3094 case UDS_SERVICES_TP
:
3095 offset
= dissect_uds_subfunction(tvb
, pinfo
, uds_tree
, offset
, &enum_val
, hf_uds_tp_subfunction_no_suppress
, NULL
, !(sid
& UDS_REPLY_MASK
));
3098 case UDS_SERVICES_ERR
:
3099 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_err_sid
, tvb
, offset
, 1, ENC_NA
, &enum_val
);
3100 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", val_to_str_ext(enum_val
, &uds_services_ext
, "Unknown (0x%02x)"));
3103 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_err_code
, tvb
, offset
, 1, ENC_NA
, &enum_val
);
3104 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " (NRC: %s)", val_to_str_ext(enum_val
, &uds_response_codes_ext
, "Unknown (0x%02x)"));
3108 case UDS_SERVICES_SDT
: {
3109 static int * const admin_param_flags
[] = {
3110 &hf_uds_sdt_administrative_param_resp_sign_req
,
3111 &hf_uds_sdt_administrative_param_signed
,
3112 &hf_uds_sdt_administrative_param_encrypted
,
3113 &hf_uds_sdt_administrative_param_pre_estab_key
,
3114 &hf_uds_sdt_administrative_param_req
,
3118 uint64_t addmin_param
;
3119 proto_tree_add_bitmask_with_flags_ret_uint64(uds_tree
, tvb
, offset
, hf_uds_sdt_administrative_param
, ett_uds_sdt_admin_param
, admin_param_flags
, ENC_NA
, BMT_NO_APPEND
, &addmin_param
);
3122 proto_tree_add_item(uds_tree
, hf_uds_sdt_signature_encryption_calculation
, tvb
, offset
, 1, ENC_NA
);
3125 uint32_t sig_length
;
3126 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_sdt_signature_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &sig_length
);
3129 proto_tree_add_item(uds_tree
, hf_uds_sdt_anti_replay_counter
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
3132 if (offset
+ sig_length
< data_length
) {
3133 uint32_t encap_length
= data_length
- offset
- sig_length
;
3134 ti
= proto_tree_add_item(uds_tree
, hf_uds_sdt_encapsulated_message
, tvb
, offset
, encap_length
, ENC_NA
);
3136 if ((addmin_param
& UDS_SDT_ADMIN_PARAM_ENCRYPTED
) == 0) {
3137 proto_tree
*encap_tree
= proto_item_add_subtree(ti
, ett_uds_sdt_encap_message
);
3138 proto_tree_add_item(encap_tree
, hf_uds_sdt_encapsulated_message_sid
, tvb
, offset
, 1, ENC_NA
);
3139 proto_tree_add_item(encap_tree
, hf_uds_sdt_encapsulated_message_sid_reply
, tvb
, offset
, 1, ENC_NA
);
3141 offset
+= encap_length
;
3144 proto_tree_add_item(uds_tree
, hf_uds_sdt_signature_mac
, tvb
, offset
, sig_length
, ENC_NA
);
3145 offset
+= sig_length
;
3150 case UDS_SERVICES_CDTCS
:
3151 if ((sid
& UDS_REPLY_MASK
)) {
3152 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_cdtcs_type
, tvb
, offset
, 1, ENC_NA
, &enum_val
);
3153 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", val_to_str(enum_val
, uds_cdtcs_types
, "Unknown (0x%02x)"));
3156 ti
= proto_tree_add_item(uds_tree
, hf_uds_cdtcs_subfunction
, tvb
, offset
, 1, ENC_NA
);
3157 subfunction_tree
= proto_item_add_subtree(ti
, ett_uds_subfunction
);
3158 proto_tree_add_item_ret_uint(subfunction_tree
, hf_uds_cdtcs_subfunction_no_suppress
, tvb
, offset
, 1, ENC_NA
, &enum_val
);
3159 proto_tree_add_item(subfunction_tree
, hf_uds_cdtcs_subfunction_pos_rsp_msg_ind
, tvb
, offset
, 1, ENC_NA
);
3160 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", val_to_str(enum_val
, uds_cdtcs_types
, "Unknown (0x%02x)"));
3163 if (data_length
- offset
> 0) {
3164 proto_tree_add_item(uds_tree
, hf_uds_cdtcs_option_record
, tvb
, offset
, data_length
- offset
, ENC_NA
);
3165 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", tvb_bytes_to_str_punct(pinfo
->pool
, tvb
, offset
, data_length
- offset
, ' '));
3166 offset
= data_length
;
3171 case UDS_SERVICES_ROE
:
3172 /* TODO UDS_SERVICES_ROE 0x86*/
3175 case UDS_SERVICES_LC
:
3176 ti
= proto_tree_add_item(uds_tree
, hf_uds_lc_subfunction
, tvb
, offset
, 1, ENC_NA
);
3177 /* do not increase offset, since reply uses the same byte with different mask! */
3179 subfunction_tree
= proto_item_add_subtree(ti
, ett_uds_subfunction
);
3180 proto_tree_add_item_ret_uint(subfunction_tree
, hf_uds_lc_subfunction_no_suppress
, tvb
, offset
, 1, ENC_NA
, &enum_val
);
3182 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " %s", val_to_str(enum_val
, uds_lc_types
, "Unknown (0x%02x)"));
3184 if (sid
& UDS_REPLY_MASK
) {
3187 proto_tree_add_item(subfunction_tree
, hf_uds_lc_subfunction_pos_rsp_msg_ind
, tvb
, offset
, 1, ENC_NA
);
3191 case UDS_LC_TYPES_VMTWFP
: {
3192 unsigned control_mode_id
;
3193 proto_tree_add_item_ret_uint(uds_tree
, hf_uds_lc_control_mode_id
, tvb
, offset
, 1, ENC_NA
, &control_mode_id
);
3194 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", %s", val_to_str(control_mode_id
, uds_lc_lcmi_types
, "Unknown (0x%02x)"));
3199 case UDS_LC_TYPES_VMTWSP
:
3200 proto_tree_add_item(uds_tree
, hf_uds_lc_link_record
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
3204 case UDS_LC_TYPES_TM
:
3212 if (data_length
- offset
> 0) {
3213 proto_tree_add_item(uds_tree
, hf_uds_unparsed_bytes
, tvb
, offset
, data_length
- offset
, ENC_NA
);
3220 dissect_uds_no_data(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
) {
3221 return dissect_uds_internal(tvb
, pinfo
, tree
, 0, 0, 0, 0);
3225 dissect_uds_doip(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
) {
3226 DISSECTOR_ASSERT(data
);
3228 doip_info_t
*doip_info
= (doip_info_t
*)data
;
3229 return dissect_uds_internal(tvb
, pinfo
, tree
, doip_info
->source_address
, doip_info
->target_address
, 2, 2);
3233 dissect_uds_hsfz(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
) {
3234 DISSECTOR_ASSERT(data
);
3236 hsfz_info_t
*hsfz_info
= (hsfz_info_t
*)data
;
3237 return dissect_uds_internal(tvb
, pinfo
, tree
, hsfz_info
->source_address
, hsfz_info
->target_address
, 2, 1);
3241 dissect_uds_iso15765(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
) {
3242 DISSECTOR_ASSERT(data
);
3244 iso15765_info_t
*info
= (iso15765_info_t
*)data
;
3245 return dissect_uds_internal(tvb
, pinfo
, tree
, info
->source_address
, info
->target_address
, info
->number_of_addresses_valid
, info
->address_length
);
3249 dissect_uds_iso10681(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
) {
3250 DISSECTOR_ASSERT(data
);
3252 iso10681_info_t
*info
= (iso10681_info_t
*)data
;
3253 return dissect_uds_internal(tvb
, pinfo
, tree
, info
->source_address
, info
->target_address
, 2, 2);
3257 pref_update_uds(void) {
3258 if (uds_ht_routine_ids
&& uds_uat_routine_id_num
== 0) {
3259 g_hash_table_destroy(uds_ht_routine_ids
);
3260 uds_ht_routine_ids
= NULL
;
3263 if (uds_ht_data_ids
&& uds_uat_data_id_num
== 0) {
3264 g_hash_table_destroy(uds_ht_data_ids
);
3265 uds_ht_data_ids
= NULL
;
3268 if (uds_ht_dtc_ids
&& uds_uat_dtc_id_num
== 0) {
3269 g_hash_table_destroy(uds_ht_dtc_ids
);
3270 uds_ht_dtc_ids
= NULL
;
3276 proto_register_uds(void) {
3277 module_t
* uds_module
;
3278 static hf_register_info hf
[] = {
3279 { &hf_uds_diag_addr
, {
3280 "Diagnostic Address", "uds.diag_addr", FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3281 { &hf_uds_diag_addr_name
, {
3282 "Diagnostic Address Name", "uds.diag_addr_name", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3283 { &hf_uds_diag_source_addr
, {
3284 "Diagnostic Source Address", "uds.diag_addr_source", FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3285 { &hf_uds_diag_source_addr_name
, {
3286 "Diagnostic Source Address Name", "uds.diag_addr_source_name", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3287 { &hf_uds_diag_target_addr
, {
3288 "Diagnostic Target Address", "uds.diag_addr_target", FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3289 { &hf_uds_diag_target_addr_name
, {
3290 "Diagnostic Target Address Name", "uds.diag_addr_target_name", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3291 { &hf_uds_service
, {
3292 "Service Identifier", "uds.sid", FT_UINT8
, BASE_HEX
| BASE_EXT_STRING
, VALS_EXT_PTR(&uds_services_ext
), UDS_SID_MASK
, NULL
, HFILL
} },
3294 "Reply Flag", "uds.reply", FT_UINT8
, BASE_HEX
, NULL
, UDS_REPLY_MASK
, NULL
, HFILL
} },
3296 { &hf_uds_subfunction
, {
3297 "SubFunction", "uds.subfunction", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3298 { &hf_uds_suppress_pos_rsp_msg_ind
, {
3299 "Suppress reply", "uds.suppress_reply.indication", FT_BOOLEAN
, 8, NULL
, UDS_SUPPRESS_POS_RSP_MSG_IND_MASK
, NULL
, HFILL
} },
3300 { &hf_uds_data_record
, {
3301 "Data Record", "uds.data_record", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3303 { &hf_uds_compression_method
, {
3304 "Compression Method", "uds.compression_method", FT_UINT8
, BASE_HEX
, NULL
, UDS_RD_COMPRESSION_METHOD_MASK
, NULL
, HFILL
} },
3305 { &hf_uds_encrypting_method
, {
3306 "Encrypting Method", "uds.encrypting_method", FT_UINT8
, BASE_HEX
, NULL
, UDS_RD_ENCRYPTING_METHOD_MASK
, NULL
, HFILL
} },
3307 { &hf_uds_memory_size_length
, {
3308 "Memory size length", "uds.memory_size_length", FT_UINT8
, BASE_HEX
, NULL
, UDS_RD_MEMORY_SIZE_LENGTH_MASK
, NULL
, HFILL
} },
3309 { &hf_uds_memory_address_length
, {
3310 "Memory address length", "uds.memory_address_length", FT_UINT8
, BASE_HEX
, NULL
, UDS_RD_MEMORY_ADDRESS_LENGTH_MASK
, NULL
, HFILL
} },
3311 { &hf_uds_memory_address
, {
3312 "Memory Address", "uds.memory_address", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3313 { &hf_uds_memory_size
, {
3314 "Memory Size", "uds.memory_size", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3315 { &hf_uds_max_block_len_len
, {
3316 "Length of Max Block Length", "uds.max_block_length_length", FT_UINT8
, BASE_HEX
, NULL
, UDS_RD_MAX_BLOCK_LEN_LEN_MASK
, NULL
, HFILL
} },
3317 { &hf_uds_max_block_len
, {
3318 "Max Block Length", "uds.max_block_length", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3320 { &hf_uds_dsc_subfunction
, {
3321 "SubFunction", "uds.dsc.subfunction", FT_UINT8
, BASE_HEX
, VALS(uds_dsc_types
), UDS_SUBFUNCTION_MASK
, NULL
, HFILL
} },
3322 { &hf_uds_dsc_suppress_pos_rsp_msg_ind
, {
3323 "Suppress reply", "uds.dsc.suppress_reply.indication", FT_BOOLEAN
, 8, NULL
, UDS_SUPPRESS_POS_RSP_MSG_IND_MASK
, NULL
, HFILL
} },
3324 { &hf_uds_dsc_parameter_record
, {
3325 "Parameter Record", "uds.dsc.parameter_record", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3326 { &hf_uds_dsc_default_p2_server_timer
, {
3327 "Default P2 Server Timer", "uds.dsc.p2_server_time_default", FT_UINT16
, BASE_DEC
| BASE_UNIT_STRING
, UNS(&units_milliseconds
), 0x0, NULL
, HFILL
} },
3328 /* Header field is actually only 16bit but has to be scaled up by 10x. */
3329 { &hf_uds_dsc_enhanced_p2_server_timer
, {
3330 "Enhanced P2 Server Timer", "uds.dsc.p2_server_time_enhanced", FT_UINT32
, BASE_DEC
| BASE_UNIT_STRING
, UNS(&units_milliseconds
), 0x0, NULL
, HFILL
} },
3332 { &hf_uds_er_subfunction
, {
3333 "SubFunction", "uds.er.subfunction", FT_UINT8
, BASE_HEX
, VALS(uds_er_types
), 0x0, NULL
, HFILL
} },
3334 { &hf_uds_er_power_down_time
, {
3335 "Power Down Time", "uds.er.power_down_time", FT_UINT8
, BASE_DEC
| BASE_UNIT_STRING
, UNS(&units_seconds
), 0x0, NULL
, HFILL
} },
3337 { &hf_uds_cdtci_group_of_dtc
, {
3338 "Group of DTC", "uds.cdtci.group_of_dtc", FT_UINT24
, BASE_HEX
, VALS(uds_cdtci_group_of_dtc
), 0x0, NULL
, HFILL
} },
3339 { &hf_uds_cdtci_memory_selection
, {
3340 "Memory Selection", "uds.cdtci.memory_selection", FT_UINT8
, BASE_HEX_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3342 { &hf_uds_rdtci_subfunction
, {
3343 "SubFunction", "uds.rdtci.subfunction", FT_UINT8
, BASE_HEX
| BASE_EXT_STRING
, VALS_EXT_PTR(&uds_rdtci_types_ext
), 0x0, NULL
, HFILL
} },
3344 { &hf_uds_rdtci_dtc_status_mask
, {
3345 "DTC Status Mask", "uds.rdtci.dtc_status_mask", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3346 { &hf_uds_rdtci_dtc_status_mask_tf
, {
3347 "(Last) Test Failed", "uds.rdtci.dtc_status_mask.tf", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_FAILED
, NULL
, HFILL
} },
3348 { &hf_uds_rdtci_dtc_status_mask_tftoc
, {
3349 "Test Failed This Operation Cycle", "uds.rdtci.dtc_status_mask.tftoc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_FAILED_THIS_OPER_CYCLE
, NULL
, HFILL
} },
3350 { &hf_uds_rdtci_dtc_status_mask_pdtc
, {
3351 "Pending DTC", "uds.rdtci.dtc_status_mask.pdtc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_PENDING_DTC
, NULL
, HFILL
} },
3352 { &hf_uds_rdtci_dtc_status_mask_cdtc
, {
3353 "Confirmed DTC", "uds.rdtci.dtc_status_mask.ctdc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_CONFIRMED_DTC
, NULL
, HFILL
} },
3354 { &hf_uds_rdtci_dtc_status_mask_tncslc
, {
3355 "Test Not Completed Since Last Clear", "uds.rdtci.dtc_status_mask.tncslc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_NOT_COMPL_SINCE_LAST_CLEAR
, NULL
, HFILL
} },
3356 { &hf_uds_rdtci_dtc_status_mask_tfslc
, {
3357 "Test Failed Since Last Clear", "uds.rdtci.dtc_status_mask.tfslc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_FAILED_SINCE_LAST_CLEAR
, NULL
, HFILL
} },
3358 { &hf_uds_rdtci_dtc_status_mask_tnctoc
, {
3359 "Test Not Completed This Operation Cycle", "uds.rdtci.dtc_status_mask.tnctoc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_NOT_COMPL_THIS_OPER_CYCLE
, NULL
, HFILL
} },
3360 { &hf_uds_rdtci_dtc_status_mask_wir
, {
3361 "Warning Indicator Requested", "uds.rdtci.dtc_status_mask.wir", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_WARNING_INDICATOR_REQUESTED
, NULL
, HFILL
} },
3362 { &hf_uds_rdtci_dtc_mask_record
, {
3363 "DTC Mask Record", "uds.rdtci.dtc_mask_record", FT_UINT24
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3364 { &hf_uds_rdtci_dtc_snapshot_rec_no
, {
3365 "DTC Snapshot Record Number", "uds.rdtci.dtc_snapshot_record_number", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3366 { &hf_uds_rdtci_dtc_stored_data_rec_no
, {
3367 "DTC Stored Data Record Number", "uds.rdtci.dtc_stored_data_record_number", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3368 { &hf_uds_rdtci_dtc_ext_data_rec_no
, {
3369 "DTC Extended Data Record Number", "uds.rdtci.dtc_extended_data_record_number", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3370 { &hf_uds_rdtci_dtc_severity_mask
, {
3371 "DTC Severity Mask", "uds.rdtci.dtc_severity_mask", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3372 { &hf_uds_rdtci_memory_selection
, {
3373 "Memory Selection", "uds.rdtci.memory_selection", FT_UINT8
, BASE_HEX_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3374 { &hf_uds_rdtci_user_def_dtc_snapshot_rec_no
, {
3375 "User Defined DTC Snapshot Record Number", "uds.rdtci.user_def_dtc_snapshot_record_number", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3376 { &hf_uds_rdtci_functional_group_id
, {
3377 "Functional Group Identifier", "uds.rdtci.functional_group_id", FT_UINT8
, BASE_HEX_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3378 { &hf_uds_rdtci_dtc_readiness_group_id
, {
3379 "DTC Readiness Group Identifier", "uds.rdtci.dtc_readiness_group_id", FT_UINT8
, BASE_HEX_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3380 { &hf_uds_rdtci_dtc_status_avail
, {
3381 "DTC Status Availability Mask", "uds.rdtci.dtc_status_availability_mask", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3382 { &hf_uds_rdtci_dtc_status_avail_tf
, {
3383 "Test Failed", "uds.rdtci.dtc_status_avail_mask.tf", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_FAILED
, NULL
, HFILL
} },
3384 { &hf_uds_rdtci_dtc_status_avail_tftoc
, {
3385 "Test Failed This Operation Cycle", "uds.rdtci.dtc_status_avail_mask.tftoc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_FAILED_THIS_OPER_CYCLE
, NULL
, HFILL
} },
3386 { &hf_uds_rdtci_dtc_status_avail_pdtc
, {
3387 "Pending DTC", "uds.rdtci.dtc_status_avail_mask.pdtc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_PENDING_DTC
, NULL
, HFILL
} },
3388 { &hf_uds_rdtci_dtc_status_avail_cdtc
, {
3389 "Confirmed DTC", "uds.rdtci.dtc_status_avail_mask.ctdc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_CONFIRMED_DTC
, NULL
, HFILL
} },
3390 { &hf_uds_rdtci_dtc_status_avail_tncslc
,{
3391 "Test Not Completed Since Last Clear", "uds.rdtci.dtc_status_avail_mask.tncslc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_NOT_COMPL_SINCE_LAST_CLEAR
, NULL
, HFILL
} },
3392 { &hf_uds_rdtci_dtc_status_avail_tfslc
, {
3393 "Test Failed Since Last Clear", "uds.rdtci.dtc_status_avail_mask.tfslc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_FAILED_SINCE_LAST_CLEAR
, NULL
, HFILL
} },
3394 { &hf_uds_rdtci_dtc_status_avail_tnctoc
, {
3395 "Test Not Completed This Operation Cycle", "uds.rdtci.dtc_status_avail_mask.tnctoc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_NOT_COMPL_THIS_OPER_CYCLE
, NULL
, HFILL
} },
3396 { &hf_uds_rdtci_dtc_status_avail_wir
, {
3397 "Warning Indicator Requested", "uds.rdtci.dtc_status_avail_mask.wir", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_WARNING_INDICATOR_REQUESTED
, NULL
, HFILL
} },
3398 { &hf_uds_rdtci_dtc_id
, {
3399 "DTC Identifier", "uds.rdtci.dtc_id", FT_UINT24
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3400 { &hf_uds_rdtci_dtc_status
, {
3401 "DTC Status", "uds.rdtci.dtc_status", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3402 { &hf_uds_rdtci_dtc_status_tf
, {
3403 "Test Failed", "uds.rdtci.dtc_status.tf", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_FAILED
, NULL
, HFILL
} },
3404 { &hf_uds_rdtci_dtc_status_tftoc
, {
3405 "Test Failed This Operation Cycle", "uds.rdtci.dtc_status.tftoc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_FAILED_THIS_OPER_CYCLE
, NULL
, HFILL
} },
3406 { &hf_uds_rdtci_dtc_status_pdtc
, {
3407 "Pending DTC", "uds.rdtci.dtc_status.pdtc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_PENDING_DTC
, NULL
, HFILL
} },
3408 { &hf_uds_rdtci_dtc_status_cdtc
, {
3409 "Confirmed DTC", "uds.rdtci.dtc_status.ctdc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_CONFIRMED_DTC
, NULL
, HFILL
} },
3410 { &hf_uds_rdtci_dtc_status_tncslc
, {
3411 "Test Not Completed Since Last Clear", "uds.rdtci.dtc_status.tncslc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_NOT_COMPL_SINCE_LAST_CLEAR
, NULL
, HFILL
} },
3412 { &hf_uds_rdtci_dtc_status_tfslc
, {
3413 "Test Failed Since Last Clear", "uds.rdtci.dtc_status.tfslc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_FAILED_SINCE_LAST_CLEAR
, NULL
, HFILL
} },
3414 { &hf_uds_rdtci_dtc_status_tnctoc
, {
3415 "Test Not Completed This Operation Cycle", "uds.rdtci.dtc_status.tnctoc", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_TEST_NOT_COMPL_THIS_OPER_CYCLE
, NULL
, HFILL
} },
3416 { &hf_uds_rdtci_dtc_status_wir
, {
3417 "Warning Indicator Requested", "uds.rdtci.dtc_status.wir", FT_BOOLEAN
, 8, NULL
, UDS_RDTCI_DTC_STATUS_WARNING_INDICATOR_REQUESTED
, NULL
, HFILL
} },
3418 { &hf_uds_rdtci_dtc_format_id
, {
3419 "DTC Format Identifier", "uds.rdtci.dtc_format_id", FT_UINT8
, BASE_HEX_DEC
, VALS(uds_rdtci_format_id_types
), 0x0, NULL
, HFILL
} },
3420 { &hf_uds_rdtci_dtc_count
, {
3421 "DTC Count", "uds.rdtci.dtc_count", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3422 { &hf_uds_rdtci_dtc_snapshot_record_number_of_ids
, {
3423 "DTC Snapshot Record Number of IDs", "uds.rdtci.dtc_snapshot_record_number_of_ids", FT_UINT8
, BASE_HEX_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3424 { &hf_uds_rdtci_dtc_stored_data_record_number_of_ids
, {
3425 "DTC Stored Data Record Number of IDs", "uds.rdtci.dtc_stored_data_record_number_of_ids", FT_UINT8
, BASE_HEX_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3426 { &hf_uds_rdtci_dtc_severity
, {
3427 "DTC Severity", "uds.rdtci.dtc_severity", FT_UINT8
, BASE_HEX_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3428 { &hf_uds_rdtci_dtc_functional_unit
, {
3429 "DTC Functional Unit", "uds.rdtci.dtc_functional_unit", FT_UINT8
, BASE_HEX_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3430 { &hf_uds_rdtci_dtc_fault_detect_counter
, {
3431 "DTC Fault Detection Counter", "uds.rdtci.dtc_fault_detection_counter", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3432 { &hf_uds_rdtci_dtc_severity_avail
, {
3433 "DTC Severity Availability Mask", "uds.rdtci.dtc_severity_availability_mask", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3434 { &hf_uds_rdtci_record
, {
3435 "Record", "uds.rdtci.record", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3436 { &hf_uds_rdtci_record_unparsed
, {
3437 "Unparsed Record", "uds.rdtci.record_unparsed", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3439 { &hf_uds_rdbi_data_identifier
, {
3440 "Data Identifier", "uds.rdbi.data_identifier", FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3442 { &hf_uds_rsdbi_data_identifier
, {
3443 "Data Identifier", "uds.rsdbi.data_identifier", FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3444 { &hf_uds_rsdbi_scaling_byte
, {
3445 "Scaling Byte", "uds.rsdbi.scaling_byte", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3446 { &hf_uds_rsdbi_scaling_byte_data_type
, {
3447 "Data Type", "uds.rsdbi.scaling_byte.data_type", FT_UINT8
, BASE_HEX
, VALS(uds_rsdbi_data_types
), 0xF0, NULL
, HFILL
} },
3448 { &hf_uds_rsdbi_scaling_byte_num_of_bytes
, {
3449 "Number of Bytes", "uds.rsdbi.scaling_byte.number_of_Bytes", FT_UINT8
, BASE_DEC
, NULL
, 0x0F, NULL
, HFILL
} },
3450 { &hf_uds_rsdbi_validity_mask
, {
3451 "Validity Mask", "uds.rsdbi.scaling_byte_ext.validity_mask", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3452 { &hf_uds_rsdbi_formula_identifier
, {
3453 "Formula Identifier", "uds.rsdbi.scaling_byte_ext.formula_identifier", FT_UINT8
, BASE_HEX
, VALS(uds_rsdbi_formulas
), 0x0, NULL
, HFILL
} },
3454 { &hf_uds_rsdbi_formula_constant
, {
3455 "Constant", "uds.rsdbi.scaling_byte_ext.formula_constant", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3456 { &hf_uds_rsdbi_formula_constant_exp
, {
3457 "Exponent", "uds.rsdbi.scaling_byte_ext.formulat_constant_exp", FT_UINT16
, BASE_HEX
, NULL
, 0xF000, NULL
, HFILL
} },
3458 { &hf_uds_rsdbi_formula_constant_mantissa
, {
3459 "Constant", "uds.rsdbi.scaling_byte_ext.formulat_constant", FT_UINT16
, BASE_HEX
, NULL
, 0x0FFF, NULL
, HFILL
} },
3460 { &hf_uds_rsdbi_unit
, {
3461 "Unit Identifier", "uds.rsdbi.scaling_byte_ext.unit", FT_UINT8
, BASE_HEX
| BASE_EXT_STRING
, VALS_EXT_PTR(&uds_rsdbi_units_ext
), 0x0, NULL
, HFILL
} },
3463 { &hf_uds_sa_subfunction
, {
3464 "SubFunction", "uds.sa.subfunction", FT_UINT8
, BASE_CUSTOM
, CF_FUNC(uds_sa_subfunction_format
), 0x0, NULL
, HFILL
} },
3466 "Key", "uds.sa.key", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3467 { &hf_uds_sa_seed
, {
3468 "Seed", "uds.sa.seed", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3470 { &hf_uds_cc_subfunction_no_suppress
, {
3471 "SubFunction (without Suppress)", "uds.cc.subfunction_without_suppress", FT_UINT8
, BASE_HEX
, VALS(uds_cc_types
), UDS_SUBFUNCTION_MASK
, NULL
, HFILL
} },
3472 { &hf_uds_cc_comm_type_and_subnet_number
, {
3473 "Communication Type/Subnet Number", "uds.cc.comm_type_and_subnet_number", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3474 { &hf_uds_cc_communication_type
, {
3475 "Communication Type", "uds.cc.communication_type", FT_UINT8
, BASE_HEX
, VALS(uds_cc_comm_types
), UDS_CC_COMM_TYPE_COMM_TYPE_MASK
, NULL
, HFILL
} },
3476 { &hf_uds_cc_subnet_number
, {
3477 "Subnet Number", "uds.cc.subnet_number", FT_UINT8
, BASE_HEX
, VALS(uds_cc_subnet_number_types
), UDS_CC_COMM_TYPE_SUBNET_NUMBER_MASK
, NULL
, HFILL
} },
3478 { &hf_uds_cc_node_identifier_number
, {
3479 "Node Identifier Number", "uds.cc.node_identifier_number", FT_UINT16
, BASE_HEX_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3481 { &hf_uds_ars_subfunction_no_suppress
, {
3482 "SubFunction (without Suppress)", "uds.ars.subfunction_without_suppress", FT_UINT8
, BASE_HEX
, VALS(uds_ars_types
), UDS_SUBFUNCTION_MASK
, NULL
, HFILL
} },
3483 { &hf_uds_ars_comm_config
, {
3484 "Communication Configuration", "uds.ars.communication_configuration", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3485 { &hf_uds_ars_length_of_cert_client
, {
3486 "Length of Certificate Client", "uds.ars.length_of_certificate_client", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3487 { &hf_uds_ars_cert_client
, {
3488 "Certificate Client", "uds.ars.certificate_client", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3489 { &hf_uds_ars_length_of_cert_server
, {
3490 "Length of Certificate Server", "uds.ars.length_of_certificate_server", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3491 { &hf_uds_ars_cert_server
, {
3492 "Certificate Server", "uds.ars.certificate_server", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3493 { &hf_uds_ars_length_of_challenge_client
, {
3494 "Length of Challenge Client", "uds.ars.length_of_challenge_client", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3495 { &hf_uds_ars_challenge_client
, {
3496 "Challenge Client", "uds.ars.challenge_client", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3497 { &hf_uds_ars_length_of_challenge_server
, {
3498 "Length of Challenge Server", "uds.ars.length_of_challenge_server", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3499 { &hf_uds_ars_challenge_server
, {
3500 "Challenge Server", "uds.ars.challenge_server", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3501 { &hf_uds_ars_length_of_proof_of_ownership_client
, {
3502 "Length of Proof of Ownership Client", "uds.ars.length_of_proof_of_ownership_client", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3503 { &hf_uds_ars_proof_of_ownership_client
, {
3504 "Proof of Ownership Client", "uds.ars.proof_of_ownership_client", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3505 { &hf_uds_ars_length_of_proof_of_ownership_server
, {
3506 "Length of Proof of Ownership Server", "uds.ars.length_of_proof_of_ownership_server", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3507 { &hf_uds_ars_proof_of_ownership_server
, {
3508 "Proof of Ownership Server", "uds.ars.proof_of_ownership_server", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3509 { &hf_uds_ars_length_of_ephemeral_public_key_client
, {
3510 "Length of Ephemeral Public Key Client", "uds.ars.length_of_ephemeral_public_key_client", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3511 { &hf_uds_ars_ephemeral_public_key_client
, {
3512 "Ephemeral Public Key Client", "uds.ars.ephemeral_public_key_client", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3513 { &hf_uds_ars_length_of_ephemeral_public_key_server
, {
3514 "Length of Ephemeral Public Key Server", "uds.ars.length_of_ephemeral_public_key_server", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3515 { &hf_uds_ars_ephemeral_public_key_server
, {
3516 "Ephemeral Public Key Server", "uds.ars.ephemeral_public_key_server", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3517 { &hf_uds_ars_cert_eval_id
, {
3518 "Certificate Evaluation ID", "uds.ars.certificate_evaluation_id", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3519 { &hf_uds_ars_length_of_cert_data
, {
3520 "Length of Certificate Data", "uds.ars.length_of_certificate_data", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3521 { &hf_uds_ars_cert_data
, {
3522 "Certificate Data", "uds.ars.certificate_data", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3523 { &hf_uds_ars_algo_indicator
, {
3524 "Algorithm Indicator", "uds.ars.algorithm_indicator", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3525 { &hf_uds_ars_length_of_additional_parameter
, {
3526 "Length of Additional Parameter", "uds.ars.length_of_additional_parameter", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3527 { &hf_uds_ars_additional_parameter
, {
3528 "Additional Parameter", "uds.ars.additional_parameter", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3529 { &hf_uds_ars_length_of_needed_additional_parameter
, {
3530 "Length of Needed Additional Parameter", "uds.ars.length_of_needed_additional_parameter", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3531 { &hf_uds_ars_needed_additional_parameter
, {
3532 "Needed Additional Parameter", "uds.ars.needed_additional_parameter", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3533 { &hf_uds_ars_auth_ret_param
, {
3534 "Authentication Return Parameter", "uds.ars.authentication_return_parameter", FT_UINT8
, BASE_HEX
, VALS(uds_ars_auth_ret_types
), 0x0, NULL
, HFILL
} },
3535 { &hf_uds_ars_length_of_session_key_info
, {
3536 "Length of Session Key Info", "uds.ars.length_of_session_key_info", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3537 { &hf_uds_ars_session_key_info
, {
3538 "Session Key Info", "uds.ars.session_key_info", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3540 { &hf_uds_signedCertificate
, {
3541 "signedCertificate", "uds.signedCertificate_element", FT_NONE
, BASE_NONE
, NULL
, 0, NULL
, HFILL
} },
3543 { &hf_uds_rdbpi_transmission_mode
, {
3544 "Transmission Mode", "uds.rdbpi.transmission_mode", FT_UINT8
, BASE_HEX
, VALS(uds_rdbpi_transmission_mode
), 0x0, NULL
, HFILL
} },
3545 { &hf_uds_rdbpi_periodic_data_identifier
, {
3546 "Periodic Data Identifier", "uds.rdbpi.periodic_data_identifier", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3548 { &hf_uds_dddi_subfunction_no_suppress
, {
3549 "SubFunction (without Suppress)", "uds.dddi.subfunction_without_suppress", FT_UINT8
, BASE_HEX
, VALS(uds_dddi_types
), UDS_SUBFUNCTION_MASK
, NULL
, HFILL
} },
3550 { &hf_uds_dddi_dyn_defined_data_identifier
, {
3551 "Dynamically Defined Data Identifier", "uds.dddi.dynamically_defined_data_identifier", FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3552 { &hf_uds_dddi_source_data_identifier
, {
3553 "Source Data Identifier", "uds.dddi.source_data_identifier", FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3554 { &hf_uds_dddi_position_in_source_data_record
, {
3555 "Position in Source Data Record", "uds.dddi.position_in_source_data_record", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3556 { &hf_uds_dddi_memory_size
, {
3557 "Memory Size", "uds.dddi.memory_size", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3559 { &hf_uds_wdbi_data_identifier
, {
3560 "Data Identifier", "uds.wdbi.data_identifier", FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3562 { &hf_uds_iocbi_data_identifier
, {
3563 "Data Identifier", "uds.iocbi.data_identifier", FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3564 { &hf_uds_iocbi_parameter
, {
3565 "Parameter", "uds.iocbi.parameter", FT_UINT8
, BASE_HEX
, VALS(uds_iocbi_parameters
), 0x0, NULL
, HFILL
} },
3566 { &hf_uds_iocbi_state
, {
3567 "State", "uds.iocbi.state", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3569 { &hf_uds_rc_subfunction
, {
3570 "SubFunction", "uds.rc.subfunction", FT_UINT8
, BASE_HEX
, VALS(uds_rc_types
), 0x0, NULL
, HFILL
} },
3571 { &hf_uds_rc_identifier
, {
3572 "Identifier", "uds.rc.identifier", FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3573 { &hf_uds_rc_option_record
, {
3574 "Option record", "uds.rc.option_record", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3575 { &hf_uds_rc_info
, {
3576 "Info", "uds.rc.info", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3577 { &hf_uds_rc_status_record
, {
3578 "Status Record", "uds.rc.status_record", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3580 { &hf_uds_td_sequence_counter
, {
3581 "Block Sequence Counter", "uds.td.block_sequence_counter", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3582 { &hf_uds_td_record_data
, {
3583 "Parameter Record", "uds.td.parameter_record", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3585 { &hf_uds_rte_record_data
, {
3586 "Parameter Record", "uds.rte.parameter_record", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3588 { &hf_uds_rft_mode_of_operation
, {
3589 "Mode of Operation", "uds.rft.mode_of_operation", FT_UINT8
, BASE_HEX
, VALS(uds_rft_mode_types
), 0x0, NULL
, HFILL
} },
3590 { &hf_uds_rft_length_of_file_path_and_name
, {
3591 "Length of File Path and Name", "uds.rft.length_of_file_path_and_name", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3592 { &hf_uds_rft_file_path_and_name
, {
3593 "File Path and Name", "uds.rft.file_path_and_name", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3594 { &hf_uds_rft_file_size_param_length
, {
3595 "File Size Parameter Length", "uds.rft.file_size_parameter_length", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3596 { &hf_uds_rft_file_size_uncompressed
, {
3597 "File Size Uncompressed", "uds.rft.file_size_uncompressed", FT_UINT64
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3598 { &hf_uds_rft_file_size_compressed
, {
3599 "File Size Compressed", "uds.rft.file_size_compressed", FT_UINT64
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3600 { &hf_uds_rft_length_format_identifier
, {
3601 "Length Format Identifier", "uds.rft.length_format_identifier", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3602 { &hf_uds_rft_max_num_of_block_length
, {
3603 "Max Number of Block Length", "uds.rft.max_number_of_block_length", FT_UINT64
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3604 { &hf_uds_rft_file_size_or_dir_info_param_length
, {
3605 "File Size or Dir Info Parameter Length", "uds.rft.file_size_or_dir_info_parameter_length", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3606 { &hf_uds_rft_file_size_uncompressed_or_dir_info_length
, {
3607 "File Size Uncompressed or Dir Info Length", "uds.rft.file_size_uncompressed_or_dir_info_length", FT_UINT64
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3608 { &hf_uds_rft_file_position
, {
3609 "File Position", "uds.rft.file_position", FT_UINT64
, BASE_HEX_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3611 { &hf_uds_tp_subfunction_no_suppress
, {
3612 "SubFunction (without Suppress)", "uds.tp.subfunction_without_suppress", FT_UINT8
, BASE_HEX
, NULL
, UDS_SUBFUNCTION_MASK
, NULL
, HFILL
} },
3614 { &hf_uds_err_sid
, {
3615 "Service Identifier", "uds.err.sid", FT_UINT8
, BASE_HEX
| BASE_EXT_STRING
, VALS_EXT_PTR(&uds_services_ext
), 0x0, NULL
, HFILL
} },
3616 { &hf_uds_err_code
, {
3617 "Code", "uds.err.code", FT_UINT8
, BASE_HEX
| BASE_EXT_STRING
, VALS_EXT_PTR(&uds_response_codes_ext
), 0x0, NULL
, HFILL
} },
3619 { &hf_uds_sdt_administrative_param
, {
3620 "Administrative Parameter", "uds.sdt.admin_param", FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3621 { &hf_uds_sdt_administrative_param_req
, {
3622 "Request message", "uds.sdt.admin_param.request", FT_BOOLEAN
, 16, NULL
, UDS_SDT_ADMIN_PARAM_REQ
, NULL
, HFILL
} },
3623 { &hf_uds_sdt_administrative_param_pre_estab_key
, {
3624 "Pre-established key is used", "uds.sdt.admin_param.pre_estab_key", FT_BOOLEAN
, 16, NULL
, UDS_SDT_ADMIN_PARAM_PRE_ESTABL_KEY
, NULL
, HFILL
} },
3625 { &hf_uds_sdt_administrative_param_encrypted
, {
3626 "Message is encrypted", "uds.sdt.admin_param.encrypted", FT_BOOLEAN
, 16, NULL
, UDS_SDT_ADMIN_PARAM_ENCRYPTED
, NULL
, HFILL
} },
3627 { &hf_uds_sdt_administrative_param_signed
, {
3628 "Message is signed", "uds.sdt.admin_param.signed", FT_BOOLEAN
, 16, NULL
, UDS_SDT_ADMIN_PARAM_SIGNED
, NULL
, HFILL
} },
3629 { &hf_uds_sdt_administrative_param_resp_sign_req
, {
3630 "Signature on the response is requested", "uds.sdt.admin_param.resp_sign_req", FT_BOOLEAN
, 16, NULL
, UDS_SDT_ADMIN_PARAM_SIGN_ON_RESP_REQ
, NULL
, HFILL
} },
3631 { &hf_uds_sdt_signature_encryption_calculation
, {
3632 "Signature/Encryption Calculation", "uds.sdt.signature_encryption_calculation", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3633 { &hf_uds_sdt_signature_length
, {
3634 "Signature/MAC Length", "uds.sdt.signature_length", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3635 { &hf_uds_sdt_anti_replay_counter
, {
3636 "Anti-replay Counter", "uds.sdt.anti_replay_counter", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
} },
3637 { &hf_uds_sdt_encapsulated_message
, {
3638 "Encapsulated Message", "uds.sdt.encapsulated_message", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3639 { &hf_uds_sdt_encapsulated_message_sid
, {
3640 "Service Identifier", "uds.sdt.encapsulated_message.sid", FT_UINT8
, BASE_HEX
| BASE_EXT_STRING
, VALS_EXT_PTR(&uds_services_ext
), UDS_SID_MASK
, NULL
, HFILL
} },
3641 { &hf_uds_sdt_encapsulated_message_sid_reply
, {
3642 "Reply Flag", "uds.sdt.encapsulated_message.reply", FT_UINT8
, BASE_HEX
, NULL
, UDS_REPLY_MASK
, NULL
, HFILL
} },
3643 { &hf_uds_sdt_signature_mac
, {
3644 "Signature/MAC", "uds.sdt.signature_mac", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3646 { &hf_uds_cdtcs_subfunction
, {
3647 "SubFunction", "uds.cdtcs.subfunction", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3648 { &hf_uds_cdtcs_subfunction_no_suppress
, {
3649 "DTC Setting Type", "uds.cdtcs.subfunction_without_suppress", FT_UINT8
, BASE_HEX
, VALS(uds_cdtcs_types
), UDS_SUBFUNCTION_MASK
, NULL
, HFILL
} },
3650 { &hf_uds_cdtcs_subfunction_pos_rsp_msg_ind
, {
3651 "Suppress reply", "uds.cdtcs.suppress_reply", FT_BOOLEAN
, 8, NULL
, UDS_SUPPRESS_POS_RSP_MSG_IND_MASK
, NULL
, HFILL
} },
3652 { &hf_uds_cdtcs_option_record
, {
3653 "Option Record", "uds.cdtcs.option_record", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3654 { &hf_uds_cdtcs_type
, {
3655 "DTC Setting Type", "uds.cdtcs.dtc_setting_type", FT_UINT8
, BASE_HEX
, VALS(uds_cdtcs_types
), 0x0, NULL
, HFILL
} },
3657 { &hf_uds_lc_subfunction
, {
3658 "SubFunction", "uds.lc.subfunction", FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3659 { &hf_uds_lc_subfunction_no_suppress
, {
3660 "SubFunction (without Suppress)", "uds.lc.subfunction_without_suppress", FT_UINT8
, BASE_HEX
, VALS(uds_lc_types
), UDS_SUBFUNCTION_MASK
, NULL
, HFILL
} },
3661 { &hf_uds_lc_subfunction_pos_rsp_msg_ind
, {
3662 "Suppress reply", "uds.lc.suppress_reply", FT_BOOLEAN
, 8, NULL
, UDS_SUPPRESS_POS_RSP_MSG_IND_MASK
, NULL
, HFILL
} },
3663 { &hf_uds_lc_control_mode_id
, {
3664 "Link Control Mode Identifier", "uds.lc.link_control_mode_identifier", FT_UINT8
, BASE_HEX
, VALS(uds_lc_lcmi_types
), 0x0, NULL
, HFILL
} },
3665 { &hf_uds_lc_link_record
, {
3666 "Link Record", "uds.lc.link_record", FT_UINT24
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3668 { &hf_uds_did_reply_f186_diag_session
, {
3669 "Diagnostic Session", "uds.did_f186.diagnostic_session", FT_UINT8
, BASE_HEX
, VALS(uds_dsc_types
), 0x0, NULL
, HFILL
} },
3670 { &hf_uds_did_reply_f190_vin
, {
3671 "VIN", "uds.did_f190.vin", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3672 { &hf_uds_did_reply_ff00_version
, {
3673 "Version", "uds.did_ff00.version", FT_UINT32
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
} },
3674 { &hf_uds_did_reply_ff01_dlc_support
, {
3675 "DLC Supports", "uds.did_ff01.dlc_supports", FT_UINT8
, BASE_HEX
, VALS(uds_did_resrvdcpadlc_types
), 0x0, NULL
, HFILL
} },
3677 { &hf_uds_unparsed_bytes
, {
3678 "Unparsed Bytes", "uds.unparsed_bytes", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
} },
3681 uat_t
* uds_routine_ids_uat
;
3682 uat_t
* uds_data_ids_uat
;
3683 uat_t
* uds_dtc_ids_uat
;
3684 uat_t
* uds_address_uat
;
3686 /* Setup protocol subtree array */
3687 static int *ett
[] = {
3689 &ett_uds_subfunction
,
3690 &ett_uds_dtc_status_entry
,
3691 &ett_uds_dtc_status_bits
,
3692 &ett_uds_dtc_snapshot_entry
,
3693 &ett_uds_dtc_counter_entry
,
3694 &ett_uds_dsc_parameter_record
,
3695 &ett_uds_rsdbi_scaling_byte
,
3696 &ett_uds_rsdbi_formula_constant
,
3697 &ett_uds_cc_communication_type
,
3698 &ett_uds_ars_certificate
,
3699 &ett_uds_ars_algo_indicator
,
3700 &ett_uds_dddi_entry
,
3701 &ett_uds_sdt_admin_param
,
3702 &ett_uds_sdt_encap_message
,
3705 proto_uds
= proto_register_protocol (
3706 "Unified Diagnostic Services", /* name */
3707 "UDS", /* short name */
3711 proto_register_field_array(proto_uds
, hf
, array_length(hf
));
3712 proto_register_subtree_array(ett
, array_length(ett
));
3714 uds_handle
= register_dissector("uds", dissect_uds_no_data
, proto_uds
);
3715 uds_handle_doip
= register_dissector("uds_over_doip", dissect_uds_doip
, proto_uds
);
3716 uds_handle_hsfz
= register_dissector("uds_over_hsfz", dissect_uds_hsfz
, proto_uds
);
3717 uds_handle_iso10681
= register_dissector("uds_over_iso10681", dissect_uds_iso10681
, proto_uds
);
3718 uds_handle_iso15765
= register_dissector("uds_over_iso15765", dissect_uds_iso15765
, proto_uds
);
3720 /* Register preferences */
3721 uds_module
= prefs_register_protocol(proto_uds
, &pref_update_uds
);
3723 /* UATs for user_data fields */
3724 static uat_field_t uds_routine_id_uat_fields
[] = {
3725 UAT_FLD_HEX(uds_uat_routine_ids
, address
, "Address", "Address (16bit hex without leading 0x, 0xffffffff for 'any')"),
3726 UAT_FLD_HEX(uds_uat_routine_ids
, id
, "Routine ID", "Routine Identifier (16bit hex without leading 0x)"),
3727 UAT_FLD_CSTRING(uds_uat_routine_ids
, name
, "Routine Name", "Name of the Routine ID (string)"),
3731 uds_routine_ids_uat
= uat_new("UDS Routine Identifier List",
3732 sizeof(generic_addr_id_string_t
), /* record size */
3733 DATAFILE_UDS_ROUTINE_IDS
, /* filename */
3734 true, /* from profile */
3735 (void**)&uds_uat_routine_ids
, /* data_ptr */
3736 &uds_uat_routine_id_num
, /* numitems_ptr */
3737 UAT_AFFECTS_DISSECTION
, /* but not fields */
3739 copy_generic_one_id_string_cb
, /* copy callback */
3740 update_generic_addr_16bit_id_16bit
, /* update callback */
3741 free_generic_one_id_string_cb
, /* free callback */
3742 post_update_uds_routine_cb
, /* post update callback */
3743 NULL
, /* reset callback */
3744 uds_routine_id_uat_fields
/* UAT field definitions */
3747 prefs_register_uat_preference(uds_module
, "_uds_routine_id_list", "UDS Routine Identifier List",
3748 "A table to define names of UDS Routines", uds_routine_ids_uat
);
3751 static uat_field_t uds_data_id_uat_fields
[] = {
3752 UAT_FLD_HEX(uds_uat_data_ids
, address
, "Address", "Address (16bit hex without leading 0x, 0xffffffff for 'any')"),
3753 UAT_FLD_HEX(uds_uat_data_ids
, id
, "Data ID", "Data Identifier (16bit hex without leading 0x)"),
3754 UAT_FLD_CSTRING(uds_uat_data_ids
, name
, "Data Name", "Name of the Data ID (string)"),
3758 uds_data_ids_uat
= uat_new("UDS Data Identifier List",
3759 sizeof(generic_addr_id_string_t
), /* record size */
3760 DATAFILE_UDS_DATA_IDS
, /* filename */
3761 true, /* from profile */
3762 (void**)&uds_uat_data_ids
, /* data_ptr */
3763 &uds_uat_data_id_num
, /* numitems_ptr */
3764 UAT_AFFECTS_DISSECTION
, /* but not fields */
3766 copy_generic_one_id_string_cb
, /* copy callback */
3767 update_generic_addr_16bit_id_16bit
, /* update callback */
3768 free_generic_one_id_string_cb
, /* free callback */
3769 post_update_uds_data_cb
, /* post update callback */
3770 NULL
, /* reset callback */
3771 uds_data_id_uat_fields
/* UAT field definitions */
3774 prefs_register_uat_preference(uds_module
, "_uds_data_id_list", "UDS Data Identifier List",
3775 "A table to define names of UDS Data Identifier", uds_data_ids_uat
);
3778 static uat_field_t uds_dtc_id_uat_fields
[] = {
3779 UAT_FLD_HEX(uds_uat_dtc_ids
, address
, "Address", "Address (16bit hex without leading 0x, 0xffffffff for 'any')"),
3780 UAT_FLD_HEX(uds_uat_dtc_ids
, id
, "DTC ID", "Data Identifier (24bit hex without leading 0x)"),
3781 UAT_FLD_CSTRING(uds_uat_dtc_ids
, name
, "DTC Name", "Name of the Data ID (string)"),
3785 uds_dtc_ids_uat
= uat_new("UDS DTC Identifier List",
3786 sizeof(generic_addr_id_string_t
), /* record size */
3787 DATAFILE_UDS_DTC_IDS
, /* filename */
3788 true, /* from profile */
3789 (void**)&uds_uat_dtc_ids
, /* data_ptr */
3790 &uds_uat_dtc_id_num
, /* numitems_ptr */
3791 UAT_AFFECTS_DISSECTION
, /* but not fields */
3793 copy_generic_one_id_string_cb
, /* copy callback */
3794 update_generic_addr_16bit_id_24bit
, /* update callback */
3795 free_generic_one_id_string_cb
, /* free callback */
3796 post_update_uds_dtc_cb
, /* post update callback */
3797 NULL
, /* reset callback */
3798 uds_dtc_id_uat_fields
/* UAT field definitions */
3801 prefs_register_uat_preference(uds_module
, "_uds_dtc_id_list", "UDS DTC Identifier List",
3802 "A table to define names of UDS DTC Identifier", uds_dtc_ids_uat
);
3805 static uat_field_t uds_address_name_uat_fields
[] = {
3806 UAT_FLD_HEX(uds_uat_addresses
, address
, "Address", "Address (32bit hex without leading 0x)"),
3807 UAT_FLD_CSTRING(uds_uat_addresses
, name
, "Name", "Name of the Address (string)"),
3811 uds_address_uat
= uat_new("UDS Addresses",
3812 sizeof(address_string_t
), /* record size */
3813 DATAFILE_UDS_ADDRESSES
, /* filename */
3814 true, /* from profile */
3815 (void**)&uds_uat_addresses
, /* data_ptr */
3816 &uds_uat_addresses_num
, /* numitems_ptr */
3817 UAT_AFFECTS_DISSECTION
, /* but not fields */
3819 copy_address_string_cb
, /* copy callback */
3820 update_address_string_cb
, /* update callback */
3821 free_address_string_cb
, /* free callback */
3822 post_update_uds_address_cb
, /* post update callback */
3823 NULL
, /* reset callback */
3824 uds_address_name_uat_fields
/* UAT field definitions */
3827 prefs_register_uat_preference(uds_module
, "_uds_address_list", "UDS Address List",
3828 "A table to define names of UDS Addresses", uds_address_uat
);
3830 prefs_register_bool_preference(uds_module
, "dissect_small_sids_with_obd_ii",
3831 "Dissect Service Identifiers smaller 0x10 with OBD II Dissector?",
3832 "Dissect Service Identifiers smaller 0x10 with OBD II Dissector?",
3833 &uds_dissect_small_sids_with_obd_ii
);
3835 prefs_register_enum_preference(uds_module
, "cert_decode_strategy",
3836 "Certificate Decoding Strategy",
3837 "Decide how the certificate bytes are decoded",
3838 &uds_certificate_decoding_config
, certificate_decoding_vals
, false);
3840 prefs_register_bool_preference(uds_module
, "do_clear_info_col",
3841 "Show only UDS in the Info Column",
3842 "Show only UDS in the Info Column?",
3843 &uds_clear_info_col
);
3845 heur_subdissector_list
= register_heur_dissector_list_with_description("uds", "UDS RDBI data", proto_uds
);
3849 proto_reg_handoff_uds(void)
3851 dissector_add_for_decode_as("iso10681.subdissector", uds_handle_iso10681
);
3852 dissector_add_for_decode_as("iso15765.subdissector", uds_handle_iso15765
);
3853 obd_ii_handle
= find_dissector("obd-ii-uds");
3857 * Editor modelines - https://www.wireshark.org/tools/modelines.html
3862 * indent-tabs-mode: nil
3865 * vi: set shiftwidth=4 tabstop=8 expandtab:
3866 * :indentSize=4:tabSize=8:noTabs=true: