Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-asam-cmp.c
blob0b963947b79d7fe4352a6e6dc5548da15cee3806
1 /* packet-asam-cmp.c
2 * ASAM Capture Module Protocol dissector.
3 * Copyright 2021-2023 Alicia Mediano Schikarski, Technica Engineering GmbH
4 * Copyright 2021-2024 Dr. Lars Voelker, Technica Engineering GmbH
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
14 * This is a dissector for the Capture Module Protocol standardized by the ASAM.
15 * ASAM CMP is the standardized successor of TECMP.
18 #include "config.h"
20 #include <epan/packet.h>
21 #include <epan/uat.h>
22 #include <epan/expert.h>
23 #include <epan/tfs.h>
24 #include <epan/unit_strings.h>
26 #include "packet-socketcan.h"
27 #include "packet-flexray.h"
28 #include "packet-lin.h"
30 void proto_register_asam_cmp(void);
31 void proto_reg_handoff_asam_cmp(void);
33 static int proto_asam_cmp;
35 static dissector_handle_t eth_handle;
37 static bool heuristic_first;
38 static bool old_11bit_canid_encoding;
40 static dissector_table_t lin_subdissector_table;
42 /* Header fields */
43 static int hf_cmp_header;
44 static int hf_cmp_version;
45 static int hf_cmp_header_res;
46 static int hf_cmp_device_id;
47 static int hf_cmp_msg_type;
48 static int hf_cmp_stream_id;
49 static int hf_cmp_stream_seq_ctr;
51 /* Message Fields */
52 /* Message Header Fields */
53 static int hf_cmp_msg_header;
55 static int hf_cmp_common_flag_recal;
56 static int hf_cmp_common_flag_insync;
57 static int hf_cmp_common_flag_seg;
58 static int hf_cmp_common_flag_dir_on_if;
59 static int hf_cmp_common_flag_overflow;
60 static int hf_cmp_common_flag_err_in_payload;
61 static int hf_cmp_common_flag_reserved;
62 static int hf_cmp_common_flag_reserved_ctrl;
64 static int hf_cmp_msg_timestamp;
65 static int hf_cmp_msg_timestamp_ns;
66 static int hf_cmp_msg_reserved;
67 static int hf_cmp_msg_common_flags;
68 static int hf_cmp_msg_vendor_id;
69 static int hf_cmp_msg_payload_length;
70 static int hf_cmp_msg_payload;
72 /* Additional Data Message Header Fields */
73 static int hf_cmp_interface_id;
74 static int hf_cmp_payload_type;
76 /* Additional Control Message Header Fields */
77 static int hf_cmp_ctrl_msg_reserved;
78 static int hf_cmp_ctrl_msg_payload_type;
80 /* Additional Status Message Header Fields */
81 static int hf_cmp_status_msg_payload_type;
83 /* Additional Status Message Header Fields */
84 static int hf_cmp_vendor_msg_payload_type;
86 /* Data Message Payload Fields */
87 /* CAN */
88 #define CMP_CAN_FLAGS_ERRORS 0x03ff
89 #define CMP_CAN_ID_11BIT_MASK 0x1ffc0000
90 #define CMP_CAN_ID_11BIT_SHIFT 18
91 #define CMP_CAN_ID_11BIT_MASK_OLD 0x000007ff
92 #define CMP_CAN_ID_29BIT_MASK 0x1fffffff
93 #define CMP_CAN_ID_RES 0x20000000
94 #define CMP_CAN_ID_RTR 0x40000000
95 #define CMP_CAN_ID_IDE 0x80000000
97 #define CMP_CAN_CRC_CRC 0x00007fff
98 #define CMP_CAN_CRC_RES 0x7fff8000
99 #define CMP_CAN_CRC_CRC_SUPP 0x80000000
101 static int hf_cmp_can_flags;
103 static int hf_cmp_can_flag_crc_err;
104 static int hf_cmp_can_flag_ack_err;
105 static int hf_cmp_can_flag_passive_ack_err;
106 static int hf_cmp_can_flag_active_ack_err;
107 static int hf_cmp_can_flag_ack_del_err;
108 static int hf_cmp_can_flag_form_err;
109 static int hf_cmp_can_flag_stuff_err;
110 static int hf_cmp_can_flag_crc_del_err;
111 static int hf_cmp_can_flag_eof_err;
112 static int hf_cmp_can_flag_bit_err;
113 static int hf_cmp_can_flag_r0;
114 static int hf_cmp_can_flag_srr_dom;
115 static int hf_cmp_can_flag_reserved;
117 static int hf_cmp_can_reserved;
118 static int hf_cmp_can_id;
119 static int hf_cmp_can_id_11bit;
120 static int hf_cmp_can_id_11bit_old;
121 static int hf_cmp_can_id_29bit;
122 static int hf_cmp_can_id_res;
123 static int hf_cmp_can_id_rtr;
124 static int hf_cmp_can_id_ide;
125 static int hf_cmp_can_crc;
126 static int hf_cmp_can_crc_crc;
127 static int hf_cmp_can_crc_res;
128 static int hf_cmp_can_crc_crc_support;
129 static int hf_cmp_can_err_pos;
130 static int hf_cmp_can_dlc;
131 static int hf_cmp_can_data_len;
133 /* CAN FD */
134 #define CMP_CANFD_FLAGS_ERRORS 0x03ff
135 #define CMP_CANFD_ID_RES 0x20000000
136 #define CMP_CANFD_ID_RRS 0x40000000
137 #define CMP_CANFD_ID_IDE 0x80000000
139 #define CMP_CANFD_CRC_CRC17 0x0001ffff
140 #define CMP_CANFD_CRC_CRC21 0x001fffff
141 #define CMP_CANFD_CRC_SBC 0x00e00000
142 #define CMP_CANFD_CRC_SBC_PARITY 0x01000000
143 #define CMP_CANFD_CRC_RES 0x3e000000
144 #define CMP_CANFD_CRC_SBC_SUPP 0x40000000
145 #define CMP_CANFD_CRC_CRC_SUPP 0x80000000
147 static int hf_cmp_canfd_flags;
149 static int hf_cmp_canfd_flag_crc_err;
150 static int hf_cmp_canfd_flag_ack_err;
151 static int hf_cmp_canfd_flag_passive_ack_err;
152 static int hf_cmp_canfd_flag_active_ack_err;
153 static int hf_cmp_canfd_flag_ack_del_err;
154 static int hf_cmp_canfd_flag_form_err;
155 static int hf_cmp_canfd_flag_stuff_err;
156 static int hf_cmp_canfd_flag_crc_del_err;
157 static int hf_cmp_canfd_flag_eof_err;
158 static int hf_cmp_canfd_flag_bit_err;
159 static int hf_cmp_canfd_flag_res;
160 static int hf_cmp_canfd_flag_srr_dom;
161 static int hf_cmp_canfd_flag_brs;
162 static int hf_cmp_canfd_flag_esi;
163 static int hf_cmp_canfd_flag_reserved;
165 static int hf_cmp_canfd_reserved;
166 static int hf_cmp_canfd_id;
167 static int hf_cmp_canfd_id_11bit;
168 static int hf_cmp_canfd_id_11bit_old;
169 static int hf_cmp_canfd_id_29bit;
170 static int hf_cmp_canfd_id_res;
171 static int hf_cmp_canfd_id_rrs;
172 static int hf_cmp_canfd_id_ide;
173 static int hf_cmp_canfd_crc;
174 static int hf_cmp_canfd_crc_crc17;
175 static int hf_cmp_canfd_crc_crc21;
176 static int hf_cmp_canfd_crc_sbc;
177 static int hf_cmp_canfd_crc_sbc_parity;
178 static int hf_cmp_canfd_crc_res;
179 static int hf_cmp_canfd_crc_sbc_support;
180 static int hf_cmp_canfd_crc_crc_support;
181 static int hf_cmp_canfd_err_pos;
182 static int hf_cmp_canfd_dlc;
183 static int hf_cmp_canfd_data_len;
185 /* LIN */
186 #define CMP_CANFD_PID_PARITY_MASK 0xc0
187 #define CMP_CANFD_PID_ID_MASK 0x3f
189 static int hf_cmp_lin_flags;
190 static int hf_cmp_lin_flag_checksum_err;
191 static int hf_cmp_lin_flag_col_err;
192 static int hf_cmp_lin_flag_parity_err;
193 static int hf_cmp_lin_flag_no_slave_res_err;
194 static int hf_cmp_lin_flag_sync_err;
195 static int hf_cmp_lin_flag_framing_err;
196 static int hf_cmp_lin_flag_short_dom_err;
197 static int hf_cmp_lin_flag_long_dom_err;
198 static int hf_cmp_lin_flag_wup;
199 static int hf_cmp_lin_flag_reserved;
201 static int hf_cmp_lin_reserved;
202 static int hf_cmp_lin_pid;
203 static int hf_cmp_lin_pid_parity;
204 static int hf_cmp_lin_pid_id;
205 static int hf_cmp_lin_reserved_2;
206 static int hf_cmp_lin_checksum;
207 static int hf_cmp_lin_data_len;
209 /* FlexRay */
210 #define CMP_FLEXRAY_FLAGS_NF 0x0004
212 static int hf_cmp_flexray_flags;
214 static int hf_cmp_flexray_flag_crc_frame_err;
215 static int hf_cmp_flexray_flag_crc_header_err;
216 static int hf_cmp_flexray_flag_nf;
217 static int hf_cmp_flexray_flag_sf;
218 static int hf_cmp_flexray_flag_sync;
219 static int hf_cmp_flexray_flag_wus;
220 static int hf_cmp_flexray_flag_ppi;
221 static int hf_cmp_flexray_flag_cas;
222 static int hf_cmp_flexray_flag_reserved;
224 static int hf_cmp_flexray_reserved;
225 static int hf_cmp_flexray_header_crc;
226 static int hf_cmp_flexray_frame_id;
227 static int hf_cmp_flexray_cycle;
228 static int hf_cmp_flexray_frame_crc;
229 static int hf_cmp_flexray_reserved_2;
230 static int hf_cmp_flexray_data_len;
232 /* UART/RS-232 */
233 #define CMP_UART_DATA_DATA_MASK 0x01FF
235 static int hf_cmp_uart_flags;
237 static int hf_cmp_uart_flag_cl;
238 static int hf_cmp_uart_flag_reserved;
240 static int hf_cmp_uart_reserved;
241 static int hf_cmp_uart_data_len;
242 static int hf_cmp_uart_data;
244 static int hf_cmp_uart_data_data;
245 static int hf_cmp_uart_data_reserved;
246 static int hf_cmp_uart_data_framing_err;
247 static int hf_cmp_uart_data_break_condition;
248 static int hf_cmp_uart_data_parity_err;
250 /* Analog */
251 static int hf_cmp_analog_flags;
253 static int hf_cmp_analog_flag_sample_dt;
254 static int hf_cmp_analog_flag_reserved;
256 static int hf_cmp_analog_reserved;
257 static int hf_cmp_analog_unit;
258 static int hf_cmp_analog_sample_interval;
259 static int hf_cmp_analog_sample_offset;
260 static int hf_cmp_analog_sample_scalar;
261 static int hf_cmp_analog_sample;
262 static int hf_cmp_analog_sample_raw;
264 /* Ethernet */
265 static int hf_cmp_eth_flags;
267 static int hf_cmp_eth_flag_fcs_err;
268 static int hf_cmp_eth_flag_short_err;
269 static int hf_cmp_eth_flag_tx_down;
270 static int hf_cmp_eth_flag_collision;
271 static int hf_cmp_eth_flag_long_err;
272 static int hf_cmp_eth_flag_phy_err;
273 static int hf_cmp_eth_flag_truncated;
274 static int hf_cmp_eth_flag_fcs_supported;
275 static int hf_cmp_eth_flag_reserved;
277 static int hf_cmp_eth_reserved;
278 static int hf_cmp_eth_payload_length;
280 /* Control Message Payload Fields */
281 /* Data Sink Ready */
282 static int hf_cmp_ctrl_msg_device_id;
284 /* User Event */
285 static int hf_cmp_ctrl_msg_event_id;
287 /* Vendor specific */
288 static int hf_cmp_ctrl_msg_vendor_id;
289 static int hf_cmp_ctrl_msg_vendor_payload_type;
291 /* Status Message Payload Fields */
292 /* Capture Module Status Message */
293 static int hf_cmp_status_msg_cm_uptime_ns;
294 static int hf_cmp_status_msg_cm_uptime_s;
295 static int hf_cmp_status_msg_gm_identity;
296 static int hf_cmp_status_msg_gm_clock_quality;
297 static int hf_cmp_status_msg_current_utc_offset;
298 static int hf_cmp_status_msg_time_source;
299 static int hf_cmp_status_msg_domain_num;
300 static int hf_cmp_status_msg_res;
301 static int hf_cmp_gptp_flags;
303 static int hf_cmp_gptp_flags_leap61;
304 static int hf_cmp_gptp_flags_leap59;
305 static int hf_cmp_gptp_flags_cur_utco_valid;
306 static int hf_cmp_gptp_flags_ptp_timescale;
307 static int hf_cmp_gptp_flags_time_traceable;
308 static int hf_cmp_gptp_flags_freq_traceable;
309 static int hf_cmp_gptp_flags_reserved;
311 static int hf_cmp_status_dev_desc_length;
312 static int hf_cmp_status_dev_desc;
313 static int hf_cmp_status_sn_length;
314 static int hf_cmp_status_sn;
315 static int hf_cmp_status_hw_ver_length;
316 static int hf_cmp_status_hw_ver;
317 static int hf_cmp_status_sw_ver_length;
318 static int hf_cmp_status_sw_ver;
319 static int hf_cmp_status_vendor_data_length;
320 static int hf_cmp_status_vendor_data;
322 /* Interface Status Message */
323 static int hf_cmp_iface_interface;
324 static int hf_cmp_iface_iface_id;
325 static int hf_cmp_iface_msg_total_rx;
326 static int hf_cmp_iface_msg_total_tx;
327 static int hf_cmp_iface_msg_dropped_rx;
328 static int hf_cmp_iface_msg_dropped_tx;
329 static int hf_cmp_iface_errs_total_rx;
330 static int hf_cmp_iface_errs_total_tx;
331 static int hf_cmp_iface_iface_type;
332 static int hf_cmp_iface_iface_status;
333 static int hf_cmp_iface_stream_id_cnt;
334 static int hf_cmp_iface_reserved;
336 static int hf_cmp_iface_feat;
337 static int hf_cmp_iface_feat_can_pas_ack;
338 static int hf_cmp_iface_feat_can_act_ack;
339 static int hf_cmp_iface_feat_can_ack_del_err;
340 static int hf_cmp_iface_feat_can_crc_del_err;
341 static int hf_cmp_iface_feat_can_eof_err;
342 static int hf_cmp_iface_feat_can_r0;
343 static int hf_cmp_iface_feat_can_srr_dom;
345 static int hf_cmp_iface_feat_canfd_pas_ack;
346 static int hf_cmp_iface_feat_canfd_act_ack;
347 static int hf_cmp_iface_feat_canfd_ack_del_err;
348 static int hf_cmp_iface_feat_canfd_crc_del_err;
349 static int hf_cmp_iface_feat_canfd_eof_err;
350 static int hf_cmp_iface_feat_canfd_rsvd;
351 static int hf_cmp_iface_feat_canfd_srr_dom;
352 static int hf_cmp_iface_feat_canfd_brs_dom;
353 static int hf_cmp_iface_feat_canfd_esi_dom;
355 static int hf_cmp_iface_feat_lin_sync_err;
356 static int hf_cmp_iface_feat_lin_framing_err;
357 static int hf_cmp_iface_feat_lin_short_dom_err;
358 static int hf_cmp_iface_feat_lin_long_dom_err;
359 static int hf_cmp_iface_feat_lin_wup;
361 static int hf_cmp_iface_feat_eth_too_long;
362 static int hf_cmp_iface_feat_eth_phy_err;
363 static int hf_cmp_iface_feat_eth_trunc;
365 static int hf_cmp_iface_stream_ids;
366 static int hf_cmp_iface_stream_id;
367 static int hf_cmp_iface_vendor_data_len;
368 static int hf_cmp_iface_vendor_data;
370 /* Configuration Status Message */
371 static int hf_cmp_status_msg_config;
373 /* Data Lost Event Status Message */
374 static int hf_cmp_dataloss_data_sink_port;
375 static int hf_cmp_dataloss_device_id;
376 static int hf_cmp_dataloss_reserved;
377 static int hf_cmp_dataloss_stream_id;
378 static int hf_cmp_dataloss_last_ssq_value;
379 static int hf_cmp_dataloss_current_ssq_value;
381 /* Time Sync Lost Event Status Message */
382 static int hf_cmp_timeloss_port_nr;
383 static int hf_cmp_timeloss_device_id;
384 static int hf_cmp_timeloss_error_flags;
386 static int hf_cmp_timeloss_error_flags_ts;
387 static int hf_cmp_timeloss_error_flags_insync;
388 static int hf_cmp_timeloss_error_flags_delta;
389 static int hf_cmp_timeloss_error_flags_reserved;
391 /* Vendor Specific */
392 static int hf_cmp_status_msg_vendor_specific;
394 /* Protocol trees */
395 static int ett_asam_cmp;
396 static int ett_asam_cmp_header;
397 static int ett_asam_cmp_timestamp;
398 static int ett_asam_cmp_common_flags;
399 static int ett_asam_cmp_payload;
400 static int ett_asam_cmp_payload_flags;
401 static int ett_asam_cmp_lin_pid;
402 static int ett_asam_cmp_can_id;
403 static int ett_asam_cmp_can_crc;
404 static int ett_asam_cmp_uart_data;
405 static int ett_asam_cmp_analog_sample;
406 static int ett_asam_cmp_status_cm_flags;
407 static int ett_asam_cmp_status_cm_uptime;
408 static int ett_asam_cmp_status_timeloss_flags;
409 static int ett_asam_cmp_status_interface;
410 static int ett_asam_cmp_status_feature_support;
411 static int ett_asam_cmp_status_stream_ids;
413 /* General */
414 #define CMP_HEADER_LEN 8
415 #define CMP_MSG_HEADER_LEN 16
417 /* CMP Message Type Names */
418 #define CMP_MSG_TYPE_DATA_MSG 0x01
419 #define CMP_MSG_TYPE_CTRL_MSG 0x02
420 #define CMP_MSG_TYPE_STATUS_MSG 0x03
421 #define CMP_MSG_TYPE_VENDOR 0xFF
423 /* CMP Segmentation Flag Values */
424 #define CMP_SEG_UNSEGMENTED 0x00
425 #define CMP_SEG_FIRST 0x01
426 #define CMP_SEG_INTERMEDIARY 0x02
427 #define CMP_SEG_LAST 0x03
429 /* CMP Data Message Payload Type Names */
430 #define CMP_DATA_MSG_INVALID 0x00
431 #define CMP_DATA_MSG_CAN 0x01
432 #define CMP_DATA_MSG_CANFD 0x02
433 #define CMP_DATA_MSG_LIN 0x03
434 #define CMP_DATA_MSG_FLEXRAY 0x04
435 #define CMP_DATA_MSG_DIGITAL 0x05
436 #define CMP_DATA_MSG_UART_RS_232 0x06
437 #define CMP_DATA_MSG_ANALOG 0x07
438 #define CMP_DATA_MSG_ETHERNET 0x08
439 #define CMP_DATA_MSG_SPI 0x09
440 #define CMP_DATA_MSG_I2C 0x0A
441 #define CMP_DATA_MSG_GIGEVISION 0x0B
442 #define CMP_DATA_MSG_MIPI_CSI2 0x0C
443 #define CMP_DATA_MSG_USER_DEFINED 0xFF
445 /* CMP Digital Trigger Pattern Values */
446 #define CMP_T_PATTERN_FALLING 0x00
447 #define CMP_T_PATTERN_RISING 0x01
449 /* CMP Digital Data Message DL Values */
450 #define CMP_UART_CL_5 0x00
451 #define CMP_UART_CL_6 0x01
452 #define CMP_UART_CL_7 0x02
453 #define CMP_UART_CL_8 0x03
454 #define CMP_UART_CL_9 0x04
456 /* CMP Analog Data Message DT Values */
457 #define CMP_ANALOG_DATA_MSG_DL_16 0x00
458 #define CMP_ANALOG_DATA_MSG_DL_32 0x01
459 #define CMP_ANALOG_DATA_MSG_DL_RES1 0x02
460 #define CMP_ANALOG_DATA_MSG_DL_RES2 0x03
462 /* CMP Control Message Payload Type Names */
463 #define CMP_CTRL_MSG_INVALID 0x00
464 #define CMP_CTRL_MSG_DSR_CTRL_MSG 0x01
465 #define CMP_CTRL_MSG_USER_EVENT_CTRL_MSG 0xFE
466 #define CMP_CTRL_MSG_VENDOR 0xFF
468 /* CMP Status Message Payload Type Names */
469 #define CMP_STATUS_MSG_INVALID 0x00
470 #define CMP_STATUS_MSG_CM_STAT_MSG 0x01
471 #define CMP_STATUS_MSG_IF_STAT_MSG 0x02
472 #define CMP_STATUS_MSG_CONF_STAT_MSG 0x03
473 #define CMP_STATUS_MSG_DLE_STAT_MSG 0x04
474 #define CMP_STATUS_MSG_TSLE_STAT_MSG 0x05
475 #define CMP_STATUS_MSG_VENDOR_STAT_MSG 0xFF
477 /* Interface Status Message Names */
478 #define CMP_STATUS_IFACE_DOWN_EN 0x00
479 #define CMP_STATUS_IFACE_UP_EN 0x01
480 #define CMP_STATUS_IFACE_DOWN_DIS 0x02
482 static const value_string msg_type_names[] = {
483 {CMP_MSG_TYPE_DATA_MSG, "Data Message"},
484 {CMP_MSG_TYPE_CTRL_MSG, "Control Message"},
485 {CMP_MSG_TYPE_STATUS_MSG, "Status Message"},
486 {CMP_MSG_TYPE_VENDOR, "Vendor Specific Data"},
487 {0, NULL}
490 static const value_string seg_flag_names[] = {
491 {CMP_SEG_INTERMEDIARY, "Intermediary segment"},
492 {CMP_SEG_FIRST, "First segment"},
493 {CMP_SEG_LAST, "Last segment"},
494 {CMP_SEG_UNSEGMENTED, "Unsegmented"},
495 {0, NULL}
498 static const true_false_string interface_direction = {
499 "Sending",
500 "Receive"
503 static const value_string data_msg_type_names[] = {
504 {CMP_DATA_MSG_INVALID, "Invalid"},
505 {CMP_DATA_MSG_CAN, "CAN"},
506 {CMP_DATA_MSG_CANFD, "CAN-FD"},
507 {CMP_DATA_MSG_LIN, "LIN"},
508 {CMP_DATA_MSG_FLEXRAY, "FlexRay"},
509 {CMP_DATA_MSG_DIGITAL, "Digital"},
510 {CMP_DATA_MSG_UART_RS_232, "UART/RS-232"},
511 {CMP_DATA_MSG_ANALOG, "Analog"},
512 {CMP_DATA_MSG_ETHERNET, "Ethernet"},
513 {CMP_DATA_MSG_SPI, "SPI"},
514 {CMP_DATA_MSG_I2C, "I2C"},
515 {CMP_DATA_MSG_GIGEVISION, "Gigevision"},
516 {CMP_DATA_MSG_MIPI_CSI2, "MIPI CSI-2"},
517 {CMP_DATA_MSG_USER_DEFINED, "User defined"},
518 {0, NULL}
521 static const true_false_string can_dom_rec = {
522 "Dominant",
523 "Recessive"
526 static const true_false_string can_rec_dom = {
527 "Recessive",
528 "Dominant"
531 static const true_false_string can_id_ide = {
532 "29bit ID",
533 "11bit ID"
536 static const true_false_string can_id_rtr = {
537 "Remote Frame",
538 "Data Frame"
541 static const true_false_string canfd_act_pas = {
542 "Error active",
543 "Error passive"
547 static const value_string uart_cl_names[] = {
548 {CMP_UART_CL_5, "5 Bits"},
549 {CMP_UART_CL_6, "6 Bits"},
550 {CMP_UART_CL_7, "7 Bits"},
551 {CMP_UART_CL_8, "8 Bits"},
552 {CMP_UART_CL_9, "9 Bits"},
553 {0, NULL}
556 static const value_string analog_sample_dt[] = {
557 {CMP_ANALOG_DATA_MSG_DL_16, "A_INT16"},
558 {CMP_ANALOG_DATA_MSG_DL_32, "A_INT32"},
559 {CMP_ANALOG_DATA_MSG_DL_RES1, "Reserved"},
560 {CMP_ANALOG_DATA_MSG_DL_RES2, "Reserved"},
561 {0, NULL}
564 static const value_string ctrl_msg_type_names[] = {
565 {CMP_CTRL_MSG_INVALID, "Invalid"},
566 {CMP_CTRL_MSG_DSR_CTRL_MSG, "Data Sink ready to receive Control Message"},
567 {CMP_CTRL_MSG_USER_EVENT_CTRL_MSG, "User Event Message"},
568 {CMP_CTRL_MSG_VENDOR, "Vendor Specific Control Message"},
569 {0, NULL}
572 static const value_string status_msg_type_names[] = {
573 {CMP_STATUS_MSG_INVALID, "Invalid"},
574 {CMP_STATUS_MSG_CM_STAT_MSG, "Capture Module Status"},
575 {CMP_STATUS_MSG_IF_STAT_MSG, "Interface Status"},
576 {CMP_STATUS_MSG_CONF_STAT_MSG, "Configuration Status"},
577 {CMP_STATUS_MSG_DLE_STAT_MSG, "Data Lost Status"},
578 {CMP_STATUS_MSG_TSLE_STAT_MSG, "Time Sync Lost Status"},
579 {CMP_STATUS_MSG_VENDOR_STAT_MSG, "Vendor specific Status"},
580 {0, NULL}
583 static const value_string interface_status_names[] = {
584 {CMP_STATUS_IFACE_DOWN_EN, "Down and enabled"},
585 {CMP_STATUS_IFACE_UP_EN, "Up and enabled"},
586 {CMP_STATUS_IFACE_DOWN_DIS, "Down and disabled"},
587 {0, NULL}
590 /* As defined by the ASAM Vendor ID registry for POD and CMP */
591 #define CMP_VENDOR_ID_AVL_LIST 0x0006
592 #define CMP_VENDOR_DSPACE 0x000b
593 #define CMP_VENDOR_ETAS 0x000c
594 #define CMP_VENDOR_BOSCH 0x0027
595 #define CMP_VENDOR_VECTOR 0x002d
596 #define CMP_VENDOR_CONTINENTAL 0x003c
597 #define CMP_VENDOR_MK 0x003e
598 #define CMP_VENDOR_ID_ACCURATE 0x004a
599 #define CMP_VENDOR_RA 0x006c
600 #define CMP_VENDOR_X2E 0x00ca
601 #define CMP_VENDOR_INTREPIDCS 0x00f0
602 #define CMP_VENDOR_ID_BPLUS 0x010f
603 #define CMP_VENDOR_VIGEM 0x012a
604 #define CMP_VENDOR_TECHNICA 0x019c
605 #define CMP_VENDOR_ID_AED_ENG 0x0241
607 /* As defined by the ASAM Vendor ID registry for POD and CMP */
608 static const value_string vendor_ids[] = {
609 {CMP_VENDOR_ID_ACCURATE, "Accurate Technologies Inc."},
610 {CMP_VENDOR_ID_AED_ENG, "AED Engineering GmbH"},
611 {CMP_VENDOR_ID_AVL_LIST, "AVL List GmbH"},
612 {CMP_VENDOR_ID_BPLUS, "b-plus GmbH"},
613 {CMP_VENDOR_CONTINENTAL, "Continental AG"},
614 {CMP_VENDOR_DSPACE, "dSPACE GmbH"},
615 {CMP_VENDOR_ETAS, "ETAS GmbH"},
616 {CMP_VENDOR_INTREPIDCS, "Intrepid Control Systems, Inc."},
617 {CMP_VENDOR_MK, "M&K Meß- und Kommunikationstechnik GmbH"},
618 {CMP_VENDOR_RA, "RA Consulting GmbH"},
619 {CMP_VENDOR_BOSCH, "Robert Bosch GmbH"},
620 {CMP_VENDOR_TECHNICA, "Technica Engineering GmbH"},
621 {CMP_VENDOR_VECTOR, "Vector Informatik GmbH"},
622 {CMP_VENDOR_VIGEM, "ViGEM GmbH"},
623 {CMP_VENDOR_X2E, "X2E GmbH"},
624 {0, NULL}
627 static const value_string analog_units[] = {
628 {0x01, "s"},
629 {0x02, "m"},
630 {0x03, "kg"},
631 {0x04, "A"},
632 {0x05, "K"},
633 {0x06, "mol"},
634 {0x07, "cd"},
635 {0x08, "Hz"},
636 {0x09, "rad"},
637 {0x0a, "sr"},
638 {0x0b, "N"},
639 {0x0c, "Pa"},
640 {0x0d, "J"},
641 {0x0e, "W"},
642 {0x0f, "C"},
643 {0x10, "V"},
644 {0x11, "F"},
645 {0x12, "Ω"},
646 {0x13, "S"},
647 {0x14, "Wb"},
648 {0x15, "T"},
649 {0x16, "H"},
650 {0x17, "°C"},
651 {0x18, "lm"},
652 {0x19, "lx"},
653 {0x1A, "Bq"},
654 {0x1B, "Gy"},
655 {0x1C, "Sv"},
656 {0x1D, "kat"},
657 {0x1E, "m/s"},
658 {0x1F, "m/s2"},
659 {0x20, "m/s3"},
660 {0x21, "m/s4"},
661 {0x22, "rad/s"},
662 {0x23, "rad/s2"},
663 {0x24, "Hz/s"},
664 {0x25, "m3/s"},
665 {0x26, "m2"},
666 {0x27, "m3"},
667 {0x28, "N s"},
668 {0x29, "N m s"},
669 {0x2A, "N m"},
670 {0x2B, "kg/m2"},
671 {0x2C, "kg/m3"},
672 {0x2D, "m3/kg"},
673 {0x2E, "J s"},
674 {0x2F, "J/kg"},
675 {0x30, "J/m3"},
676 {0x31, "N/m"},
677 {0x32, "W/m2"},
678 {0x33, "m2/s"},
679 {0x34, "Pa s"},
680 {0x35, "kg/s"},
681 {0x36, "W/(sr m2)"},
682 {0x37, "Gy/s"},
683 {0x38, "m/m3"},
684 {0x39, "W/m3"},
685 {0x3A, "J/(m2 s)"},
686 {0x3B, "kg m2"},
687 {0x3C, "W/sr"},
688 {0x3D, "mol/m3"},
689 {0x3E, "m3/mol"},
690 {0x3F, "J/(mol K)"},
691 {0x40, "J/mol"},
692 {0x41, "mol/kg"},
693 {0x42, "kg/mol"},
694 {0x45, "C/m3"},
695 {0x46, "A/m2"},
696 {0x47, "S/m"},
697 {0x48, "F/m"},
698 {0x49, "H/m"},
699 {0x4A, "V/m"},
700 {0x4B, "A/m"},
701 {0x4C, "C/Kg"},
702 {0x4D, "J/T"},
703 {0x4E, "lm s"},
704 {0x4F, "lx s"},
705 {0x50, "cd/m2"},
706 {0x51, "lm/W"},
707 {0x52, "J/K"},
708 {0x53, "J/(K kg)"},
709 {0x54, "W/(m K)"},
710 {0, NULL}
713 /********* UATs *********/
715 typedef struct _generic_one_id_string {
716 unsigned id;
717 char *name;
718 } generic_one_id_string_t;
720 /* Interface UAT */
721 typedef struct _interface_config {
722 unsigned id;
723 unsigned bus_id;
724 char *name;
725 } interface_config_t;
727 /* Devices */
728 #define DATAFILE_ASAM_CMP_DEVICES_IDS "ASAM_CMP_devices"
730 static GHashTable *data_asam_cmp_devices;
731 static generic_one_id_string_t *asam_cmp_devices;
732 static unsigned asam_cmp_devices_num;
734 UAT_HEX_CB_DEF(asam_cmp_devices, id, generic_one_id_string_t)
735 UAT_CSTRING_CB_DEF(asam_cmp_devices, name, generic_one_id_string_t)
737 /* Interfaces */
738 #define DATAFILE_ASAM_CMP_IFACE_IDS "ASAM_CMP_interfaces"
740 static GHashTable *data_asam_cmp_interfaces;
741 static interface_config_t *asam_cmp_interfaces;
742 static unsigned asam_cmp_interface_num;
744 UAT_HEX_CB_DEF(asam_cmp_interfaces, id, interface_config_t)
745 UAT_CSTRING_CB_DEF(asam_cmp_interfaces, name, interface_config_t)
746 UAT_HEX_CB_DEF(asam_cmp_interfaces, bus_id, interface_config_t)
748 /*** expert info items ***/
749 static expert_field ei_asam_cmp_length_mismatch;
750 static expert_field ei_asam_cmp_unsupported_crc_not_zero;
752 /* ID -> Name */
753 static void *
754 copy_generic_one_id_string_cb(void *n, const void *o, size_t size _U_) {
755 generic_one_id_string_t *new_rec = (generic_one_id_string_t *)n;
756 const generic_one_id_string_t *old_rec = (const generic_one_id_string_t *)o;
758 new_rec->name = g_strdup(old_rec->name);
759 new_rec->id = old_rec->id;
760 return new_rec;
763 static bool
764 update_generic_one_identifier_16bit(void *r, char **err) {
765 generic_one_id_string_t *rec = (generic_one_id_string_t *)r;
767 if (rec->id > 0xffff) {
768 *err = ws_strdup_printf("We currently only support 16 bit identifiers (ID: %i Name: %s)", rec->id, rec->name);
769 return false;
772 if (rec->name == NULL || rec->name[0] == 0) {
773 *err = g_strdup("Name cannot be empty");
774 return false;
777 return true;
780 static void
781 free_generic_one_id_string_cb(void *r) {
782 generic_one_id_string_t *rec = (generic_one_id_string_t *)r;
783 /* freeing result of g_strdup */
784 g_free(rec->name);
785 rec->name = NULL;
788 /* ID -> ID, Name */
789 static void *
790 copy_interface_config_cb(void *n, const void *o, size_t size _U_) {
791 interface_config_t *new_rec = (interface_config_t *)n;
792 const interface_config_t *old_rec = (const interface_config_t *)o;
794 new_rec->id = old_rec->id;
795 new_rec->name = g_strdup(old_rec->name);
796 new_rec->bus_id = old_rec->bus_id;
797 return new_rec;
800 static bool
801 update_interface_config(void *r, char **err) {
802 interface_config_t *rec = (interface_config_t *)r;
804 if (rec->id > 0xffffffff) {
805 *err = ws_strdup_printf("We currently only support 32 bit identifiers (ID: %i Name: %s)", rec->id, rec->name);
806 return false;
809 if (rec->name == NULL || rec->name[0] == 0) {
810 *err = g_strdup("Name cannot be empty");
811 return false;
814 if (rec->bus_id > 0xffff) {
815 *err = ws_strdup_printf("We currently only support 16 bit bus identifiers (ID: %i Name: %s Bus-ID: %i)", rec->id, rec->name, rec->bus_id);
816 return false;
819 return true;
822 static void
823 free_interface_config_cb(void *r) {
824 interface_config_t *rec = (interface_config_t *)r;
825 /* freeing result of g_strdup */
826 g_free(rec->name);
827 rec->name = NULL;
830 static char *
831 ht_interface_config_to_string(unsigned int identifier) {
832 interface_config_t *tmp = g_hash_table_lookup(data_asam_cmp_interfaces, GUINT_TO_POINTER(identifier));
833 if (tmp == NULL) {
834 return NULL;
837 return tmp->name;
840 static uint16_t
841 ht_interface_config_to_bus_id(unsigned int identifier) {
842 interface_config_t *tmp = g_hash_table_lookup(data_asam_cmp_interfaces, GUINT_TO_POINTER(identifier));
843 if (tmp == NULL) {
844 /* 0 means basically any or none */
845 return 0;
848 return tmp->bus_id;
851 static void
852 post_update_asam_cmp_devices_cb(void) {
853 unsigned i;
855 /* destroy old hash table, if it exists */
856 if (data_asam_cmp_devices) {
857 g_hash_table_destroy(data_asam_cmp_devices);
860 /* create new hash table */
861 data_asam_cmp_devices = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL);
863 for (i = 0; i < asam_cmp_devices_num; i++) {
864 g_hash_table_insert(data_asam_cmp_devices, GUINT_TO_POINTER(asam_cmp_devices[i].id), asam_cmp_devices[i].name);
868 static void
869 post_update_interface_config_cb(void) {
870 unsigned i;
872 /* destroy old hash table, if it exists */
873 if (data_asam_cmp_interfaces) {
874 g_hash_table_destroy(data_asam_cmp_interfaces);
877 /* create new hash table */
878 data_asam_cmp_interfaces = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL);
880 for (i = 0; i < asam_cmp_interface_num; i++) {
881 g_hash_table_insert(data_asam_cmp_interfaces, GUINT_TO_POINTER(asam_cmp_interfaces[i].id), &asam_cmp_interfaces[i]);
885 static void
886 add_device_id_text(proto_item *ti, uint16_t device_id) {
887 const char *descr = g_hash_table_lookup(data_asam_cmp_devices, GUINT_TO_POINTER(device_id));
889 if (descr != NULL) {
890 proto_item_append_text(ti, " (%s)", descr);
894 static void
895 add_interface_id_text(proto_item *ti, uint32_t interface_id) {
896 const char *descr = ht_interface_config_to_string(interface_id);
898 if (descr != NULL) {
899 proto_item_append_text(ti, " (%s)", descr);
903 static int
904 dissect_asam_cmp_data_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, proto_tree *tree, unsigned offset_orig) {
905 proto_item *ti = NULL;
906 proto_item *ti_msg_header = NULL;
907 proto_item *ti_msg_payload = NULL;
908 proto_tree *asam_cmp_data_msg_header_tree = NULL;
909 proto_tree *asam_cmp_data_msg_payload_tree = NULL;
910 proto_tree *subtree = NULL;
911 unsigned offset = offset_orig;
913 unsigned msg_payload_type = 0;
914 unsigned msg_payload_length = 0;
915 unsigned msg_payload_type_length = 0;
916 unsigned interface_id = 0;
918 static int * const asam_cmp_common_flags[] = {
919 &hf_cmp_common_flag_reserved,
920 &hf_cmp_common_flag_err_in_payload,
921 &hf_cmp_common_flag_overflow,
922 &hf_cmp_common_flag_dir_on_if,
923 &hf_cmp_common_flag_seg,
924 &hf_cmp_common_flag_insync,
925 &hf_cmp_common_flag_recal,
926 NULL
929 static int * const asam_cmp_can_flags[] = {
930 &hf_cmp_can_flag_reserved,
931 &hf_cmp_can_flag_srr_dom,
932 &hf_cmp_can_flag_r0,
933 &hf_cmp_can_flag_bit_err,
934 &hf_cmp_can_flag_eof_err,
935 &hf_cmp_can_flag_crc_del_err,
936 &hf_cmp_can_flag_stuff_err,
937 &hf_cmp_can_flag_form_err,
938 &hf_cmp_can_flag_ack_del_err,
939 &hf_cmp_can_flag_active_ack_err,
940 &hf_cmp_can_flag_passive_ack_err,
941 &hf_cmp_can_flag_ack_err,
942 &hf_cmp_can_flag_crc_err,
943 NULL
946 static int * const asam_cmp_canfd_flags[] = {
947 &hf_cmp_canfd_flag_reserved,
948 &hf_cmp_canfd_flag_esi,
949 &hf_cmp_canfd_flag_brs,
950 &hf_cmp_canfd_flag_srr_dom,
951 &hf_cmp_canfd_flag_res,
952 &hf_cmp_canfd_flag_bit_err,
953 &hf_cmp_canfd_flag_eof_err,
954 &hf_cmp_canfd_flag_crc_del_err,
955 &hf_cmp_canfd_flag_stuff_err,
956 &hf_cmp_canfd_flag_form_err,
957 &hf_cmp_canfd_flag_ack_del_err,
958 &hf_cmp_canfd_flag_active_ack_err,
959 &hf_cmp_canfd_flag_passive_ack_err,
960 &hf_cmp_canfd_flag_ack_err,
961 &hf_cmp_canfd_flag_crc_err,
962 NULL
965 static int * const asam_cmp_lin_pid[] = {
966 &hf_cmp_lin_pid_parity,
967 &hf_cmp_lin_pid_id,
968 NULL
971 static int * const asam_cmp_lin_flags[] = {
972 &hf_cmp_lin_flag_reserved,
973 &hf_cmp_lin_flag_wup,
974 &hf_cmp_lin_flag_long_dom_err,
975 &hf_cmp_lin_flag_short_dom_err,
976 &hf_cmp_lin_flag_framing_err,
977 &hf_cmp_lin_flag_sync_err,
978 &hf_cmp_lin_flag_no_slave_res_err,
979 &hf_cmp_lin_flag_parity_err,
980 &hf_cmp_lin_flag_col_err,
981 &hf_cmp_lin_flag_checksum_err,
982 NULL
985 static int * const asam_cmp_flexray_flags[] = {
986 &hf_cmp_flexray_flag_reserved,
987 &hf_cmp_flexray_flag_cas,
988 &hf_cmp_flexray_flag_ppi,
989 &hf_cmp_flexray_flag_wus,
990 &hf_cmp_flexray_flag_sync,
991 &hf_cmp_flexray_flag_sf,
992 &hf_cmp_flexray_flag_nf,
993 &hf_cmp_flexray_flag_crc_header_err,
994 &hf_cmp_flexray_flag_crc_frame_err,
995 NULL
998 static int * const asam_cmp_uart_flags[] = {
999 &hf_cmp_uart_flag_reserved,
1000 &hf_cmp_uart_flag_cl,
1001 NULL
1004 static int * const asam_cmp_uart_data[] = {
1005 &hf_cmp_uart_data_parity_err,
1006 &hf_cmp_uart_data_break_condition,
1007 &hf_cmp_uart_data_framing_err,
1008 &hf_cmp_uart_data_reserved,
1009 &hf_cmp_uart_data_data,
1010 NULL
1013 static int * const asam_cmp_analog_flags[] = {
1014 &hf_cmp_analog_flag_reserved,
1015 &hf_cmp_analog_flag_sample_dt,
1016 NULL
1019 static int * const asam_cmp_ethernet_flags[] = {
1020 &hf_cmp_eth_flag_reserved,
1021 &hf_cmp_eth_flag_fcs_supported,
1022 &hf_cmp_eth_flag_truncated,
1023 &hf_cmp_eth_flag_phy_err,
1024 &hf_cmp_eth_flag_long_err,
1025 &hf_cmp_eth_flag_collision,
1026 &hf_cmp_eth_flag_tx_down,
1027 &hf_cmp_eth_flag_short_err,
1028 &hf_cmp_eth_flag_fcs_err,
1029 NULL
1032 ti_msg_header = proto_tree_add_item(tree, hf_cmp_msg_header, tvb, offset, 8, ENC_BIG_ENDIAN);
1033 asam_cmp_data_msg_header_tree = proto_item_add_subtree(ti_msg_header, ett_asam_cmp_header);
1034 proto_item_append_text(ti_msg_header, " %s", "- Data Message");
1036 uint64_t ns = tvb_get_uint64(tvb, offset, ENC_BIG_ENDIAN);
1037 nstime_t timestamp = { .secs = (time_t)(ns / 1000000000), .nsecs = (int)(ns % 1000000000) };
1039 ti = proto_tree_add_time(asam_cmp_data_msg_header_tree, hf_cmp_msg_timestamp, tvb, offset, 8, &timestamp);
1040 subtree = proto_item_add_subtree(ti, ett_asam_cmp_timestamp);
1041 proto_tree_add_item(subtree, hf_cmp_msg_timestamp_ns, tvb, offset, 8, ENC_BIG_ENDIAN);
1042 offset += 8;
1044 ti = proto_tree_add_item_ret_uint(asam_cmp_data_msg_header_tree, hf_cmp_interface_id, tvb, offset, 4, ENC_BIG_ENDIAN, &interface_id);
1045 add_interface_id_text(ti, interface_id);
1046 offset += 4;
1048 proto_tree_add_bitmask(asam_cmp_data_msg_header_tree, tvb, offset, hf_cmp_msg_common_flags, ett_asam_cmp_common_flags, asam_cmp_common_flags, ENC_BIG_ENDIAN);
1049 offset += 1;
1051 proto_tree_add_item_ret_uint(asam_cmp_data_msg_header_tree, hf_cmp_payload_type, tvb, offset, 1, ENC_NA, &msg_payload_type);
1052 offset += 1;
1054 proto_tree_add_item_ret_uint(asam_cmp_data_msg_header_tree, hf_cmp_msg_payload_length, tvb, offset, 2, ENC_BIG_ENDIAN, &msg_payload_length);
1055 offset += 2;
1057 proto_item_set_end(ti_msg_header, tvb, offset);
1059 ti_msg_payload = proto_tree_add_item(tree, hf_cmp_msg_payload, tvb, offset, msg_payload_length, ENC_BIG_ENDIAN);
1060 asam_cmp_data_msg_payload_tree = proto_item_add_subtree(ti_msg_payload, ett_asam_cmp_header);
1061 proto_item_append_text(ti_msg_payload, " %s", "- Data Message");
1063 switch (msg_payload_type) {
1064 case CMP_DATA_MSG_INVALID: {
1065 col_append_str(pinfo->cinfo, COL_INFO, " (Invalid)");
1066 proto_item_append_text(ti_msg_payload, " %s", "(Invalid)");
1068 if (msg_payload_length > 0) {
1069 tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, msg_payload_length);
1070 call_data_dissector(sub_tvb, pinfo, tree);
1071 offset += (int)msg_payload_length;
1074 proto_item_set_end(ti_msg_payload, tvb, offset);
1076 break;
1079 case CMP_DATA_MSG_CAN: {
1080 static int *const asam_cmp_can_id_field_11bit[] = {
1081 &hf_cmp_can_id_ide,
1082 &hf_cmp_can_id_rtr,
1083 &hf_cmp_can_id_res,
1084 &hf_cmp_can_id_11bit,
1085 NULL
1088 static int *const asam_cmp_can_id_field_11bit_old[] = {
1089 &hf_cmp_can_id_ide,
1090 &hf_cmp_can_id_rtr,
1091 &hf_cmp_can_id_res,
1092 &hf_cmp_can_id_11bit_old,
1093 NULL
1096 static int *const asam_cmp_can_id_field_29bit[] = {
1097 &hf_cmp_can_id_ide,
1098 &hf_cmp_can_id_rtr,
1099 &hf_cmp_can_id_res,
1100 &hf_cmp_can_id_29bit,
1101 NULL
1104 static int *const asam_cmp_can_crc_field[] = {
1105 &hf_cmp_can_crc_crc_support,
1106 &hf_cmp_can_crc_res,
1107 &hf_cmp_can_crc_crc,
1108 NULL
1111 col_append_str(pinfo->cinfo, COL_INFO, " (CAN)");
1112 proto_item_append_text(ti_msg_payload, " %s", "(CAN)");
1114 uint16_t can_flags = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
1115 proto_tree_add_bitmask(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_can_flags, ett_asam_cmp_payload_flags, asam_cmp_can_flags, ENC_BIG_ENDIAN);
1116 offset += 2;
1118 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_can_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1119 offset += 2;
1121 uint32_t can_id_field = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1122 bool can_id_29bit = (can_id_field & CMP_CAN_ID_IDE) == CMP_CAN_ID_IDE;
1123 uint32_t can_id = 0;
1124 if (can_id_29bit) {
1125 proto_tree_add_bitmask_with_flags(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_can_id, ett_asam_cmp_can_id, asam_cmp_can_id_field_29bit, ENC_BIG_ENDIAN, BMT_NO_FALSE);
1126 can_id = can_id_field & (CMP_CAN_ID_29BIT_MASK | CMP_CAN_ID_RTR | CMP_CAN_ID_IDE);
1127 } else {
1128 if (old_11bit_canid_encoding) {
1129 proto_tree_add_bitmask_with_flags(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_can_id, ett_asam_cmp_can_id, asam_cmp_can_id_field_11bit_old, ENC_BIG_ENDIAN, BMT_NO_FALSE);
1130 can_id = can_id_field & (CMP_CAN_ID_RTR | CMP_CAN_ID_IDE | CMP_CAN_ID_11BIT_MASK_OLD);
1131 } else {
1132 proto_tree_add_bitmask_with_flags(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_can_id, ett_asam_cmp_can_id, asam_cmp_can_id_field_11bit, ENC_BIG_ENDIAN, BMT_NO_FALSE);
1133 can_id = (can_id_field & (CMP_CAN_ID_RTR | CMP_CAN_ID_IDE)) + ((can_id_field & CMP_CAN_ID_11BIT_MASK) >> CMP_CAN_ID_11BIT_SHIFT);
1136 offset += 4;
1138 uint64_t tmp64;
1139 proto_tree_add_bitmask_with_flags_ret_uint64(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_can_crc, ett_asam_cmp_can_crc, asam_cmp_can_crc_field, ENC_BIG_ENDIAN, BMT_NO_FALSE, &tmp64);
1140 if ((tmp64 & CMP_CAN_CRC_CRC_SUPP) == 0 && (tmp64 & CMP_CAN_CRC_CRC) != 0) {
1141 proto_tree_add_expert(asam_cmp_data_msg_payload_tree, pinfo, &ei_asam_cmp_unsupported_crc_not_zero, tvb, offset, 4);
1143 offset += 4;
1145 uint32_t err_pos = 0;
1146 proto_tree_add_item_ret_uint(asam_cmp_data_msg_payload_tree, hf_cmp_can_err_pos, tvb, offset, 2, ENC_BIG_ENDIAN, &err_pos);
1147 offset += 2;
1149 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_can_dlc, tvb, offset, 1, ENC_NA);
1150 offset += 1;
1152 proto_tree_add_item_ret_uint(asam_cmp_data_msg_payload_tree, hf_cmp_can_data_len, tvb, offset, 1, ENC_NA, &msg_payload_type_length);
1153 offset += 1;
1155 if (msg_payload_type_length > 0) {
1156 tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, msg_payload_type_length);
1158 if ((can_flags & CMP_CAN_FLAGS_ERRORS) != 0) {
1159 can_id = can_id | CAN_ERR_FLAG;
1162 struct can_info can_info = { .id = can_id, .len = msg_payload_type_length, .fd = CAN_TYPE_CAN_CLASSIC, .bus_id = ht_interface_config_to_bus_id(interface_id) };
1163 if (!socketcan_call_subdissectors(sub_tvb, pinfo, tree, &can_info, heuristic_first)) {
1164 call_data_dissector(sub_tvb, pinfo, tree);
1167 offset += (int)msg_payload_type_length;
1170 proto_item_set_end(ti_msg_payload, tvb, offset);
1171 break;
1174 case CMP_DATA_MSG_CANFD: {
1175 static int * const asam_cmp_canfd_id_field_11bit[] = {
1176 &hf_cmp_canfd_id_ide,
1177 &hf_cmp_canfd_id_rrs,
1178 &hf_cmp_canfd_id_res,
1179 &hf_cmp_canfd_id_11bit,
1180 NULL
1183 static int * const asam_cmp_canfd_id_field_11bit_old[] = {
1184 &hf_cmp_canfd_id_ide,
1185 &hf_cmp_canfd_id_rrs,
1186 &hf_cmp_canfd_id_res,
1187 &hf_cmp_canfd_id_11bit_old,
1188 NULL
1191 static int * const asam_cmp_canfd_id_field_29bit[] = {
1192 &hf_cmp_canfd_id_res,
1193 &hf_cmp_canfd_id_rrs,
1194 &hf_cmp_canfd_id_ide,
1195 &hf_cmp_canfd_id_29bit,
1196 NULL
1199 static int * const asam_cmp_canfd_crc_field_17bit[] = {
1200 &hf_cmp_canfd_crc_crc_support,
1201 &hf_cmp_canfd_crc_sbc_support,
1202 &hf_cmp_canfd_crc_res,
1203 &hf_cmp_canfd_crc_sbc_parity,
1204 &hf_cmp_canfd_crc_sbc,
1205 &hf_cmp_canfd_crc_crc17,
1206 NULL
1209 static int * const asam_cmp_canfd_crc_field_21bit[] = {
1210 &hf_cmp_canfd_crc_crc_support,
1211 &hf_cmp_canfd_crc_sbc_support,
1212 &hf_cmp_canfd_crc_res,
1213 &hf_cmp_canfd_crc_sbc_parity,
1214 &hf_cmp_canfd_crc_sbc,
1215 &hf_cmp_canfd_crc_crc21,
1216 NULL
1219 col_append_str(pinfo->cinfo, COL_INFO, " (CAN FD)");
1220 proto_item_append_text(ti_msg_payload, " %s", "(CAN FD)");
1222 uint16_t canfd_flags = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
1223 proto_tree_add_bitmask(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_canfd_flags, ett_asam_cmp_payload_flags, asam_cmp_canfd_flags, ENC_BIG_ENDIAN);
1224 offset += 2;
1226 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_canfd_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1227 offset += 2;
1229 uint32_t can_id_field = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1230 bool can_id_29bit = (can_id_field & CMP_CANFD_ID_IDE) == CMP_CANFD_ID_IDE;
1231 uint32_t can_id = 0;
1232 if (can_id_29bit) {
1233 proto_tree_add_bitmask_with_flags(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_canfd_id, ett_asam_cmp_can_id, asam_cmp_canfd_id_field_29bit, ENC_BIG_ENDIAN, BMT_NO_FALSE);
1234 can_id = can_id_field & (CMP_CAN_ID_29BIT_MASK | CMP_CANFD_ID_IDE);
1235 } else {
1236 if (old_11bit_canid_encoding) {
1237 proto_tree_add_bitmask_with_flags(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_canfd_id, ett_asam_cmp_can_id, asam_cmp_canfd_id_field_11bit_old, ENC_BIG_ENDIAN, BMT_NO_FALSE);
1238 can_id = can_id_field & (CMP_CANFD_ID_IDE | CMP_CAN_ID_11BIT_MASK_OLD);
1239 } else {
1240 proto_tree_add_bitmask_with_flags(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_canfd_id, ett_asam_cmp_can_id, asam_cmp_canfd_id_field_11bit, ENC_BIG_ENDIAN, BMT_NO_FALSE);
1241 can_id = (can_id_field & CMP_CANFD_ID_IDE) + ((can_id_field & CMP_CAN_ID_11BIT_MASK) >> CMP_CAN_ID_11BIT_SHIFT);
1244 offset += 4;
1246 /* We peek ahead to find out the DLC. 0..10: 17bit CRC, 11..15: 21bit CRC. */
1247 if (tvb_get_uint8(tvb, offset + 6) <= 10) {
1248 proto_tree_add_bitmask_with_flags(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_canfd_crc, ett_asam_cmp_can_crc, asam_cmp_canfd_crc_field_17bit, ENC_BIG_ENDIAN, BMT_NO_FALSE);
1249 } else {
1250 proto_tree_add_bitmask_with_flags(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_canfd_crc, ett_asam_cmp_can_crc, asam_cmp_canfd_crc_field_21bit, ENC_BIG_ENDIAN, BMT_NO_FALSE);
1252 offset += 4;
1254 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_canfd_err_pos, tvb, offset, 2, ENC_BIG_ENDIAN);
1255 offset += 2;
1257 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_canfd_dlc, tvb, offset, 1, ENC_NA);
1258 offset += 1;
1260 proto_tree_add_item_ret_uint(asam_cmp_data_msg_payload_tree, hf_cmp_canfd_data_len, tvb, offset, 1, ENC_NA, &msg_payload_type_length);
1261 offset += 1;
1263 if (msg_payload_type_length > 0) {
1264 tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, msg_payload_type_length);
1266 if ((canfd_flags & CMP_CANFD_FLAGS_ERRORS) != 0) {
1267 can_id = can_id | CAN_ERR_FLAG;
1270 struct can_info can_info = { .id = can_id, .len = msg_payload_type_length, .fd = CAN_TYPE_CAN_FD, .bus_id = ht_interface_config_to_bus_id(interface_id) };
1271 if (!socketcan_call_subdissectors(sub_tvb, pinfo, tree, &can_info, heuristic_first)) {
1272 call_data_dissector(sub_tvb, pinfo, tree);
1275 offset += (int)msg_payload_type_length;
1278 proto_item_set_end(ti_msg_payload, tvb, offset);
1279 break;
1282 case CMP_DATA_MSG_LIN: {
1283 lin_info_t lin_info = {0, 0, 0};
1285 col_append_str(pinfo->cinfo, COL_INFO, " (LIN)");
1286 proto_item_append_text(ti_msg_payload, " %s", "(LIN)");
1288 proto_tree_add_bitmask(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_lin_flags, ett_asam_cmp_payload_flags, asam_cmp_lin_flags, ENC_BIG_ENDIAN);
1289 offset += 2;
1291 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_lin_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1292 offset += 2;
1294 lin_info.id = tvb_get_uint8(tvb, offset) & CMP_CANFD_PID_ID_MASK;
1295 proto_tree_add_bitmask(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_lin_pid, ett_asam_cmp_lin_pid, asam_cmp_lin_pid, ENC_BIG_ENDIAN);
1296 offset += 1;
1298 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_lin_reserved_2, tvb, offset, 1, ENC_NA);
1299 offset += 1;
1301 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_lin_checksum, tvb, offset, 1, ENC_NA);
1302 offset += 1;
1304 proto_tree_add_item_ret_uint(asam_cmp_data_msg_payload_tree, hf_cmp_lin_data_len, tvb, offset, 1, ENC_NA, &msg_payload_type_length);
1305 offset += 1;
1307 if (msg_payload_type_length > 0) {
1308 tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, msg_payload_type_length);
1310 lin_info.bus_id = ht_interface_config_to_bus_id(interface_id);
1311 lin_info.len = msg_payload_type_length;
1313 if (!dissector_try_uint_with_data(lin_subdissector_table, lin_info.id | (lin_info.bus_id << 16), sub_tvb, pinfo, tree, false, &lin_info)) {
1314 if (!dissector_try_uint_with_data(lin_subdissector_table, lin_info.id, sub_tvb, pinfo, tree, false, &lin_info)) {
1315 call_data_dissector(sub_tvb, pinfo, tree);
1319 offset += (int)msg_payload_type_length;
1322 proto_item_set_end(ti_msg_payload, tvb, offset);
1323 break;
1326 case CMP_DATA_MSG_FLEXRAY: {
1327 flexray_info_t fr_info = {0, 0, 0, 0};
1328 uint32_t tmp;
1330 col_append_str(pinfo->cinfo, COL_INFO, " (FlexRay)");
1331 proto_item_append_text(ti_msg_payload, " %s", "(FlexRay)");
1333 uint16_t flags = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
1334 proto_tree_add_bitmask(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_flexray_flags, ett_asam_cmp_payload_flags, asam_cmp_flexray_flags, ENC_BIG_ENDIAN);
1335 offset += 2;
1337 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_flexray_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1338 offset += 2;
1340 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_flexray_header_crc, tvb, offset, 2, ENC_BIG_ENDIAN);
1341 offset += 2;
1343 proto_tree_add_item_ret_uint(asam_cmp_data_msg_payload_tree, hf_cmp_flexray_frame_id, tvb, offset, 2, ENC_BIG_ENDIAN, &tmp);
1344 fr_info.id = (uint16_t)tmp;
1345 offset += 2;
1347 proto_tree_add_item_ret_uint(asam_cmp_data_msg_payload_tree, hf_cmp_flexray_cycle, tvb, offset, 1, ENC_NA, &tmp);
1348 fr_info.cc= (uint8_t)tmp;
1349 offset += 1;
1351 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_flexray_frame_crc, tvb, offset, 3, ENC_BIG_ENDIAN);
1352 offset += 3;
1354 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_flexray_reserved_2, tvb, offset, 1, ENC_NA);
1355 offset += 1;
1357 proto_tree_add_item_ret_uint(asam_cmp_data_msg_payload_tree, hf_cmp_flexray_data_len, tvb, offset, 1, ENC_NA, &msg_payload_type_length);
1358 offset += 1;
1360 if (msg_payload_type_length > 0 && (flags & CMP_FLEXRAY_FLAGS_NF) == 0) {
1361 fr_info.bus_id = ht_interface_config_to_bus_id(interface_id);
1362 fr_info.ch = 0; /* Assuming A! Could this be B? */
1364 tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, msg_payload_type_length);
1365 if (!flexray_call_subdissectors(sub_tvb, pinfo, tree, &fr_info, heuristic_first)) {
1366 call_data_dissector(sub_tvb, pinfo, tree);
1369 offset += (int)msg_payload_type_length;
1371 proto_item_set_end(ti_msg_payload, tvb, offset);
1372 break;
1375 case CMP_DATA_MSG_UART_RS_232: {
1376 col_append_str(pinfo->cinfo, COL_INFO, " (UART/RS-232)");
1377 proto_item_append_text(ti_msg_payload, " %s", "(UART/RS-232)");
1379 uint64_t char_len;
1380 proto_tree_add_bitmask_ret_uint64(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_uart_flags, ett_asam_cmp_payload_flags, asam_cmp_uart_flags, ENC_BIG_ENDIAN, &char_len);
1381 char_len = char_len & 0x07;
1382 offset += 2;
1384 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_uart_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1385 offset += 2;
1387 proto_tree_add_item_ret_uint(asam_cmp_data_msg_payload_tree, hf_cmp_uart_data_len, tvb, offset, 2, ENC_BIG_ENDIAN, &msg_payload_type_length);
1388 offset += 2;
1390 if (msg_payload_type_length > 0) {
1391 for (unsigned i = 0; i < msg_payload_type_length; i++) {
1392 uint8_t *buf = NULL;
1393 ti = proto_tree_add_bitmask(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_uart_data, ett_asam_cmp_uart_data, asam_cmp_uart_data, ENC_BIG_ENDIAN);
1394 if (char_len == CMP_UART_CL_7 || char_len == CMP_UART_CL_8) {
1395 buf = tvb_get_string_enc(pinfo->pool, tvb, offset + 1, 1, ENC_ASCII | ENC_NA);
1397 /* sanitizing buffer */
1398 if (buf[0] > 0x00 && buf[0] < 0x20) {
1399 buf[0] = 0x20;
1400 } else {
1401 proto_item_append_text(ti, ": %s", buf);
1404 offset += 2;
1408 proto_item_set_end(ti_msg_payload, tvb, offset);
1409 break;
1412 case CMP_DATA_MSG_ANALOG: {
1413 col_append_str(pinfo->cinfo, COL_INFO, " (Analog)");
1414 proto_item_append_text(ti_msg_payload, " %s", "(Analog)");
1416 uint64_t flags;
1417 proto_tree_add_bitmask_ret_uint64(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_analog_flags, ett_asam_cmp_payload_flags, asam_cmp_analog_flags, ENC_BIG_ENDIAN, &flags);
1418 offset += 2;
1420 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_analog_reserved, tvb, offset, 1, ENC_NA);
1421 offset += 1;
1423 unsigned analog_unit;
1424 proto_tree_add_item_ret_uint(asam_cmp_data_msg_payload_tree, hf_cmp_analog_unit, tvb, offset, 1, ENC_NA, &analog_unit);
1425 const char *unit_symbol;
1426 unit_symbol = try_val_to_str(analog_unit, analog_units);
1427 offset += 1;
1429 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_analog_sample_interval, tvb, offset, 4, ENC_BIG_ENDIAN);
1430 offset += 4;
1432 float sample_offset;
1433 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_analog_sample_offset, tvb, offset, 4, ENC_BIG_ENDIAN);
1434 sample_offset = tvb_get_ieee_float(tvb, offset, ENC_BIG_ENDIAN);
1435 offset += 4;
1437 float sample_scalar;
1438 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_analog_sample_scalar, tvb, offset, 4, ENC_BIG_ENDIAN);
1439 sample_scalar = tvb_get_ieee_float(tvb, offset, ENC_BIG_ENDIAN);
1440 offset += 4;
1442 int data_left = msg_payload_length - 16;
1443 if (data_left > 0) {
1444 switch (flags & 0x03) {
1445 case 0: /* INT16 */
1446 while (data_left >= 2) {
1447 double sample_value = ((double)tvb_get_int16(tvb, offset, ENC_BIG_ENDIAN) * sample_scalar + sample_offset);
1448 ti = proto_tree_add_double(asam_cmp_data_msg_payload_tree, hf_cmp_analog_sample, tvb, offset, 2, sample_value);
1449 if (unit_symbol == NULL) {
1450 proto_item_append_text(ti, " (%.9f)", sample_value);
1451 } else {
1452 proto_item_append_text(ti, "%s (%.9f%s)", unit_symbol, sample_value, unit_symbol);
1454 PROTO_ITEM_SET_GENERATED(ti);
1456 proto_tree *sample_tree = proto_item_add_subtree(ti, ett_asam_cmp_analog_sample);
1457 ti = proto_tree_add_item(sample_tree, hf_cmp_analog_sample_raw, tvb, offset, 2, ENC_BIG_ENDIAN);
1458 PROTO_ITEM_SET_HIDDEN(ti);
1460 data_left -= 2;
1461 offset += 2;
1463 break;
1464 case 1: /* INT32 */
1465 while (data_left >= 4) {
1466 double sample_value = ((double)tvb_get_int32(tvb, offset, ENC_BIG_ENDIAN) * sample_scalar + sample_offset);
1467 ti = proto_tree_add_double(asam_cmp_data_msg_payload_tree, hf_cmp_analog_sample, tvb, offset, 4, sample_value);
1468 if (unit_symbol == NULL) {
1469 proto_item_append_text(ti, " (%.9f)", sample_value);
1470 } else {
1471 proto_item_append_text(ti, "%s (%.9f%s)", unit_symbol, sample_value, unit_symbol);
1473 PROTO_ITEM_SET_GENERATED(ti);
1475 proto_tree *sample_tree = proto_item_add_subtree(ti, ett_asam_cmp_analog_sample);
1476 ti = proto_tree_add_item(sample_tree, hf_cmp_analog_sample_raw, tvb, offset, 4, ENC_BIG_ENDIAN);
1477 PROTO_ITEM_SET_HIDDEN(ti);
1479 data_left -= 4;
1480 offset += 4;
1482 break;
1486 proto_item_set_end(ti_msg_payload, tvb, offset);
1487 break;
1490 case CMP_DATA_MSG_ETHERNET:
1491 col_append_str(pinfo->cinfo, COL_INFO, " (Ethernet)");
1492 proto_item_append_text(ti_msg_payload, " %s", "(Ethernet)");
1494 proto_tree_add_bitmask(asam_cmp_data_msg_payload_tree, tvb, offset, hf_cmp_eth_flags, ett_asam_cmp_payload_flags, asam_cmp_ethernet_flags, ENC_BIG_ENDIAN);
1495 offset += 2;
1497 proto_tree_add_item(asam_cmp_data_msg_payload_tree, hf_cmp_eth_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1498 offset += 2;
1500 proto_tree_add_item_ret_uint(asam_cmp_data_msg_payload_tree, hf_cmp_eth_payload_length, tvb, offset, 2, ENC_BIG_ENDIAN, &msg_payload_type_length);
1501 offset += 2;
1503 if (msg_payload_type_length > 0) {
1504 tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, (int)msg_payload_type_length);
1505 call_dissector(eth_handle, sub_tvb, pinfo, root_tree);
1507 offset += (int)msg_payload_type_length;
1509 proto_item_set_end(ti_msg_payload, tvb, offset);
1510 break;
1512 case CMP_DATA_MSG_USER_DEFINED:
1513 col_append_str(pinfo->cinfo, COL_INFO, " (User defined)");
1515 if (msg_payload_length > 0) {
1516 tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, msg_payload_length);
1517 call_data_dissector(sub_tvb, pinfo, tree);
1518 offset += (int)msg_payload_length;
1521 proto_item_set_end(ti_msg_payload, tvb, offset);
1522 break;
1524 default:
1525 if (msg_payload_length > 0) {
1526 offset += (int)msg_payload_length;
1529 proto_item_set_end(ti_msg_payload, tvb, offset);
1530 break;
1533 if ((CMP_MSG_HEADER_LEN + msg_payload_length) < (offset - offset_orig)) {
1534 proto_tree_add_expert(tree, pinfo, &ei_asam_cmp_length_mismatch, tvb, offset_orig + CMP_MSG_HEADER_LEN, msg_payload_length);
1535 proto_item_set_end(ti_msg_payload, tvb, offset);
1538 return CMP_MSG_HEADER_LEN + msg_payload_length;
1541 static int
1542 dissect_asam_cmp_ctrl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree _U_, proto_tree *tree, unsigned offset_orig) {
1544 proto_item *ti = NULL;
1545 proto_item *ti_msg_header = NULL;
1546 proto_item *ti_msg_payload = NULL;
1547 proto_tree *asam_cmp_ctrl_msg_header_tree = NULL;
1548 proto_tree *asam_cmp_ctrl_msg_payload_tree = NULL;
1549 proto_tree *subtree = NULL;
1550 unsigned asam_cmp_ctrl_msg_payload_type = 0;
1551 unsigned asam_cmp_ctrl_msg_payload_length = 0;
1552 unsigned offset = offset_orig;
1554 static int * const asam_cmp_common_flags[] = {
1555 &hf_cmp_common_flag_reserved_ctrl,
1556 &hf_cmp_common_flag_seg,
1557 &hf_cmp_common_flag_insync,
1558 &hf_cmp_common_flag_recal,
1559 NULL
1562 ti_msg_header = proto_tree_add_item(tree, hf_cmp_msg_header, tvb, offset, 8, ENC_BIG_ENDIAN);
1563 asam_cmp_ctrl_msg_header_tree = proto_item_add_subtree(ti_msg_header, ett_asam_cmp_header);
1564 proto_item_append_text(ti_msg_header, " %s", "- Control Message");
1566 uint64_t ns = tvb_get_uint64(tvb, offset, ENC_BIG_ENDIAN);
1567 nstime_t timestamp = { .secs = (time_t)(ns / 1000000000), .nsecs = (int)(ns % 1000000000) };
1569 ti = proto_tree_add_time(asam_cmp_ctrl_msg_header_tree, hf_cmp_msg_timestamp, tvb, offset, 8, &timestamp);
1571 subtree = proto_item_add_subtree(ti, ett_asam_cmp_timestamp);
1572 proto_tree_add_item(subtree, hf_cmp_msg_timestamp_ns, tvb, offset, 8, ENC_BIG_ENDIAN);
1573 offset += 8;
1575 proto_tree_add_item(asam_cmp_ctrl_msg_header_tree, hf_cmp_ctrl_msg_reserved, tvb, offset, 4, ENC_BIG_ENDIAN);
1576 offset += 4;
1578 proto_tree_add_bitmask(asam_cmp_ctrl_msg_header_tree, tvb, offset, hf_cmp_msg_common_flags, ett_asam_cmp_common_flags, asam_cmp_common_flags, ENC_BIG_ENDIAN);
1579 offset += 1;
1581 proto_tree_add_item_ret_uint(asam_cmp_ctrl_msg_header_tree, hf_cmp_ctrl_msg_payload_type, tvb, offset, 1, ENC_NA, &asam_cmp_ctrl_msg_payload_type);
1582 offset += 1;
1584 proto_tree_add_item_ret_uint(asam_cmp_ctrl_msg_header_tree, hf_cmp_msg_payload_length, tvb, offset, 2, ENC_BIG_ENDIAN, &asam_cmp_ctrl_msg_payload_length);
1585 offset += 2;
1587 proto_item_set_end(ti_msg_header, tvb, offset);
1589 ti_msg_payload = proto_tree_add_item(tree, hf_cmp_msg_payload, tvb, offset, asam_cmp_ctrl_msg_payload_length, ENC_BIG_ENDIAN);
1590 asam_cmp_ctrl_msg_payload_tree = proto_item_add_subtree(ti_msg_payload, ett_asam_cmp_header);
1591 proto_item_append_text(ti_msg_payload, " %s", "- Control Message");
1593 switch (asam_cmp_ctrl_msg_payload_type) {
1594 case CMP_CTRL_MSG_INVALID:
1595 col_append_str(pinfo->cinfo, COL_INFO, " (Invalid/Padding)");
1596 proto_item_append_text(ti_msg_payload, " %s", "(Invalid/Padding)");
1597 proto_item_set_end(ti_msg_payload, tvb, offset + asam_cmp_ctrl_msg_payload_length);
1599 return tvb_reported_length_remaining(tvb, offset_orig);
1601 case CMP_CTRL_MSG_DSR_CTRL_MSG:
1602 col_append_str(pinfo->cinfo, COL_INFO, " (Data Sink Ready)");
1603 proto_item_append_text(ti_msg_payload, " %s", "(Data Sink Ready)");
1605 proto_tree_add_item(asam_cmp_ctrl_msg_payload_tree, hf_cmp_ctrl_msg_device_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1606 offset += 2;
1608 break;
1610 case CMP_CTRL_MSG_USER_EVENT_CTRL_MSG:
1611 col_append_str(pinfo->cinfo, COL_INFO, " (User Event)");
1612 proto_item_append_text(ti_msg_payload, " %s", "(User Event)");
1614 proto_tree_add_item(asam_cmp_ctrl_msg_payload_tree, hf_cmp_ctrl_msg_event_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1615 offset += 4;
1617 break;
1619 case CMP_CTRL_MSG_VENDOR:
1620 col_append_str(pinfo->cinfo, COL_INFO, " (Vendor specific)");
1621 proto_item_append_text(ti_msg_payload, " %s", "(Vendor specific)");
1623 proto_tree_add_item(asam_cmp_ctrl_msg_payload_tree, hf_cmp_ctrl_msg_vendor_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1624 offset += 2;
1625 asam_cmp_ctrl_msg_payload_length -= 2;
1627 proto_tree_add_item(asam_cmp_ctrl_msg_payload_tree, hf_cmp_ctrl_msg_vendor_payload_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1628 offset += 2;
1629 asam_cmp_ctrl_msg_payload_length -= 2;
1631 if ((asam_cmp_ctrl_msg_payload_length) > 0) {
1632 tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, asam_cmp_ctrl_msg_payload_length);
1633 call_data_dissector(sub_tvb, pinfo, tree);
1634 offset += (int)asam_cmp_ctrl_msg_payload_length;
1637 /* we changed the payload length, so lets skip the length check by leaving */
1638 return (offset + asam_cmp_ctrl_msg_payload_length) - offset_orig;
1640 default:
1641 if (asam_cmp_ctrl_msg_payload_length > 0) {
1642 offset += (int)asam_cmp_ctrl_msg_payload_length;
1645 proto_item_set_end(ti_msg_payload, tvb, offset);
1646 break;
1649 if ((CMP_MSG_HEADER_LEN + asam_cmp_ctrl_msg_payload_length) < (offset - offset_orig)) {
1650 proto_tree_add_expert(tree, pinfo, &ei_asam_cmp_length_mismatch, tvb, offset_orig + CMP_MSG_HEADER_LEN, asam_cmp_ctrl_msg_payload_length);
1651 proto_item_set_end(ti_msg_payload, tvb, offset);
1654 return CMP_MSG_HEADER_LEN + asam_cmp_ctrl_msg_payload_length;
1657 static int
1658 dissect_asam_cmp_status_interface_support_mask(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset_orig, uint8_t interface_type) {
1659 unsigned offset = offset_orig;
1660 uint64_t temp = 0;
1662 static int *const can_feature_support[] = {
1663 &hf_cmp_iface_feat_can_srr_dom,
1664 &hf_cmp_iface_feat_can_r0,
1665 &hf_cmp_iface_feat_can_eof_err,
1666 &hf_cmp_iface_feat_can_crc_del_err,
1667 &hf_cmp_iface_feat_can_ack_del_err,
1668 &hf_cmp_iface_feat_can_act_ack,
1669 &hf_cmp_iface_feat_can_pas_ack,
1670 NULL
1673 static int *const canfd_feature_support[] = {
1674 &hf_cmp_iface_feat_canfd_esi_dom,
1675 &hf_cmp_iface_feat_canfd_brs_dom,
1676 &hf_cmp_iface_feat_canfd_srr_dom,
1677 &hf_cmp_iface_feat_canfd_rsvd,
1678 &hf_cmp_iface_feat_canfd_eof_err,
1679 &hf_cmp_iface_feat_canfd_crc_del_err,
1680 &hf_cmp_iface_feat_canfd_ack_del_err,
1681 &hf_cmp_iface_feat_canfd_act_ack,
1682 &hf_cmp_iface_feat_canfd_pas_ack,
1683 NULL
1686 static int *const lin_feature_support[] = {
1687 &hf_cmp_iface_feat_lin_wup,
1688 &hf_cmp_iface_feat_lin_long_dom_err,
1689 &hf_cmp_iface_feat_lin_short_dom_err,
1690 &hf_cmp_iface_feat_lin_framing_err,
1691 &hf_cmp_iface_feat_lin_sync_err,
1692 NULL
1695 static int *const eth_feature_support[] = {
1696 &hf_cmp_iface_feat_eth_trunc,
1697 &hf_cmp_iface_feat_eth_phy_err,
1698 &hf_cmp_iface_feat_eth_too_long,
1699 NULL
1702 switch (interface_type) {
1703 case CMP_DATA_MSG_CAN:
1704 proto_tree_add_bitmask_ret_uint64(tree, tvb, offset, hf_cmp_iface_feat, ett_asam_cmp_status_feature_support, can_feature_support, ENC_BIG_ENDIAN, &temp);
1705 break;
1707 case CMP_DATA_MSG_CANFD:
1708 proto_tree_add_bitmask_ret_uint64(tree, tvb, offset, hf_cmp_iface_feat, ett_asam_cmp_status_feature_support, canfd_feature_support, ENC_BIG_ENDIAN, &temp);
1709 break;
1711 case CMP_DATA_MSG_LIN:
1712 proto_tree_add_bitmask_ret_uint64(tree, tvb, offset, hf_cmp_iface_feat, ett_asam_cmp_status_feature_support, lin_feature_support, ENC_BIG_ENDIAN, &temp);
1713 break;
1715 case CMP_DATA_MSG_ETHERNET:
1716 proto_tree_add_bitmask_ret_uint64(tree, tvb, offset, hf_cmp_iface_feat, ett_asam_cmp_status_feature_support, eth_feature_support, ENC_BIG_ENDIAN, &temp);
1717 break;
1719 default:
1720 proto_tree_add_item(tree, hf_cmp_iface_feat, tvb, offset, 4, ENC_BIG_ENDIAN);
1723 offset += 4;
1725 return offset - offset_orig;
1728 static int
1729 dissect_asam_cmp_status_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree _U_, proto_tree *tree, unsigned offset_orig) {
1730 proto_item *ti = NULL;
1731 proto_item *ti_msg_header = NULL;
1732 proto_item *ti_msg_payload = NULL;
1733 proto_item *ti_interface = NULL;
1734 proto_item *ti_stream_ids = NULL;
1735 proto_tree *asam_cmp_status_msg_header_tree = NULL;
1736 proto_tree *asam_cmp_status_msg_payload_tree = NULL;
1737 proto_tree *subtree = NULL;
1738 proto_tree *stream_ids_subtree = NULL;
1739 unsigned offset = offset_orig;
1741 unsigned asam_cmp_status_msg_payload_type = 0;
1742 unsigned asam_cmp_status_msg_payload_length = 0;
1743 unsigned asam_cmp_status_msg_cm_dev_desc_length = 0;
1744 unsigned asam_cmp_status_msg_cm_sn_length = 0;
1745 unsigned asam_cmp_status_msg_cm_hw_ver_length = 0;
1746 unsigned asam_cmp_status_msg_cm_sw_ver_length = 0;
1747 unsigned asam_cmp_status_msg_vendor_data_length = 0;
1748 unsigned asam_cmp_status_msg_iface_stream_id_count = 0;
1749 uint64_t uptime = 0;
1750 const char *descr = NULL;
1752 static int * const asam_cmp_common_flags[] = {
1753 &hf_cmp_common_flag_reserved_ctrl,
1754 &hf_cmp_common_flag_seg,
1755 &hf_cmp_common_flag_insync,
1756 &hf_cmp_common_flag_recal,
1757 NULL
1760 static int * const asam_cmp_status_cm_flags[] = {
1761 &hf_cmp_gptp_flags_reserved,
1762 &hf_cmp_gptp_flags_freq_traceable,
1763 &hf_cmp_gptp_flags_time_traceable,
1764 &hf_cmp_gptp_flags_ptp_timescale,
1765 &hf_cmp_gptp_flags_cur_utco_valid,
1766 &hf_cmp_gptp_flags_leap59,
1767 &hf_cmp_gptp_flags_leap61,
1768 NULL
1771 static int * const asam_cmp_status_timeloss_error_flags[] = {
1772 &hf_cmp_timeloss_error_flags_reserved,
1773 &hf_cmp_timeloss_error_flags_delta,
1774 &hf_cmp_timeloss_error_flags_insync,
1775 &hf_cmp_timeloss_error_flags_ts,
1776 NULL
1779 ti_msg_header = proto_tree_add_item(tree, hf_cmp_msg_header, tvb, offset, 16, ENC_BIG_ENDIAN);
1780 asam_cmp_status_msg_header_tree = proto_item_add_subtree(ti_msg_header, ett_asam_cmp_header);
1781 proto_item_append_text(ti_msg_header, " %s", "- Status Message");
1783 uint64_t ns = tvb_get_uint64(tvb, offset, ENC_BIG_ENDIAN);
1784 nstime_t timestamp = { .secs = (time_t)(ns / 1000000000), .nsecs = (int)(ns % 1000000000) };
1786 ti = proto_tree_add_time(asam_cmp_status_msg_header_tree, hf_cmp_msg_timestamp, tvb, offset, 8, &timestamp);
1787 subtree = proto_item_add_subtree(ti, ett_asam_cmp_timestamp);
1788 proto_tree_add_item(subtree, hf_cmp_msg_timestamp_ns, tvb, offset, 8, ENC_BIG_ENDIAN);
1789 offset += 8;
1791 proto_tree_add_item(asam_cmp_status_msg_header_tree, hf_cmp_msg_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1792 offset += 2;
1794 proto_tree_add_item(asam_cmp_status_msg_header_tree, hf_cmp_msg_vendor_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1795 offset += 2;
1797 proto_tree_add_bitmask(asam_cmp_status_msg_header_tree, tvb, offset, hf_cmp_msg_common_flags, ett_asam_cmp_common_flags, asam_cmp_common_flags, ENC_BIG_ENDIAN);
1798 offset += 1;
1800 proto_tree_add_item_ret_uint(asam_cmp_status_msg_header_tree, hf_cmp_status_msg_payload_type, tvb, offset, 1, ENC_NA, &asam_cmp_status_msg_payload_type);
1801 offset += 1;
1803 proto_tree_add_item_ret_uint(asam_cmp_status_msg_header_tree, hf_cmp_msg_payload_length, tvb, offset, 2, ENC_BIG_ENDIAN, &asam_cmp_status_msg_payload_length);
1804 offset += 2;
1806 proto_item_set_end(ti_msg_header, tvb, offset);
1808 ti_msg_payload = proto_tree_add_item(tree, hf_cmp_msg_payload, tvb, offset, asam_cmp_status_msg_payload_length, ENC_BIG_ENDIAN);
1809 asam_cmp_status_msg_payload_tree = proto_item_add_subtree(ti_msg_payload, ett_asam_cmp_header);
1810 proto_item_append_text(ti_msg_payload, " %s", "- Status Message");
1812 switch (asam_cmp_status_msg_payload_type) {
1813 case CMP_STATUS_MSG_INVALID:
1814 col_append_str(pinfo->cinfo, COL_INFO, " (Invalid/Padding)");
1815 proto_item_append_text(ti_msg_payload, " %s", "(Invalid/Padding)");
1816 proto_item_set_end(ti_msg_payload, tvb, offset + asam_cmp_status_msg_payload_length);
1818 return tvb_reported_length_remaining(tvb, offset_orig);
1820 case CMP_STATUS_MSG_CM_STAT_MSG:
1821 col_append_str(pinfo->cinfo, COL_INFO, " (CM)");
1822 proto_item_append_text(ti_msg_payload, " %s", "(CM)");
1824 ti = proto_tree_add_item_ret_uint64(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_cm_uptime_ns, tvb, offset, 8, ENC_BIG_ENDIAN, &uptime);
1826 subtree = proto_item_add_subtree(ti, ett_asam_cmp_status_cm_uptime);
1827 proto_tree_add_uint64(subtree, hf_cmp_status_msg_cm_uptime_s, tvb, offset, 8, uptime / 1000000000);
1828 offset += 8;
1830 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_gm_identity, tvb, offset, 8, ENC_BIG_ENDIAN);
1831 offset += 8;
1833 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_gm_clock_quality, tvb, offset, 4, ENC_BIG_ENDIAN);
1834 offset += 4;
1836 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_current_utc_offset, tvb, offset, 2, ENC_BIG_ENDIAN);
1837 offset += 2;
1839 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_time_source, tvb, offset, 1, ENC_NA);
1840 offset += 1;
1842 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_domain_num, tvb, offset, 1, ENC_NA);
1843 offset += 1;
1845 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_res, tvb, offset, 1, ENC_NA);
1846 offset += 1;
1848 proto_tree_add_bitmask(asam_cmp_status_msg_payload_tree, tvb, offset, hf_cmp_gptp_flags, ett_asam_cmp_status_cm_flags, asam_cmp_status_cm_flags, ENC_BIG_ENDIAN);
1849 offset += 1;
1851 proto_tree_add_item_ret_uint(asam_cmp_status_msg_payload_tree, hf_cmp_status_dev_desc_length, tvb, offset, 2, ENC_BIG_ENDIAN, &asam_cmp_status_msg_cm_dev_desc_length);
1852 offset += 2;
1854 if ((asam_cmp_status_msg_cm_dev_desc_length) > 0) {
1855 asam_cmp_status_msg_cm_dev_desc_length += (asam_cmp_status_msg_cm_dev_desc_length % 2); /* padding to 16bit */
1856 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_dev_desc, tvb, offset, asam_cmp_status_msg_cm_dev_desc_length, ENC_UTF_8 | ENC_NA);
1857 offset += (int)asam_cmp_status_msg_cm_dev_desc_length;
1860 proto_tree_add_item_ret_uint(asam_cmp_status_msg_payload_tree, hf_cmp_status_sn_length, tvb, offset, 2, ENC_BIG_ENDIAN, &asam_cmp_status_msg_cm_sn_length);
1861 offset += 2;
1863 if ((asam_cmp_status_msg_cm_sn_length) > 0) {
1864 asam_cmp_status_msg_cm_sn_length += (asam_cmp_status_msg_cm_sn_length % 2); /* padding to 16bit */
1865 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_sn, tvb, offset, asam_cmp_status_msg_cm_sn_length, ENC_UTF_8 | ENC_NA);
1866 offset += (int)asam_cmp_status_msg_cm_sn_length;
1869 proto_tree_add_item_ret_uint(asam_cmp_status_msg_payload_tree, hf_cmp_status_hw_ver_length, tvb, offset, 2, ENC_BIG_ENDIAN, &asam_cmp_status_msg_cm_hw_ver_length);
1870 offset += 2;
1872 if ((asam_cmp_status_msg_cm_hw_ver_length) > 0) {
1873 asam_cmp_status_msg_cm_hw_ver_length += (asam_cmp_status_msg_cm_hw_ver_length % 2); /* padding to 16bit */
1874 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_hw_ver, tvb, offset, asam_cmp_status_msg_cm_hw_ver_length, ENC_UTF_8 | ENC_NA);
1875 offset += (int)asam_cmp_status_msg_cm_hw_ver_length;
1878 proto_tree_add_item_ret_uint(asam_cmp_status_msg_payload_tree, hf_cmp_status_sw_ver_length, tvb, offset, 2, ENC_BIG_ENDIAN, &asam_cmp_status_msg_cm_sw_ver_length);
1879 offset += 2;
1881 if ((asam_cmp_status_msg_cm_sw_ver_length) > 0) {
1882 asam_cmp_status_msg_cm_sw_ver_length += (asam_cmp_status_msg_cm_sw_ver_length % 2); /* padding to 16bit */
1883 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_sw_ver, tvb, offset, asam_cmp_status_msg_cm_sw_ver_length, ENC_UTF_8 | ENC_NA);
1884 offset += (int)asam_cmp_status_msg_cm_sw_ver_length;
1887 proto_tree_add_item_ret_uint(asam_cmp_status_msg_payload_tree, hf_cmp_status_vendor_data_length, tvb, offset, 2, ENC_BIG_ENDIAN, &asam_cmp_status_msg_vendor_data_length);
1888 offset += 2;
1890 if ((asam_cmp_status_msg_vendor_data_length) > 0) {
1891 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_vendor_data, tvb, offset, asam_cmp_status_msg_vendor_data_length, ENC_NA);
1892 offset += (int)asam_cmp_status_msg_vendor_data_length;
1894 break;
1896 case CMP_STATUS_MSG_IF_STAT_MSG:
1897 col_append_str(pinfo->cinfo, COL_INFO, " (Interface)");
1898 proto_item_append_text(ti_msg_payload, " %s", "(Interface)");
1900 /* each entry is 40 bytes, header is 16 bytes */
1901 while (tvb_reported_length_remaining(tvb, offset) >= 40 && offset - offset_orig + 40 <= 16 + asam_cmp_status_msg_payload_length) {
1902 uint32_t ifaceid;
1903 uint32_t ifacetype;
1905 ti_interface = proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_iface_interface, tvb, offset, 34, ENC_NA);
1906 subtree = proto_item_add_subtree(ti_interface, ett_asam_cmp_status_interface);
1908 ti = proto_tree_add_item_ret_uint(subtree, hf_cmp_iface_iface_id, tvb, offset, 4, ENC_BIG_ENDIAN, &ifaceid);
1909 descr = ht_interface_config_to_string(ifaceid);
1910 if (descr != NULL) {
1911 proto_item_append_text(ti, " (%s)", descr);
1913 offset += 4;
1915 proto_tree_add_item(subtree, hf_cmp_iface_msg_total_rx, tvb, offset, 4, ENC_BIG_ENDIAN);
1916 offset += 4;
1918 proto_tree_add_item(subtree, hf_cmp_iface_msg_total_tx, tvb, offset, 4, ENC_BIG_ENDIAN);
1919 offset += 4;
1921 proto_tree_add_item(subtree, hf_cmp_iface_msg_dropped_rx, tvb, offset, 4, ENC_BIG_ENDIAN);
1922 offset += 4;
1924 proto_tree_add_item(subtree, hf_cmp_iface_msg_dropped_tx, tvb, offset, 4, ENC_BIG_ENDIAN);
1925 offset += 4;
1927 proto_tree_add_item(subtree, hf_cmp_iface_errs_total_rx, tvb, offset, 4, ENC_BIG_ENDIAN);
1928 offset += 4;
1930 proto_tree_add_item(subtree, hf_cmp_iface_errs_total_tx, tvb, offset, 4, ENC_BIG_ENDIAN);
1931 offset += 4;
1933 proto_tree_add_item_ret_uint(subtree, hf_cmp_iface_iface_type, tvb, offset, 1, ENC_NA, &ifacetype);
1934 offset += 1;
1936 if (descr != NULL) {
1937 proto_item_append_text(ti_interface, " %s, Type: %s", descr, val_to_str(ifacetype, data_msg_type_names, "Unknown (0x%x)"));
1938 } else {
1939 proto_item_append_text(ti_interface, " 0x%x, Type: %s", ifaceid, val_to_str(ifacetype, data_msg_type_names, "Unknown (0x%x)"));
1942 proto_tree_add_item(subtree, hf_cmp_iface_iface_status, tvb, offset, 1, ENC_NA);
1943 offset += 1;
1945 proto_tree_add_item(subtree, hf_cmp_iface_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1946 offset += 2;
1948 offset += dissect_asam_cmp_status_interface_support_mask(tvb, pinfo, subtree, offset, (uint8_t)ifacetype);
1950 proto_tree_add_item_ret_uint(subtree, hf_cmp_iface_stream_id_cnt, tvb, offset, 2, ENC_BIG_ENDIAN, &asam_cmp_status_msg_iface_stream_id_count);
1951 offset += 2;
1953 if ((asam_cmp_status_msg_iface_stream_id_count) > 0) {
1954 ti_stream_ids = proto_tree_add_item(subtree, hf_cmp_iface_stream_ids, tvb, offset, asam_cmp_status_msg_iface_stream_id_count, ENC_NA);
1955 stream_ids_subtree = proto_item_add_subtree(ti_stream_ids, ett_asam_cmp_status_stream_ids);
1957 for (unsigned i = 0; i < asam_cmp_status_msg_iface_stream_id_count; i++) {
1958 proto_tree_add_item(stream_ids_subtree, hf_cmp_iface_stream_id, tvb, offset, 1, ENC_NA);
1959 offset += 1;
1961 offset += (asam_cmp_status_msg_iface_stream_id_count % 2); /* padding to 16bit */
1964 proto_tree_add_item_ret_uint(subtree, hf_cmp_iface_vendor_data_len, tvb, offset, 2, ENC_BIG_ENDIAN, &asam_cmp_status_msg_vendor_data_length);
1965 offset += 2;
1967 if ((asam_cmp_status_msg_vendor_data_length) > 0) {
1968 proto_tree_add_item(subtree, hf_cmp_iface_vendor_data, tvb, offset, asam_cmp_status_msg_vendor_data_length, ENC_NA);
1969 offset += (int)asam_cmp_status_msg_vendor_data_length;
1972 proto_item_set_end(ti_interface, tvb, offset);
1974 break;
1976 case CMP_STATUS_MSG_CONF_STAT_MSG:
1977 col_append_str(pinfo->cinfo, COL_INFO, " (Configuration)");
1978 proto_item_append_text(ti_msg_payload, " %s", "(Configuration)");
1980 if ((asam_cmp_status_msg_payload_length) > 0) {
1981 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_config, tvb, offset, asam_cmp_status_msg_payload_length, ENC_NA);
1982 offset += (int)asam_cmp_status_msg_payload_length;
1984 break;
1986 case CMP_STATUS_MSG_DLE_STAT_MSG:
1987 col_append_str(pinfo->cinfo, COL_INFO, " (Data Lost Event)");
1988 proto_item_append_text(ti_msg_payload, " %s", "(Data Lost Event)");
1990 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_dataloss_data_sink_port, tvb, offset, 2, ENC_BIG_ENDIAN);
1991 offset += 2;
1993 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_dataloss_device_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1994 offset += 2;
1996 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_dataloss_reserved, tvb, offset, 1, ENC_NA);
1997 offset += 1;
1999 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_dataloss_stream_id, tvb, offset, 1, ENC_NA);
2000 offset += 1;
2002 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_dataloss_last_ssq_value, tvb, offset, 2, ENC_BIG_ENDIAN);
2003 offset += 2;
2005 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_dataloss_current_ssq_value, tvb, offset, 2, ENC_BIG_ENDIAN);
2006 offset += 2;
2007 break;
2009 case CMP_STATUS_MSG_TSLE_STAT_MSG:
2010 col_append_str(pinfo->cinfo, COL_INFO, " (Time Sync Lost Event)");
2011 proto_item_append_text(ti_msg_payload, " %s", "(Time Sync Lost Event)");
2013 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_timeloss_port_nr, tvb, offset, 2, ENC_BIG_ENDIAN);
2014 offset += 2;
2016 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_timeloss_device_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2017 offset += 2;
2019 proto_tree_add_bitmask(asam_cmp_status_msg_payload_tree, tvb, offset, hf_cmp_timeloss_error_flags, ett_asam_cmp_status_timeloss_flags, asam_cmp_status_timeloss_error_flags, ENC_BIG_ENDIAN);
2020 offset += 1;
2021 break;
2023 case CMP_STATUS_MSG_VENDOR_STAT_MSG:
2024 col_append_str(pinfo->cinfo, COL_INFO, " (Vendor specific)");
2025 proto_item_append_text(ti_msg_payload, " %s", "(Vendor specific)");
2027 if ((asam_cmp_status_msg_payload_length) > 0) {
2028 proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_vendor_specific, tvb, offset, asam_cmp_status_msg_payload_length, ENC_NA);
2029 offset += (int)asam_cmp_status_msg_payload_length;
2031 break;
2033 default:
2034 if (asam_cmp_status_msg_payload_length > 0) {
2035 offset += (int)asam_cmp_status_msg_payload_length;
2038 proto_item_set_end(ti_msg_payload, tvb, offset);
2039 break;
2042 if ((CMP_MSG_HEADER_LEN + asam_cmp_status_msg_payload_length) < (offset - offset_orig)) {
2043 proto_tree_add_expert(tree, pinfo, &ei_asam_cmp_length_mismatch, tvb, offset_orig + CMP_MSG_HEADER_LEN, asam_cmp_status_msg_payload_length);
2044 proto_item_set_end(ti_msg_payload, tvb, offset);
2047 return CMP_MSG_HEADER_LEN + asam_cmp_status_msg_payload_length;
2050 static int
2051 dissect_asam_cmp_vendor_msg(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *root_tree _U_, proto_tree *tree, unsigned offset_orig) {
2052 proto_item *ti = NULL;
2053 proto_item *ti_msg_header = NULL;
2054 proto_item *ti_msg_payload = NULL;
2055 proto_tree *asam_cmp_vendor_msg_header_tree = NULL;
2056 proto_tree *subtree = NULL;
2057 unsigned asam_cmp_vendor_msg_payload_type = 0;
2058 unsigned asam_cmp_vendor_msg_payload_length = 0;
2059 unsigned offset = offset_orig;
2061 static int * const asam_cmp_common_flags[] = {
2062 &hf_cmp_common_flag_recal,
2063 &hf_cmp_common_flag_insync,
2064 &hf_cmp_common_flag_seg,
2065 &hf_cmp_common_flag_reserved_ctrl,
2066 NULL
2069 ti_msg_header = proto_tree_add_item(tree, hf_cmp_msg_header, tvb, offset, 8, ENC_BIG_ENDIAN);
2070 asam_cmp_vendor_msg_header_tree = proto_item_add_subtree(ti_msg_header, ett_asam_cmp_header);
2071 proto_item_append_text(ti_msg_header, " %s", "- Vendor-Defined Message");
2073 uint64_t ns = tvb_get_uint64(tvb, offset, ENC_BIG_ENDIAN);
2074 nstime_t timestamp = { .secs = (time_t)(ns / 1000000000), .nsecs = (int)(ns % 1000000000) };
2076 ti = proto_tree_add_time(asam_cmp_vendor_msg_header_tree, hf_cmp_msg_timestamp, tvb, offset, 8, &timestamp);
2078 subtree = proto_item_add_subtree(ti, ett_asam_cmp_timestamp);
2079 proto_tree_add_item(subtree, hf_cmp_msg_timestamp_ns, tvb, offset, 8, ENC_BIG_ENDIAN);
2080 offset += 8;
2082 proto_tree_add_item(asam_cmp_vendor_msg_header_tree, hf_cmp_msg_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2083 offset += 2;
2085 proto_tree_add_item(asam_cmp_vendor_msg_header_tree, hf_cmp_msg_vendor_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2086 offset += 2;
2088 proto_tree_add_bitmask(asam_cmp_vendor_msg_header_tree, tvb, offset, hf_cmp_msg_common_flags, ett_asam_cmp_common_flags, asam_cmp_common_flags, ENC_BIG_ENDIAN);
2089 offset += 1;
2091 proto_tree_add_item_ret_uint(asam_cmp_vendor_msg_header_tree, hf_cmp_vendor_msg_payload_type, tvb, offset, 1, ENC_NA, &asam_cmp_vendor_msg_payload_type);
2092 offset += 1;
2094 proto_tree_add_item_ret_uint(asam_cmp_vendor_msg_header_tree, hf_cmp_msg_payload_length, tvb, offset, 2, ENC_BIG_ENDIAN, &asam_cmp_vendor_msg_payload_length);
2095 offset += 2;
2097 proto_item_set_end(ti_msg_header, tvb, offset);
2099 ti_msg_payload = proto_tree_add_item(tree, hf_cmp_msg_payload, tvb, offset, asam_cmp_vendor_msg_payload_length, ENC_BIG_ENDIAN);
2100 proto_item_append_text(ti_msg_payload, " %s", "- Vendor-Defined Message");
2102 if ((asam_cmp_vendor_msg_payload_length) > 0) {
2103 offset += (int)asam_cmp_vendor_msg_payload_length;
2104 proto_item_set_end(ti_msg_payload, tvb, offset);
2107 return CMP_MSG_HEADER_LEN + asam_cmp_vendor_msg_payload_length;
2110 static int
2111 dissect_asam_cmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
2112 proto_item *ti_root = NULL;
2113 proto_item *ti_header = NULL;
2114 proto_item *ti = NULL;
2115 proto_tree *asam_cmp_tree = NULL;
2116 proto_tree *asam_cmp_header_tree = NULL;
2117 unsigned msg_type = 0;
2118 unsigned device_id = 0;
2119 unsigned offset = 0;
2121 col_clear(pinfo->cinfo, COL_INFO);
2122 col_set_str(pinfo->cinfo, COL_INFO, "ASAM-CMP");
2123 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ASAM-CMP");
2125 ti_root = proto_tree_add_item(tree, proto_asam_cmp, tvb, 0, -1, ENC_NA);
2126 asam_cmp_tree = proto_item_add_subtree(ti_root, ett_asam_cmp);
2128 ti_header = proto_tree_add_item(asam_cmp_tree, hf_cmp_header, tvb, offset, CMP_HEADER_LEN, ENC_BIG_ENDIAN);
2129 asam_cmp_header_tree = proto_item_add_subtree(ti_header, ett_asam_cmp_header);
2131 proto_tree_add_item(asam_cmp_header_tree, hf_cmp_version, tvb, offset, 1, ENC_NA);
2132 offset += 1;
2134 proto_tree_add_item(asam_cmp_header_tree, hf_cmp_header_res, tvb, offset, 1, ENC_NA);
2135 offset += 1;
2137 ti = proto_tree_add_item_ret_uint(asam_cmp_header_tree, hf_cmp_device_id, tvb, offset, 2, ENC_BIG_ENDIAN, &device_id);
2138 add_device_id_text(ti, device_id);
2139 offset += 2;
2141 proto_tree_add_item_ret_uint(asam_cmp_header_tree, hf_cmp_msg_type, tvb, offset, 1, ENC_NA, &msg_type);
2142 offset += 1;
2144 proto_tree_add_item(asam_cmp_header_tree, hf_cmp_stream_id, tvb, offset, 1, ENC_NA);
2145 offset += 1;
2147 proto_tree_add_item(asam_cmp_header_tree, hf_cmp_stream_seq_ctr, tvb, offset, 2, ENC_BIG_ENDIAN);
2148 offset += 2;
2150 proto_item_append_text(ti_root, ", Device: 0x%04x, Type: %s", device_id, val_to_str(msg_type, msg_type_names, "Unknown (0x%x)"));
2152 while (tvb_reported_length_remaining(tvb, offset) >= 16) {
2153 switch (msg_type) {
2154 case CMP_MSG_TYPE_CTRL_MSG:
2155 col_append_str(pinfo->cinfo, COL_INFO, ", Control Msg");
2156 offset += dissect_asam_cmp_ctrl_msg(tvb, pinfo, tree, asam_cmp_tree, offset);
2157 break;
2158 case CMP_MSG_TYPE_STATUS_MSG:
2159 col_append_str(pinfo->cinfo, COL_INFO, ", Status Msg");
2160 offset += dissect_asam_cmp_status_msg(tvb, pinfo, tree, asam_cmp_tree, offset);
2161 break;
2162 case CMP_MSG_TYPE_VENDOR:
2163 col_append_str(pinfo->cinfo, COL_INFO, ", Vendor Msg");
2164 offset += dissect_asam_cmp_vendor_msg(tvb, pinfo, tree, asam_cmp_tree, offset);
2165 break;
2166 case CMP_MSG_TYPE_DATA_MSG:
2167 col_append_str(pinfo->cinfo, COL_INFO, ", Data Msg");
2168 offset += dissect_asam_cmp_data_msg(tvb, pinfo, tree, asam_cmp_tree, offset);
2169 break;
2170 default:
2171 proto_item_set_end(ti_root, tvb, offset);
2172 proto_item_set_end(ti_header, tvb, offset);
2173 return offset;
2177 proto_item_set_end(ti_root, tvb, offset);
2178 proto_item_set_end(ti_header, tvb, offset);
2179 return offset;
2182 void
2183 proto_register_asam_cmp(void) {
2184 module_t *asam_cmp_module = NULL;
2185 expert_module_t *expert_module_asam_cmp;
2186 uat_t *asam_cmp_deviceid_uat = NULL;
2187 uat_t *asam_cmp_interfaceid_uat = NULL;
2189 static hf_register_info hf[] = {
2190 /* Header */
2191 { &hf_cmp_header, { "ASAM CMP Header", "asam-cmp.hdr", FT_PROTOCOL, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2193 { &hf_cmp_version, { "Version", "asam-cmp.hdr.version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2194 { &hf_cmp_header_res, { "Reserved", "asam-cmp.hdr.res", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2195 { &hf_cmp_device_id, { "Device ID", "asam-cmp.hdr.device_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2196 { &hf_cmp_msg_type, { "Message Type", "asam-cmp.hdr.msg_type", FT_UINT8, BASE_HEX, VALS(msg_type_names), 0x0, NULL, HFILL }},
2197 { &hf_cmp_stream_id, { "Stream ID", "asam-cmp.hdr.stream_id", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2198 { &hf_cmp_stream_seq_ctr, { "Stream Sequence Counter", "asam-cmp.hdr.stream_seq_cnt", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2200 /* Message Header*/
2201 { &hf_cmp_msg_header, { "ASAM CMP Msg Header", "asam-cmp.msg_hdr", FT_PROTOCOL, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2203 { &hf_cmp_common_flag_recal, { "Timestamp recalculated", "asam-cmp.msg_hdr.recalculated", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
2204 { &hf_cmp_common_flag_insync, { "Synchronized", "asam-cmp.msg_hdr.sync", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL } },
2205 { &hf_cmp_common_flag_seg, { "Segmentation", "asam-cmp.msg_hdr.seg", FT_UINT8, BASE_HEX, VALS(seg_flag_names), 0x0C, NULL, HFILL } },
2206 { &hf_cmp_common_flag_dir_on_if, { "Direction", "asam-cmp.msg_hdr.dir_on_if", FT_BOOLEAN, 8, TFS(&interface_direction), 0x10, NULL, HFILL } },
2207 { &hf_cmp_common_flag_overflow, { "Overflow", "asam-cmp.msg_hdr.overflow", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL } },
2208 { &hf_cmp_common_flag_err_in_payload, { "Error in payload", "asam-cmp.msg_hdr.error_in_payload", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL } },
2209 { &hf_cmp_common_flag_reserved, { "Reserved", "asam-cmp.msg_hdr.res", FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL } },
2210 { &hf_cmp_common_flag_reserved_ctrl, { "Reserved", "asam-cmp.msg_hdr.res2", FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL } },
2212 { &hf_cmp_msg_timestamp, { "Timestamp", "asam-cmp.msg_hdr.timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }},
2213 { &hf_cmp_msg_timestamp_ns, { "Timestamp (ns)", "asam-cmp.msg_hdr.timestamp_ns", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2214 { &hf_cmp_msg_reserved, { "Reserved", "asam-cmp.msg_hdr.reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2215 { &hf_cmp_msg_common_flags, { "Common Flags", "asam-cmp.msg_hdr.common_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2216 { &hf_cmp_msg_vendor_id, { "Vendor ID", "asam-cmp.msg_hdr.vendor_id", FT_UINT16, BASE_HEX, VALS(vendor_ids), 0x0, NULL, HFILL }},
2217 { &hf_cmp_msg_payload_length, { "Payload Length", "asam-cmp.msg_hdr.payload_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2218 { &hf_cmp_msg_payload, { "Payload", "asam-cmp.msg_payload", FT_PROTOCOL, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2220 /* Data Message Header */
2221 { &hf_cmp_interface_id, { "Interface ID", "asam-cmp.msg_hdr.interface_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2222 { &hf_cmp_payload_type, { "Payload Type", "asam-cmp.msg_hdr.payload_type", FT_UINT8, BASE_HEX, VALS(data_msg_type_names), 0x0, NULL, HFILL }},
2224 /* Additional Control Message Header */
2225 { &hf_cmp_ctrl_msg_reserved, { "Reserved", "asam-cmp.msg_hdr.reserved", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2226 { &hf_cmp_ctrl_msg_payload_type, { "Payload Type", "asam-cmp.msg_hdr.payload_type", FT_UINT8, BASE_HEX, VALS(ctrl_msg_type_names), 0x0, NULL, HFILL }},
2228 /* Additional Status Message Header */
2229 { &hf_cmp_status_msg_payload_type, { "Payload Type", "asam-cmp.msg_hdr.payload_type", FT_UINT8, BASE_HEX, VALS(status_msg_type_names), 0x0, NULL, HFILL }},
2231 /* Additional Vendor Message Header */
2232 { &hf_cmp_vendor_msg_payload_type, { "Payload Type", "asam-cmp.msg_hdr.payload_type", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2234 /* Data Message Payloads */
2235 /* CAN Data */
2236 { &hf_cmp_can_flags, { "Flags", "asam-cmp.msg.can.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2237 { &hf_cmp_can_reserved, { "Reserved", "asam-cmp.msg.can.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2239 { &hf_cmp_can_id, { "ID", "asam-cmp.msg.can.id_field", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2240 { &hf_cmp_can_id_11bit, { "ID (11bit)", "asam-cmp.msg.can.id_11bit", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CAN_ID_11BIT_MASK, NULL, HFILL }},
2241 { &hf_cmp_can_id_11bit_old, { "ID (11bit)", "asam-cmp.msg.can.id_11bit", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CAN_ID_11BIT_MASK_OLD, NULL, HFILL }},
2242 { &hf_cmp_can_id_29bit, { "ID (29bit)", "asam-cmp.msg.can.id_29bit", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CAN_ID_29BIT_MASK, NULL, HFILL }},
2243 { &hf_cmp_can_id_res, { "Reserved", "asam-cmp.msg.can.id_res", FT_BOOLEAN, 32, NULL, CMP_CAN_ID_RES, NULL, HFILL }},
2244 { &hf_cmp_can_id_rtr, { "RTR", "asam-cmp.msg.can.rtr", FT_BOOLEAN, 32, TFS(&can_id_rtr), CMP_CAN_ID_RTR, NULL, HFILL }},
2245 { &hf_cmp_can_id_ide, { "IDE", "asam-cmp.msg.can.ide", FT_BOOLEAN, 32, TFS(&can_id_ide), CMP_CAN_ID_IDE, NULL, HFILL }},
2247 { &hf_cmp_can_crc, { "CRC", "asam-cmp.msg.can.crc_field", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2248 { &hf_cmp_can_crc_crc, { "CRC", "asam-cmp.msg.can.crc", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CAN_CRC_CRC, NULL, HFILL }},
2249 { &hf_cmp_can_crc_res, { "Reserved", "asam-cmp.msg.can.crc_res", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CAN_CRC_RES, NULL, HFILL }},
2250 { &hf_cmp_can_crc_crc_support, { "CRC Supported", "asam-cmp.msg.can.crc_support", FT_BOOLEAN, 32, NULL, CMP_CAN_CRC_CRC_SUPP, NULL, HFILL }},
2252 { &hf_cmp_can_err_pos, { "Error Position", "asam-cmp.msg.can.err_pos", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2253 { &hf_cmp_can_dlc, { "DLC", "asam-cmp.msg.can.dlc", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2254 { &hf_cmp_can_data_len, { "Data length", "asam-cmp.msg.can.data_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2256 { &hf_cmp_can_flag_crc_err, { "CRC Error", "asam-cmp.msg.can.flags.crc_err", FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL }},
2257 { &hf_cmp_can_flag_ack_err, { "ACK Error", "asam-cmp.msg.can.flags.ack_err", FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL } },
2258 { &hf_cmp_can_flag_passive_ack_err, { "Passive ACK Error", "asam-cmp.msg.can.flags.passive_ack_err", FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL } },
2259 { &hf_cmp_can_flag_active_ack_err, { "Active ACK Error", "asam-cmp.msg.can.flags.active_ack_err", FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL } },
2260 { &hf_cmp_can_flag_ack_del_err, { "ACK DEL Error", "asam-cmp.msg.can.flags.ack_del_err", FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL } },
2261 { &hf_cmp_can_flag_form_err, { "Form Error", "asam-cmp.msg.can.flags.form_err", FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL } },
2262 { &hf_cmp_can_flag_stuff_err, { "Stuff Error", "asam-cmp.msg.can.flags.stuff_err", FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL } },
2263 { &hf_cmp_can_flag_crc_del_err, { "CRC DEL Error", "asam-cmp.msg.can.flags.crc_del_err", FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL } },
2264 { &hf_cmp_can_flag_eof_err, { "EOF Error", "asam-cmp.msg.can.flags.eof_err", FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL } },
2265 { &hf_cmp_can_flag_bit_err, { "Bit Error", "asam-cmp.msg.can.flags.bit_err", FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL } },
2266 { &hf_cmp_can_flag_r0, { "R0", "asam-cmp.msg.can.flags.r0", FT_BOOLEAN, 16, TFS(&can_rec_dom), 0x0400, NULL, HFILL } },
2267 { &hf_cmp_can_flag_srr_dom, { "Substitute Remote Request (SRR)", "asam-cmp.msg.can.flags.srr", FT_BOOLEAN, 16, TFS(&can_dom_rec), 0x0800, NULL, HFILL } },
2268 { &hf_cmp_can_flag_reserved, { "Reserved", "asam-cmp.msg.can.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xF000, NULL, HFILL } },
2270 /* CAN-FD Data */
2271 { &hf_cmp_canfd_flags, { "Flags", "asam-cmp.msg.canfd.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2272 { &hf_cmp_canfd_reserved, { "Reserved", "asam-cmp.msg.canfd.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2274 { &hf_cmp_canfd_id, { "ID", "asam-cmp.msg.canfd.id_field", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2275 { &hf_cmp_canfd_id_11bit, { "ID (11bit)", "asam-cmp.msg.canfd.id_11bit", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CAN_ID_11BIT_MASK, NULL, HFILL }},
2276 { &hf_cmp_canfd_id_11bit_old, { "ID (11bit)", "asam-cmp.msg.canfd.id_11bit", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CAN_ID_11BIT_MASK_OLD, NULL, HFILL }},
2277 { &hf_cmp_canfd_id_29bit, { "ID (29bit)", "asam-cmp.msg.canfd.id_29bit", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CAN_ID_29BIT_MASK, NULL, HFILL }},
2278 { &hf_cmp_canfd_id_res, { "Reserved", "asam-cmp.msg.canfd.id_res", FT_BOOLEAN, 32, NULL, CMP_CANFD_ID_RES, NULL, HFILL }},
2279 { &hf_cmp_canfd_id_rrs, { "RRS", "asam-cmp.msg.canfd.rrs", FT_BOOLEAN, 32, NULL, CMP_CANFD_ID_RRS, NULL, HFILL }},
2280 { &hf_cmp_canfd_id_ide, { "IDE", "asam-cmp.msg.canfd.ide", FT_BOOLEAN, 32, NULL, CMP_CANFD_ID_IDE, NULL, HFILL }},
2282 { &hf_cmp_canfd_crc, { "CRC SBC", "asam-cmp.msg.canfd.crc_field", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2283 { &hf_cmp_canfd_crc_crc17, { "CRC (17bit)", "asam-cmp.msg.canfd.crc17", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CANFD_CRC_CRC17, NULL, HFILL }},
2284 { &hf_cmp_canfd_crc_crc21, { "CRC (21bit)", "asam-cmp.msg.canfd.crc21", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CANFD_CRC_CRC21, NULL, HFILL }},
2285 { &hf_cmp_canfd_crc_sbc, { "SBC", "asam-cmp.msg.canfd.sbc", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CANFD_CRC_SBC, NULL, HFILL }},
2286 { &hf_cmp_canfd_crc_sbc_parity, { "SBC Parity", "asam-cmp.msg.canfd.sbc_parity", FT_BOOLEAN, 32, NULL, CMP_CANFD_CRC_SBC_PARITY, NULL, HFILL }},
2287 { &hf_cmp_canfd_crc_res, { "Reserved", "asam-cmp.msg.canfd.crc_res", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CANFD_CRC_RES, NULL, HFILL }},
2288 { &hf_cmp_canfd_crc_sbc_support, { "SBC Supported", "asam-cmp.msg.canfd.sbc_support", FT_BOOLEAN, 32, NULL, CMP_CANFD_CRC_SBC_SUPP, NULL, HFILL }},
2289 { &hf_cmp_canfd_crc_crc_support, { "CRC Supported", "asam-cmp.msg.canfd.crc_support", FT_BOOLEAN, 32, NULL, CMP_CANFD_CRC_CRC_SUPP, NULL, HFILL }},
2291 { &hf_cmp_canfd_err_pos, { "Error Position", "asam-cmp.msg.canfd.err_pos", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2292 { &hf_cmp_canfd_dlc, { "DLC", "asam-cmp.msg.canfd.dlc", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2293 { &hf_cmp_canfd_data_len, { "Data length", "asam-cmp.msg.canfd.data_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2295 { &hf_cmp_canfd_flag_crc_err, { "CRC Error", "asam-cmp.msg.canfd.flags.crc_err", FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL }},
2296 { &hf_cmp_canfd_flag_ack_err, { "ACK Error", "asam-cmp.msg.canfd.flags.ack_err", FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL } },
2297 { &hf_cmp_canfd_flag_passive_ack_err, { "Passive ACK Error", "asam-cmp.msg.canfd.flags.passive_ack_err", FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL } },
2298 { &hf_cmp_canfd_flag_active_ack_err, { "Active ACK Error", "asam-cmp.msg.canfd.flags.active_ack_err", FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL } },
2299 { &hf_cmp_canfd_flag_ack_del_err, { "ACK DEL Error", "asam-cmp.msg.canfd.flags.ack_del_err", FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL } },
2300 { &hf_cmp_canfd_flag_form_err, { "Form Error", "asam-cmp.msg.canfd.flags.form_err", FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL } },
2301 { &hf_cmp_canfd_flag_stuff_err, { "Stuff Error", "asam-cmp.msg.canfd.flags.stuff_err", FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL } },
2302 { &hf_cmp_canfd_flag_crc_del_err, { "CRC DEL Error", "asam-cmp.msg.canfd.flags.crc_del_err", FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL } },
2303 { &hf_cmp_canfd_flag_eof_err, { "EOF Error", "asam-cmp.msg.canfd.flags.eof_err", FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL } },
2304 { &hf_cmp_canfd_flag_bit_err, { "Bit Error", "asam-cmp.msg.canfd.flags.bit_err", FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL } },
2305 { &hf_cmp_canfd_flag_res, { "Reserved Bit", "asam-cmp.msg.canfd.flags.res", FT_BOOLEAN, 16, TFS(&can_rec_dom), 0x0400, NULL, HFILL } },
2306 { &hf_cmp_canfd_flag_srr_dom, { "Substitute Remote Request (SRR)", "asam-cmp.msg.canfd.flags.srr", FT_BOOLEAN, 16, TFS(&can_dom_rec), 0x0800, NULL, HFILL } },
2307 { &hf_cmp_canfd_flag_brs, { "BRS", "asam-cmp.msg.canfd.flags.brs", FT_BOOLEAN, 16, NULL, 0x1000, NULL, HFILL } },
2308 { &hf_cmp_canfd_flag_esi, { "ESI", "asam-cmp.msg.canfd.flags.esi", FT_BOOLEAN, 16, TFS(&canfd_act_pas), 0x2000, NULL, HFILL } },
2309 { &hf_cmp_canfd_flag_reserved, { "Reserved", "asam-cmp.msg.canfd.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xC000, NULL, HFILL } },
2311 /* LIN */
2312 { &hf_cmp_lin_flags, { "Flags", "asam-cmp.msg.lin.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2313 { &hf_cmp_lin_reserved, { "Reserved", "asam-cmp.msg.lin.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2314 { &hf_cmp_lin_pid, { "PID", "asam-cmp.msg.lin.pid", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2315 { &hf_cmp_lin_pid_id, { "ID", "asam-cmp.msg.lin.pid.id", FT_UINT8, BASE_HEX, NULL, CMP_CANFD_PID_ID_MASK, NULL, HFILL } },
2316 { &hf_cmp_lin_pid_parity, { "Parity", "asam-cmp.msg.lin.pid.parity", FT_UINT8, BASE_HEX, NULL, CMP_CANFD_PID_PARITY_MASK, NULL, HFILL } },
2317 { &hf_cmp_lin_reserved_2, { "Reserved", "asam-cmp.msg.lin.res_2", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2318 { &hf_cmp_lin_checksum, { "Checksum", "asam-cmp.msg.lin.checksum", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2319 { &hf_cmp_lin_data_len, { "Data length", "asam-cmp.msg.lin.data_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2321 { &hf_cmp_lin_flag_checksum_err, { "Checksum Error", "asam-cmp.msg.lin.flags.checksum_err", FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL } },
2322 { &hf_cmp_lin_flag_col_err, { "Collision Error", "asam-cmp.msg.lin.flags.col_err", FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL } },
2323 { &hf_cmp_lin_flag_parity_err, { "Parity Error", "asam-cmp.msg.lin.flags.parity_err", FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL } },
2324 { &hf_cmp_lin_flag_no_slave_res_err, { "No Slave Response Error", "asam-cmp.msg.lin.flags.no_slave_res_err", FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL } },
2325 { &hf_cmp_lin_flag_sync_err, { "Sync Error", "asam-cmp.msg.lin.flags.sync_err", FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL } },
2326 { &hf_cmp_lin_flag_framing_err, { "Framing Error", "asam-cmp.msg.lin.flags.framing_err", FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL } },
2327 { &hf_cmp_lin_flag_short_dom_err, { "Short Dominant Error", "asam-cmp.msg.lin.flags.short_dom_err", FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL } },
2328 { &hf_cmp_lin_flag_long_dom_err, { "Long Dominant Error", "asam-cmp.msg.lin.flags.long_dom_err", FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL } },
2329 { &hf_cmp_lin_flag_wup, { "Wake Up Request Detection (WUP)", "asam-cmp.msg.lin.flags.wup", FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL } },
2330 { &hf_cmp_lin_flag_reserved, { "Reserved", "asam-cmp.msg.lin.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xFE00, NULL, HFILL } },
2332 /* FlexRay */
2333 { &hf_cmp_flexray_flags, { "Flags", "asam-cmp.msg.flexray.flags.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2334 { &hf_cmp_flexray_reserved, { "Reserved", "asam-cmp.msg.flexray.flags.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2335 { &hf_cmp_flexray_header_crc, { "Header CRC", "asam-cmp.msg.flexray.flags.header_crc", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2336 { &hf_cmp_flexray_frame_id, { "Frame ID", "asam-cmp.msg.flexray.flags.frame_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2337 { &hf_cmp_flexray_cycle, { "Cycle", "asam-cmp.msg.flexray.flags.cycle", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2338 { &hf_cmp_flexray_frame_crc, { "Frame CRC", "asam-cmp.msg.flexray.flags.frame_crc", FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2339 { &hf_cmp_flexray_reserved_2, { "Reserved", "asam-cmp.msg.flexray.flags.res_2", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2340 { &hf_cmp_flexray_data_len, { "Data length", "asam-cmp.msg.flexray.flags.data_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2342 { &hf_cmp_flexray_flag_crc_frame_err, { "Frame CRC Error", "asam-cmp.msg.flexray.flags.crc_frame_err", FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL }},
2343 { &hf_cmp_flexray_flag_crc_header_err, { "Header CRC Error", "asam-cmp.msg.flexray.flags.crc_header_err", FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL }},
2344 { &hf_cmp_flexray_flag_nf, { "Null Frame", "asam-cmp.msg.flexray.flags.nf", FT_BOOLEAN, 16, NULL, CMP_FLEXRAY_FLAGS_NF, NULL, HFILL }},
2345 { &hf_cmp_flexray_flag_sf, { "Startup Frame", "asam-cmp.msg.flexray.flags.sf", FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL } },
2346 { &hf_cmp_flexray_flag_sync, { "Sync Frame", "asam-cmp.msg.flexray.flags.sync", FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL } },
2347 { &hf_cmp_flexray_flag_wus, { "Wake Up Symbol", "asam-cmp.msg.flexray.flags.wus", FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL } },
2348 { &hf_cmp_flexray_flag_ppi, { "Preamble Indicator", "asam-cmp.msg.flexray.flags.ppi", FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL } },
2349 { &hf_cmp_flexray_flag_cas, { "Collision avoidance Symbol (CAS)", "asam-cmp.msg.flexray.flags.cas", FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL } },
2350 { &hf_cmp_flexray_flag_reserved, { "Reserved", "asam-cmp.msg.flexray.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xFF00, NULL, HFILL } },
2352 /* UART/RS-232 */
2353 { &hf_cmp_uart_flags, { "Flags", "asam-cmp.msg.uart.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2354 { &hf_cmp_uart_reserved, { "Reserved", "asam-cmp.msg.uart.reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2355 { &hf_cmp_uart_data_len, { "Data entry count", "asam-cmp.msg.uart.data_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2356 { &hf_cmp_uart_data, { "Data", "asam-cmp.msg.uart.data", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2358 { &hf_cmp_uart_data_data, { "Data", "asam-cmp.msg.uart.data.data", FT_UINT16, BASE_HEX, NULL, CMP_UART_DATA_DATA_MASK, NULL, HFILL }},
2359 { &hf_cmp_uart_data_reserved, { "Reserved", "asam-cmp.msg.uart.data.reserved", FT_UINT16, BASE_HEX, NULL, 0x1E00, NULL, HFILL }},
2360 { &hf_cmp_uart_data_framing_err, { "Framing Error", "asam-cmp.msg.uart.flags.framing_err", FT_BOOLEAN, 16, NULL, 0x2000, NULL, HFILL }},
2361 { &hf_cmp_uart_data_break_condition, { "Break Condition", "asam-cmp.msg.uart.flags.break_condition", FT_BOOLEAN, 16, NULL, 0x4000, NULL, HFILL }},
2362 { &hf_cmp_uart_data_parity_err, { "Parity Error", "asam-cmp.msg.uart.data.parity_err", FT_BOOLEAN, 16, NULL, 0x8000, NULL, HFILL }},
2364 { &hf_cmp_uart_flag_cl, { "CL", "asam-cmp.msg.uart.flags.cl", FT_UINT16, BASE_HEX, VALS(uart_cl_names), 0x0007, NULL, HFILL }},
2365 { &hf_cmp_uart_flag_reserved, { "Reserved", "asam-cmp.msg.uart.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xFFF8, NULL, HFILL }},
2367 /* Analog */
2368 { &hf_cmp_analog_flags, { "Flags", "asam-cmp.msg.analog.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2369 { &hf_cmp_analog_reserved, { "Reserved", "asam-cmp.msg.analog.reserved", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2370 { &hf_cmp_analog_unit, { "Unit", "asam-cmp.msg.analog.unit", FT_UINT8, BASE_HEX, VALS(analog_units), 0x0, NULL, HFILL } },
2371 { &hf_cmp_analog_sample_interval, { "Sample Interval", "asam-cmp.msg.analog.sample_interval", FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, UNS(&units_seconds), 0x0, NULL, HFILL } },
2372 { &hf_cmp_analog_sample_offset, { "Sample Offset", "asam-cmp.msg.analog.sample_offset", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2373 { &hf_cmp_analog_sample_scalar, { "Sample Scalar", "asam-cmp.msg.analog.sample_scalar", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2374 { &hf_cmp_analog_sample, { "Sample", "asam-cmp.msg.analog.sample", FT_DOUBLE, BASE_EXP, NULL, 0x0, NULL, HFILL } },
2375 { &hf_cmp_analog_sample_raw, { "Sample Raw", "asam-cmp.msg.analog.sample_raw", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2377 { &hf_cmp_analog_flag_sample_dt, { "Sample Datatype", "asam-cmp.msg.analog.flags.sample_dt", FT_UINT16, BASE_HEX, VALS(analog_sample_dt), 0x0003, NULL, HFILL }},
2378 { &hf_cmp_analog_flag_reserved, { "Reserved", "asam-cmp.msg.analog.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xfffc, NULL, HFILL }},
2380 /* Ethernet */
2381 { &hf_cmp_eth_flags, { "Flags", "asam-cmp.msg.eth.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2382 { &hf_cmp_eth_reserved, { "Reserved", "asam-cmp.msg.eth.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2383 { &hf_cmp_eth_payload_length, { "Data length", "asam-cmp.msg.eth.data_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2385 { &hf_cmp_eth_flag_fcs_err, { "FCS Error", "asam-cmp.msg.eth.flags.crc_err", FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL }},
2386 { &hf_cmp_eth_flag_short_err, { "Short Frame Error", "asam-cmp.msg.eth.flags.short_err", FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL } },
2387 { &hf_cmp_eth_flag_tx_down, { "TX Port Down", "asam-cmp.msg.eth.flags.tx_down", FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL } },
2388 { &hf_cmp_eth_flag_collision, { "Collision detected", "asam-cmp.msg.eth.flags.collision", FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL } },
2389 { &hf_cmp_eth_flag_long_err, { "Long Frame Error", "asam-cmp.msg.eth.flags.long_err", FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL } },
2390 { &hf_cmp_eth_flag_phy_err, { "PHY Error", "asam-cmp.msg.eth.flags.phy_err", FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL } },
2391 { &hf_cmp_eth_flag_truncated, { "Frame truncated", "asam-cmp.msg.eth.flags.truncated", FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL } },
2392 { &hf_cmp_eth_flag_fcs_supported, { "FCS supported", "asam-cmp.msg.eth.flags.fcs_supported", FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL } },
2393 { &hf_cmp_eth_flag_reserved, { "Reserved", "asam-cmp.msg.eth.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xFF00, NULL, HFILL } },
2395 /* Control Message Payloads */
2396 /* Data Sink Ready */
2397 { &hf_cmp_ctrl_msg_device_id, { "Device ID", "asam-cmp.msg.dsr.device_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2399 /* User Event */
2400 { &hf_cmp_ctrl_msg_event_id, { "Event ID", "asam-cmp.msg.ue.event_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2402 /* Vendor specific */
2403 { &hf_cmp_ctrl_msg_vendor_id, { "Vendor ID", "asam-cmp.msg.vs.vendor_id", FT_UINT16, BASE_HEX, VALS(vendor_ids), 0x0, NULL, HFILL } },
2404 { &hf_cmp_ctrl_msg_vendor_payload_type, { "Payload Type", "asam-cmp.msg.vs.payload_type", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2406 /* Status Message Payloads */
2407 /* Capture Module Status Message */
2408 { &hf_cmp_status_msg_cm_uptime_ns, { "Uptime (ns)", "asam-cmp.msg.cm.uptime_ns", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2409 { &hf_cmp_status_msg_cm_uptime_s, { "Uptime (s)", "asam-cmp.msg.cm.uptime_s", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2410 { &hf_cmp_status_msg_gm_identity, { "gPTP grandmasterIdentity", "asam-cmp.msg.cm.gm_identity", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2411 { &hf_cmp_status_msg_gm_clock_quality, { "gPTP grandmasterClockQuality", "asam-cmp.msg.cm.gm_clock_quality", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2412 { &hf_cmp_status_msg_current_utc_offset, { "gPTP currentUtcOffset", "asam-cmp.msg.cm.current_utc_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2413 { &hf_cmp_status_msg_time_source, { "gPTP timeSource", "asam-cmp.msg.cm.time_source", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2414 { &hf_cmp_status_msg_domain_num, { "gPTP domainNumber", "asam-cmp.msg.cm.domain_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2415 { &hf_cmp_status_msg_res, { "Reserved", "asam-cmp.msg.cm.res", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2416 { &hf_cmp_gptp_flags, { "gPTP Flags", "asam-cmp.msg.cm.gptp_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2418 { &hf_cmp_gptp_flags_leap61, { "Leap61", "asam-cmp.msg.cm.gptp_flags.leap61", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL } },
2419 { &hf_cmp_gptp_flags_leap59, { "Leap59", "asam-cmp.msg.cm.gptp_flags.leap59", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL } },
2420 { &hf_cmp_gptp_flags_cur_utco_valid, { "Current UTC Offset Valid", "asam-cmp.msg.cm.gptp_flags.current_utco_valid", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL } },
2421 { &hf_cmp_gptp_flags_ptp_timescale, { "PTP Timescale", "asam-cmp.msg.cm.gptp_flags.ptp_timescale", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL } },
2422 { &hf_cmp_gptp_flags_time_traceable, { "Time Traceable", "asam-cmp.msg.cm.gptp_flags.time_traceable", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL } },
2423 { &hf_cmp_gptp_flags_freq_traceable, { "Frequency Traceable", "asam-cmp.msg.cm.gptp_flags.freq_traceable", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL } },
2424 { &hf_cmp_gptp_flags_reserved, { "Reserved", "asam-cmp.msg.cm.gptp_flags.res", FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL } },
2426 { &hf_cmp_status_dev_desc_length, { "Length of Device Description", "asam-cmp.msg.cm.dev_desc_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2427 { &hf_cmp_status_dev_desc, { "Device Description", "asam-cmp.msg.cm.dev_desc", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2428 { &hf_cmp_status_sn_length, { "Length of Serial Number", "asam-cmp.msg.cm.sn_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2429 { &hf_cmp_status_sn, { "Serial Number (SN)", "asam-cmp.msg.cm.sn", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2430 { &hf_cmp_status_hw_ver_length, { "Length of Hardware Version", "asam-cmp.msg.cm.hw_ver_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2431 { &hf_cmp_status_hw_ver, { "HW version", "asam-cmp.msg.cm.hw_ver", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2432 { &hf_cmp_status_sw_ver_length, { "Length of Software Version", "asam-cmp.msg.cm.sw_ver_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2433 { &hf_cmp_status_sw_ver, { "SW version", "asam-cmp.msg.cm.sw_ver", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2434 { &hf_cmp_status_vendor_data_length, { "Length of Vendor Data", "asam-cmp.msg.cm.vendor_data_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2435 { &hf_cmp_status_vendor_data, { "Vendor Data", "asam-cmp.msg.cm.vendor_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2437 /* Interface Status Message */
2438 { &hf_cmp_iface_interface, { "Interface", "asam-cmp.msg.iface", FT_PROTOCOL, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2439 { &hf_cmp_iface_iface_id, { "Interface ID", "asam-cmp.msg.iface.iface_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2440 { &hf_cmp_iface_msg_total_rx, { "Messages Total RX", "asam-cmp.msg.iface.msg_total_rx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2441 { &hf_cmp_iface_msg_total_tx, { "Messages Total TX", "asam-cmp.msg.iface.msg_total_tx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2442 { &hf_cmp_iface_msg_dropped_rx, { "Messages Dropped RX", "asam-cmp.msg.iface.msg_drop_rx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2443 { &hf_cmp_iface_msg_dropped_tx, { "Messages Dropped TX", "asam-cmp.msg.iface.msg_drop_tx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2444 { &hf_cmp_iface_errs_total_rx, { "Errors Total RX", "asam-cmp.msg.iface.errors_total_rx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2445 { &hf_cmp_iface_errs_total_tx, { "Errors Total TX", "asam-cmp.msg.iface.errors_total_tx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2446 { &hf_cmp_iface_iface_type, { "Interface Type", "asam-cmp.msg.iface.interface_type", FT_UINT8, BASE_HEX, VALS(data_msg_type_names), 0x0, NULL, HFILL } },
2447 { &hf_cmp_iface_iface_status, { "Interface Status", "asam-cmp.msg.iface.interface_status", FT_UINT8, BASE_HEX, VALS(interface_status_names), 0x0, NULL, HFILL } },
2448 { &hf_cmp_iface_stream_id_cnt, { "Stream ID count", "asam-cmp.msg.iface.stream_id_count", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2449 { &hf_cmp_iface_reserved, { "Reserved", "asam-cmp.msg.iface.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2451 { &hf_cmp_iface_feat, { "Feature Support Bitmask", "asam-cmp.msg.iface.feat_supp", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2452 { &hf_cmp_iface_feat_can_pas_ack, { "Passive Ack Supported", "asam-cmp.msg.iface.feat_supp.can.pas_ack", FT_BOOLEAN, 32, NULL, 0x00000004, NULL, HFILL } },
2453 { &hf_cmp_iface_feat_can_act_ack, { "Active Ack Supported", "asam-cmp.msg.iface.feat_supp.can.act_ack", FT_BOOLEAN, 32, NULL, 0x00000008, NULL, HFILL } },
2454 { &hf_cmp_iface_feat_can_ack_del_err, { "Ack Del Error Supported", "asam-cmp.msg.iface.feat_supp.can.ack_del_err", FT_BOOLEAN, 32, NULL, 0x00000010, NULL, HFILL } },
2455 { &hf_cmp_iface_feat_can_crc_del_err, { "CRC Del Error Supported", "asam-cmp.msg.iface.feat_supp.can.crc_del_err", FT_BOOLEAN, 32, NULL, 0x00000080, NULL, HFILL } },
2456 { &hf_cmp_iface_feat_can_eof_err, { "EOF Error Supported", "asam-cmp.msg.iface.feat_supp.can.eof_err", FT_BOOLEAN, 32, NULL, 0x00000100, NULL, HFILL } },
2457 { &hf_cmp_iface_feat_can_r0, { "R0 Supported", "asam-cmp.msg.iface.feat_supp.can.r0", FT_BOOLEAN, 32, NULL, 0x00000400, NULL, HFILL } },
2458 { &hf_cmp_iface_feat_can_srr_dom, { "SRR Dom Supported", "asam-cmp.msg.iface.feat_supp.can.srr_dom", FT_BOOLEAN, 32, NULL, 0x00000800, NULL, HFILL } },
2459 { &hf_cmp_iface_feat_canfd_pas_ack, { "Passive Ack Supported", "asam-cmp.msg.iface.feat_supp.canfd.pas_ack", FT_BOOLEAN, 32, NULL, 0x00000004, NULL, HFILL } },
2460 { &hf_cmp_iface_feat_canfd_act_ack, { "Active Ack Supported", "asam-cmp.msg.iface.feat_supp.canfd.act_ack", FT_BOOLEAN, 32, NULL, 0x00000008, NULL, HFILL } },
2461 { &hf_cmp_iface_feat_canfd_ack_del_err, { "Ack Del Error Supported", "asam-cmp.msg.iface.feat_supp.canfd.ack_del_err", FT_BOOLEAN, 32, NULL, 0x00000010, NULL, HFILL } },
2462 { &hf_cmp_iface_feat_canfd_crc_del_err, { "CRC Del Error Supported", "asam-cmp.msg.iface.feat_supp.canfd.crc_del_err", FT_BOOLEAN, 32, NULL, 0x00000080, NULL, HFILL } },
2463 { &hf_cmp_iface_feat_canfd_eof_err, { "EOF Error Supported", "asam-cmp.msg.iface.feat_supp.canfd.eof_err", FT_BOOLEAN, 32, NULL, 0x00000100, NULL, HFILL } },
2464 { &hf_cmp_iface_feat_canfd_rsvd, { "RRSV Supported", "asam-cmp.msg.iface.feat_supp.canfd.rsvd", FT_BOOLEAN, 32, NULL, 0x00000400, NULL, HFILL } },
2465 { &hf_cmp_iface_feat_canfd_srr_dom, { "SRR Dom Supported", "asam-cmp.msg.iface.feat_supp.canfd.srr_dom", FT_BOOLEAN, 32, NULL, 0x00000800, NULL, HFILL } },
2466 { &hf_cmp_iface_feat_canfd_brs_dom, { "BRS Dom Supported", "asam-cmp.msg.iface.feat_supp.canfd.brs_dom", FT_BOOLEAN, 32, NULL, 0x00001000, NULL, HFILL } },
2467 { &hf_cmp_iface_feat_canfd_esi_dom, { "ESI Dom Supported", "asam-cmp.msg.iface.feat_supp.canfd.esi_dom", FT_BOOLEAN, 32, NULL, 0x00002000, NULL, HFILL } },
2468 { &hf_cmp_iface_feat_lin_sync_err, { "Sync Error Supported", "asam-cmp.msg.iface.feat_supp.lin.sync_err", FT_BOOLEAN, 32, NULL, 0x00000010, NULL, HFILL } },
2469 { &hf_cmp_iface_feat_lin_framing_err, { "Framing Error Supported", "asam-cmp.msg.iface.feat_supp.lin.framing_err", FT_BOOLEAN, 32, NULL, 0x00000020, NULL, HFILL } },
2470 { &hf_cmp_iface_feat_lin_short_dom_err, { "Short Dom Error Supported", "asam-cmp.msg.iface.feat_supp.lin.short_dom_err", FT_BOOLEAN, 32, NULL, 0x00000040, NULL, HFILL } },
2471 { &hf_cmp_iface_feat_lin_long_dom_err, { "Long Dom Error Supported", "asam-cmp.msg.iface.feat_supp.lin.long_dom_err", FT_BOOLEAN, 32, NULL, 0x00000080, NULL, HFILL } },
2472 { &hf_cmp_iface_feat_lin_wup, { "WUP Supported", "asam-cmp.msg.iface.feat_supp.lin.wup", FT_BOOLEAN, 32, NULL, 0x00000100, NULL, HFILL } },
2473 { &hf_cmp_iface_feat_eth_too_long, { "Frame too long Supported", "asam-cmp.msg.iface.feat_supp.eth.frame_too_long", FT_BOOLEAN, 32, NULL, 0x00000010, NULL, HFILL } },
2474 { &hf_cmp_iface_feat_eth_phy_err, { "PHY Error Supported", "asam-cmp.msg.iface.feat_supp.eth.phy_err", FT_BOOLEAN, 32, NULL, 0x00000020, NULL, HFILL } },
2475 { &hf_cmp_iface_feat_eth_trunc, { "Truncated Frames Supported", "asam-cmp.msg.iface.feat_supp.eth.truncated_frames", FT_BOOLEAN, 32, NULL, 0x00000040, NULL, HFILL } },
2477 { &hf_cmp_iface_stream_ids, { "Stream IDs", "asam-cmp.msg.iface.stream_ids", FT_PROTOCOL, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2478 { &hf_cmp_iface_stream_id, { "Stream ID", "asam-cmp.msg.iface.stream_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2479 { &hf_cmp_iface_vendor_data_len, { "Vendor Data Length", "asam-cmp.msg.iface.vendor_data_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2480 { &hf_cmp_iface_vendor_data, { "Vendor Data", "asam-cmp.msg.iface.vendor_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2482 /* Configuration Status Message */
2483 { &hf_cmp_status_msg_config, { "Data", "asam-cmp.msg.config.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2485 /* Data Lost Event Status Message */
2486 { &hf_cmp_dataloss_data_sink_port, { "Data Sink Port", "asam-cmp.msg.dataloss.data_sink_port", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2487 { &hf_cmp_dataloss_device_id, { "Device ID", "asam-cmp.msg.dataloss.device_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2488 { &hf_cmp_dataloss_reserved, { "Reserved", "asam-cmp.msg.dataloss.res", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2489 { &hf_cmp_dataloss_stream_id, { "Stream ID", "asam-cmp.msg.dataloss.stream_id", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2490 { &hf_cmp_dataloss_last_ssq_value, { "Last Stream Sequence Counter Value", "asam-cmp.msg.dataloss.last_ssqc", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2491 { &hf_cmp_dataloss_current_ssq_value, { "Current Stream Sequence Counter Value", "asam-cmp.msg.dataloss.current_ssqc", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2493 /* Time Sync Lost Event Status Message */
2494 { &hf_cmp_timeloss_port_nr, { "Port Number", "asam-cmp.msg.timesyncloss.port_nr", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2495 { &hf_cmp_timeloss_device_id, { "Device ID", "asam-cmp.msg.timesyncloss.device_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2496 { &hf_cmp_timeloss_error_flags, { "Time Sync Loss Error Flags", "asam-cmp.msg.timesyncloss.err_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2498 { &hf_cmp_timeloss_error_flags_ts, { "Was Time Synced before", "asam-cmp.msg.timesyncloss.err_flags.ts", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL } },
2499 { &hf_cmp_timeloss_error_flags_insync, { "Original CMP Message had at least one INSYNC=0", "asam-cmp.msg.timesyncloss.err_flags.insync", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL } },
2500 { &hf_cmp_timeloss_error_flags_delta, { "Configured Time Delta was exceeded", "asam-cmp.msg.timesyncloss.err_flags.delta", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL } },
2501 { &hf_cmp_timeloss_error_flags_reserved, { "Reserved", "asam-cmp.msg.timesyncloss.err_flags.res", FT_UINT8, BASE_HEX, NULL, 0xF8, NULL, HFILL } },
2503 /* Vendor Specific Status Message */
2504 { &hf_cmp_status_msg_vendor_specific, { "Vendor Specific", "asam-cmp.msg.vendor_specific", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2507 static int *ett[] = {
2508 &ett_asam_cmp,
2509 &ett_asam_cmp_header,
2510 &ett_asam_cmp_timestamp,
2511 &ett_asam_cmp_common_flags,
2512 &ett_asam_cmp_payload,
2513 &ett_asam_cmp_payload_flags,
2514 &ett_asam_cmp_lin_pid,
2515 &ett_asam_cmp_can_id,
2516 &ett_asam_cmp_can_crc,
2517 &ett_asam_cmp_uart_data,
2518 &ett_asam_cmp_analog_sample,
2519 &ett_asam_cmp_status_cm_flags,
2520 &ett_asam_cmp_status_cm_uptime,
2521 &ett_asam_cmp_status_timeloss_flags,
2522 &ett_asam_cmp_status_interface,
2523 &ett_asam_cmp_status_feature_support,
2524 &ett_asam_cmp_status_stream_ids
2527 static ei_register_info ei[] = {
2528 { &ei_asam_cmp_length_mismatch, {"asam-cmp.expert.length_mismatch", PI_MALFORMED, PI_WARN, "Malformed message, length mismatch!", EXPFILL } },
2529 { &ei_asam_cmp_unsupported_crc_not_zero, {"asam-cmp.export.deactivated_crc_not_zero", PI_MALFORMED, PI_WARN, "Unsupported CRC is not zero!", EXPFILL } },
2532 /* UATs for user_data fields */
2533 static uat_field_t asam_cmp_device_id_uat_fields[] = {
2534 UAT_FLD_HEX(asam_cmp_devices, id, "Device ID", "Device ID (hex uint16 without leading 0x)"),
2535 UAT_FLD_CSTRING(asam_cmp_devices, name, "Device Name", "Device Name (string)"),
2536 UAT_END_FIELDS
2539 static uat_field_t asam_cmp_interface_id_uat_fields[] = {
2540 UAT_FLD_HEX(asam_cmp_interfaces, id, "Interface ID", "Interface ID (hex uint32 without leading 0x)"),
2541 UAT_FLD_CSTRING(asam_cmp_interfaces, name, "Interface Name", "Interface Name (string)"),
2542 UAT_FLD_HEX(asam_cmp_interfaces, bus_id, "Bus ID", "Bus ID of the Interface (hex uint16 without leading 0x)"),
2543 UAT_END_FIELDS
2546 proto_asam_cmp = proto_register_protocol("ASAM Capture Module Protocol", "ASAM CMP", "asam-cmp");
2547 proto_register_field_array(proto_asam_cmp, hf, array_length(hf));
2548 proto_register_subtree_array(ett, array_length(ett));
2549 asam_cmp_module = prefs_register_protocol(proto_asam_cmp, NULL);
2551 expert_module_asam_cmp = expert_register_protocol(proto_asam_cmp);
2552 expert_register_field_array(expert_module_asam_cmp, ei, array_length(ei));
2554 /* Configuration Items */
2555 asam_cmp_deviceid_uat = uat_new("ASAM CMP Devices",
2556 sizeof(generic_one_id_string_t), /* record size */
2557 DATAFILE_ASAM_CMP_DEVICES_IDS, /* filename */
2558 true, /* from profile */
2559 (void**)&asam_cmp_devices, /* data_ptr */
2560 &asam_cmp_devices_num, /* numitems_ptr */
2561 UAT_AFFECTS_DISSECTION, /* but not fields */
2562 NULL, /* help */
2563 copy_generic_one_id_string_cb, /* copy callback */
2564 update_generic_one_identifier_16bit, /* update callback */
2565 free_generic_one_id_string_cb, /* free callback */
2566 post_update_asam_cmp_devices_cb, /* post update callback */
2567 NULL, /* reset callback */
2568 asam_cmp_device_id_uat_fields /* UAT field definitions */
2571 prefs_register_uat_preference(asam_cmp_module, "_udf_asam_cmp_devices", "Devices",
2572 "A table to define names of Devices.", asam_cmp_deviceid_uat);
2574 asam_cmp_interfaceid_uat = uat_new("ASAM CMP Interfaces",
2575 sizeof(interface_config_t), /* record size */
2576 DATAFILE_ASAM_CMP_IFACE_IDS, /* filename */
2577 true, /* from profile */
2578 (void**)&asam_cmp_interfaces, /* data_ptr */
2579 &asam_cmp_interface_num, /* numitems_ptr */
2580 UAT_AFFECTS_DISSECTION, /* but not fields */
2581 NULL, /* help */
2582 copy_interface_config_cb, /* copy callback */
2583 update_interface_config, /* update callback */
2584 free_interface_config_cb, /* free callback */
2585 post_update_interface_config_cb, /* post update callback */
2586 NULL, /* reset callback */
2587 asam_cmp_interface_id_uat_fields /* UAT field definitions */
2590 prefs_register_uat_preference(asam_cmp_module, "_udf_asam_cmp_interfaces", "Interfaces",
2591 "A table to define names and mappings of Interfaces.", asam_cmp_interfaceid_uat);
2593 prefs_register_bool_preference(asam_cmp_module, "try_heuristic_first",
2594 "Try heuristic sub-dissectors first",
2595 "Try to decode a packet using an heuristic sub-dissector"
2596 " before using a sub-dissector registered to \"decode as\"",
2597 &heuristic_first);
2599 prefs_register_bool_preference(asam_cmp_module, "use_old_canid_11bit_format",
2600 "Use old encoding of 11bit CAN/CAN-FD IDs",
2601 "Use the old encoding of 11bit CAN/CAN-FD IDs",
2602 &old_11bit_canid_encoding);
2605 void
2606 proto_reg_handoff_asam_cmp(void) {
2607 dissector_handle_t asam_cmp_handle;
2609 asam_cmp_handle = register_dissector("asam-cmp", dissect_asam_cmp, proto_asam_cmp);
2610 eth_handle = find_dissector("eth_maybefcs");
2612 dissector_add_for_decode_as("ethertype", asam_cmp_handle);
2613 dissector_add_for_decode_as_with_preference("udp.port", asam_cmp_handle);
2615 lin_subdissector_table = find_dissector_table("lin.frame_id");
2619 * Editor modelines
2621 * Local Variables:
2622 * c-basic-offset: 4
2623 * tab-width: 8
2624 * indent-tabs-mode: nil
2625 * End:
2627 * ex: set shiftwidth=4 tabstop=8 expandtab:
2628 * :indentSize=4:tabSize=8:noTabs=true: