Coverage Report

Created: 2026-08-14 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-asam-cmp.c
Line
Count
Source
1
/* packet-asam-cmp.c
2
 * ASAM Capture Module Protocol dissector.
3
 * Copyright 2021-2023 Alicia Mediano Schikarski, Technica Engineering GmbH
4
 * Copyright 2021-2026 Dr. Lars Völker, Technica Engineering GmbH
5
 *
6
 * Wireshark - Network traffic analyzer
7
 * By Gerald Combs <gerald@wireshark.org>
8
 * Copyright 1998 Gerald Combs
9
 *
10
 * SPDX-License-Identifier: GPL-2.0-or-later
11
 */
12
13
 /*
14
  * This is a dissector for the Capture Module Protocol standardized by the ASAM.
15
  * ASAM CMP is the standardized successor of TECMP.
16
  */
17
18
#include "config.h"
19
20
#include "math.h"
21
22
#include <epan/packet.h>
23
#include <epan/uat.h>
24
#include <epan/expert.h>
25
#include <epan/tfs.h>
26
#include <epan/unit_strings.h>
27
28
#include "packet-socketcan.h"
29
#include "packet-flexray.h"
30
#include "packet-lin.h"
31
32
void proto_register_asam_cmp(void);
33
void proto_reg_handoff_asam_cmp(void);
34
35
static int proto_asam_cmp;
36
37
static dissector_handle_t eth_handle;
38
39
static bool heuristic_first;
40
static bool old_11bit_canid_encoding;
41
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;
50
51
/* Message Fields */
52
/* Message Header Fields */
53
static int hf_cmp_msg_header;
54
55
static int hf_cmp_common_flag_recal;
56
static int hf_cmp_common_flag_relative;
57
static int hf_cmp_common_flag_insync;
58
static int hf_cmp_common_flag_reserved_0x02;
59
static int hf_cmp_common_flag_seg;
60
static int hf_cmp_common_flag_dir_on_if;
61
static int hf_cmp_common_flag_overflow;
62
static int hf_cmp_common_flag_err_in_payload;
63
static int hf_cmp_common_flag_reserved;
64
static int hf_cmp_common_flag_reserved_0xf0;
65
66
static int hf_cmp_msg_timestamp;
67
static int hf_cmp_msg_timestamp_ns;
68
static int hf_cmp_msg_deadline;
69
static int hf_cmp_msg_reserved;
70
static int hf_cmp_msg_trans_opts;
71
static int hf_cmp_msg_trans_opts_res;
72
static int hf_cmp_msg_trans_opts_lin_wup_dura;
73
static int hf_cmp_msg_trans_opts_lin_res;
74
static int hf_cmp_msg_trans_opts_fr_op;
75
static int hf_cmp_msg_trans_opts_fr_cycle_rep;
76
static int hf_cmp_msg_trans_opts_fr_res;
77
static int hf_cmp_msg_common_flags;
78
static int hf_cmp_msg_vendor_id;
79
static int hf_cmp_msg_payload_length;
80
static int hf_cmp_msg_payload;
81
82
/* Additional Data Message Header Fields */
83
static int hf_cmp_interface_id;
84
static int hf_cmp_payload_type;
85
86
/* Additional Control Message Header Fields */
87
static int hf_cmp_ctrl_msg_reserved;
88
static int hf_cmp_ctrl_msg_payload_type;
89
90
/* Additional Status Message Header Fields */
91
static int hf_cmp_status_msg_payload_type;
92
93
/* Additional Status Message Header Fields */
94
static int hf_cmp_vendor_msg_payload_type;
95
96
/* Data Message Payload Fields */
97
/* CAN */
98
9
#define CMP_CAN_FLAGS_ERRORS        0x03ff
99
60
#define CMP_CAN_ID_11BIT_MASK       0x1ffc0000
100
28
#define CMP_CAN_ID_11BIT_SHIFT      18
101
32
#define CMP_CAN_ID_11BIT_MASK_OLD   0x000007ff
102
37
#define CMP_CAN_ID_29BIT_MASK       0x1fffffff
103
16
#define CMP_CAN_ID_ERR              0x20000000
104
40
#define CMP_CAN_ID_RTR              0x40000000
105
88
#define CMP_CAN_ID_IDE              0x80000000
106
107
35
#define CMP_CAN_CRC_CRC             0x00007fff
108
16
#define CMP_CAN_CRC_RES             0x7fff8000
109
40
#define CMP_CAN_CRC_CRC_SUPP        0x80000000
110
111
static int hf_cmp_can_flags;
112
113
static int hf_cmp_can_flag_crc_err;
114
static int hf_cmp_can_flag_ack_err;
115
static int hf_cmp_can_flag_passive_ack_err;
116
static int hf_cmp_can_flag_reserved_0004;
117
static int hf_cmp_can_flag_active_ack_err;
118
static int hf_cmp_can_flag_reserved_0008;
119
static int hf_cmp_can_flag_ack_del_err;
120
static int hf_cmp_can_flag_form_err;
121
static int hf_cmp_can_flag_stuff_err;
122
static int hf_cmp_can_flag_crc_del_err;
123
static int hf_cmp_can_flag_eof_err;
124
static int hf_cmp_can_flag_bit_err;
125
static int hf_cmp_can_flag_r0;
126
static int hf_cmp_can_flag_srr_dom;
127
static int hf_cmp_can_flag_reserved;
128
static int hf_cmp_can_flag_reserved_1000;
129
static int hf_cmp_can_flag_reserved_2000;
130
static int hf_cmp_can_flag_gen_err;
131
static int hf_cmp_can_flag_reserved_tx;
132
133
static int hf_cmp_can_reserved;
134
static int hf_cmp_can_id;
135
static int hf_cmp_can_id_11bit;
136
static int hf_cmp_can_id_11bit_old;
137
static int hf_cmp_can_id_29bit;
138
static int hf_cmp_can_id_err;
139
static int hf_cmp_can_id_rtr;
140
static int hf_cmp_can_id_ide;
141
static int hf_cmp_can_crc;
142
static int hf_cmp_can_crc_crc;
143
static int hf_cmp_can_crc_res;
144
static int hf_cmp_can_crc_crc_support;
145
static int hf_cmp_can_err_pos;
146
static int hf_cmp_can_dlc;
147
static int hf_cmp_can_data_len;
148
149
/* CAN FD */
150
5
#define CMP_CANFD_FLAGS_ERRORS      0x03ff
151
16
#define CMP_CANFD_ID_ERR            0x20000000
152
16
#define CMP_CANFD_ID_RRS            0x40000000
153
43
#define CMP_CANFD_ID_IDE            0x80000000
154
155
16
#define CMP_CANFD_CRC_CRC17         0x0001ffff
156
16
#define CMP_CANFD_CRC_CRC21         0x001fffff
157
16
#define CMP_CANFD_CRC_SBC           0x00e00000
158
16
#define CMP_CANFD_CRC_SBC_PARITY    0x01000000
159
16
#define CMP_CANFD_CRC_RES           0x3e000000
160
16
#define CMP_CANFD_CRC_SBC_SUPP      0x40000000
161
16
#define CMP_CANFD_CRC_CRC_SUPP      0x80000000
162
163
static int hf_cmp_canfd_flags;
164
165
static int hf_cmp_canfd_flag_crc_err;
166
static int hf_cmp_canfd_flag_ack_err;
167
static int hf_cmp_canfd_flag_passive_ack_err;
168
static int hf_cmp_canfd_flag_reserved_0004;
169
static int hf_cmp_canfd_flag_active_ack_err;
170
static int hf_cmp_canfd_flag_reserved_0008;
171
static int hf_cmp_canfd_flag_ack_del_err;
172
static int hf_cmp_canfd_flag_form_err;
173
static int hf_cmp_canfd_flag_stuff_err;
174
static int hf_cmp_canfd_flag_crc_del_err;
175
static int hf_cmp_canfd_flag_eof_err;
176
static int hf_cmp_canfd_flag_bit_err;
177
static int hf_cmp_canfd_flag_res;
178
static int hf_cmp_canfd_flag_srr_dom;
179
static int hf_cmp_canfd_flag_brs;
180
static int hf_cmp_canfd_flag_esi;
181
static int hf_cmp_canfd_flag_reserved;
182
static int hf_cmp_canfd_flag_gen_err;
183
static int hf_cmp_canfd_flag_reserved_tx;
184
185
static int hf_cmp_canfd_reserved;
186
static int hf_cmp_canfd_id;
187
static int hf_cmp_canfd_id_11bit;
188
static int hf_cmp_canfd_id_11bit_old;
189
static int hf_cmp_canfd_id_29bit;
190
static int hf_cmp_canfd_id_err;
191
static int hf_cmp_canfd_id_rrs;
192
static int hf_cmp_canfd_id_ide;
193
static int hf_cmp_canfd_crc;
194
static int hf_cmp_canfd_crc_crc17;
195
static int hf_cmp_canfd_crc_crc21;
196
static int hf_cmp_canfd_crc_sbc;
197
static int hf_cmp_canfd_crc_sbc_parity;
198
static int hf_cmp_canfd_crc_res;
199
static int hf_cmp_canfd_crc_sbc_support;
200
static int hf_cmp_canfd_crc_crc_support;
201
static int hf_cmp_canfd_err_pos;
202
static int hf_cmp_canfd_dlc;
203
static int hf_cmp_canfd_data_len;
204
205
/* LIN */
206
16
#define CMP_CANFD_PID_PARITY_MASK   0xc0
207
22
#define CMP_CANFD_PID_ID_MASK       0x3f
208
209
static int hf_cmp_lin_flags;
210
static int hf_cmp_lin_flag_checksum_err;
211
static int hf_cmp_lin_flag_col_err;
212
static int hf_cmp_lin_flag_reserved_0x0002;
213
static int hf_cmp_lin_flag_parity_err;
214
static int hf_cmp_lin_flag_no_slave_res;
215
static int hf_cmp_lin_flag_reserved_0x0008;
216
static int hf_cmp_lin_flag_sync_err;
217
static int hf_cmp_lin_flag_framing_err;
218
static int hf_cmp_lin_flag_short_dom_err;
219
static int hf_cmp_lin_flag_long_dom_err;
220
static int hf_cmp_lin_flag_wup;
221
static int hf_cmp_lin_flag_reserved;
222
223
static int hf_cmp_lin_reserved;
224
static int hf_cmp_lin_pid;
225
static int hf_cmp_lin_pid_parity;
226
static int hf_cmp_lin_pid_id;
227
static int hf_cmp_lin_reserved_2;
228
static int hf_cmp_lin_checksum;
229
static int hf_cmp_lin_data_len;
230
231
/* FlexRay */
232
19
#define CMP_FLEXRAY_FLAGS_NF 0x0004
233
234
static int hf_cmp_flexray_flags;
235
236
static int hf_cmp_flexray_flag_crc_frame_err;
237
static int hf_cmp_flexray_flag_crc_header_err;
238
static int hf_cmp_flexray_flag_nf;
239
static int hf_cmp_flexray_flag_sf;
240
static int hf_cmp_flexray_flag_sync;
241
static int hf_cmp_flexray_flag_wus;
242
static int hf_cmp_flexray_flag_ppi;
243
static int hf_cmp_flexray_flag_cas;
244
static int hf_cmp_flexray_flag_reserved_0x0100;
245
static int hf_cmp_flexray_flag_leading;
246
static int hf_cmp_flexray_flag_channel;
247
static int hf_cmp_flexray_flag_reserved;
248
249
static int hf_cmp_flexray_reserved;
250
static int hf_cmp_flexray_header_crc;
251
static int hf_cmp_flexray_frame_id;
252
static int hf_cmp_flexray_cycle;
253
static int hf_cmp_flexray_frame_crc;
254
static int hf_cmp_flexray_reserved_2;
255
static int hf_cmp_flexray_data_len;
256
257
/* Digital */
258
26
#define CMP_DIGITAL_FLAG_TRIGGER_PRESENT 0x0001
259
26
#define CMP_DIGITAL_FLAG_SAMPLE_PRESENT 0x0002
260
261
static int hf_cmp_digital_flags;
262
263
static int hf_cmp_digital_flag_trig_present;
264
static int hf_cmp_digital_flag_sampl_present;
265
static int hf_cmp_digital_flag_reserved;
266
267
static int hf_cmp_digital_reserved;
268
static int hf_cmp_digital_pin_count;
269
270
static int hf_cmp_digital_trig_pattern;
271
static int hf_cmp_digital_trig_pin;
272
static int hf_cmp_digital_flag_reserved2;
273
274
static int hf_cmp_digital_sample_interval;
275
static int hf_cmp_digital_sample_count;
276
277
static int hf_cmp_digital_sample;
278
279
/* define 32 Pins for now */
280
static int hf_cmp_digital_sample_pin_0;
281
static int hf_cmp_digital_sample_pin_1;
282
static int hf_cmp_digital_sample_pin_2;
283
static int hf_cmp_digital_sample_pin_3;
284
static int hf_cmp_digital_sample_pin_4;
285
static int hf_cmp_digital_sample_pin_5;
286
static int hf_cmp_digital_sample_pin_6;
287
static int hf_cmp_digital_sample_pin_7;
288
289
static int hf_cmp_digital_sample_pin_8;
290
static int hf_cmp_digital_sample_pin_9;
291
static int hf_cmp_digital_sample_pin_10;
292
static int hf_cmp_digital_sample_pin_11;
293
static int hf_cmp_digital_sample_pin_12;
294
static int hf_cmp_digital_sample_pin_13;
295
static int hf_cmp_digital_sample_pin_14;
296
static int hf_cmp_digital_sample_pin_15;
297
298
static int hf_cmp_digital_sample_pin_16;
299
static int hf_cmp_digital_sample_pin_17;
300
static int hf_cmp_digital_sample_pin_18;
301
static int hf_cmp_digital_sample_pin_19;
302
static int hf_cmp_digital_sample_pin_20;
303
static int hf_cmp_digital_sample_pin_21;
304
static int hf_cmp_digital_sample_pin_22;
305
static int hf_cmp_digital_sample_pin_23;
306
307
static int hf_cmp_digital_sample_pin_24;
308
static int hf_cmp_digital_sample_pin_25;
309
static int hf_cmp_digital_sample_pin_26;
310
static int hf_cmp_digital_sample_pin_27;
311
static int hf_cmp_digital_sample_pin_28;
312
static int hf_cmp_digital_sample_pin_29;
313
static int hf_cmp_digital_sample_pin_30;
314
static int hf_cmp_digital_sample_pin_31;
315
316
/* UART/RS-232 */
317
16
#define CMP_UART_DATA_DATA_MASK     0x01FF
318
319
static int hf_cmp_uart_flags;
320
321
static int hf_cmp_uart_flag_cl;
322
static int hf_cmp_uart_flag_reserved;
323
324
static int hf_cmp_uart_reserved;
325
static int hf_cmp_uart_data_len;
326
static int hf_cmp_uart_data;
327
328
static int hf_cmp_uart_data_data;
329
static int hf_cmp_uart_data_reserved;
330
static int hf_cmp_uart_data_framing_err;
331
static int hf_cmp_uart_data_break_condition;
332
static int hf_cmp_uart_data_parity_err;
333
334
/* Analog */
335
static int hf_cmp_analog_flags;
336
337
static int hf_cmp_analog_flag_sample_dt;
338
static int hf_cmp_analog_flag_reserved;
339
340
static int hf_cmp_analog_reserved;
341
static int hf_cmp_analog_unit;
342
static int hf_cmp_analog_sample_interval;
343
static int hf_cmp_analog_sample_offset;
344
static int hf_cmp_analog_sample_scalar;
345
static int hf_cmp_analog_sample;
346
static int hf_cmp_analog_sample_raw;
347
348
/* Ethernet */
349
static int hf_cmp_eth_flags;
350
351
static int hf_cmp_eth_flag_fcs_err;
352
static int hf_cmp_eth_flag_short_err;
353
static int hf_cmp_eth_flag_tx_down;
354
static int hf_cmp_eth_flag_collision;
355
static int hf_cmp_eth_flag_long_err;
356
static int hf_cmp_eth_flag_phy_err;
357
static int hf_cmp_eth_flag_truncated;
358
static int hf_cmp_eth_flag_fcs_supported;
359
static int hf_cmp_eth_flag_reserved_cap;
360
361
static int hf_cmp_eth_flag_reserved_tx;
362
static int hf_cmp_eth_flag_fcs_sending;
363
static int hf_cmp_eth_flag_reserved_tx2;
364
365
static int hf_cmp_eth_reserved;
366
static int hf_cmp_eth_payload_length;
367
368
/* SPI */
369
static int hf_cmp_spi_flags;
370
371
static int hf_cmp_spi_flag_reserved;
372
373
static int hf_cmp_spi_reserved;
374
static int hf_cmp_spi_cipo_length;
375
static int hf_cmp_spi_cipo;
376
static int hf_cmp_spi_copi_length;
377
static int hf_cmp_spi_copi;
378
379
/* I2C */
380
static int hf_cmp_i2c_flags;
381
static int hf_cmp_i2c_flag_dir;
382
static int hf_cmp_i2c_flag_addr_len;
383
static int hf_cmp_i2c_flag_addr_ack;
384
static int hf_cmp_i2c_flag_addr_err;
385
static int hf_cmp_i2c_flag_stop_cond;
386
static int hf_cmp_i2c_flag_start_cond;
387
static int hf_cmp_i2c_flag_reserved;
388
389
static int hf_cmp_i2c_reserved;
390
static int hf_cmp_i2c_addr;
391
static int hf_cmp_i2c_data_entry_count;
392
static int hf_cmp_i2c_data;
393
static int hf_cmp_i2c_data_byte;
394
static int hf_cmp_i2c_data_control_ack;
395
static int hf_cmp_i2c_data_control_res;
396
397
/* GigE Vision */
398
static int hf_cmp_gige_flags;
399
static int hf_cmp_gige_flag_reserved;
400
401
static int hf_cmp_gige_reserved;
402
static int hf_cmp_gige_payload_length;
403
static int hf_cmp_gige_payload;
404
405
/* MIPI CSI-2 */
406
static int hf_cmp_mipi_csi2_flags;
407
static int hf_cmp_mipi_csi2_flag_crc_err;
408
static int hf_cmp_mipi_csi2_flag_ecc_err_c;
409
static int hf_cmp_mipi_csi2_flag_ecc_err_uc;
410
static int hf_cmp_mipi_csi2_flag_ecc_fmt;
411
static int hf_cmp_mipi_csi2_flag_frame_ctr_src;
412
static int hf_cmp_mipi_csi2_flag_line_ctr_src;
413
static int hf_cmp_mipi_csi2_flag_cs_support;
414
static int hf_cmp_mipi_csi2_flag_reserved;
415
416
static int hf_cmp_mipi_csi2_flag_reserved_tx;
417
418
static int hf_cmp_mipi_csi2_reserved;
419
static int hf_cmp_mipi_csi2_frame_counter;
420
static int hf_cmp_mipi_csi2_line_counter;
421
static int hf_cmp_mipi_csi2_dt;
422
static int hf_cmp_mipi_csi2_dt_res;
423
static int hf_cmp_mipi_csi2_dt_dt;
424
static int hf_cmp_mipi_csi2_vci;
425
static int hf_cmp_mipi_csi2_vci_res;
426
static int hf_cmp_mipi_csi2_vci_vcx;
427
static int hf_cmp_mipi_csi2_vci_vci;
428
static int hf_cmp_mipi_csi2_reserved2;
429
static int hf_cmp_mipi_csi2_ecc;
430
static int hf_cmp_mipi_csi2_ecc_res;
431
static int hf_cmp_mipi_csi2_ecc_ecc;
432
static int hf_cmp_mipi_csi2_cs;
433
static int hf_cmp_mipi_csi2_wc;
434
static int hf_cmp_mipi_csi2_short_packet_data;
435
static int hf_cmp_mipi_csi2_data;
436
437
/* Raw Ethernet */
438
static int hf_cmp_raw_eth_flags;
439
static int hf_cmp_raw_eth_flag_reserved;
440
441
static int hf_cmp_raw_eth_reserved;
442
static int hf_cmp_raw_eth_payload_length;
443
static int hf_cmp_raw_eth_preamble;
444
static int hf_cmp_raw_eth_sfd;
445
static int hf_cmp_raw_eth_mpacket;
446
447
/* 10BASE-T1S Symbols */
448
static int hf_cmp_10t1s_symb_flags;
449
static int hf_cmp_10t1s_symb_flag_decode_err;
450
static int hf_cmp_10t1s_symb_flag_miss_beacon;
451
static int hf_cmp_10t1s_symb_flag_res;
452
static int hf_cmp_10t1s_symb_flag_first_beacon;
453
454
static int hf_cmp_10t1s_symb_data_length;
455
static int hf_cmp_10t1s_symb_data;
456
static int hf_cmp_10t1s_symb_data_symbol;
457
458
/* A2B */
459
static int hf_cmp_a2b_flags;
460
static int hf_cmp_a2b_flag_fin;
461
static int hf_cmp_a2b_flag_fault_err;
462
static int hf_cmp_a2b_flag_fault_code;
463
static int hf_cmp_a2b_flag_fault_nloc;
464
static int hf_cmp_a2b_flag_hdcnt_err;
465
static int hf_cmp_a2b_flag_dd_err;
466
static int hf_cmp_a2b_flag_crc_err;
467
static int hf_cmp_a2b_flag_dp_err;
468
static int hf_cmp_a2b_flag_pwd_err;
469
static int hf_cmp_a2b_flag_becovf_err;
470
static int hf_cmp_a2b_flag_srf_err;
471
static int hf_cmp_a2b_flag_srfcrc_err;
472
static int hf_cmp_a2b_flag_icrc_err;
473
static int hf_cmp_a2b_flag_i2c_err;
474
475
static int hf_cmp_a2b_reserved;
476
static int hf_cmp_a2b_upstream_set;
477
static int hf_cmp_a2b_upstream_set_upfmt;
478
static int hf_cmp_a2b_upstream_set_ups;
479
static int hf_cmp_a2b_upstream_set_upsize;
480
static int hf_cmp_a2b_upstream_set_upslots;
481
static int hf_cmp_a2b_upstream_set_upoffset;
482
483
static int hf_cmp_a2b_downstream_set;
484
static int hf_cmp_a2b_downstream_set_dnfmt;
485
static int hf_cmp_a2b_downstream_set_dns;
486
static int hf_cmp_a2b_downstream_set_dnsize;
487
static int hf_cmp_a2b_downstream_set_dnslots;
488
static int hf_cmp_a2b_downstream_set_dnoffset;
489
490
static int hf_cmp_a2b_general_set;
491
static int hf_cmp_a2b_general_set_mstr;
492
static int hf_cmp_a2b_general_set_standby;
493
static int hf_cmp_a2b_general_set_endsniff;
494
static int hf_cmp_a2b_general_set_discvd;
495
static int hf_cmp_a2b_general_set_tx2pintl;
496
static int hf_cmp_a2b_general_set_rx2pintl;
497
static int hf_cmp_a2b_general_set_tdmmode;
498
static int hf_cmp_a2b_general_set_tdmss;
499
static int hf_cmp_a2b_general_set_bmmen;
500
static int hf_cmp_a2b_general_set_bclkrate;
501
static int hf_cmp_a2b_general_set_i2srate;
502
static int hf_cmp_a2b_general_set_txoffset;
503
static int hf_cmp_a2b_general_set_rxoffset;
504
static int hf_cmp_a2b_general_set_syncoffset;
505
static int hf_cmp_a2b_general_set_rrdiv;
506
static int hf_cmp_a2b_general_set_rrsoffset;
507
static int hf_cmp_a2b_general_set_reserved;
508
static int hf_cmp_a2b_general_set_raw_cap;
509
510
static int hf_cmp_a2b_data_length;
511
static int hf_cmp_a2b_data;
512
513
/* Link State */
514
static int hf_cmp_link_state_flags;
515
static int hf_cmp_link_state_flag_link_err;
516
static int hf_cmp_link_state_flag_reserved;
517
518
static int hf_cmp_link_state_flag_reserved_tx;
519
520
static int hf_cmp_link_state_interface_status;
521
static int hf_cmp_link_state_reserved;
522
523
/* Vendor Defined */
524
static int hf_cmp_vendor_def_vendor_id;
525
static int hf_cmp_vendor_def_vendor_payload_type;
526
static int hf_cmp_vendor_def_vendor_payload_data;
527
528
/* Control Message Payload Fields */
529
/* Data Sink Ready */
530
static int hf_cmp_ctrl_msg_device_id;
531
532
/* User Event */
533
static int hf_cmp_ctrl_msg_event_id;
534
535
/* Vendor specific */
536
static int hf_cmp_ctrl_msg_vendor_id;
537
static int hf_cmp_ctrl_msg_vendor_payload_type;
538
539
/* Status Message Payload Fields */
540
/* Capture Module Status Message */
541
static int hf_cmp_status_msg_cm_uptime_ns;
542
static int hf_cmp_status_msg_cm_uptime_s;
543
static int hf_cmp_status_msg_gm_identity;
544
static int hf_cmp_status_msg_gm_clock_quality;
545
static int hf_cmp_status_msg_current_utc_offset;
546
static int hf_cmp_status_msg_time_source;
547
static int hf_cmp_status_msg_domain_num;
548
static int hf_cmp_status_msg_res;
549
static int hf_cmp_gptp_flags;
550
551
static int hf_cmp_gptp_flags_leap61;
552
static int hf_cmp_gptp_flags_leap59;
553
static int hf_cmp_gptp_flags_cur_utco_valid;
554
static int hf_cmp_gptp_flags_ptp_timescale;
555
static int hf_cmp_gptp_flags_time_traceable;
556
static int hf_cmp_gptp_flags_freq_traceable;
557
static int hf_cmp_gptp_flags_reserved;
558
559
static int hf_cmp_status_dev_desc_length;
560
static int hf_cmp_status_dev_desc;
561
static int hf_cmp_status_sn_length;
562
static int hf_cmp_status_sn;
563
static int hf_cmp_status_hw_ver_length;
564
static int hf_cmp_status_hw_ver;
565
static int hf_cmp_status_sw_ver_length;
566
static int hf_cmp_status_sw_ver;
567
static int hf_cmp_status_vendor_data_length;
568
static int hf_cmp_status_vendor_data;
569
570
/* Interface Status Message */
571
static int hf_cmp_iface_interface;
572
static int hf_cmp_iface_iface_id;
573
static int hf_cmp_iface_msg_total_rx;
574
static int hf_cmp_iface_msg_total_tx;
575
static int hf_cmp_iface_msg_dropped_rx;
576
static int hf_cmp_iface_msg_dropped_tx;
577
static int hf_cmp_iface_errs_total_rx;
578
static int hf_cmp_iface_errs_total_tx;
579
static int hf_cmp_iface_iface_type;
580
static int hf_cmp_iface_iface_status;
581
static int hf_cmp_iface_stream_id_cnt;
582
static int hf_cmp_iface_reserved;
583
584
static int hf_cmp_iface_feat;
585
586
static int hf_cmp_iface_feat_can_crr_err;
587
static int hf_cmp_iface_feat_can_ack_err;
588
static int hf_cmp_iface_feat_can_pas_ack;
589
static int hf_cmp_iface_feat_can_act_ack;
590
static int hf_cmp_iface_feat_can_ack_del_err;
591
static int hf_cmp_iface_feat_can_form_err;
592
static int hf_cmp_iface_feat_can_stuff_err;
593
static int hf_cmp_iface_feat_can_crc_del_err;
594
static int hf_cmp_iface_feat_can_eof_err;
595
static int hf_cmp_iface_feat_can_bit_err;
596
static int hf_cmp_iface_feat_can_r0;
597
static int hf_cmp_iface_feat_can_srr_dom;
598
static int hf_cmp_iface_feat_can_gen_err;
599
600
static int hf_cmp_iface_feat_canfd_crr_err;
601
static int hf_cmp_iface_feat_canfd_ack_err;
602
static int hf_cmp_iface_feat_canfd_pas_ack;
603
static int hf_cmp_iface_feat_canfd_act_ack;
604
static int hf_cmp_iface_feat_canfd_ack_del_err;
605
static int hf_cmp_iface_feat_canfd_form_err;
606
static int hf_cmp_iface_feat_canfd_stuff_err;
607
static int hf_cmp_iface_feat_canfd_crc_del_err;
608
static int hf_cmp_iface_feat_canfd_eof_err;
609
static int hf_cmp_iface_feat_canfd_bit_err;
610
static int hf_cmp_iface_feat_canfd_rsvd;
611
static int hf_cmp_iface_feat_canfd_srr_dom;
612
static int hf_cmp_iface_feat_canfd_brs;
613
static int hf_cmp_iface_feat_canfd_esi;
614
static int hf_cmp_iface_feat_canfd_gen_err;
615
616
static int hf_cmp_iface_feat_lin_checksum_err;
617
static int hf_cmp_iface_feat_lin_coll_err;
618
static int hf_cmp_iface_feat_lin_parity_err;
619
static int hf_cmp_iface_feat_lin_no_slave_resp_err;
620
static int hf_cmp_iface_feat_lin_sync_err;
621
static int hf_cmp_iface_feat_lin_framing_err;
622
static int hf_cmp_iface_feat_lin_short_dom_err;
623
static int hf_cmp_iface_feat_lin_long_dom_err;
624
static int hf_cmp_iface_feat_lin_wup;
625
626
static int hf_cmp_iface_feat_fr_crc_frame_err;
627
static int hf_cmp_iface_feat_fr_crc_header_err;
628
static int hf_cmp_iface_feat_fr_nf;
629
static int hf_cmp_iface_feat_fr_sf;
630
static int hf_cmp_iface_feat_fr_sync;
631
static int hf_cmp_iface_feat_fr_wus;
632
static int hf_cmp_iface_feat_fr_ppi;
633
static int hf_cmp_iface_feat_fr_cas;
634
static int hf_cmp_iface_feat_fr_channel;
635
636
static int hf_cmp_iface_feat_eth_fcs_err;
637
static int hf_cmp_iface_feat_eth_too_short;
638
static int hf_cmp_iface_feat_eth_tx_port_down;
639
static int hf_cmp_iface_feat_eth_collision;
640
static int hf_cmp_iface_feat_eth_too_long;
641
static int hf_cmp_iface_feat_eth_phy_err;
642
static int hf_cmp_iface_feat_eth_trunc;
643
static int hf_cmp_iface_feat_eth_fcs;
644
645
static int hf_cmp_iface_feat_10t1s_first_beacon;
646
static int hf_cmp_iface_feat_10t1s_mis_beacon;
647
static int hf_cmp_iface_feat_10t1s_sym_decode;
648
649
static int hf_cmp_iface_feat_link_err;
650
651
static int hf_cmp_iface_stream_ids;
652
static int hf_cmp_iface_stream_id;
653
static int hf_cmp_iface_vendor_data_len;
654
static int hf_cmp_iface_vendor_data;
655
656
/* Configuration Status Message */
657
static int hf_cmp_status_msg_config;
658
659
/* Data Lost Event Status Message */
660
static int hf_cmp_dataloss_data_sink_port;
661
static int hf_cmp_dataloss_device_id;
662
static int hf_cmp_dataloss_reserved;
663
static int hf_cmp_dataloss_stream_id;
664
static int hf_cmp_dataloss_last_ssq_value;
665
static int hf_cmp_dataloss_current_ssq_value;
666
667
/* Time Sync Lost Event Status Message */
668
static int hf_cmp_timeloss_port_nr;
669
static int hf_cmp_timeloss_device_id;
670
static int hf_cmp_timeloss_error_flags;
671
672
static int hf_cmp_timeloss_error_flags_ts;
673
static int hf_cmp_timeloss_error_flags_insync;
674
static int hf_cmp_timeloss_error_flags_delta;
675
static int hf_cmp_timeloss_error_flags_reserved;
676
677
/* Vendor Specific */
678
static int hf_cmp_status_msg_vendor_specific;
679
680
/* Protocol trees */
681
static int ett_asam_cmp;
682
static int ett_asam_cmp_header;
683
static int ett_asam_cmp_timestamp;
684
static int ett_asam_cmp_trans_opts;
685
static int ett_asam_cmp_common_flags;
686
static int ett_asam_cmp_payload;
687
static int ett_asam_cmp_payload_flags;
688
static int ett_asam_cmp_payload_data;
689
static int ett_asam_cmp_lin_pid;
690
static int ett_asam_cmp_can_id;
691
static int ett_asam_cmp_can_crc;
692
static int ett_asam_cmp_digital_sample;
693
static int ett_asam_cmp_uart_data;
694
static int ett_asam_cmp_analog_sample;
695
static int ett_asam_cmp_i2c_data_entry;
696
static int ett_asam_cmp_a2b_upstream_settings;
697
static int ett_asam_cmp_a2b_downstream_settings;
698
static int ett_asam_cmp_a2b_general_settings;
699
static int ett_asam_cmp_status_cm_flags;
700
static int ett_asam_cmp_status_cm_uptime;
701
static int ett_asam_cmp_status_timeloss_flags;
702
static int ett_asam_cmp_status_interface;
703
static int ett_asam_cmp_status_feature_support;
704
static int ett_asam_cmp_status_stream_ids;
705
706
/* General */
707
400
#define CMP_HEADER_LEN                         8
708
786
#define CMP_MSG_HEADER_LEN                    16
709
14
#define CMP_MSG_HEADER_LEN_TX                 24
710
711
/* CMP Message Type Names */
712
219
#define CMP_MSG_TYPE_CAP_DATA_MSG           0x01
713
38
#define CMP_MSG_TYPE_CTRL_MSG               0x02
714
160
#define CMP_MSG_TYPE_STATUS_MSG             0x03
715
18
#define CMP_MSG_TYPE_TX_DATA_MSG            0x04
716
64
#define CMP_MSG_TYPE_VENDOR                 0xFF
717
718
/* CMP Segmentation Flag Values */
719
#define CMP_SEG_UNSEGMENTED                 0x00
720
#define CMP_SEG_FIRST                       0x01
721
#define CMP_SEG_INTERMEDIARY                0x02
722
#define CMP_SEG_LAST                        0x03
723
724
/* CMP Data Message Payload Type Names */
725
0
#define CMP_DATA_MSG_INVALID                0x00
726
25
#define CMP_DATA_MSG_CAN                    0x01
727
22
#define CMP_DATA_MSG_CANFD                  0x02
728
9
#define CMP_DATA_MSG_LIN                    0x03
729
6
#define CMP_DATA_MSG_FLEXRAY                0x04
730
13
#define CMP_DATA_MSG_DIGITAL                0x05
731
57
#define CMP_DATA_MSG_UART_RS_232            0x06
732
29
#define CMP_DATA_MSG_ANALOG                 0x07
733
8
#define CMP_DATA_MSG_ETHERNET               0x08
734
0
#define CMP_DATA_MSG_SPI                    0x09
735
13
#define CMP_DATA_MSG_I2C                    0x0A
736
2
#define CMP_DATA_MSG_GIGEVISION             0x0B
737
2
#define CMP_DATA_MSG_MIPI_CSI2              0x0C
738
7
#define CMP_DATA_MSG_RAW_ETHERNET           0x0D
739
2
#define CMP_DATA_MSG_10BASE_T1S_SYMBOL      0x0E
740
1
#define CMP_DATA_MSG_A2B                    0x0F
741
4
#define CMP_DATA_MSG_LINK_STATE             0xFE
742
2
#define CMP_DATA_MSG_VENDOR_DATA_MSG        0xFF
743
744
/* CMP Digital Trigger Pattern Values */
745
#define CMP_T_PATTERN_FALLING               0x00
746
#define CMP_T_PATTERN_RISING                0x01
747
748
/* CMP UART Data Message DL Values */
749
#define CMP_UART_CL_5                       0x00
750
#define CMP_UART_CL_6                       0x01
751
19.2k
#define CMP_UART_CL_7                       0x02
752
2.74k
#define CMP_UART_CL_8                       0x03
753
#define CMP_UART_CL_9                       0x04
754
755
/* CMP Analog Data Message DT Values */
756
#define CMP_ANALOG_DATA_MSG_DL_16           0x00
757
#define CMP_ANALOG_DATA_MSG_DL_32           0x01
758
#define CMP_ANALOG_DATA_MSG_DL_RES1         0x02
759
#define CMP_ANALOG_DATA_MSG_DL_RES2         0x03
760
761
/* CMP Control Message Payload Type Names */
762
0
#define CMP_CTRL_MSG_INVALID                0x00
763
6
#define CMP_CTRL_MSG_DSR_CTRL_MSG           0x01
764
2
#define CMP_CTRL_MSG_USER_EVENT_CTRL_MSG    0xFE
765
2
#define CMP_CTRL_MSG_VENDOR_CTRL_MSG        0xFF
766
767
/* CMP Status Message Payload Type Names */
768
0
#define CMP_STATUS_MSG_INVALID              0x00
769
4
#define CMP_STATUS_MSG_CM_STAT_MSG          0x01
770
72
#define CMP_STATUS_MSG_IF_STAT_MSG          0x02
771
2
#define CMP_STATUS_MSG_CONF_STAT_MSG        0x03
772
1
#define CMP_STATUS_MSG_DLE_STAT_MSG         0x04
773
2
#define CMP_STATUS_MSG_TSLE_STAT_MSG        0x05
774
21
#define CMP_STATUS_MSG_VENDOR_STAT_MSG      0xFF
775
776
/* Interface Status Message Names */
777
#define CMP_STATUS_IFACE_DOWN_EN            0x00
778
#define CMP_STATUS_IFACE_UP_EN              0x01
779
#define CMP_STATUS_IFACE_DOWN_DIS           0x02
780
781
static const value_string msg_type_names[] = {
782
    {CMP_MSG_TYPE_CAP_DATA_MSG,             "Capture Data Message"},
783
    {CMP_MSG_TYPE_CTRL_MSG,                 "Control Message"},
784
    {CMP_MSG_TYPE_STATUS_MSG,               "Status Message"},
785
    {CMP_MSG_TYPE_TX_DATA_MSG,              "Transmit Data Message"},
786
    {CMP_MSG_TYPE_VENDOR,                   "Vendor-defined Message"},
787
    {0, NULL}
788
};
789
790
static const true_false_string timestamp_rel_abs = {
791
    "Relative Mode",
792
    "Absolute Mode"
793
};
794
795
static const value_string seg_flag_names[] = {
796
    {CMP_SEG_INTERMEDIARY,                  "Intermediary segment"},
797
    {CMP_SEG_FIRST,                         "First segment"},
798
    {CMP_SEG_LAST,                          "Last segment"},
799
    {CMP_SEG_UNSEGMENTED,                   "Unsegmented"},
800
    {0, NULL}
801
};
802
803
static const true_false_string interface_direction = {
804
    "Sending",
805
    "Receive"
806
};
807
808
static const value_string data_msg_type_names[] = {
809
    {CMP_DATA_MSG_INVALID,                  "Invalid"},
810
    {CMP_DATA_MSG_CAN,                      "CAN"},
811
    {CMP_DATA_MSG_CANFD,                    "CAN FD"},
812
    {CMP_DATA_MSG_LIN,                      "LIN"},
813
    {CMP_DATA_MSG_FLEXRAY,                  "FlexRay"},
814
    {CMP_DATA_MSG_DIGITAL,                  "Digital"},
815
    {CMP_DATA_MSG_UART_RS_232,              "UART/RS-232"},
816
    {CMP_DATA_MSG_ANALOG,                   "Analog"},
817
    {CMP_DATA_MSG_ETHERNET,                 "Ethernet"},
818
    {CMP_DATA_MSG_SPI,                      "SPI"},
819
    {CMP_DATA_MSG_I2C,                      "I2C"},
820
    {CMP_DATA_MSG_GIGEVISION,               "Gigevision"},
821
    {CMP_DATA_MSG_MIPI_CSI2,                "MIPI CSI-2"},
822
    {CMP_DATA_MSG_RAW_ETHERNET,             "Raw Ethernet"},
823
    {CMP_DATA_MSG_10BASE_T1S_SYMBOL,        "10BASE-T1S Symbol"},
824
    {CMP_DATA_MSG_A2B,                      "A2B"},
825
    {CMP_DATA_MSG_LINK_STATE,               "Link State"},
826
    {CMP_DATA_MSG_VENDOR_DATA_MSG,          "Vendor-specific"},
827
    {0, NULL}
828
};
829
830
static const true_false_string cmp_err_noerr = {
831
    "Error",
832
    "No Error"
833
};
834
835
static const true_false_string can_dom_rec = {
836
    "Dominant",
837
    "Recessive"
838
};
839
840
static const true_false_string can_rec_dom = {
841
    "Recessive",
842
    "Dominant"
843
};
844
845
static const true_false_string can_id_ide = {
846
    "29bit ID",
847
    "11bit ID"
848
};
849
850
static const true_false_string can_id_rtr = {
851
    "Remote Frame",
852
    "Data Frame"
853
};
854
855
static const true_false_string canfd_act_pas = {
856
    "Error active",
857
    "Error passive"
858
};
859
860
static const true_false_string flexray_leading_following = {
861
    "Leading",
862
    "Following"
863
};
864
865
static const true_false_string flexray_channel_b_a = {
866
    "B",
867
    "A"
868
};
869
870
static const value_string flexray_transmission_operations[] = {
871
    {0x00,                                  "Stop Sending"},
872
    {0x01,                                  "Send Once"},
873
    {0x02,                                  "Send Cyclically"},
874
    {0x08,                                  "Configuration"},
875
    {0x09,                                  "Start Node"},
876
    {0x0a,                                  "Stop Node"},
877
    {0x0b,                                  "Abort Node"},
878
    {0x00, NULL}
879
};
880
881
static const value_string digital_trigger_pattern[] = {
882
    {0,                                     "Falling edge"},
883
    {1,                                     "Rising edge"},
884
    {0, NULL}
885
};
886
887
static const value_string uart_cl_names[] = {
888
    {CMP_UART_CL_5,                         "5 Bits"},
889
    {CMP_UART_CL_6,                         "6 Bits"},
890
    {CMP_UART_CL_7,                         "7 Bits"},
891
    {CMP_UART_CL_8,                         "8 Bits"},
892
    {CMP_UART_CL_9,                         "9 Bits"},
893
    {0, NULL}
894
};
895
896
static const value_string analog_sample_dt[] = {
897
    {CMP_ANALOG_DATA_MSG_DL_16,             "A_INT16"},
898
    {CMP_ANALOG_DATA_MSG_DL_32,             "A_INT32"},
899
    {CMP_ANALOG_DATA_MSG_DL_RES1,           "Reserved"},
900
    {CMP_ANALOG_DATA_MSG_DL_RES2,           "Reserved"},
901
    {0, NULL}
902
};
903
904
/* Also see packet-tecmp.c */
905
6
#define CMP_ETH_RAW_PREAMBLE                0x55
906
0
#define CMP_ETH_RAW_SFD_ORIG                0xD5
907
#define CMP_ETH_RAW_SFD_SMD_V               0x07
908
#define CMP_ETH_RAW_SFD_SMD_R               0x19
909
#define CMP_ETH_RAW_SFD_SMD_S0              0xE6
910
#define CMP_ETH_RAW_SFD_SMD_S1              0x4C
911
#define CMP_ETH_RAW_SFD_SMD_S2              0x7F
912
#define CMP_ETH_RAW_SFD_SMD_S3              0xB3
913
#define CMP_ETH_RAW_SFD_SMD_C0              0x61
914
#define CMP_ETH_RAW_SFD_SMD_C1              0x52
915
#define CMP_ETH_RAW_SFD_SMD_C2              0x9E
916
#define CMP_ETH_RAW_SFD_SMD_C3              0x2A
917
918
static const value_string eth_raw_sfd[] = {
919
    {CMP_ETH_RAW_SFD_ORIG,                  "SFD/SMD-E"},
920
    {CMP_ETH_RAW_SFD_SMD_V,                 "SMD-V"},
921
    {CMP_ETH_RAW_SFD_SMD_R,                 "SMD-R"},
922
    {CMP_ETH_RAW_SFD_SMD_S0,                "SMD-S0"},
923
    {CMP_ETH_RAW_SFD_SMD_S1,                "SMD-S1"},
924
    {CMP_ETH_RAW_SFD_SMD_S2,                "SMD-S2"},
925
    {CMP_ETH_RAW_SFD_SMD_S3,                "SMD-S3"},
926
    {CMP_ETH_RAW_SFD_SMD_C0,                "SMD-C0"},
927
    {CMP_ETH_RAW_SFD_SMD_C1,                "SMD-C1"},
928
    {CMP_ETH_RAW_SFD_SMD_C2,                "SMD-C2"},
929
    {CMP_ETH_RAW_SFD_SMD_C3,                "SMD-C3"},
930
    {0, NULL}
931
};
932
933
static const true_false_string i2c_read_write = {
934
    "Read",
935
    "Write"
936
};
937
938
static const true_false_string i2c_addr_length = {
939
    "10 Bit Address",
940
    "7 Bit Address"
941
};
942
943
static const true_false_string i2c_nack_ack = {
944
    "NACK",
945
    "ACK"
946
};
947
948
static const true_false_string i2c_stop_repeated_start = {
949
    "Stop",
950
    "Repeated-Start"
951
};
952
953
static const true_false_string i2c_repeated_start_start = {
954
    "Repeated-Start",
955
    "Start"
956
};
957
958
static const true_false_string mipi_csi2_ecc_noecc = {
959
    "6-bit ECC",
960
    "No ECC"
961
};
962
963
static const true_false_string mipi_csi2_cmcounter_csicounter = {
964
    "Counter generated by Capture Module",
965
    "Counter extracted from MIPI CSI-2 data"
966
};
967
968
/*
969
 * Based on what is publicly available:
970
 *   https://elixir.bootlin.com/linux/v5.19.17/source/include/media/mipi-csi2.h
971
 *   https://www.nxp.com/docs/en/application-note/AN5305.pdf
972
 *   https://www.efinixinc.com/docs/mipi-csi2-rx-core-ug-v3.2.pdf
973
 *   https://introspect.ca/blog/mipi-cse-and-csi-2/
974
 *   https://www.macnica.co.jp/en/business/semiconductor/articles/lattice/142604/
975
 *   https://www.design-reuse.com/article/60991-generating-high-speed-csi2-video-by-an-fpga/
976
 *   https://www.ti.com/lit/ds/symlink/ds90ub954-q1.pdf
977
 *   https://bitsimnow.se/wp-content/uploads/2021/04/Data_Sheet_bitcsi2rx_rH.pdf
978
 */
979
980
18
#define MIPI_CSI2_DT_BITS           0x3F
981
#define MIPI_CSI2_DT_SHORT_START    0x00
982
2
#define MIPI_CSI2_DT_SHORT_END      0x0F
983
984
static const value_string mipi_csi2_data_type_names[] = {
985
    /* 0x00 - 0x07 Sync Short Packets */
986
    {MIPI_CSI2_DT_SHORT_START,              "Frame Start Code"},
987
    {0x01,                                  "Frame End Code"},
988
    {0x02,                                  "Line Start Code"},
989
    {0x03,                                  "Line End Code"},
990
    /* 0x08 - 0x0F Generic Short Packets */
991
    /* 0x10 - 0x17 Generic Long Packets */
992
    {0x10,                                  "Null"},
993
    {0x11,                                  "Blanking Data"},
994
    {0x12,                                  "Embedded 8-bit non-Image Data"},
995
    /* 0x18 - 0x1F YUV Data Long Packets */
996
    {0x18,                                  "YUV420 8-bit"},
997
    {0x19,                                  "YUV420 10-bit"},
998
    {0x1A,                                  "Legacy YUV420 8-bit"},
999
    {0x1C,                                  "YUV420 8-bit (CSPS)"},
1000
    {0x1D,                                  "YUV420 10-bit (CSPS)"},
1001
    {0x1E,                                  "YUV422 8-bit"},
1002
    {0x1F,                                  "YUV422 10-bit"},
1003
    /* 0x20 - 0x27 RGB Data Long Packets */
1004
    {0x20,                                  "RGB444"},
1005
    {0x21,                                  "RGB555"},
1006
    {0x22,                                  "RGB565"},
1007
    {0x23,                                  "RGB666"},
1008
    {0x24,                                  "RGB888"},
1009
    /* 0x28 - 0x2F RAW Data Long Packets */
1010
    {0x26,                                  "RAW24"},
1011
    {0x27,                                  "RAW28"},
1012
    {0x28,                                  "RAW6"},
1013
    {0x29,                                  "RAW7"},
1014
    {0x2A,                                  "RAW8"},
1015
    {0x2B,                                  "RAW10"},
1016
    {0x2C,                                  "RAW12"},
1017
    {0x2D,                                  "RAW14"},
1018
    {0x2E,                                  "RAW16"},
1019
    {0x2F,                                  "RAW20"},
1020
    /* 0x30 - 0x37 User Defined Long Packets */
1021
    {0x30,                                  "User Defined 8-bit Data Type 1"},
1022
    {0x31,                                  "User Defined 8-bit Data Type 2"},
1023
    {0x32,                                  "User Defined 8-bit Data Type 3"},
1024
    {0x33,                                  "User Defined 8-bit Data Type 4"},
1025
    {0x34,                                  "User Defined 8-bit Data Type 5"},
1026
    {0x35,                                  "User Defined 8-bit Data Type 6"},
1027
    {0x36,                                  "User Defined 8-bit Data Type 7"},
1028
    {0x37,                                  "User Defined 8-bit Data Type 8"},
1029
    /* 0x38 - 0x3F Reserved */
1030
    {0x3E,                                  "SEP (MIPI CSE)"},
1031
    {0, NULL}
1032
};
1033
1034
static const true_false_string eth_10baset1s_firstbeacon_notfirstbeacon = {
1035
    "First Beacon",
1036
    "Not First Beacon"
1037
};
1038
1039
/* IEEE 802.3-2022 Table 147-1: 4B/5B Encoding */
1040
static const value_string eth_10baset1s_symbol_names[] = {
1041
    {0x1F,                                  "SILENCE"},         /* I: 11111 */
1042
    {0x18,                                  "SYNC / COMMIT"},   /* J: 11000 */
1043
    {0x11,                                  "ESDERR"},          /* K: 10001 */
1044
    {0x0D,                                  "ESD / HB"},        /* T: 01101 */
1045
    {0x07,                                  "ESDOK / ESDBRS"},  /* R: 00111 */
1046
    {0x04,                                  "SSD"},             /* H: 00100 */
1047
    {0x08,                                  "BEACON"},          /* N: 01000 */
1048
    {0x19,                                  "ESDJAB"},          /* I: 11001 */
1049
    {0, NULL}
1050
};
1051
1052
static const true_false_string a2b_switch_closed_open = {
1053
    "Switch completed closing",
1054
    "Switch is open or has not finished closing"
1055
};
1056
1057
static const true_false_string a2b_cable_fault_no_fault = {
1058
    "Cable fault detected",
1059
    "Cable fault not detected"
1060
};
1061
1062
static const value_string a2b_fault_code_names[] = {
1063
    {0x0,                                   "No fault detected"},
1064
    {0x1,                                   "Cable terminal shorted to GND"},
1065
    {0x2,                                   "Cable terminal shorted to VBAT"},
1066
    {0x3,                                   "Cable terminals shorted together"},
1067
    {0x4,                                   "Cable disconnected or open circuit"},
1068
    {0x5,                                   "Cable is reverse connected"},
1069
    {0x6,                                   "Reserved"},
1070
    {0x7,                                   "Undetermined fault"},
1071
    {0, NULL}
1072
};
1073
1074
static const true_false_string a2b_cable_fault_not_localized_localized = {
1075
    "Cable fault not localized",
1076
    "Cable fault localized"
1077
};
1078
1079
static const true_false_string a2b_data_decode_error_no_error = {
1080
    "Data decoding error detected",
1081
    "No data decoding error"
1082
};
1083
1084
static const true_false_string a2b_crc_error_no_error = {
1085
    "CRC error detected",
1086
    "No CRC error"
1087
};
1088
1089
static const true_false_string a2b_data_parity_error_no_error = {
1090
    "Data parity error detected",
1091
    "No data parity error"
1092
};
1093
1094
static const true_false_string a2b_downstream_power_switch_error_no_error = {
1095
    "Downstream power switch error",
1096
    "No power error"
1097
};
1098
1099
static const true_false_string a2b_bit_error_count_error_no_error = {
1100
    "BEC error pending",
1101
    "No BEC error pending"
1102
};
1103
1104
static const true_false_string a2b_srf_miss_error_no_error = {
1105
    "SRF miss error detected",
1106
    "No SRF miss error"
1107
};
1108
1109
static const true_false_string a2b_srf_crc_error_no_error = {
1110
    "SRF CRC error detected",
1111
    "No SRF CRC error"
1112
};
1113
1114
static const true_false_string a2b_iocrc_error_no_error = {
1115
    "Interrupt Frame CRC error detected",
1116
    "No error"
1117
};
1118
1119
static const true_false_string a2b_i2c_transaction_error_no_error = {
1120
    "An I2C access error occurred",
1121
    "No error"
1122
};
1123
1124
static const true_false_string a2b_fmt_alternate_normal = {
1125
    "Alternate data slot format",
1126
    "Normal data slot format"
1127
};
1128
1129
static const value_string a2b_slot_sizes[] = {
1130
    {0x00,                                  "8 bits"},
1131
    {0x01,                                  "12 bits"},
1132
    {0x02,                                  "16 bits"},
1133
    {0x03,                                  "20 bits"},
1134
    {0x04,                                  "24 bits"},
1135
    {0x05,                                  "28 bits"},
1136
    {0x06,                                  "32 bits"},
1137
    {0x07,                                  "Reserved"},
1138
    {0, NULL}
1139
};
1140
1141
static const val64_string a2b_tdmmode_values[] = {
1142
    {0x00,                                  "TDM2"},
1143
    {0x01,                                  "TDM4"},
1144
    {0x02,                                  "TDM8"},
1145
    {0x03,                                  "TDM12"},
1146
    {0x04,                                  "TDM16"},
1147
    {0x05,                                  "TDM20"},
1148
    {0x06,                                  "TDM24"},
1149
    {0x07,                                  "TDM32"},
1150
    {0, NULL}
1151
};
1152
1153
static const true_false_string a2b_tdmss_16_32 = {
1154
    "32bit",
1155
    "16bit"
1156
};
1157
1158
static const val64_string a2b_blckrate_values[] = {
1159
    {0x00,                                  "BCLK frequency as configured in A2B_I2SGCFG"},
1160
    {0x01,                                  "SYNC frequency x 2048"},
1161
    {0x02,                                  "SYNC frequency x 4096"},
1162
    {0x04,                                  "SFF frequency x 64"},
1163
    {0x05,                                  "SFF frequency x 128"},
1164
    {0x06,                                  "SFF frequency x 256"},
1165
    {0, NULL}
1166
};
1167
1168
static const val64_string a2b_i2srate_values[] = {
1169
    {0x00,                                  "SFF x 1"},
1170
    {0x01,                                  "SFF / 2"},
1171
    {0x02,                                  "SFF / 4"},
1172
    {0x03,                                  "SFF / A2B_I2SRRATE.RRDIV"},
1173
    {0x05,                                  "SFF x 2"},
1174
    {0x06,                                  "SFF x 4"},
1175
    {0, NULL}
1176
};
1177
1178
static const val64_string a2b_rrdiv_values[] = {
1179
    {1,                                     "Superframe frequency (SFF)"},
1180
    {2,                                     "SFF / 2"},
1181
    {4,                                     "SFF / 4"},
1182
    {8,                                     "SFF / 8"},
1183
    {12,                                    "SFF / 12"},
1184
    {16,                                    "SFF / 16"},
1185
    {20,                                    "SFF / 20"},
1186
    {24,                                    "SFF / 24"},
1187
    {28,                                    "SFF / 28"},
1188
    {32,                                    "SFF / 32"},
1189
    {0, NULL}
1190
};
1191
1192
static const val64_string a2b_rrsoffset_values[] = {
1193
    {0,                                     "No Offset"},
1194
    {1,                                     "1 Superframe Earlier"},
1195
    {2,                                     "2 Superframes Earlier"},
1196
    {3,                                     "3 Superframes Earlier"},
1197
    {0, NULL}
1198
};
1199
1200
static const true_false_string a2b_raw_capturing = {
1201
    "Raw A2B Busline was captured",
1202
    "I²S/TDM representation was captured"
1203
};
1204
1205
static const value_string link_state_names[] = {
1206
    {0x00,                                  "Down"},
1207
    {0x01,                                  "Up"},
1208
    {0x02,                                  "Disabled"},
1209
    {0x03,                                  "Testing"},
1210
    {0x04,                                  "Unknown"},
1211
    {0x05,                                  "Dormant"},
1212
    {0x06,                                  "NotPresent"},
1213
    {0, NULL}
1214
};
1215
1216
static const value_string ctrl_msg_type_names[] = {
1217
    {CMP_CTRL_MSG_INVALID,                  "Invalid"},
1218
    {CMP_CTRL_MSG_DSR_CTRL_MSG,             "Data Sink ready to receive Control Message"},
1219
    {CMP_CTRL_MSG_USER_EVENT_CTRL_MSG,      "User Event Message"},
1220
    {CMP_CTRL_MSG_VENDOR_CTRL_MSG,          "Vendor-specific Control Message"},
1221
    {0, NULL}
1222
};
1223
1224
static const value_string status_msg_type_names[] = {
1225
    {CMP_STATUS_MSG_INVALID,                "Invalid"},
1226
    {CMP_STATUS_MSG_CM_STAT_MSG,            "Capture Module Status"},
1227
    {CMP_STATUS_MSG_IF_STAT_MSG,            "Interface Status"},
1228
    {CMP_STATUS_MSG_CONF_STAT_MSG,          "Configuration Status"},
1229
    {CMP_STATUS_MSG_DLE_STAT_MSG,           "Data Lost Status"},
1230
    {CMP_STATUS_MSG_TSLE_STAT_MSG,          "Time Sync Lost Status"},
1231
    {CMP_STATUS_MSG_VENDOR_STAT_MSG,        "Vendor-specific Status Message"},
1232
    {0, NULL}
1233
};
1234
1235
static const value_string interface_status_names[] = {
1236
    {CMP_STATUS_IFACE_DOWN_EN,              "Down and enabled"},
1237
    {CMP_STATUS_IFACE_UP_EN,                "Up and enabled"},
1238
    {CMP_STATUS_IFACE_DOWN_DIS,             "Down and disabled"},
1239
    {0, NULL}
1240
};
1241
1242
/* As defined by the ASAM Vendor ID registry for POD and CMP */
1243
#define CMP_VENDOR_ID_AVL_LIST              0x0006
1244
#define CMP_VENDOR_DSPACE                   0x000b
1245
#define CMP_VENDOR_ETAS                     0x000c
1246
#define CMP_VENDOR_BOSCH                    0x0027
1247
#define CMP_VENDOR_VECTOR                   0x002d
1248
#define CMP_VENDOR_CONTINENTAL              0x003c
1249
#define CMP_VENDOR_MK                       0x003e
1250
#define CMP_VENDOR_ID_ACCURATE              0x004a
1251
#define CMP_VENDOR_RA                       0x006c
1252
#define CMP_VENDOR_X2E                      0x00ca
1253
#define CMP_VENDOR_INTREPIDCS               0x00f0
1254
#define CMP_VENDOR_ID_BPLUS                 0x010f
1255
#define CMP_VENDOR_VIGEM                    0x012a
1256
#define CMP_VENDOR_TECHNICA                 0x019c
1257
#define CMP_VENDOR_ID_AED_ENG               0x0241
1258
1259
/* As defined by the ASAM Vendor ID registry for POD and CMP */
1260
static const value_string vendor_ids[] = {
1261
    {CMP_VENDOR_ID_ACCURATE,                "Accurate Technologies Inc."},
1262
    {CMP_VENDOR_ID_AED_ENG,                 "AED Engineering GmbH"},
1263
    {CMP_VENDOR_ID_AVL_LIST,                "AVL List GmbH"},
1264
    {CMP_VENDOR_ID_BPLUS,                   "b-plus GmbH"},
1265
    {CMP_VENDOR_CONTINENTAL,                "Continental AG"},
1266
    {CMP_VENDOR_DSPACE,                     "dSPACE GmbH"},
1267
    {CMP_VENDOR_ETAS,                       "ETAS GmbH"},
1268
    {CMP_VENDOR_INTREPIDCS,                 "Intrepid Control Systems, Inc."},
1269
    {CMP_VENDOR_MK,                         "M&K MeĂź- und Kommunikationstechnik GmbH"},
1270
    {CMP_VENDOR_RA,                         "RA Consulting GmbH"},
1271
    {CMP_VENDOR_BOSCH,                      "Robert Bosch GmbH"},
1272
    {CMP_VENDOR_TECHNICA,                   "Technica Engineering GmbH"},
1273
    {CMP_VENDOR_VECTOR,                     "Vector Informatik GmbH"},
1274
    {CMP_VENDOR_VIGEM,                      "ViGEM GmbH"},
1275
    {CMP_VENDOR_X2E,                        "X2E GmbH"},
1276
    {0, NULL}
1277
};
1278
1279
static const value_string analog_units[] = {
1280
    {0x01, "s"},
1281
    {0x02, "m"},
1282
    {0x03, "kg"},
1283
    {0x04, "A"},
1284
    {0x05, "K"},
1285
    {0x06, "mol"},
1286
    {0x07, "cd"},
1287
    {0x08, "Hz"},
1288
    {0x09, "rad"},
1289
    {0x0a, "sr"},
1290
    {0x0b, "N"},
1291
    {0x0c, "Pa"},
1292
    {0x0d, "J"},
1293
    {0x0e, "W"},
1294
    {0x0f, "C"},
1295
    {0x10, "V"},
1296
    {0x11, "F"},
1297
    {0x12, "Ω"},
1298
    {0x13, "S"},
1299
    {0x14, "Wb"},
1300
    {0x15, "T"},
1301
    {0x16, "H"},
1302
    {0x17, "°C"},
1303
    {0x18, "lm"},
1304
    {0x19, "lx"},
1305
    {0x1A, "Bq"},
1306
    {0x1B, "Gy"},
1307
    {0x1C, "Sv"},
1308
    {0x1D, "kat"},
1309
    {0x1E, "m/s"},
1310
    {0x1F, "m/s2"},
1311
    {0x20, "m/s3"},
1312
    {0x21, "m/s4"},
1313
    {0x22, "rad/s"},
1314
    {0x23, "rad/s2"},
1315
    {0x24, "Hz/s"},
1316
    {0x25, "m3/s"},
1317
    {0x26, "m2"},
1318
    {0x27, "m3"},
1319
    {0x28, "N s"},
1320
    {0x29, "N m s"},
1321
    {0x2A, "N m"},
1322
    {0x2B, "kg/m2"},
1323
    {0x2C, "kg/m3"},
1324
    {0x2D, "m3/kg"},
1325
    {0x2E, "J s"},
1326
    {0x2F, "J/kg"},
1327
    {0x30, "J/m3"},
1328
    {0x31, "N/m"},
1329
    {0x32, "W/m2"},
1330
    {0x33, "m2/s"},
1331
    {0x34, "Pa s"},
1332
    {0x35, "kg/s"},
1333
    {0x36, "W/(sr m2)"},
1334
    {0x37, "Gy/s"},
1335
    {0x38, "m/m3"},
1336
    {0x39, "W/m3"},
1337
    {0x3A, "J/(m2 s)"},
1338
    {0x3B, "kg m2"},
1339
    {0x3C, "W/sr"},
1340
    {0x3D, "mol/m3"},
1341
    {0x3E, "m3/mol"},
1342
    {0x3F, "J/(mol K)"},
1343
    {0x40, "J/mol"},
1344
    {0x41, "mol/kg"},
1345
    {0x42, "kg/mol"},
1346
    {0x45, "C/m3"},
1347
    {0x46, "A/m2"},
1348
    {0x47, "S/m"},
1349
    {0x48, "F/m"},
1350
    {0x49, "H/m"},
1351
    {0x4A, "V/m"},
1352
    {0x4B, "A/m"},
1353
    {0x4C, "C/Kg"},
1354
    {0x4D, "J/T"},
1355
    {0x4E, "lm s"},
1356
    {0x4F, "lx s"},
1357
    {0x50, "cd/m2"},
1358
    {0x51, "lm/W"},
1359
    {0x52, "J/K"},
1360
    {0x53, "J/(K kg)"},
1361
    {0x54, "W/(m K)"},
1362
    {0, NULL}
1363
};
1364
1365
/********* UATs *********/
1366
1367
typedef struct _generic_one_id_string {
1368
    unsigned   id;
1369
    char   *name;
1370
} generic_one_id_string_t;
1371
1372
/* Interface UAT */
1373
typedef struct _interface_config {
1374
    unsigned  id;
1375
    unsigned  bus_id;
1376
    char     *name;
1377
} interface_config_t;
1378
1379
/* Devices */
1380
16
#define DATAFILE_ASAM_CMP_DEVICES_IDS "ASAM_CMP_devices"
1381
1382
static GHashTable *data_asam_cmp_devices;
1383
static generic_one_id_string_t *asam_cmp_devices;
1384
static unsigned asam_cmp_devices_num;
1385
1386
0
UAT_HEX_CB_DEF(asam_cmp_devices, id, generic_one_id_string_t)
Unexecuted instantiation: packet-asam-cmp.c:asam_cmp_devices_id_set_cb
Unexecuted instantiation: packet-asam-cmp.c:asam_cmp_devices_id_tostr_cb
1387
0
UAT_CSTRING_CB_DEF(asam_cmp_devices, name, generic_one_id_string_t)
1388
1389
/* Interfaces */
1390
16
#define DATAFILE_ASAM_CMP_IFACE_IDS "ASAM_CMP_interfaces"
1391
1392
static GHashTable *data_asam_cmp_interfaces;
1393
static interface_config_t *asam_cmp_interfaces;
1394
static unsigned asam_cmp_interface_num;
1395
1396
0
UAT_HEX_CB_DEF(asam_cmp_interfaces, id, interface_config_t)
Unexecuted instantiation: packet-asam-cmp.c:asam_cmp_interfaces_id_set_cb
Unexecuted instantiation: packet-asam-cmp.c:asam_cmp_interfaces_id_tostr_cb
1397
0
UAT_CSTRING_CB_DEF(asam_cmp_interfaces, name, interface_config_t)
1398
0
UAT_HEX_CB_DEF(asam_cmp_interfaces, bus_id, interface_config_t)
Unexecuted instantiation: packet-asam-cmp.c:asam_cmp_interfaces_bus_id_set_cb
Unexecuted instantiation: packet-asam-cmp.c:asam_cmp_interfaces_bus_id_tostr_cb
1399
1400
/*** expert info items ***/
1401
static expert_field ei_asam_cmp_length_mismatch;
1402
static expert_field ei_asam_cmp_unsupported_crc_not_zero;
1403
1404
/* ID -> Name */
1405
static void *
1406
0
copy_generic_one_id_string_cb(void *n, const void *o, size_t size _U_) {
1407
0
    generic_one_id_string_t *new_rec = (generic_one_id_string_t *)n;
1408
0
    const generic_one_id_string_t *old_rec = (const generic_one_id_string_t *)o;
1409
1410
0
    new_rec->name = g_strdup(old_rec->name);
1411
0
    new_rec->id = old_rec->id;
1412
0
    return new_rec;
1413
0
}
1414
1415
static bool
1416
0
update_generic_one_identifier_16bit(void *r, char **err) {
1417
0
    generic_one_id_string_t *rec = (generic_one_id_string_t *)r;
1418
1419
0
    if (rec->id > 0xffff) {
1420
0
        *err = ws_strdup_printf("We currently only support 16 bit identifiers (ID: %i  Name: %s)", rec->id, rec->name);
1421
0
        return false;
1422
0
    }
1423
1424
0
    if (rec->name == NULL || rec->name[0] == 0) {
1425
0
        *err = g_strdup("Name cannot be empty");
1426
0
        return false;
1427
0
    }
1428
1429
0
    return true;
1430
0
}
1431
1432
static void
1433
0
free_generic_one_id_string_cb(void *r) {
1434
0
    generic_one_id_string_t *rec = (generic_one_id_string_t *)r;
1435
    /* freeing result of g_strdup */
1436
0
    g_free(rec->name);
1437
0
    rec->name = NULL;
1438
0
}
1439
1440
static char *
1441
399
ht_lookup_device_name(uint16_t device_id) {
1442
399
    if (data_asam_cmp_devices == NULL) {
1443
0
        return NULL;
1444
0
    }
1445
1446
399
    return g_hash_table_lookup(data_asam_cmp_devices, GUINT_TO_POINTER(device_id));
1447
399
}
1448
1449
/* ID -> ID, Name */
1450
static void *
1451
0
copy_interface_config_cb(void *n, const void *o, size_t size _U_) {
1452
0
    interface_config_t *new_rec = (interface_config_t *)n;
1453
0
    const interface_config_t *old_rec = (const interface_config_t *)o;
1454
1455
0
    new_rec->id = old_rec->id;
1456
0
    new_rec->name = g_strdup(old_rec->name);
1457
0
    new_rec->bus_id = old_rec->bus_id;
1458
0
    return new_rec;
1459
0
}
1460
1461
static bool
1462
0
update_interface_config(void *r, char **err) {
1463
0
    interface_config_t *rec = (interface_config_t *)r;
1464
1465
0
    if (rec->id > 0xffffffff) {
1466
0
        *err = ws_strdup_printf("We currently only support 32 bit identifiers (ID: %i  Name: %s)", rec->id, rec->name);
1467
0
        return false;
1468
0
    }
1469
1470
0
    if (rec->name == NULL || rec->name[0] == 0) {
1471
0
        *err = g_strdup("Name cannot be empty");
1472
0
        return false;
1473
0
    }
1474
1475
0
    if (rec->bus_id > 0xffff) {
1476
0
        *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);
1477
0
        return false;
1478
0
    }
1479
1480
0
    return true;
1481
0
}
1482
1483
static void
1484
0
free_interface_config_cb(void *r) {
1485
0
    interface_config_t *rec = (interface_config_t *)r;
1486
    /* freeing result of g_strdup */
1487
0
    g_free(rec->name);
1488
0
    rec->name = NULL;
1489
0
}
1490
1491
static interface_config_t *
1492
310
ht_lookup_interface(unsigned int identifier) {
1493
310
    if (data_asam_cmp_interfaces == NULL) {
1494
0
        return NULL;
1495
0
    }
1496
1497
310
    return g_hash_table_lookup(data_asam_cmp_interfaces, GUINT_TO_POINTER(identifier));
1498
310
}
1499
1500
1501
static char *
1502
289
ht_interface_config_to_string(unsigned int identifier) {
1503
289
    interface_config_t *tmp = ht_lookup_interface(identifier);
1504
289
    if (tmp == NULL) {
1505
289
        return NULL;
1506
289
    }
1507
1508
0
    return tmp->name;
1509
289
}
1510
1511
static uint16_t
1512
21
ht_interface_config_to_bus_id(unsigned int identifier) {
1513
21
    interface_config_t *tmp = ht_lookup_interface(identifier);
1514
21
    if (tmp == NULL) {
1515
        /* 0 means basically any or none */
1516
21
        return 0;
1517
21
    }
1518
1519
0
    return (uint16_t)tmp->bus_id;
1520
21
}
1521
1522
static void
1523
16
reset_asam_cmp_devices_cb(void) {
1524
    /* destroy old hash table, if it exists */
1525
16
    if (data_asam_cmp_devices) {
1526
0
        g_hash_table_destroy(data_asam_cmp_devices);
1527
0
        data_asam_cmp_devices = NULL;
1528
0
    }
1529
16
}
1530
1531
static void
1532
16
post_update_asam_cmp_devices_cb(void) {
1533
    /* destroy old hash table, if it exists */
1534
16
    reset_asam_cmp_devices_cb();
1535
1536
    /* create new hash table */
1537
16
    data_asam_cmp_devices = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL);
1538
1539
16
    for (unsigned i = 0; i < asam_cmp_devices_num; i++) {
1540
0
        g_hash_table_insert(data_asam_cmp_devices, GUINT_TO_POINTER(asam_cmp_devices[i].id), asam_cmp_devices[i].name);
1541
0
    }
1542
16
}
1543
1544
static void
1545
16
reset_interface_config_cb(void) {
1546
    /* destroy old hash table, if it exists */
1547
16
    if (data_asam_cmp_interfaces) {
1548
0
        g_hash_table_destroy(data_asam_cmp_interfaces);
1549
0
        data_asam_cmp_interfaces = NULL;
1550
0
    }
1551
16
}
1552
1553
static void
1554
16
post_update_interface_config_cb(void) {
1555
    /* destroy old hash table, if it exists */
1556
16
    reset_interface_config_cb();
1557
1558
    /* create new hash table */
1559
16
    data_asam_cmp_interfaces = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL);
1560
1561
16
    for (unsigned i = 0; i < asam_cmp_interface_num; i++) {
1562
0
        g_hash_table_insert(data_asam_cmp_interfaces, GUINT_TO_POINTER(asam_cmp_interfaces[i].id), &asam_cmp_interfaces[i]);
1563
0
    }
1564
16
}
1565
1566
static void
1567
399
add_device_id_text(proto_item *ti, uint16_t device_id) {
1568
399
    const char *descr = ht_lookup_device_name(device_id);
1569
1570
399
    if (descr != NULL) {
1571
0
        proto_item_append_text(ti, " (%s)", descr);
1572
0
    }
1573
399
}
1574
1575
static void
1576
222
add_interface_id_text(proto_item *ti, uint32_t interface_id) {
1577
222
    const char *descr = ht_interface_config_to_string(interface_id);
1578
1579
222
    if (descr != NULL) {
1580
0
        proto_item_append_text(ti, " (%s)", descr);
1581
0
    }
1582
222
}
1583
1584
static uint32_t
1585
24
dissect_asam_cmp_data_msg_can(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned interface_id, bool tx) {
1586
24
    uint32_t offset = 0;
1587
1588
24
    static int * const asam_cmp_can_flags_cap[] = {
1589
24
        &hf_cmp_can_flag_reserved,
1590
24
        &hf_cmp_can_flag_srr_dom,
1591
24
        &hf_cmp_can_flag_r0,
1592
24
        &hf_cmp_can_flag_bit_err,
1593
24
        &hf_cmp_can_flag_eof_err,
1594
24
        &hf_cmp_can_flag_crc_del_err,
1595
24
        &hf_cmp_can_flag_stuff_err,
1596
24
        &hf_cmp_can_flag_form_err,
1597
24
        &hf_cmp_can_flag_ack_del_err,
1598
24
        &hf_cmp_can_flag_active_ack_err,
1599
24
        &hf_cmp_can_flag_passive_ack_err,
1600
24
        &hf_cmp_can_flag_ack_err,
1601
24
        &hf_cmp_can_flag_crc_err,
1602
24
        NULL
1603
24
    };
1604
1605
24
    static int * const asam_cmp_can_flags_tx[] = {
1606
24
        &hf_cmp_can_flag_reserved_tx,
1607
24
        &hf_cmp_can_flag_gen_err,
1608
24
        &hf_cmp_can_flag_reserved_2000,
1609
24
        &hf_cmp_can_flag_reserved_1000,
1610
24
        &hf_cmp_can_flag_srr_dom,
1611
24
        &hf_cmp_can_flag_r0,
1612
24
        &hf_cmp_can_flag_bit_err,
1613
24
        &hf_cmp_can_flag_eof_err,
1614
24
        &hf_cmp_can_flag_crc_del_err,
1615
24
        &hf_cmp_can_flag_stuff_err,
1616
24
        &hf_cmp_can_flag_form_err,
1617
24
        &hf_cmp_can_flag_ack_del_err,
1618
24
        &hf_cmp_can_flag_reserved_0008,
1619
24
        &hf_cmp_can_flag_reserved_0004,
1620
24
        &hf_cmp_can_flag_ack_err,
1621
24
        &hf_cmp_can_flag_crc_err,
1622
24
        NULL
1623
24
    };
1624
1625
24
    static int * const asam_cmp_can_id_field_11bit[] = {
1626
24
        &hf_cmp_can_id_ide,
1627
24
        &hf_cmp_can_id_rtr,
1628
24
        &hf_cmp_can_id_err,
1629
24
        &hf_cmp_can_id_11bit,
1630
24
        NULL
1631
24
    };
1632
1633
24
    static int * const asam_cmp_can_id_field_11bit_old[] = {
1634
24
        &hf_cmp_can_id_ide,
1635
24
        &hf_cmp_can_id_rtr,
1636
24
        &hf_cmp_can_id_err,
1637
24
        &hf_cmp_can_id_11bit_old,
1638
24
        NULL
1639
24
    };
1640
1641
24
    static int * const asam_cmp_can_id_field_29bit[] = {
1642
24
        &hf_cmp_can_id_ide,
1643
24
        &hf_cmp_can_id_rtr,
1644
24
        &hf_cmp_can_id_err,
1645
24
        &hf_cmp_can_id_29bit,
1646
24
        NULL
1647
24
    };
1648
1649
24
    static int * const asam_cmp_can_crc_field[] = {
1650
24
        &hf_cmp_can_crc_crc_support,
1651
24
        &hf_cmp_can_crc_res,
1652
24
        &hf_cmp_can_crc_crc,
1653
24
        NULL
1654
24
    };
1655
1656
24
    uint16_t can_flags = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
1657
24
    if (tx) {
1658
2
        proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_can_flags, ett_asam_cmp_payload_flags, asam_cmp_can_flags_tx, ENC_BIG_ENDIAN);
1659
22
    } else {
1660
22
        proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_can_flags, ett_asam_cmp_payload_flags, asam_cmp_can_flags_cap, ENC_BIG_ENDIAN);
1661
22
    }
1662
24
    offset += 2;
1663
1664
24
    proto_tree_add_item(tree, hf_cmp_can_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1665
24
    offset += 2;
1666
1667
24
    uint32_t can_id_field = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1668
24
    bool can_id_29bit = (can_id_field & CMP_CAN_ID_IDE) == CMP_CAN_ID_IDE;
1669
24
    uint32_t can_id = 0;
1670
24
    if (can_id_29bit) {
1671
4
        proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_cmp_can_id, ett_asam_cmp_can_id, asam_cmp_can_id_field_29bit, ENC_BIG_ENDIAN, BMT_NO_FALSE);
1672
4
        can_id = can_id_field & (CMP_CAN_ID_29BIT_MASK | CMP_CAN_ID_RTR | CMP_CAN_ID_IDE);
1673
20
    } else {
1674
20
        if (old_11bit_canid_encoding) {
1675
0
            proto_tree_add_bitmask_with_flags(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);
1676
0
            can_id = can_id_field & (CMP_CAN_ID_RTR | CMP_CAN_ID_IDE | CMP_CAN_ID_11BIT_MASK_OLD);
1677
20
        } else {
1678
20
            proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_cmp_can_id, ett_asam_cmp_can_id, asam_cmp_can_id_field_11bit, ENC_BIG_ENDIAN, BMT_NO_FALSE);
1679
20
            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);
1680
20
        }
1681
20
    }
1682
24
    offset += 4;
1683
1684
24
    uint64_t tmp64;
1685
24
    proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_cmp_can_crc, ett_asam_cmp_can_crc, asam_cmp_can_crc_field, ENC_BIG_ENDIAN, BMT_NO_FALSE, &tmp64);
1686
24
    if ((tmp64 & CMP_CAN_CRC_CRC_SUPP) == 0 && (tmp64 & CMP_CAN_CRC_CRC) != 0) {
1687
13
        proto_tree_add_expert(tree, pinfo, &ei_asam_cmp_unsupported_crc_not_zero, tvb, offset, 4);
1688
13
    }
1689
24
    offset += 4;
1690
1691
24
    uint32_t err_pos = 0;
1692
24
    proto_tree_add_item_ret_uint(tree, hf_cmp_can_err_pos, tvb, offset, 2, ENC_BIG_ENDIAN, &err_pos);
1693
24
    offset += 2;
1694
1695
24
    proto_tree_add_item(tree, hf_cmp_can_dlc, tvb, offset, 1, ENC_NA);
1696
24
    offset += 1;
1697
1698
24
    uint32_t msg_payload_type_length;
1699
24
    proto_tree_add_item_ret_uint(tree, hf_cmp_can_data_len, tvb, offset, 1, ENC_NA, &msg_payload_type_length);
1700
24
    offset += 1;
1701
1702
24
    if (msg_payload_type_length > 0) {
1703
9
        tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, msg_payload_type_length);
1704
1705
9
        if ((can_flags & CMP_CAN_FLAGS_ERRORS) != 0) {
1706
4
            can_id = can_id | CAN_ERR_FLAG;
1707
4
        }
1708
1709
9
        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) };
1710
9
        if (!socketcan_call_subdissectors(sub_tvb, pinfo, tree, &can_info, heuristic_first)) {
1711
7
            call_data_dissector(sub_tvb, pinfo, tree);
1712
7
        }
1713
1714
9
        offset += msg_payload_type_length;
1715
9
    }
1716
1717
24
    return offset;
1718
24
}
1719
1720
static uint32_t
1721
9
dissect_asam_cmp_data_msg_canfd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned interface_id, bool tx) {
1722
9
    uint32_t offset = 0;
1723
1724
9
    static int * const asam_cmp_canfd_flags_cap[] = {
1725
9
        &hf_cmp_canfd_flag_reserved,
1726
9
        &hf_cmp_canfd_flag_esi,
1727
9
        &hf_cmp_canfd_flag_brs,
1728
9
        &hf_cmp_canfd_flag_srr_dom,
1729
9
        &hf_cmp_canfd_flag_res,
1730
9
        &hf_cmp_canfd_flag_bit_err,
1731
9
        &hf_cmp_canfd_flag_eof_err,
1732
9
        &hf_cmp_canfd_flag_crc_del_err,
1733
9
        &hf_cmp_canfd_flag_stuff_err,
1734
9
        &hf_cmp_canfd_flag_form_err,
1735
9
        &hf_cmp_canfd_flag_ack_del_err,
1736
9
        &hf_cmp_canfd_flag_active_ack_err,
1737
9
        &hf_cmp_canfd_flag_passive_ack_err,
1738
9
        &hf_cmp_canfd_flag_ack_err,
1739
9
        &hf_cmp_canfd_flag_crc_err,
1740
9
        NULL
1741
9
    };
1742
1743
9
    static int * const asam_cmp_canfd_flags_tx[] = {
1744
9
        &hf_cmp_canfd_flag_reserved_tx,
1745
9
        &hf_cmp_canfd_flag_gen_err,
1746
9
        &hf_cmp_canfd_flag_esi,
1747
9
        &hf_cmp_canfd_flag_brs,
1748
9
        &hf_cmp_canfd_flag_srr_dom,
1749
9
        &hf_cmp_canfd_flag_res,
1750
9
        &hf_cmp_canfd_flag_bit_err,
1751
9
        &hf_cmp_canfd_flag_eof_err,
1752
9
        &hf_cmp_canfd_flag_crc_del_err,
1753
9
        &hf_cmp_canfd_flag_stuff_err,
1754
9
        &hf_cmp_canfd_flag_form_err,
1755
9
        &hf_cmp_canfd_flag_ack_del_err,
1756
9
        &hf_cmp_canfd_flag_reserved_0008,
1757
9
        &hf_cmp_canfd_flag_reserved_0004,
1758
9
        &hf_cmp_canfd_flag_ack_err,
1759
9
        &hf_cmp_canfd_flag_crc_err,
1760
9
        NULL
1761
9
    };
1762
1763
9
    static int * const asam_cmp_canfd_id_field_11bit[] = {
1764
9
        &hf_cmp_canfd_id_ide,
1765
9
        &hf_cmp_canfd_id_rrs,
1766
9
        &hf_cmp_canfd_id_err,
1767
9
        &hf_cmp_canfd_id_11bit,
1768
9
        NULL
1769
9
    };
1770
1771
9
    static int * const asam_cmp_canfd_id_field_11bit_old[] = {
1772
9
        &hf_cmp_canfd_id_ide,
1773
9
        &hf_cmp_canfd_id_rrs,
1774
9
        &hf_cmp_canfd_id_err,
1775
9
        &hf_cmp_canfd_id_11bit_old,
1776
9
        NULL
1777
9
    };
1778
1779
9
    static int * const asam_cmp_canfd_id_field_29bit[] = {
1780
9
        &hf_cmp_canfd_id_ide,
1781
9
        &hf_cmp_canfd_id_rrs,
1782
9
        &hf_cmp_canfd_id_err,
1783
9
        &hf_cmp_canfd_id_29bit,
1784
9
        NULL
1785
9
    };
1786
1787
9
    static int * const asam_cmp_canfd_crc_field_17bit[] = {
1788
9
        &hf_cmp_canfd_crc_crc_support,
1789
9
        &hf_cmp_canfd_crc_sbc_support,
1790
9
        &hf_cmp_canfd_crc_res,
1791
9
        &hf_cmp_canfd_crc_sbc_parity,
1792
9
        &hf_cmp_canfd_crc_sbc,
1793
9
        &hf_cmp_canfd_crc_crc17,
1794
9
        NULL
1795
9
    };
1796
1797
9
    static int * const asam_cmp_canfd_crc_field_21bit[] = {
1798
9
        &hf_cmp_canfd_crc_crc_support,
1799
9
        &hf_cmp_canfd_crc_sbc_support,
1800
9
        &hf_cmp_canfd_crc_res,
1801
9
        &hf_cmp_canfd_crc_sbc_parity,
1802
9
        &hf_cmp_canfd_crc_sbc,
1803
9
        &hf_cmp_canfd_crc_crc21,
1804
9
        NULL
1805
9
    };
1806
1807
9
    uint16_t canfd_flags = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
1808
9
    if (tx) {
1809
1
        proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_canfd_flags, ett_asam_cmp_payload_flags, asam_cmp_canfd_flags_tx, ENC_BIG_ENDIAN);
1810
8
    } else {
1811
8
        proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_canfd_flags, ett_asam_cmp_payload_flags, asam_cmp_canfd_flags_cap, ENC_BIG_ENDIAN);
1812
8
    }
1813
9
    offset += 2;
1814
1815
9
    proto_tree_add_item(tree, hf_cmp_canfd_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1816
9
    offset += 2;
1817
1818
9
    uint32_t can_id_field = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
1819
9
    bool can_id_29bit = (can_id_field & CMP_CANFD_ID_IDE) == CMP_CANFD_ID_IDE;
1820
9
    uint32_t can_id = 0;
1821
9
    if (can_id_29bit) {
1822
1
        proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_cmp_canfd_id, ett_asam_cmp_can_id, asam_cmp_canfd_id_field_29bit, ENC_BIG_ENDIAN, BMT_NO_FALSE);
1823
1
        can_id = can_id_field & (CMP_CAN_ID_29BIT_MASK | CMP_CANFD_ID_IDE);
1824
8
    } else {
1825
8
        if (old_11bit_canid_encoding) {
1826
0
            proto_tree_add_bitmask_with_flags(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);
1827
0
            can_id = can_id_field & (CMP_CANFD_ID_IDE | CMP_CAN_ID_11BIT_MASK_OLD);
1828
8
        } else {
1829
8
            proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_cmp_canfd_id, ett_asam_cmp_can_id, asam_cmp_canfd_id_field_11bit, ENC_BIG_ENDIAN, BMT_NO_FALSE);
1830
8
            can_id = (can_id_field & CMP_CANFD_ID_IDE) + ((can_id_field & CMP_CAN_ID_11BIT_MASK) >> CMP_CAN_ID_11BIT_SHIFT);
1831
8
        }
1832
8
    }
1833
9
    offset += 4;
1834
1835
    /* We peek ahead to find out the DLC. 0..10: 17bit CRC, 11..15: 21bit CRC. */
1836
9
    if (tvb_get_uint8(tvb, offset + 6) <= 10) {
1837
5
        proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_cmp_canfd_crc, ett_asam_cmp_can_crc, asam_cmp_canfd_crc_field_17bit, ENC_BIG_ENDIAN, BMT_NO_FALSE);
1838
5
    } else {
1839
4
        proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_cmp_canfd_crc, ett_asam_cmp_can_crc, asam_cmp_canfd_crc_field_21bit, ENC_BIG_ENDIAN, BMT_NO_FALSE);
1840
4
    }
1841
9
    offset += 4;
1842
1843
9
    proto_tree_add_item(tree, hf_cmp_canfd_err_pos, tvb, offset, 2, ENC_BIG_ENDIAN);
1844
9
    offset += 2;
1845
1846
9
    proto_tree_add_item(tree, hf_cmp_canfd_dlc, tvb, offset, 1, ENC_NA);
1847
9
    offset += 1;
1848
1849
9
    uint32_t msg_payload_type_length;
1850
9
    proto_tree_add_item_ret_uint(tree, hf_cmp_canfd_data_len, tvb, offset, 1, ENC_NA, &msg_payload_type_length);
1851
9
    offset += 1;
1852
1853
9
    if (msg_payload_type_length > 0) {
1854
5
        tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, msg_payload_type_length);
1855
1856
5
        if ((canfd_flags & CMP_CANFD_FLAGS_ERRORS) != 0) {
1857
3
            can_id = can_id | CAN_ERR_FLAG;
1858
3
        }
1859
1860
5
        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) };
1861
5
        if (!socketcan_call_subdissectors(sub_tvb, pinfo, tree, &can_info, heuristic_first)) {
1862
3
            call_data_dissector(sub_tvb, pinfo, tree);
1863
3
        }
1864
1865
5
        offset += msg_payload_type_length;
1866
5
    }
1867
1868
9
    return offset;
1869
9
}
1870
1871
static uint32_t
1872
6
dissect_asam_cmp_data_msg_lin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned interface_id, bool tx) {
1873
6
    uint32_t offset = 0;
1874
1875
6
    lin_info_t lin_info = { 0, 0, 0 };
1876
1877
6
    static int * const asam_cmp_lin_pid[] = {
1878
6
        &hf_cmp_lin_pid_parity,
1879
6
        &hf_cmp_lin_pid_id,
1880
6
        NULL
1881
6
    };
1882
1883
6
    static int * const asam_cmp_lin_flags_cap[] = {
1884
6
        &hf_cmp_lin_flag_reserved,
1885
6
        &hf_cmp_lin_flag_wup,
1886
6
        &hf_cmp_lin_flag_long_dom_err,
1887
6
        &hf_cmp_lin_flag_short_dom_err,
1888
6
        &hf_cmp_lin_flag_framing_err,
1889
6
        &hf_cmp_lin_flag_sync_err,
1890
6
        &hf_cmp_lin_flag_no_slave_res,
1891
6
        &hf_cmp_lin_flag_parity_err,
1892
6
        &hf_cmp_lin_flag_col_err,
1893
6
        &hf_cmp_lin_flag_checksum_err,
1894
6
        NULL
1895
6
    };
1896
1897
6
    static int * const asam_cmp_lin_flags_tx[] = {
1898
6
        &hf_cmp_lin_flag_reserved,
1899
6
        &hf_cmp_lin_flag_wup,
1900
6
        &hf_cmp_lin_flag_long_dom_err,
1901
6
        &hf_cmp_lin_flag_short_dom_err,
1902
6
        &hf_cmp_lin_flag_framing_err,
1903
6
        &hf_cmp_lin_flag_sync_err,
1904
6
        &hf_cmp_lin_flag_reserved_0x0008,
1905
6
        &hf_cmp_lin_flag_parity_err,
1906
6
        &hf_cmp_lin_flag_reserved_0x0002,
1907
6
        &hf_cmp_lin_flag_checksum_err,
1908
6
        NULL
1909
6
    };
1910
1911
6
    if (tx) {
1912
1
        proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_lin_flags, ett_asam_cmp_payload_flags, asam_cmp_lin_flags_tx, ENC_BIG_ENDIAN);
1913
5
    } else {
1914
5
        proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_lin_flags, ett_asam_cmp_payload_flags, asam_cmp_lin_flags_cap, ENC_BIG_ENDIAN);
1915
5
    }
1916
6
    offset += 2;
1917
1918
6
    proto_tree_add_item(tree, hf_cmp_lin_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1919
6
    offset += 2;
1920
1921
6
    lin_info.id = tvb_get_uint8(tvb, offset) & CMP_CANFD_PID_ID_MASK;
1922
6
    proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_lin_pid, ett_asam_cmp_lin_pid, asam_cmp_lin_pid, ENC_BIG_ENDIAN);
1923
6
    offset += 1;
1924
1925
6
    proto_tree_add_item(tree, hf_cmp_lin_reserved_2, tvb, offset, 1, ENC_NA);
1926
6
    offset += 1;
1927
1928
6
    proto_tree_add_item(tree, hf_cmp_lin_checksum, tvb, offset, 1, ENC_NA);
1929
6
    offset += 1;
1930
1931
6
    uint32_t msg_payload_type_length;
1932
6
    proto_tree_add_item_ret_uint(tree, hf_cmp_lin_data_len, tvb, offset, 1, ENC_NA, &msg_payload_type_length);
1933
6
    offset += 1;
1934
1935
6
    if (msg_payload_type_length > 0) {
1936
5
        lin_info.bus_id = ht_interface_config_to_bus_id(interface_id);
1937
5
        lin_info.len = (uint16_t)msg_payload_type_length;
1938
1939
5
        tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, msg_payload_type_length);
1940
5
        dissect_lin_message(sub_tvb, pinfo, tree, &lin_info);
1941
5
        offset += msg_payload_type_length;
1942
5
    }
1943
1944
6
    return offset;
1945
6
}
1946
1947
static uint32_t
1948
4
dissect_asam_cmp_data_msg_flexray(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned interface_id, bool tx) {
1949
4
    uint32_t offset = 0;
1950
1951
4
    flexray_info_t fr_info = { 0, 0, 0, 0 };
1952
4
    uint32_t tmp;
1953
1954
4
    static int * const asam_cmp_flexray_flags_cap[] = {
1955
4
        &hf_cmp_flexray_flag_reserved,
1956
4
        &hf_cmp_flexray_flag_channel,
1957
4
        &hf_cmp_flexray_flag_reserved_0x0100,
1958
4
        &hf_cmp_flexray_flag_cas,
1959
4
        &hf_cmp_flexray_flag_ppi,
1960
4
        &hf_cmp_flexray_flag_wus,
1961
4
        &hf_cmp_flexray_flag_sync,
1962
4
        &hf_cmp_flexray_flag_sf,
1963
4
        &hf_cmp_flexray_flag_nf,
1964
4
        &hf_cmp_flexray_flag_crc_header_err,
1965
4
        &hf_cmp_flexray_flag_crc_frame_err,
1966
4
        NULL
1967
4
    };
1968
1969
4
    static int * const asam_cmp_flexray_flags_tx[] = {
1970
4
        &hf_cmp_flexray_flag_reserved,
1971
4
        &hf_cmp_flexray_flag_channel,
1972
4
        &hf_cmp_flexray_flag_leading,
1973
4
        &hf_cmp_flexray_flag_cas,
1974
4
        &hf_cmp_flexray_flag_ppi,
1975
4
        &hf_cmp_flexray_flag_wus,
1976
4
        &hf_cmp_flexray_flag_sync,
1977
4
        &hf_cmp_flexray_flag_sf,
1978
4
        &hf_cmp_flexray_flag_nf,
1979
4
        &hf_cmp_flexray_flag_crc_header_err,
1980
4
        &hf_cmp_flexray_flag_crc_frame_err,
1981
4
        NULL
1982
4
    };
1983
1984
4
    uint16_t flags = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
1985
4
    if (tx) {
1986
1
        proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_flexray_flags, ett_asam_cmp_payload_flags, asam_cmp_flexray_flags_tx, ENC_BIG_ENDIAN);
1987
3
    } else {
1988
3
        proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_flexray_flags, ett_asam_cmp_payload_flags, asam_cmp_flexray_flags_cap, ENC_BIG_ENDIAN);
1989
3
    }
1990
4
    offset += 2;
1991
1992
4
    proto_tree_add_item(tree, hf_cmp_flexray_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1993
4
    offset += 2;
1994
1995
4
    proto_tree_add_item(tree, hf_cmp_flexray_header_crc, tvb, offset, 2, ENC_BIG_ENDIAN);
1996
4
    offset += 2;
1997
1998
4
    proto_tree_add_item_ret_uint(tree, hf_cmp_flexray_frame_id, tvb, offset, 2, ENC_BIG_ENDIAN, &tmp);
1999
4
    fr_info.id = (uint16_t)tmp;
2000
4
    offset += 2;
2001
2002
4
    proto_tree_add_item_ret_uint(tree, hf_cmp_flexray_cycle, tvb, offset, 1, ENC_NA, &tmp);
2003
4
    fr_info.cc = (uint8_t)tmp;
2004
4
    offset += 1;
2005
2006
4
    proto_tree_add_item(tree, hf_cmp_flexray_frame_crc, tvb, offset, 3, ENC_BIG_ENDIAN);
2007
4
    offset += 3;
2008
2009
4
    proto_tree_add_item(tree, hf_cmp_flexray_reserved_2, tvb, offset, 1, ENC_BIG_ENDIAN);
2010
4
    offset += 1;
2011
2012
4
    uint32_t msg_payload_type_length;
2013
4
    proto_tree_add_item_ret_uint(tree, hf_cmp_flexray_data_len, tvb, offset, 1, ENC_NA, &msg_payload_type_length);
2014
4
    offset += 1;
2015
2016
4
    if (msg_payload_type_length > 0 && (flags & CMP_FLEXRAY_FLAGS_NF) == 0) {
2017
2
        fr_info.bus_id = ht_interface_config_to_bus_id(interface_id);
2018
2
        fr_info.ch = 0; /* Assuming A! Could this be B? */
2019
2020
2
        tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, msg_payload_type_length);
2021
2
        if (!flexray_call_subdissectors(sub_tvb, pinfo, tree, &fr_info, heuristic_first)) {
2022
2
            call_data_dissector(sub_tvb, pinfo, tree);
2023
2
        }
2024
2
    }
2025
2026
4
    offset += msg_payload_type_length;
2027
2028
4
    return offset;
2029
4
}
2030
2031
static uint32_t
2032
13
dissect_asam_cmp_data_msg_digital(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
2033
13
    uint32_t offset = 0;
2034
2035
13
    static int * const asam_cmp_digital_flags[] = {
2036
13
        &hf_cmp_digital_flag_reserved,
2037
13
        &hf_cmp_digital_flag_sampl_present,
2038
13
        &hf_cmp_digital_flag_trig_present,
2039
13
        NULL
2040
13
    };
2041
2042
13
    uint64_t flags;
2043
13
    proto_tree_add_bitmask_ret_uint64(tree, tvb, offset, hf_cmp_digital_flags, ett_asam_cmp_payload_flags, asam_cmp_digital_flags, ENC_BIG_ENDIAN, &flags);
2044
13
    offset += 2;
2045
2046
13
    proto_tree_add_item(tree, hf_cmp_digital_reserved, tvb, offset, 1, ENC_NA);
2047
13
    offset += 1;
2048
2049
13
    uint32_t pin_count;
2050
13
    proto_tree_add_item_ret_uint(tree, hf_cmp_digital_pin_count, tvb, offset, 1, ENC_NA, &pin_count);
2051
13
    offset += 1;
2052
2053
13
    if ((flags & CMP_DIGITAL_FLAG_TRIGGER_PRESENT) == CMP_DIGITAL_FLAG_TRIGGER_PRESENT) {
2054
11
        proto_tree_add_item(tree, hf_cmp_digital_trig_pattern, tvb, offset, 1, ENC_NA);
2055
11
        offset += 1;
2056
2057
11
        proto_tree_add_item(tree, hf_cmp_digital_trig_pin, tvb, offset, 1, ENC_NA);
2058
11
        offset += 1;
2059
2060
11
        proto_tree_add_item(tree, hf_cmp_digital_flag_reserved2, tvb, offset, 2, ENC_BIG_ENDIAN);
2061
11
        offset += 2;
2062
11
    }
2063
2064
13
    if ((flags & CMP_DIGITAL_FLAG_SAMPLE_PRESENT) == CMP_DIGITAL_FLAG_SAMPLE_PRESENT) {
2065
12
        proto_tree_add_item(tree, hf_cmp_digital_sample_interval, tvb, offset, 4, ENC_BIG_ENDIAN);
2066
12
        offset += 4;
2067
2068
12
        uint32_t sample_count;
2069
12
        proto_tree_add_item_ret_uint(tree, hf_cmp_digital_sample_count, tvb, offset, 1, ENC_NA, &sample_count);
2070
12
        offset += 1;
2071
2072
12
        uint32_t sample_byte_count = (uint32_t)floor((pin_count + 7) / 8);
2073
2074
232
        for (uint32_t i = 0; i < sample_count; i++) {
2075
2076
220
            proto_item *ti = proto_tree_add_item(tree, hf_cmp_digital_sample, tvb, offset, sample_byte_count, ENC_NA);
2077
220
            proto_item_append_text(ti, " [%d] ", i);
2078
220
            proto_tree *sample_tree = proto_item_add_subtree(ti, ett_asam_cmp_digital_sample);
2079
2080
            /* we are supporting 32 pins for the beginning */
2081
220
            if (4 < sample_byte_count) {
2082
                /* skip unsupported pins */
2083
75
                offset += sample_byte_count - 4;
2084
75
            }
2085
220
            if (4 <= sample_byte_count) {
2086
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_31, tvb, offset, 1, ENC_NA);
2087
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_30, tvb, offset, 1, ENC_NA);
2088
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_29, tvb, offset, 1, ENC_NA);
2089
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_28, tvb, offset, 1, ENC_NA);
2090
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_27, tvb, offset, 1, ENC_NA);
2091
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_26, tvb, offset, 1, ENC_NA);
2092
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_25, tvb, offset, 1, ENC_NA);
2093
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_24, tvb, offset, 1, ENC_NA);
2094
106
                col_append_fstr(pinfo->cinfo, COL_INFO, " 0x%02x", tvb_get_uint8(tvb, offset));
2095
106
                offset += 1;
2096
106
            }
2097
2098
220
            if (3 <= sample_byte_count) {
2099
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_23, tvb, offset, 1, ENC_NA);
2100
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_22, tvb, offset, 1, ENC_NA);
2101
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_21, tvb, offset, 1, ENC_NA);
2102
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_20, tvb, offset, 1, ENC_NA);
2103
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_19, tvb, offset, 1, ENC_NA);
2104
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_18, tvb, offset, 1, ENC_NA);
2105
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_17, tvb, offset, 1, ENC_NA);
2106
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_16, tvb, offset, 1, ENC_NA);
2107
106
                col_append_fstr(pinfo->cinfo, COL_INFO, " 0x%02x", tvb_get_uint8(tvb, offset));
2108
106
                offset += 1;
2109
106
            }
2110
2111
220
            if (2 <= sample_byte_count) {
2112
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_15, tvb, offset, 1, ENC_NA);
2113
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_14, tvb, offset, 1, ENC_NA);
2114
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_13, tvb, offset, 1, ENC_NA);
2115
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_12, tvb, offset, 1, ENC_NA);
2116
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_11, tvb, offset, 1, ENC_NA);
2117
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_10, tvb, offset, 1, ENC_NA);
2118
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_9, tvb, offset, 1, ENC_NA);
2119
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_8, tvb, offset, 1, ENC_NA);
2120
106
                col_append_fstr(pinfo->cinfo, COL_INFO, " 0x%02x", tvb_get_uint8(tvb, offset));
2121
106
                offset += 1;
2122
106
            }
2123
2124
220
            if (1 <= sample_byte_count) {
2125
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_7, tvb, offset, 1, ENC_NA);
2126
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_6, tvb, offset, 1, ENC_NA);
2127
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_5, tvb, offset, 1, ENC_NA);
2128
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_4, tvb, offset, 1, ENC_NA);
2129
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_3, tvb, offset, 1, ENC_NA);
2130
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_2, tvb, offset, 1, ENC_NA);
2131
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_1, tvb, offset, 1, ENC_NA);
2132
106
                proto_tree_add_item(sample_tree, hf_cmp_digital_sample_pin_0, tvb, offset, 1, ENC_NA);
2133
106
                col_append_fstr(pinfo->cinfo, COL_INFO, " 0x%02x", tvb_get_uint8(tvb, offset));
2134
106
                offset += 1;
2135
106
            }
2136
220
        }
2137
12
    }
2138
2139
13
    return offset;
2140
13
}
2141
2142
static uint32_t
2143
57
dissect_asam_cmp_data_msg_uart(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
2144
57
    uint32_t offset = 0;
2145
2146
57
    static int * const asam_cmp_uart_flags[] = {
2147
57
        &hf_cmp_uart_flag_reserved,
2148
57
        &hf_cmp_uart_flag_cl,
2149
57
        NULL
2150
57
    };
2151
2152
57
    static int * const asam_cmp_uart_data[] = {
2153
57
        &hf_cmp_uart_data_parity_err,
2154
57
        &hf_cmp_uart_data_break_condition,
2155
57
        &hf_cmp_uart_data_framing_err,
2156
57
        &hf_cmp_uart_data_reserved,
2157
57
        &hf_cmp_uart_data_data,
2158
57
        NULL
2159
57
    };
2160
2161
57
    uint64_t char_len;
2162
57
    proto_tree_add_bitmask_ret_uint64(tree, tvb, offset, hf_cmp_uart_flags, ett_asam_cmp_payload_flags, asam_cmp_uart_flags, ENC_BIG_ENDIAN, &char_len);
2163
57
    char_len = char_len & 0x07;
2164
57
    offset += 2;
2165
2166
57
    proto_tree_add_item(tree, hf_cmp_uart_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2167
57
    offset += 2;
2168
2169
57
    uint32_t msg_payload_type_length;
2170
57
    proto_tree_add_item_ret_uint(tree, hf_cmp_uart_data_len, tvb, offset, 2, ENC_BIG_ENDIAN, &msg_payload_type_length);
2171
57
    offset += 2;
2172
2173
9.66k
    for (unsigned i = 0; i < msg_payload_type_length; i++) {
2174
9.61k
        uint8_t *buf = NULL;
2175
9.61k
        proto_item *ti = proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_uart_data, ett_asam_cmp_uart_data, asam_cmp_uart_data, ENC_BIG_ENDIAN);
2176
9.61k
        if (char_len == CMP_UART_CL_7 || char_len == CMP_UART_CL_8) {
2177
8.05k
            buf = tvb_get_string_enc(pinfo->pool, tvb, offset + 1, 1, ENC_ASCII | ENC_NA);
2178
2179
            /* sanitizing buffer */
2180
8.05k
            if (buf[0] > 0x00 && buf[0] < 0x20) {
2181
1.40k
                buf[0] = 0x20;
2182
6.65k
            } else {
2183
6.65k
                proto_item_append_text(ti, ": %s", buf);
2184
6.65k
            }
2185
8.05k
        }
2186
9.61k
        offset += 2;
2187
9.61k
    }
2188
2189
57
    return offset;
2190
57
}
2191
2192
static uint32_t
2193
29
dissect_asam_cmp_data_msg_analog(tvbuff_t *tvb, proto_tree *tree) {
2194
29
    uint32_t offset = 0;
2195
2196
29
    static int * const asam_cmp_analog_flags[] = {
2197
29
        &hf_cmp_analog_flag_reserved,
2198
29
        &hf_cmp_analog_flag_sample_dt,
2199
29
        NULL
2200
29
    };
2201
2202
29
    uint64_t flags;
2203
29
    proto_tree_add_bitmask_ret_uint64(tree, tvb, offset, hf_cmp_analog_flags, ett_asam_cmp_payload_flags, asam_cmp_analog_flags, ENC_BIG_ENDIAN, &flags);
2204
29
    offset += 2;
2205
2206
29
    proto_tree_add_item(tree, hf_cmp_analog_reserved, tvb, offset, 1, ENC_NA);
2207
29
    offset += 1;
2208
2209
29
    unsigned analog_unit;
2210
29
    proto_tree_add_item_ret_uint(tree, hf_cmp_analog_unit, tvb, offset, 1, ENC_NA, &analog_unit);
2211
29
    const char *unit_symbol;
2212
29
    unit_symbol = try_val_to_str(analog_unit, analog_units);
2213
29
    offset += 1;
2214
2215
29
    proto_tree_add_item(tree, hf_cmp_analog_sample_interval, tvb, offset, 4, ENC_BIG_ENDIAN);
2216
29
    offset += 4;
2217
2218
29
    float sample_offset;
2219
29
    proto_tree_add_item(tree, hf_cmp_analog_sample_offset, tvb, offset, 4, ENC_BIG_ENDIAN);
2220
29
    sample_offset = tvb_get_ieee_float(tvb, offset, ENC_BIG_ENDIAN);
2221
29
    offset += 4;
2222
2223
29
    float sample_scalar;
2224
29
    proto_tree_add_item(tree, hf_cmp_analog_sample_scalar, tvb, offset, 4, ENC_BIG_ENDIAN);
2225
29
    sample_scalar = tvb_get_ieee_float(tvb, offset, ENC_BIG_ENDIAN);
2226
29
    offset += 4;
2227
2228
29
    int data_width;
2229
29
    switch (flags & 0x03) {
2230
16
    case 0: /* INT16 */
2231
16
        data_width = 2;
2232
16
        break;
2233
10
    case 1: /* INT32 */
2234
10
        data_width = 4;
2235
10
        break;
2236
2
    default:
2237
2
        data_width = 0;
2238
29
    }
2239
2240
28
    int data_left = tvb_captured_length(tvb) - offset;
2241
2242
803
    while (data_width != 0 && data_left > data_width) {
2243
775
        switch (flags & 0x03) {
2244
640
        case 0: {
2245
            /* INT16 */
2246
640
            double sample_value = ((double)tvb_get_int16(tvb, offset, ENC_BIG_ENDIAN) * sample_scalar + sample_offset);
2247
640
            proto_item *ti = proto_tree_add_double(tree, hf_cmp_analog_sample, tvb, offset, 2, sample_value);
2248
640
            if (unit_symbol == NULL) {
2249
222
                proto_item_append_text(ti, " (%.9f)", sample_value);
2250
418
            } else {
2251
418
                proto_item_append_text(ti, "%s (%.9f%s)", unit_symbol, sample_value, unit_symbol);
2252
418
            }
2253
640
            PROTO_ITEM_SET_GENERATED(ti);
2254
2255
640
            proto_tree *sample_tree = proto_item_add_subtree(ti, ett_asam_cmp_analog_sample);
2256
640
            ti = proto_tree_add_item(sample_tree, hf_cmp_analog_sample_raw, tvb, offset, 2, ENC_BIG_ENDIAN);
2257
640
            PROTO_ITEM_SET_HIDDEN(ti);
2258
2259
640
            data_left -= 2;
2260
640
            offset += 2;
2261
640
            break;
2262
0
        }
2263
135
        case 1: { /* INT32 */
2264
135
            double sample_value = ((double)tvb_get_int32(tvb, offset, ENC_BIG_ENDIAN) * sample_scalar + sample_offset);
2265
135
            proto_item *ti = proto_tree_add_double(tree, hf_cmp_analog_sample, tvb, offset, 4, sample_value);
2266
135
            if (unit_symbol == NULL) {
2267
66
                proto_item_append_text(ti, " (%.9f)", sample_value);
2268
69
            } else {
2269
69
                proto_item_append_text(ti, "%s (%.9f%s)", unit_symbol, sample_value, unit_symbol);
2270
69
            }
2271
135
            PROTO_ITEM_SET_GENERATED(ti);
2272
2273
135
            proto_tree *sample_tree = proto_item_add_subtree(ti, ett_asam_cmp_analog_sample);
2274
135
            ti = proto_tree_add_item(sample_tree, hf_cmp_analog_sample_raw, tvb, offset, 4, ENC_BIG_ENDIAN);
2275
135
            PROTO_ITEM_SET_HIDDEN(ti);
2276
2277
135
            data_left -= 4;
2278
135
            offset += 4;
2279
135
            break;
2280
0
        }
2281
0
        default:
2282
            /* Other types are reserved as of now, so we do not know how to parse them. Just ignore. */
2283
0
            break;
2284
775
        }
2285
775
    }
2286
2287
28
    return offset;
2288
28
}
2289
2290
static uint32_t
2291
6
dissect_asam_cmp_data_msg_ethernet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *root_tree, bool tx) {
2292
6
    uint32_t offset = 0;
2293
2294
6
    static int * const asam_cmp_ethernet_flags_cap[] = {
2295
6
        &hf_cmp_eth_flag_reserved_cap,
2296
6
        &hf_cmp_eth_flag_fcs_supported,
2297
6
        &hf_cmp_eth_flag_truncated,
2298
6
        &hf_cmp_eth_flag_phy_err,
2299
6
        &hf_cmp_eth_flag_long_err,
2300
6
        &hf_cmp_eth_flag_collision,
2301
6
        &hf_cmp_eth_flag_tx_down,
2302
6
        &hf_cmp_eth_flag_short_err,
2303
6
        &hf_cmp_eth_flag_fcs_err,
2304
6
        NULL
2305
6
    };
2306
2307
6
    static int * const asam_cmp_ethernet_flags_tx[] = {
2308
6
        &hf_cmp_eth_flag_reserved_tx2,
2309
6
        &hf_cmp_eth_flag_fcs_sending,
2310
6
        &hf_cmp_eth_flag_reserved_tx,
2311
6
        NULL
2312
6
    };
2313
2314
6
    if (tx) {
2315
2
        proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_eth_flags, ett_asam_cmp_payload_flags, asam_cmp_ethernet_flags_tx, ENC_BIG_ENDIAN);
2316
4
    } else {
2317
4
        proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_eth_flags, ett_asam_cmp_payload_flags, asam_cmp_ethernet_flags_cap, ENC_BIG_ENDIAN);
2318
4
    }
2319
6
    offset += 2;
2320
2321
6
    proto_tree_add_item(tree, hf_cmp_eth_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2322
6
    offset += 2;
2323
2324
6
    uint32_t msg_payload_type_length;
2325
6
    proto_tree_add_item_ret_uint(tree, hf_cmp_eth_payload_length, tvb, offset, 2, ENC_BIG_ENDIAN, &msg_payload_type_length);
2326
6
    offset += 2;
2327
2328
6
    if (msg_payload_type_length > 0) {
2329
1
        tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, (int)msg_payload_type_length);
2330
1
        call_dissector(eth_handle, sub_tvb, pinfo, root_tree);
2331
1
        offset += msg_payload_type_length;
2332
1
    }
2333
2334
6
    return offset;
2335
6
}
2336
2337
static uint32_t
2338
0
dissect_asam_cmp_data_msg_spi(tvbuff_t *tvb, proto_tree *tree) {
2339
0
    uint32_t offset = 0;
2340
2341
0
    static int * const asam_cmp_spi_flags[] = {
2342
0
        &hf_cmp_spi_flag_reserved,
2343
0
        NULL
2344
0
    };
2345
2346
0
    proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_spi_flags, ett_asam_cmp_payload_flags, asam_cmp_spi_flags, ENC_BIG_ENDIAN);
2347
0
    offset += 2;
2348
2349
0
    proto_tree_add_item(tree, hf_cmp_spi_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2350
0
    offset += 2;
2351
2352
0
    uint32_t cipo_length;
2353
0
    proto_tree_add_item_ret_uint(tree, hf_cmp_spi_cipo_length, tvb, offset, 2, ENC_BIG_ENDIAN, &cipo_length);
2354
0
    offset += 2;
2355
2356
0
    if (cipo_length > 0) {
2357
0
        proto_tree_add_item(tree, hf_cmp_spi_cipo, tvb, offset, cipo_length, ENC_NA);
2358
0
        offset += cipo_length;
2359
0
    }
2360
2361
0
    uint32_t copi_length;
2362
0
    proto_tree_add_item_ret_uint(tree, hf_cmp_spi_copi_length, tvb, offset, 2, ENC_BIG_ENDIAN, &copi_length);
2363
0
    offset += 2;
2364
2365
0
    if (copi_length > 0) {
2366
0
        proto_tree_add_item(tree, hf_cmp_spi_copi, tvb, offset, copi_length, ENC_NA);
2367
0
        offset += copi_length;
2368
0
    }
2369
2370
0
    return offset;
2371
0
}
2372
2373
static uint32_t
2374
13
dissect_asam_cmp_data_msg_i2c(tvbuff_t *tvb, proto_tree *tree) {
2375
13
    uint32_t offset = 0;
2376
2377
13
    static int * const asam_cmp_i2c_flags[] = {
2378
13
        &hf_cmp_i2c_flag_reserved,
2379
13
        &hf_cmp_i2c_flag_start_cond,
2380
13
        &hf_cmp_i2c_flag_stop_cond,
2381
13
        &hf_cmp_i2c_flag_addr_err,
2382
13
        &hf_cmp_i2c_flag_addr_ack,
2383
13
        &hf_cmp_i2c_flag_addr_len,
2384
13
        &hf_cmp_i2c_flag_dir,
2385
13
        NULL
2386
13
    };
2387
2388
13
    proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_cmp_i2c_flags, ett_asam_cmp_payload_flags, asam_cmp_i2c_flags, ENC_BIG_ENDIAN, BMT_NO_APPEND);
2389
13
    offset += 2;
2390
2391
13
    proto_tree_add_item(tree, hf_cmp_i2c_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2392
13
    offset += 2;
2393
2394
13
    proto_tree_add_item(tree, hf_cmp_i2c_addr, tvb, offset, 2, ENC_BIG_ENDIAN);
2395
13
    offset += 2;
2396
2397
13
    uint32_t data_entry_count;
2398
13
    proto_tree_add_item_ret_uint(tree, hf_cmp_i2c_data_entry_count, tvb, offset, 2, ENC_BIG_ENDIAN, &data_entry_count);
2399
13
    offset += 2;
2400
2401
13
    static int * const asam_cmp_i2c_data[] = {
2402
13
        &hf_cmp_i2c_data_control_res,
2403
13
        &hf_cmp_i2c_data_control_ack,
2404
13
        &hf_cmp_i2c_data_byte,
2405
13
        NULL
2406
13
    };
2407
2408
1.22k
    for (uint32_t i = 0; i < data_entry_count; i++) {
2409
1.21k
        proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_i2c_data, ett_asam_cmp_i2c_data_entry, asam_cmp_i2c_data, ENC_BIG_ENDIAN);
2410
1.21k
        offset += 2;
2411
1.21k
    }
2412
2413
13
    return offset;
2414
13
}
2415
2416
static uint32_t
2417
2
dissect_asam_cmp_data_msg_gige_vision(tvbuff_t *tvb, proto_tree *tree) {
2418
2
    uint32_t offset = 0;
2419
2420
2
    static int * const asam_cmp_gige_flags[] = {
2421
2
        &hf_cmp_gige_flag_reserved,
2422
2
        NULL
2423
2
    };
2424
2425
2
    proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_cmp_gige_flags, ett_asam_cmp_payload_flags, asam_cmp_gige_flags, ENC_BIG_ENDIAN, BMT_NO_APPEND);
2426
2
    offset += 2;
2427
2428
2
    proto_tree_add_item(tree, hf_cmp_gige_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2429
2
    offset += 2;
2430
2431
2
    uint32_t msg_payload_type_length;
2432
2
    proto_tree_add_item_ret_uint(tree, hf_cmp_gige_payload_length, tvb, offset, 2, ENC_BIG_ENDIAN, &msg_payload_type_length);
2433
2
    offset += 2;
2434
2435
2
    if (msg_payload_type_length > 0) {
2436
1
        proto_tree_add_item(tree, hf_cmp_gige_payload, tvb, offset, msg_payload_type_length, ENC_NA);
2437
1
        offset += msg_payload_type_length;
2438
1
    }
2439
2440
2
    return offset;
2441
2
}
2442
2443
static uint32_t
2444
2
dissect_asam_cmp_data_msg_mipi_csi2(tvbuff_t *tvb, proto_tree *tree, bool tx) {
2445
2
    uint32_t offset = 0;
2446
2447
2
    static int * const asam_cmp_mipi_csi2_flags_cap[] = {
2448
2
        &hf_cmp_mipi_csi2_flag_reserved,
2449
2
        &hf_cmp_mipi_csi2_flag_cs_support,
2450
2
        &hf_cmp_mipi_csi2_flag_line_ctr_src,
2451
2
        &hf_cmp_mipi_csi2_flag_frame_ctr_src,
2452
2
        &hf_cmp_mipi_csi2_flag_ecc_fmt,
2453
2
        &hf_cmp_mipi_csi2_flag_ecc_err_uc,
2454
2
        &hf_cmp_mipi_csi2_flag_ecc_err_c,
2455
2
        &hf_cmp_mipi_csi2_flag_crc_err,
2456
2
        NULL
2457
2
    };
2458
2459
2
    static int * const asam_cmp_mipi_csi2_flags_tx[] = {
2460
2
        &hf_cmp_mipi_csi2_flag_reserved_tx,
2461
2
        NULL
2462
2
    };
2463
2464
2
    if (tx) {
2465
1
        proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_cmp_mipi_csi2_flags, ett_asam_cmp_payload_flags, asam_cmp_mipi_csi2_flags_tx, ENC_BIG_ENDIAN, BMT_NO_APPEND);
2466
1
    } else {
2467
1
        proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_cmp_mipi_csi2_flags, ett_asam_cmp_payload_flags, asam_cmp_mipi_csi2_flags_cap, ENC_BIG_ENDIAN, BMT_NO_APPEND);
2468
1
    }
2469
2
    offset += 2;
2470
2471
2
    proto_tree_add_item(tree, hf_cmp_mipi_csi2_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2472
2
    offset += 2;
2473
2474
2
    proto_tree_add_item(tree, hf_cmp_mipi_csi2_frame_counter, tvb, offset, 2, ENC_BIG_ENDIAN);
2475
2
    offset += 2;
2476
2477
2
    proto_tree_add_item(tree, hf_cmp_mipi_csi2_line_counter, tvb, offset, 2, ENC_BIG_ENDIAN);
2478
2
    offset += 2;
2479
2480
2
    static int * const asam_cmp_mipi_dt[] = {
2481
2
        &hf_cmp_mipi_csi2_dt_res,
2482
2
        &hf_cmp_mipi_csi2_dt_dt,
2483
2
        NULL
2484
2
    };
2485
2486
2
    uint64_t mipi_csi2_dt_flags;
2487
2
    proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_cmp_mipi_csi2_dt, ett_asam_cmp_payload_flags, asam_cmp_mipi_dt, ENC_NA, BMT_NO_APPEND, &mipi_csi2_dt_flags);
2488
2
    offset += 1;
2489
2490
2
    bool asam_cmp_mipi_csi_short_packet = (mipi_csi2_dt_flags & MIPI_CSI2_DT_BITS) <= MIPI_CSI2_DT_SHORT_END;
2491
2492
2
    static int * const asam_cmp_mipi_vci[] = {
2493
2
        &hf_cmp_mipi_csi2_vci_res,
2494
2
        &hf_cmp_mipi_csi2_vci_vcx,
2495
2
        &hf_cmp_mipi_csi2_vci_vci,
2496
2
        NULL
2497
2
    };
2498
2499
2
    proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_cmp_mipi_csi2_vci, ett_asam_cmp_payload_flags, asam_cmp_mipi_vci, ENC_NA, BMT_NO_APPEND);
2500
2
    offset += 1;
2501
2502
2
    proto_tree_add_item(tree, hf_cmp_mipi_csi2_reserved2, tvb, offset, 1, ENC_NA);
2503
2
    offset += 1;
2504
2505
2
    static int * const asam_cmp_mipi_ecc[] = {
2506
2
        &hf_cmp_mipi_csi2_ecc_res,
2507
2
        &hf_cmp_mipi_csi2_ecc_ecc,
2508
2
        NULL
2509
2
    };
2510
2511
2
    proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_cmp_mipi_csi2_ecc, ett_asam_cmp_payload_flags, asam_cmp_mipi_ecc, ENC_NA, BMT_NO_APPEND);
2512
2
    offset += 1;
2513
2514
2
    proto_tree_add_item(tree, hf_cmp_mipi_csi2_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
2515
2
    offset += 2;
2516
2517
2
    if (asam_cmp_mipi_csi_short_packet) {
2518
1
        proto_tree_add_item(tree, hf_cmp_mipi_csi2_short_packet_data, tvb, offset, 2, ENC_BIG_ENDIAN);
2519
1
        offset += 2;
2520
1
    } else {
2521
1
        uint32_t word_count;
2522
1
        proto_tree_add_item_ret_uint(tree, hf_cmp_mipi_csi2_wc, tvb, offset, 2, ENC_BIG_ENDIAN, &word_count);
2523
1
        offset += 2;
2524
2525
1
        proto_tree_add_item(tree, hf_cmp_mipi_csi2_data, tvb, offset, word_count, ENC_NA);
2526
1
        offset += word_count;
2527
1
    }
2528
2529
2
    return offset;
2530
2
}
2531
2532
static uint32_t
2533
7
dissect_asam_cmp_data_msg_raw_ethernet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *root_tree) {
2534
7
    uint32_t offset = 0;
2535
2536
7
    static int * const asam_cmp_raw_ethernet_flags[] = {
2537
7
        &hf_cmp_raw_eth_flag_reserved,
2538
7
        NULL
2539
7
    };
2540
2541
7
    proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_eth_flags, ett_asam_cmp_payload_flags, asam_cmp_raw_ethernet_flags, ENC_BIG_ENDIAN);
2542
7
    offset += 2;
2543
2544
7
    proto_tree_add_item(tree, hf_cmp_eth_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2545
7
    offset += 2;
2546
2547
7
    uint32_t msg_payload_type_length;
2548
7
    proto_tree_add_item_ret_uint(tree, hf_cmp_eth_payload_length, tvb, offset, 2, ENC_BIG_ENDIAN, &msg_payload_type_length);
2549
7
    offset += 2;
2550
2551
7
    uint32_t payload_end = offset + msg_payload_type_length;
2552
2553
7
    uint32_t preamble_length = 0;
2554
7
    while ((preamble_length < msg_payload_type_length) && (CMP_ETH_RAW_PREAMBLE == tvb_get_uint8(tvb, offset + preamble_length))) {
2555
0
        preamble_length += 1;
2556
0
    }
2557
2558
7
    if (preamble_length > 0) {
2559
0
        proto_tree_add_item(tree, hf_cmp_raw_eth_preamble, tvb, offset, preamble_length, ENC_NA);
2560
0
        offset += preamble_length;
2561
2562
0
        if (offset < payload_end) {
2563
0
            uint8_t sfd_candidate = tvb_get_uint8(tvb, offset);
2564
2565
0
            if (try_val_to_str(sfd_candidate, eth_raw_sfd) != NULL) {
2566
0
                proto_tree_add_item(tree, hf_cmp_raw_eth_sfd, tvb, offset, 1, ENC_BIG_ENDIAN);
2567
0
                offset += 1;
2568
2569
0
                if (offset < payload_end) {
2570
0
                    uint32_t bytes_left = msg_payload_type_length - preamble_length - 1;
2571
2572
0
                    if (bytes_left > 0) {
2573
0
                        if (sfd_candidate == CMP_ETH_RAW_SFD_ORIG) {
2574
0
                            call_dissector(eth_handle, tvb_new_subset_length(tvb, offset, bytes_left), pinfo, root_tree);
2575
0
                        } else {
2576
0
                            proto_tree_add_item(tree, hf_cmp_raw_eth_mpacket, tvb, offset, bytes_left, ENC_NA);
2577
0
                        }
2578
0
                        offset += (int)bytes_left;
2579
0
                    }
2580
0
                }
2581
0
            }
2582
0
        }
2583
0
    }
2584
2585
7
    return offset;
2586
7
}
2587
2588
static uint32_t
2589
0
dissect_asam_cmp_data_msg_10baset1s_symbols(tvbuff_t *tvb, proto_tree *tree) {
2590
0
    uint32_t offset = 0;
2591
2592
0
    static int * const asam_cmp_10baset1s_flags[] = {
2593
0
        &hf_cmp_10t1s_symb_flag_first_beacon,
2594
0
        &hf_cmp_10t1s_symb_flag_res,
2595
0
        &hf_cmp_10t1s_symb_flag_miss_beacon,
2596
0
        &hf_cmp_10t1s_symb_flag_decode_err,
2597
0
        NULL
2598
0
    };
2599
2600
0
    proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_10t1s_symb_flags, ett_asam_cmp_payload_flags, asam_cmp_10baset1s_flags, ENC_BIG_ENDIAN);
2601
0
    offset += 2;
2602
2603
0
    uint32_t msg_payload_type_length;
2604
0
    proto_tree_add_item_ret_uint(tree, hf_cmp_10t1s_symb_data_length, tvb, offset, 2, ENC_BIG_ENDIAN, &msg_payload_type_length);
2605
0
    offset += 2;
2606
2607
0
    proto_item *ti = proto_tree_add_item(tree, hf_cmp_10t1s_symb_data, tvb, offset, msg_payload_type_length, ENC_NA);
2608
0
    proto_tree *data_tree = proto_item_add_subtree(ti, ett_asam_cmp_payload_data);
2609
0
    for (uint32_t i = 0; i < msg_payload_type_length; i++) {
2610
0
        proto_tree_add_item(data_tree, hf_cmp_10t1s_symb_data_symbol, tvb, offset, 1, ENC_NA);
2611
0
        offset += 1;
2612
0
    }
2613
2614
0
    return offset;
2615
0
}
2616
2617
static uint32_t
2618
1
dissect_asam_cmp_data_msg_a2b(tvbuff_t *tvb, proto_tree *tree) {
2619
1
    uint32_t offset = 0;
2620
2621
1
    static int * const asam_cmp_a2b_flags[] = {
2622
1
        &hf_cmp_a2b_flag_i2c_err,
2623
1
        &hf_cmp_a2b_flag_icrc_err,
2624
1
        &hf_cmp_a2b_flag_srfcrc_err,
2625
1
        &hf_cmp_a2b_flag_srf_err,
2626
1
        &hf_cmp_a2b_flag_becovf_err,
2627
1
        &hf_cmp_a2b_flag_pwd_err,
2628
1
        &hf_cmp_a2b_flag_dp_err,
2629
1
        &hf_cmp_a2b_flag_crc_err,
2630
1
        &hf_cmp_a2b_flag_dd_err,
2631
1
        &hf_cmp_a2b_flag_hdcnt_err,
2632
1
        &hf_cmp_a2b_flag_fault_nloc,
2633
1
        &hf_cmp_a2b_flag_fault_code,
2634
1
        &hf_cmp_a2b_flag_fault_err,
2635
1
        &hf_cmp_a2b_flag_fin,
2636
1
        NULL
2637
1
    };
2638
2639
1
    static int * const asam_cmp_a2b_upstream_settings[] = {
2640
1
        &hf_cmp_a2b_upstream_set_upoffset,
2641
1
        &hf_cmp_a2b_upstream_set_upslots,
2642
1
        &hf_cmp_a2b_upstream_set_upsize,
2643
1
        &hf_cmp_a2b_upstream_set_ups,
2644
1
        &hf_cmp_a2b_upstream_set_upfmt,
2645
1
        NULL
2646
1
    };
2647
2648
1
    static int * const asam_cmp_a2b_downstream_settings[] = {
2649
1
        &hf_cmp_a2b_downstream_set_dnoffset,
2650
1
        &hf_cmp_a2b_downstream_set_dnslots,
2651
1
        &hf_cmp_a2b_downstream_set_dnsize,
2652
1
        &hf_cmp_a2b_downstream_set_dns,
2653
1
        &hf_cmp_a2b_downstream_set_dnfmt,
2654
1
        NULL
2655
1
    };
2656
2657
1
    static int * const asam_cmp_a2b_general_settings[] = {
2658
1
        &hf_cmp_a2b_general_set_raw_cap,
2659
1
        &hf_cmp_a2b_general_set_reserved,
2660
1
        &hf_cmp_a2b_general_set_rrsoffset,
2661
1
        &hf_cmp_a2b_general_set_rrdiv,
2662
1
        &hf_cmp_a2b_general_set_syncoffset,
2663
1
        &hf_cmp_a2b_general_set_rxoffset,
2664
1
        &hf_cmp_a2b_general_set_txoffset,
2665
1
        &hf_cmp_a2b_general_set_i2srate,
2666
1
        &hf_cmp_a2b_general_set_bclkrate,
2667
1
        &hf_cmp_a2b_general_set_bmmen,
2668
1
        &hf_cmp_a2b_general_set_tdmss,
2669
1
        &hf_cmp_a2b_general_set_tdmmode,
2670
1
        &hf_cmp_a2b_general_set_rx2pintl,
2671
1
        &hf_cmp_a2b_general_set_tx2pintl,
2672
1
        &hf_cmp_a2b_general_set_discvd,
2673
1
        &hf_cmp_a2b_general_set_endsniff,
2674
1
        &hf_cmp_a2b_general_set_standby,
2675
1
        &hf_cmp_a2b_general_set_mstr,
2676
1
        NULL
2677
1
    };
2678
2679
1
    proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_a2b_flags, ett_asam_cmp_payload_flags, asam_cmp_a2b_flags, ENC_BIG_ENDIAN);
2680
1
    offset += 2;
2681
2682
1
    proto_tree_add_item(tree, hf_cmp_a2b_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2683
1
    offset += 2;
2684
2685
1
    proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_a2b_upstream_set, ett_asam_cmp_a2b_upstream_settings, asam_cmp_a2b_upstream_settings, ENC_BIG_ENDIAN);
2686
1
    offset += 2;
2687
2688
1
    proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_a2b_downstream_set, ett_asam_cmp_a2b_downstream_settings, asam_cmp_a2b_downstream_settings, ENC_BIG_ENDIAN);
2689
1
    offset += 2;
2690
2691
1
    proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_a2b_general_set, ett_asam_cmp_a2b_general_settings, asam_cmp_a2b_general_settings, ENC_BIG_ENDIAN);
2692
1
    offset += 8;
2693
2694
1
    uint32_t msg_payload_type_length;
2695
1
    proto_tree_add_item_ret_uint(tree, hf_cmp_a2b_data_length, tvb, offset, 2, ENC_BIG_ENDIAN, &msg_payload_type_length);
2696
1
    offset += 2;
2697
2698
1
    if (msg_payload_type_length > 0) {
2699
1
        proto_tree_add_item(tree, hf_cmp_a2b_data, tvb, offset, msg_payload_type_length, ENC_NA);
2700
1
        offset += msg_payload_type_length;
2701
1
    }
2702
2703
1
    return offset;
2704
1
}
2705
2706
static uint32_t
2707
3
dissect_asam_cmp_data_msg_link_state(tvbuff_t *tvb, proto_tree *tree, bool tx) {
2708
3
    uint32_t offset = 0;
2709
2710
3
    static int * const asam_cmp_link_state_flags_cap[] = {
2711
3
        &hf_cmp_link_state_flag_reserved,
2712
3
        &hf_cmp_link_state_flag_link_err,
2713
3
        NULL
2714
3
    };
2715
2716
3
    static int * const asam_cmp_link_state_flags_tx[] = {
2717
3
        &hf_cmp_link_state_flag_reserved_tx,
2718
3
        NULL
2719
3
    };
2720
2721
3
    if (tx) {
2722
1
        proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_link_state_flags, ett_asam_cmp_payload_flags, asam_cmp_link_state_flags_tx, ENC_BIG_ENDIAN);
2723
2
    } else {
2724
2
        proto_tree_add_bitmask(tree, tvb, offset, hf_cmp_link_state_flags, ett_asam_cmp_payload_flags, asam_cmp_link_state_flags_cap, ENC_BIG_ENDIAN);
2725
2
    }
2726
3
    offset += 2;
2727
2728
3
    proto_tree_add_item(tree, hf_cmp_link_state_interface_status, tvb, offset, 1, ENC_NA);
2729
3
    offset += 1;
2730
2731
3
    proto_tree_add_item(tree, hf_cmp_link_state_reserved, tvb, offset, 1, ENC_NA);
2732
3
    offset += 1;
2733
2734
2735
3
    return offset;
2736
3
}
2737
2738
static uint32_t
2739
2
dissect_asam_cmp_data_msg_user_defined(tvbuff_t *tvb, proto_tree *tree) {
2740
2
    uint32_t offset = 0;
2741
2742
2
    proto_tree_add_item(tree, hf_cmp_vendor_def_vendor_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2743
2
    offset += 2;
2744
2745
2
    proto_tree_add_item(tree, hf_cmp_vendor_def_vendor_payload_type, tvb, offset, 2, ENC_BIG_ENDIAN);
2746
2
    offset += 2;
2747
2748
2
    proto_tree_add_item(tree, hf_cmp_vendor_def_vendor_payload_data, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA);
2749
2
    offset += tvb_captured_length_remaining(tvb, offset);
2750
2751
2
    return offset;
2752
2
}
2753
2754
static uint32_t
2755
222
dissect_asam_cmp_data_msg_payload(tvbuff_t *payload_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *root_tree, uint32_t msg_payload_type, uint32_t interface_id, bool tx) {
2756
222
    uint32_t offset = 0;
2757
222
    uint32_t msg_payload_length = tvb_captured_length(payload_tvb);
2758
2759
222
    switch (msg_payload_type) {
2760
0
    case CMP_DATA_MSG_INVALID:
2761
0
        if (msg_payload_length > 0) {
2762
0
            call_data_dissector(payload_tvb, pinfo, tree);
2763
0
            offset += tvb_captured_length(payload_tvb);
2764
0
        }
2765
0
        break;
2766
2767
24
    case CMP_DATA_MSG_CAN:
2768
24
        offset += dissect_asam_cmp_data_msg_can(payload_tvb, pinfo, tree, interface_id, tx);
2769
24
        break;
2770
2771
9
    case CMP_DATA_MSG_CANFD:
2772
9
        offset += dissect_asam_cmp_data_msg_canfd(payload_tvb, pinfo, tree, interface_id, tx);
2773
9
        break;
2774
2775
6
    case CMP_DATA_MSG_LIN:
2776
6
        offset += dissect_asam_cmp_data_msg_lin(payload_tvb, pinfo, tree, interface_id, tx);
2777
6
        break;
2778
2779
4
    case CMP_DATA_MSG_FLEXRAY:
2780
4
        offset += dissect_asam_cmp_data_msg_flexray(payload_tvb, pinfo, tree, interface_id, tx);
2781
4
        break;
2782
2783
13
    case CMP_DATA_MSG_DIGITAL:
2784
13
        offset += dissect_asam_cmp_data_msg_digital(payload_tvb, pinfo, tree);
2785
13
        break;
2786
2787
57
    case CMP_DATA_MSG_UART_RS_232:
2788
57
        offset += dissect_asam_cmp_data_msg_uart(payload_tvb, pinfo, tree);
2789
57
        break;
2790
2791
29
    case CMP_DATA_MSG_ANALOG:
2792
29
        offset += dissect_asam_cmp_data_msg_analog(payload_tvb, tree);
2793
29
        break;
2794
2795
6
    case CMP_DATA_MSG_ETHERNET:
2796
6
        offset += dissect_asam_cmp_data_msg_ethernet(payload_tvb, pinfo, tree, root_tree, tx);
2797
6
        break;
2798
2799
0
    case CMP_DATA_MSG_SPI:
2800
0
        offset += dissect_asam_cmp_data_msg_spi(payload_tvb, tree);
2801
0
        break;
2802
2803
13
    case CMP_DATA_MSG_I2C:
2804
13
        offset += dissect_asam_cmp_data_msg_i2c(payload_tvb, tree);
2805
13
        break;
2806
2807
2
    case CMP_DATA_MSG_GIGEVISION:
2808
2
        offset += dissect_asam_cmp_data_msg_gige_vision(payload_tvb, tree);
2809
2
        break;
2810
2811
2
    case CMP_DATA_MSG_MIPI_CSI2:
2812
2
        offset += dissect_asam_cmp_data_msg_mipi_csi2(payload_tvb, tree, tx);
2813
2
        break;
2814
2815
7
    case CMP_DATA_MSG_RAW_ETHERNET:
2816
7
        offset += dissect_asam_cmp_data_msg_raw_ethernet(payload_tvb, pinfo, tree, root_tree);
2817
7
        break;
2818
2819
0
    case CMP_DATA_MSG_10BASE_T1S_SYMBOL:
2820
0
        offset += dissect_asam_cmp_data_msg_10baset1s_symbols(payload_tvb, tree);
2821
0
        break;
2822
2823
1
    case CMP_DATA_MSG_A2B:
2824
1
        offset += dissect_asam_cmp_data_msg_a2b(payload_tvb, tree);
2825
1
        break;
2826
2827
3
    case CMP_DATA_MSG_LINK_STATE:
2828
3
        offset += dissect_asam_cmp_data_msg_link_state(payload_tvb, tree, tx);
2829
3
        break;
2830
2831
2
    case CMP_DATA_MSG_VENDOR_DATA_MSG:
2832
2
        offset += dissect_asam_cmp_data_msg_user_defined(payload_tvb, tree);
2833
2
        break;
2834
2835
44
    default:
2836
44
        offset += tvb_captured_length(payload_tvb);
2837
44
        break;
2838
222
    }
2839
2840
134
    return offset;
2841
222
}
2842
2843
static void
2844
16
dissect_asam_cmp_data_msg_transmission_options(tvbuff_t *tvb, proto_tree *tree, uint8_t payload_type) {
2845
2846
16
    static int * const trans_opts_default[] = {
2847
16
        &hf_cmp_msg_trans_opts_res,
2848
16
        NULL
2849
16
    };
2850
2851
16
    static int * const trans_opts_lin[] = {
2852
16
        &hf_cmp_msg_trans_opts_lin_wup_dura,
2853
16
        &hf_cmp_msg_trans_opts_lin_res,
2854
16
        NULL
2855
16
    };
2856
2857
16
    static int * const trans_opts_flexray[] = {
2858
16
        &hf_cmp_msg_trans_opts_fr_op,
2859
16
        &hf_cmp_msg_trans_opts_fr_cycle_rep,
2860
16
        &hf_cmp_msg_trans_opts_fr_res,
2861
16
        NULL
2862
16
    };
2863
2864
16
    switch (payload_type) {
2865
1
    case CMP_DATA_MSG_LIN:
2866
1
        proto_tree_add_bitmask(tree, tvb, 0, hf_cmp_msg_trans_opts, ett_asam_cmp_trans_opts, trans_opts_lin, ENC_BIG_ENDIAN);
2867
1
        break;
2868
2869
1
    case CMP_DATA_MSG_FLEXRAY:
2870
1
        proto_tree_add_bitmask(tree, tvb, 0, hf_cmp_msg_trans_opts, ett_asam_cmp_trans_opts, trans_opts_flexray, ENC_BIG_ENDIAN);
2871
1
        break;
2872
2873
14
    default:
2874
14
        proto_tree_add_bitmask(tree, tvb, 0, hf_cmp_msg_trans_opts, ett_asam_cmp_trans_opts, trans_opts_default, ENC_BIG_ENDIAN);
2875
16
    }
2876
16
}
2877
2878
static int
2879
237
dissect_asam_cmp_data_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, proto_tree *tree, unsigned offset_orig, bool tx) {
2880
237
    proto_item *ti = NULL;
2881
237
    proto_item *ti_msg_header = NULL;
2882
237
    proto_item *ti_msg_payload = NULL;
2883
237
    proto_tree *asam_cmp_data_msg_header_tree = NULL;
2884
237
    proto_tree *asam_cmp_data_msg_payload_tree = NULL;
2885
237
    proto_tree *subtree = NULL;
2886
237
    unsigned offset = offset_orig;
2887
2888
237
    unsigned msg_payload_type = 0;
2889
237
    unsigned msg_payload_length = 0;
2890
237
    unsigned interface_id = 0;
2891
2892
237
    static int * const asam_cmp_common_flags_cap[] = {
2893
237
        &hf_cmp_common_flag_reserved,
2894
237
        &hf_cmp_common_flag_err_in_payload,
2895
237
        &hf_cmp_common_flag_overflow,
2896
237
        &hf_cmp_common_flag_dir_on_if,
2897
237
        &hf_cmp_common_flag_seg,
2898
237
        &hf_cmp_common_flag_insync,
2899
237
        &hf_cmp_common_flag_recal,
2900
237
        NULL
2901
237
    };
2902
2903
237
    static int * const asam_cmp_common_flags_tx[] = {
2904
237
        &hf_cmp_common_flag_reserved_0xf0,
2905
237
        &hf_cmp_common_flag_seg,
2906
237
        &hf_cmp_common_flag_reserved_0x02,
2907
237
        &hf_cmp_common_flag_relative,
2908
237
        NULL
2909
237
    };
2910
2911
    /* Testing for Ethernet Padding */
2912
237
    if ( (!tx && tvb_get_uint8(tvb, offset + 13) == 0) || (tx && tvb_get_uint8(tvb, offset + 21) == 0)) {
2913
15
        return 0;
2914
15
    }
2915
2916
222
    ti_msg_header = proto_tree_add_item(tree, hf_cmp_msg_header, tvb, offset, 8, ENC_BIG_ENDIAN);
2917
222
    asam_cmp_data_msg_header_tree = proto_item_add_subtree(ti_msg_header, ett_asam_cmp_header);
2918
222
    proto_item_append_text(ti_msg_header, " %s", "- Data Message");
2919
2920
222
    uint64_t ns = tvb_get_uint64(tvb, offset, ENC_BIG_ENDIAN);
2921
222
    nstime_t timestamp = { .secs = (time_t)(ns / 1000000000), .nsecs = (int)(ns % 1000000000) };
2922
2923
222
    ti = proto_tree_add_time(asam_cmp_data_msg_header_tree, hf_cmp_msg_timestamp, tvb, offset, 8, &timestamp);
2924
222
    subtree = proto_item_add_subtree(ti, ett_asam_cmp_timestamp);
2925
222
    proto_tree_add_item(subtree, hf_cmp_msg_timestamp_ns, tvb, offset, 8, ENC_BIG_ENDIAN);
2926
222
    offset += 8;
2927
2928
222
    if (tx) {
2929
        /* Deadline */
2930
16
        proto_tree_add_item(asam_cmp_data_msg_header_tree, hf_cmp_msg_deadline, tvb, offset, 4, ENC_BIG_ENDIAN);
2931
16
        offset += 4;
2932
16
    }
2933
2934
222
    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);
2935
222
    add_interface_id_text(ti, interface_id);
2936
222
    offset += 4;
2937
2938
222
    if (tx) {
2939
        /* Transmission Options */
2940
        // peek into msg_payload_type
2941
16
        dissect_asam_cmp_data_msg_transmission_options(tvb_new_subset_length(tvb, offset, 4), asam_cmp_data_msg_header_tree, tvb_get_uint8(tvb, offset + 5));
2942
16
        offset += 4;
2943
2944
16
        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_tx, ENC_BIG_ENDIAN);
2945
16
        offset += 1;
2946
206
    } else {
2947
206
        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_cap, ENC_BIG_ENDIAN);
2948
206
        offset += 1;
2949
206
    }
2950
2951
222
    proto_tree_add_item_ret_uint(asam_cmp_data_msg_header_tree, hf_cmp_payload_type, tvb, offset, 1, ENC_NA, &msg_payload_type);
2952
222
    offset += 1;
2953
2954
222
    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);
2955
222
    offset += 2;
2956
2957
222
    proto_item_set_end(ti_msg_header, tvb, offset);
2958
2959
222
    ti_msg_payload = proto_tree_add_item(tree, hf_cmp_msg_payload, tvb, offset, msg_payload_length, ENC_BIG_ENDIAN);
2960
222
    asam_cmp_data_msg_payload_tree = proto_item_add_subtree(ti_msg_payload, ett_asam_cmp_header);
2961
222
    proto_item_append_text(ti_msg_payload, " %s", "- Data Message");
2962
2963
222
    const char *msg_payload_name = try_val_to_str(msg_payload_type, data_msg_type_names);
2964
222
    if (msg_payload_name != NULL) {
2965
178
        col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", msg_payload_name);
2966
178
        proto_item_append_text(ti_msg_payload, " (%s)", msg_payload_name);
2967
178
    }
2968
2969
222
    tvbuff_t *payload_tvb = tvb_new_subset_length(tvb, offset, msg_payload_length);
2970
2971
222
    offset += dissect_asam_cmp_data_msg_payload(payload_tvb, pinfo, asam_cmp_data_msg_payload_tree, root_tree, msg_payload_type, interface_id, tx);
2972
2973
222
    uint8_t header_len = tx ? CMP_MSG_HEADER_LEN_TX : CMP_MSG_HEADER_LEN;
2974
222
    if ((header_len + msg_payload_length) < (offset - offset_orig)) {
2975
0
        proto_tree_add_expert(tree, pinfo, &ei_asam_cmp_length_mismatch, tvb, offset_orig + header_len, msg_payload_length);
2976
0
        proto_item_set_end(ti_msg_payload, tvb, offset);
2977
0
    }
2978
2979
222
    return header_len + msg_payload_length;
2980
237
}
2981
2982
static int
2983
38
dissect_asam_cmp_ctrl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset_orig) {
2984
2985
38
    proto_item *ti = NULL;
2986
38
    proto_item *ti_msg_header = NULL;
2987
38
    proto_item *ti_msg_payload = NULL;
2988
38
    proto_tree *asam_cmp_ctrl_msg_header_tree = NULL;
2989
38
    proto_tree *asam_cmp_ctrl_msg_payload_tree = NULL;
2990
38
    proto_tree *subtree = NULL;
2991
38
    unsigned asam_cmp_ctrl_msg_payload_type = 0;
2992
38
    unsigned asam_cmp_ctrl_msg_payload_length = 0;
2993
38
    unsigned offset = offset_orig;
2994
2995
38
    static int * const asam_cmp_common_flags[] = {
2996
38
        &hf_cmp_common_flag_reserved_0xf0,
2997
38
        &hf_cmp_common_flag_seg,
2998
38
        &hf_cmp_common_flag_insync,
2999
38
        &hf_cmp_common_flag_recal,
3000
38
        NULL
3001
38
    };
3002
3003
    /* Testing for Ethernet Padding */
3004
38
    if (tvb_get_uint8(tvb, offset + 13) == 0) {
3005
5
        return 0;
3006
5
    }
3007
3008
33
    ti_msg_header = proto_tree_add_item(tree, hf_cmp_msg_header, tvb, offset, 8, ENC_BIG_ENDIAN);
3009
33
    asam_cmp_ctrl_msg_header_tree = proto_item_add_subtree(ti_msg_header, ett_asam_cmp_header);
3010
33
    proto_item_append_text(ti_msg_header, " %s", "- Control Message");
3011
3012
33
    uint64_t ns = tvb_get_uint64(tvb, offset, ENC_BIG_ENDIAN);
3013
33
    nstime_t timestamp = { .secs = (time_t)(ns / 1000000000), .nsecs = (int)(ns % 1000000000) };
3014
3015
33
    ti = proto_tree_add_time(asam_cmp_ctrl_msg_header_tree, hf_cmp_msg_timestamp, tvb, offset, 8, &timestamp);
3016
3017
33
    subtree = proto_item_add_subtree(ti, ett_asam_cmp_timestamp);
3018
33
    proto_tree_add_item(subtree, hf_cmp_msg_timestamp_ns, tvb, offset, 8, ENC_BIG_ENDIAN);
3019
33
    offset += 8;
3020
3021
33
    proto_tree_add_item(asam_cmp_ctrl_msg_header_tree, hf_cmp_ctrl_msg_reserved, tvb, offset, 4, ENC_BIG_ENDIAN);
3022
33
    offset += 4;
3023
3024
33
    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);
3025
33
    offset += 1;
3026
3027
33
    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);
3028
33
    offset += 1;
3029
3030
33
    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);
3031
33
    offset += 2;
3032
3033
33
    proto_item_set_end(ti_msg_header, tvb, offset);
3034
3035
33
    ti_msg_payload = proto_tree_add_item(tree, hf_cmp_msg_payload, tvb, offset, asam_cmp_ctrl_msg_payload_length, ENC_BIG_ENDIAN);
3036
33
    asam_cmp_ctrl_msg_payload_tree = proto_item_add_subtree(ti_msg_payload, ett_asam_cmp_header);
3037
33
    proto_item_append_text(ti_msg_payload, " %s", "- Control Message");
3038
3039
33
    switch (asam_cmp_ctrl_msg_payload_type) {
3040
0
    case CMP_CTRL_MSG_INVALID:
3041
0
        col_append_str(pinfo->cinfo, COL_INFO, " (Invalid/Padding)");
3042
0
        proto_item_append_text(ti_msg_payload, " %s", "(Invalid/Padding)");
3043
0
        proto_item_set_end(ti_msg_payload, tvb, offset + asam_cmp_ctrl_msg_payload_length);
3044
3045
0
        return tvb_reported_length_remaining(tvb, offset_orig);
3046
3047
6
    case CMP_CTRL_MSG_DSR_CTRL_MSG:
3048
6
        col_append_str(pinfo->cinfo, COL_INFO, " (Data Sink Ready)");
3049
6
        proto_item_append_text(ti_msg_payload, " %s", "(Data Sink Ready)");
3050
3051
6
        proto_tree_add_item(asam_cmp_ctrl_msg_payload_tree, hf_cmp_ctrl_msg_device_id, tvb, offset, 2, ENC_BIG_ENDIAN);
3052
6
        offset += 2;
3053
3054
6
        break;
3055
3056
2
    case CMP_CTRL_MSG_USER_EVENT_CTRL_MSG:
3057
2
        col_append_str(pinfo->cinfo, COL_INFO, " (User Event)");
3058
2
        proto_item_append_text(ti_msg_payload, " %s", "(User Event)");
3059
3060
2
        proto_tree_add_item(asam_cmp_ctrl_msg_payload_tree, hf_cmp_ctrl_msg_event_id, tvb, offset, 4, ENC_BIG_ENDIAN);
3061
2
        offset += 4;
3062
3063
2
        break;
3064
3065
2
    case CMP_CTRL_MSG_VENDOR_CTRL_MSG:
3066
2
        col_append_str(pinfo->cinfo, COL_INFO, " (Vendor specific)");
3067
2
        proto_item_append_text(ti_msg_payload, " %s", "(Vendor specific)");
3068
3069
2
        proto_tree_add_item(asam_cmp_ctrl_msg_payload_tree, hf_cmp_ctrl_msg_vendor_id, tvb, offset, 2, ENC_BIG_ENDIAN);
3070
2
        offset += 2;
3071
2
        asam_cmp_ctrl_msg_payload_length -= 2;
3072
3073
2
        proto_tree_add_item(asam_cmp_ctrl_msg_payload_tree, hf_cmp_ctrl_msg_vendor_payload_type, tvb, offset, 2, ENC_BIG_ENDIAN);
3074
2
        offset += 2;
3075
2
        asam_cmp_ctrl_msg_payload_length -= 2;
3076
3077
2
        if (asam_cmp_ctrl_msg_payload_length > 0) {
3078
2
            tvbuff_t *sub_tvb = tvb_new_subset_length(tvb, offset, asam_cmp_ctrl_msg_payload_length);
3079
2
            call_data_dissector(sub_tvb, pinfo, tree);
3080
2
            offset += (int)asam_cmp_ctrl_msg_payload_length;
3081
2
        }
3082
3083
        /* we changed the payload length, so lets skip the length check by leaving */
3084
2
        return (offset + asam_cmp_ctrl_msg_payload_length) - offset_orig;
3085
3086
23
    default:
3087
23
        if (asam_cmp_ctrl_msg_payload_length > 0) {
3088
16
            offset += (int)asam_cmp_ctrl_msg_payload_length;
3089
16
        }
3090
3091
23
        proto_item_set_end(ti_msg_payload, tvb, offset);
3092
23
        break;
3093
33
    }
3094
3095
31
    if ((CMP_MSG_HEADER_LEN + asam_cmp_ctrl_msg_payload_length) < (offset - offset_orig)) {
3096
1
        proto_tree_add_expert(tree, pinfo, &ei_asam_cmp_length_mismatch, tvb, offset_orig + CMP_MSG_HEADER_LEN, asam_cmp_ctrl_msg_payload_length);
3097
1
        proto_item_set_end(ti_msg_payload, tvb, offset);
3098
1
    }
3099
3100
31
    return CMP_MSG_HEADER_LEN + asam_cmp_ctrl_msg_payload_length;
3101
33
}
3102
3103
static int
3104
67
dissect_asam_cmp_status_interface_support_mask(tvbuff_t *tvb, proto_tree *tree, unsigned offset_orig, uint8_t interface_type) {
3105
67
    unsigned offset = offset_orig;
3106
67
    uint64_t temp = 0;
3107
3108
67
    static int *const can_feature_support[] = {
3109
67
        &hf_cmp_iface_feat_can_gen_err,
3110
67
        &hf_cmp_iface_feat_can_srr_dom,
3111
67
        &hf_cmp_iface_feat_can_r0,
3112
67
        &hf_cmp_iface_feat_can_bit_err,
3113
67
        &hf_cmp_iface_feat_can_eof_err,
3114
67
        &hf_cmp_iface_feat_can_crc_del_err,
3115
67
        &hf_cmp_iface_feat_can_stuff_err,
3116
67
        &hf_cmp_iface_feat_can_form_err,
3117
67
        &hf_cmp_iface_feat_can_ack_del_err,
3118
67
        &hf_cmp_iface_feat_can_act_ack,
3119
67
        &hf_cmp_iface_feat_can_pas_ack,
3120
67
        &hf_cmp_iface_feat_can_ack_err,
3121
67
        &hf_cmp_iface_feat_can_crr_err,
3122
67
        NULL
3123
67
    };
3124
3125
67
    static int *const canfd_feature_support[] = {
3126
67
        &hf_cmp_iface_feat_canfd_gen_err,
3127
67
        &hf_cmp_iface_feat_canfd_esi,
3128
67
        &hf_cmp_iface_feat_canfd_brs,
3129
67
        &hf_cmp_iface_feat_canfd_srr_dom,
3130
67
        &hf_cmp_iface_feat_canfd_rsvd,
3131
67
        &hf_cmp_iface_feat_canfd_bit_err,
3132
67
        &hf_cmp_iface_feat_canfd_eof_err,
3133
67
        &hf_cmp_iface_feat_canfd_crc_del_err,
3134
67
        &hf_cmp_iface_feat_canfd_stuff_err,
3135
67
        &hf_cmp_iface_feat_canfd_form_err,
3136
67
        &hf_cmp_iface_feat_canfd_ack_del_err,
3137
67
        &hf_cmp_iface_feat_canfd_act_ack,
3138
67
        &hf_cmp_iface_feat_canfd_pas_ack,
3139
67
        &hf_cmp_iface_feat_canfd_ack_err,
3140
67
        &hf_cmp_iface_feat_canfd_crr_err,
3141
67
        NULL
3142
67
    };
3143
3144
67
    static int *const lin_feature_support[] = {
3145
67
        &hf_cmp_iface_feat_lin_wup,
3146
67
        &hf_cmp_iface_feat_lin_long_dom_err,
3147
67
        &hf_cmp_iface_feat_lin_short_dom_err,
3148
67
        &hf_cmp_iface_feat_lin_framing_err,
3149
67
        &hf_cmp_iface_feat_lin_sync_err,
3150
67
        &hf_cmp_iface_feat_lin_no_slave_resp_err,
3151
67
        &hf_cmp_iface_feat_lin_parity_err,
3152
67
        &hf_cmp_iface_feat_lin_coll_err,
3153
67
        &hf_cmp_iface_feat_lin_checksum_err,
3154
67
        NULL
3155
67
    };
3156
3157
67
    static int *const flexray_feature_support[] = {
3158
67
        &hf_cmp_iface_feat_fr_channel,
3159
67
        &hf_cmp_iface_feat_fr_cas,
3160
67
        &hf_cmp_iface_feat_fr_ppi,
3161
67
        &hf_cmp_iface_feat_fr_wus,
3162
67
        &hf_cmp_iface_feat_fr_sync,
3163
67
        &hf_cmp_iface_feat_fr_sf,
3164
67
        &hf_cmp_iface_feat_fr_nf,
3165
67
        &hf_cmp_iface_feat_fr_crc_header_err,
3166
67
        &hf_cmp_iface_feat_fr_crc_frame_err,
3167
67
        NULL
3168
67
    };
3169
3170
67
    static int *const eth_feature_support[] = {
3171
67
        &hf_cmp_iface_feat_eth_fcs,
3172
67
        &hf_cmp_iface_feat_eth_trunc,
3173
67
        &hf_cmp_iface_feat_eth_phy_err,
3174
67
        &hf_cmp_iface_feat_eth_too_long,
3175
67
        &hf_cmp_iface_feat_eth_collision,
3176
67
        &hf_cmp_iface_feat_eth_tx_port_down,
3177
67
        &hf_cmp_iface_feat_eth_too_short,
3178
67
        &hf_cmp_iface_feat_eth_fcs_err,
3179
67
        NULL
3180
67
    };
3181
3182
67
    static int *const eth_10baset1s_feature_support[] = {
3183
67
        &hf_cmp_iface_feat_10t1s_first_beacon,
3184
67
        &hf_cmp_iface_feat_10t1s_mis_beacon,
3185
67
        &hf_cmp_iface_feat_10t1s_sym_decode,
3186
67
        NULL
3187
67
    };
3188
3189
67
    static int *const link_state_feature_support[] = {
3190
67
        &hf_cmp_iface_feat_link_err,
3191
67
        NULL
3192
67
    };
3193
3194
67
    switch (interface_type) {
3195
1
    case CMP_DATA_MSG_CAN:
3196
1
        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);
3197
1
        break;
3198
3199
13
    case CMP_DATA_MSG_CANFD:
3200
13
        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);
3201
13
        break;
3202
3203
2
    case CMP_DATA_MSG_LIN:
3204
2
        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);
3205
2
        break;
3206
3207
1
    case CMP_DATA_MSG_FLEXRAY:
3208
1
        proto_tree_add_bitmask_ret_uint64(tree, tvb, offset, hf_cmp_iface_feat, ett_asam_cmp_status_feature_support, flexray_feature_support, ENC_BIG_ENDIAN, &temp);
3209
1
        break;
3210
3211
2
    case CMP_DATA_MSG_ETHERNET:
3212
2
        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);
3213
2
        break;
3214
3215
0
    case CMP_DATA_MSG_RAW_ETHERNET:
3216
0
        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);
3217
0
        break;
3218
3219
2
    case CMP_DATA_MSG_10BASE_T1S_SYMBOL:
3220
2
        proto_tree_add_bitmask_ret_uint64(tree, tvb, offset, hf_cmp_iface_feat, ett_asam_cmp_status_feature_support, eth_10baset1s_feature_support, ENC_BIG_ENDIAN, &temp);
3221
2
        break;
3222
3223
1
    case CMP_DATA_MSG_LINK_STATE:
3224
1
        proto_tree_add_bitmask_ret_uint64(tree, tvb, offset, hf_cmp_iface_feat, ett_asam_cmp_status_feature_support, link_state_feature_support, ENC_BIG_ENDIAN, &temp);
3225
1
        break;
3226
3227
45
    default:
3228
45
        proto_tree_add_item(tree, hf_cmp_iface_feat, tvb, offset, 4, ENC_BIG_ENDIAN);
3229
67
    }
3230
3231
67
    offset += 4;
3232
3233
67
    return offset - offset_orig;
3234
67
}
3235
3236
static int
3237
160
dissect_asam_cmp_status_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset_orig) {
3238
160
    proto_item *ti = NULL;
3239
160
    proto_item *ti_msg_header = NULL;
3240
160
    proto_item *ti_msg_payload = NULL;
3241
160
    proto_item *ti_interface = NULL;
3242
160
    proto_item *ti_stream_ids = NULL;
3243
160
    proto_tree *asam_cmp_status_msg_header_tree = NULL;
3244
160
    proto_tree *asam_cmp_status_msg_payload_tree = NULL;
3245
160
    proto_tree *subtree = NULL;
3246
160
    proto_tree *stream_ids_subtree = NULL;
3247
160
    unsigned offset = offset_orig;
3248
3249
160
    unsigned asam_cmp_status_msg_payload_type = 0;
3250
160
    unsigned asam_cmp_status_msg_payload_length = 0;
3251
160
    unsigned asam_cmp_status_msg_cm_dev_desc_length = 0;
3252
160
    unsigned asam_cmp_status_msg_cm_sn_length = 0;
3253
160
    unsigned asam_cmp_status_msg_cm_hw_ver_length = 0;
3254
160
    unsigned asam_cmp_status_msg_cm_sw_ver_length = 0;
3255
160
    unsigned asam_cmp_status_msg_vendor_data_length = 0;
3256
160
    unsigned asam_cmp_status_msg_iface_stream_id_count = 0;
3257
160
    uint64_t uptime = 0;
3258
160
    const char *descr = NULL;
3259
3260
160
    static int * const asam_cmp_common_flags[] = {
3261
160
        &hf_cmp_common_flag_reserved_0xf0,
3262
160
        &hf_cmp_common_flag_seg,
3263
160
        &hf_cmp_common_flag_insync,
3264
160
        &hf_cmp_common_flag_recal,
3265
160
        NULL
3266
160
    };
3267
3268
160
    static int * const asam_cmp_status_cm_flags[] = {
3269
160
        &hf_cmp_gptp_flags_reserved,
3270
160
        &hf_cmp_gptp_flags_freq_traceable,
3271
160
        &hf_cmp_gptp_flags_time_traceable,
3272
160
        &hf_cmp_gptp_flags_ptp_timescale,
3273
160
        &hf_cmp_gptp_flags_cur_utco_valid,
3274
160
        &hf_cmp_gptp_flags_leap59,
3275
160
        &hf_cmp_gptp_flags_leap61,
3276
160
        NULL
3277
160
    };
3278
3279
160
    static int * const asam_cmp_status_timeloss_error_flags[] = {
3280
160
        &hf_cmp_timeloss_error_flags_reserved,
3281
160
        &hf_cmp_timeloss_error_flags_delta,
3282
160
        &hf_cmp_timeloss_error_flags_insync,
3283
160
        &hf_cmp_timeloss_error_flags_ts,
3284
160
        NULL
3285
160
    };
3286
3287
    /* Testing for Ethernet Padding */
3288
160
    if (tvb_get_uint8(tvb, offset + 13) == 0) {
3289
9
        return 0;
3290
9
    }
3291
3292
151
    ti_msg_header = proto_tree_add_item(tree, hf_cmp_msg_header, tvb, offset, 16, ENC_BIG_ENDIAN);
3293
151
    asam_cmp_status_msg_header_tree = proto_item_add_subtree(ti_msg_header, ett_asam_cmp_header);
3294
151
    proto_item_append_text(ti_msg_header, " %s", "- Status Message");
3295
3296
151
    uint64_t ns = tvb_get_uint64(tvb, offset, ENC_BIG_ENDIAN);
3297
151
    nstime_t timestamp = { .secs = (time_t)(ns / 1000000000), .nsecs = (int)(ns % 1000000000) };
3298
3299
151
    ti = proto_tree_add_time(asam_cmp_status_msg_header_tree, hf_cmp_msg_timestamp, tvb, offset, 8, &timestamp);
3300
151
    subtree = proto_item_add_subtree(ti, ett_asam_cmp_timestamp);
3301
151
    proto_tree_add_item(subtree, hf_cmp_msg_timestamp_ns, tvb, offset, 8, ENC_BIG_ENDIAN);
3302
151
    offset += 8;
3303
3304
151
    proto_tree_add_item(asam_cmp_status_msg_header_tree, hf_cmp_msg_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
3305
151
    offset += 2;
3306
3307
151
    proto_tree_add_item(asam_cmp_status_msg_header_tree, hf_cmp_msg_vendor_id, tvb, offset, 2, ENC_BIG_ENDIAN);
3308
151
    offset += 2;
3309
3310
151
    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);
3311
151
    offset += 1;
3312
3313
151
    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);
3314
151
    offset += 1;
3315
3316
151
    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);
3317
151
    offset += 2;
3318
3319
151
    proto_item_set_end(ti_msg_header, tvb, offset);
3320
3321
151
    ti_msg_payload = proto_tree_add_item(tree, hf_cmp_msg_payload, tvb, offset, asam_cmp_status_msg_payload_length, ENC_BIG_ENDIAN);
3322
151
    asam_cmp_status_msg_payload_tree = proto_item_add_subtree(ti_msg_payload, ett_asam_cmp_header);
3323
151
    proto_item_append_text(ti_msg_payload, " %s", "- Status Message");
3324
3325
151
    switch (asam_cmp_status_msg_payload_type) {
3326
0
    case CMP_STATUS_MSG_INVALID:
3327
0
        col_append_str(pinfo->cinfo, COL_INFO, " (Invalid/Padding)");
3328
0
        proto_item_append_text(ti_msg_payload, " %s", "(Invalid/Padding)");
3329
0
        proto_item_set_end(ti_msg_payload, tvb, offset + asam_cmp_status_msg_payload_length);
3330
3331
0
        return tvb_reported_length_remaining(tvb, offset_orig);
3332
3333
4
    case CMP_STATUS_MSG_CM_STAT_MSG:
3334
4
        col_append_str(pinfo->cinfo, COL_INFO, " (CM)");
3335
4
        proto_item_append_text(ti_msg_payload, " %s", "(CM)");
3336
3337
4
        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);
3338
3339
4
        subtree = proto_item_add_subtree(ti, ett_asam_cmp_status_cm_uptime);
3340
4
        proto_tree_add_uint64(subtree, hf_cmp_status_msg_cm_uptime_s, tvb, offset, 8, uptime / 1000000000);
3341
4
        offset += 8;
3342
3343
4
        proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_gm_identity, tvb, offset, 8, ENC_BIG_ENDIAN);
3344
4
        offset += 8;
3345
3346
4
        proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_gm_clock_quality, tvb, offset, 4, ENC_BIG_ENDIAN);
3347
4
        offset += 4;
3348
3349
4
        proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_current_utc_offset, tvb, offset, 2, ENC_BIG_ENDIAN);
3350
4
        offset += 2;
3351
3352
4
        proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_time_source, tvb, offset, 1, ENC_NA);
3353
4
        offset += 1;
3354
3355
4
        proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_domain_num, tvb, offset, 1, ENC_NA);
3356
4
        offset += 1;
3357
3358
4
        proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_msg_res, tvb, offset, 1, ENC_NA);
3359
4
        offset += 1;
3360
3361
4
        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);
3362
4
        offset += 1;
3363
3364
4
        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);
3365
4
        offset += 2;
3366
3367
4
        if (asam_cmp_status_msg_cm_dev_desc_length > 0) {
3368
2
            asam_cmp_status_msg_cm_dev_desc_length += (asam_cmp_status_msg_cm_dev_desc_length % 2); /* padding to 16bit */
3369
2
            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);
3370
2
            offset += (int)asam_cmp_status_msg_cm_dev_desc_length;
3371
2
        }
3372
3373
4
        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);
3374
4
        offset += 2;
3375
3376
4
        if (asam_cmp_status_msg_cm_sn_length > 0) {
3377
1
            asam_cmp_status_msg_cm_sn_length += (asam_cmp_status_msg_cm_sn_length % 2); /* padding to 16bit */
3378
1
            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);
3379
1
            offset += (int)asam_cmp_status_msg_cm_sn_length;
3380
1
        }
3381
3382
4
        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);
3383
4
        offset += 2;
3384
3385
4
        if (asam_cmp_status_msg_cm_hw_ver_length > 0) {
3386
0
            asam_cmp_status_msg_cm_hw_ver_length += (asam_cmp_status_msg_cm_hw_ver_length % 2); /* padding to 16bit */
3387
0
            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);
3388
0
            offset += (int)asam_cmp_status_msg_cm_hw_ver_length;
3389
0
        }
3390
3391
4
        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);
3392
4
        offset += 2;
3393
3394
4
        if (asam_cmp_status_msg_cm_sw_ver_length > 0) {
3395
0
            asam_cmp_status_msg_cm_sw_ver_length += (asam_cmp_status_msg_cm_sw_ver_length % 2); /* padding to 16bit */
3396
0
            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);
3397
0
            offset += (int)asam_cmp_status_msg_cm_sw_ver_length;
3398
0
        }
3399
3400
4
        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);
3401
4
        offset += 2;
3402
3403
4
        if (asam_cmp_status_msg_vendor_data_length > 0) {
3404
0
            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);
3405
0
            offset += (int)asam_cmp_status_msg_vendor_data_length;
3406
0
        }
3407
4
        break;
3408
3409
72
    case CMP_STATUS_MSG_IF_STAT_MSG:
3410
72
        col_append_str(pinfo->cinfo, COL_INFO, " (Interface)");
3411
72
        proto_item_append_text(ti_msg_payload, " %s", "(Interface)");
3412
3413
        /* each entry is 40 bytes, header is 16 bytes */
3414
139
        while (tvb_reported_length_remaining(tvb, offset) >= 40 && offset - offset_orig + 40 <= 16 + asam_cmp_status_msg_payload_length) {
3415
67
            uint32_t ifaceid;
3416
67
            uint32_t ifacetype;
3417
3418
67
            ti_interface = proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_iface_interface, tvb, offset, 34, ENC_NA);
3419
67
            subtree = proto_item_add_subtree(ti_interface, ett_asam_cmp_status_interface);
3420
3421
67
            ti = proto_tree_add_item_ret_uint(subtree, hf_cmp_iface_iface_id, tvb, offset, 4, ENC_BIG_ENDIAN, &ifaceid);
3422
67
            descr = ht_interface_config_to_string(ifaceid);
3423
67
            if (descr != NULL) {
3424
0
                proto_item_append_text(ti, " (%s)", descr);
3425
0
            }
3426
67
            offset += 4;
3427
3428
67
            proto_tree_add_item(subtree, hf_cmp_iface_msg_total_rx, tvb, offset, 4, ENC_BIG_ENDIAN);
3429
67
            offset += 4;
3430
3431
67
            proto_tree_add_item(subtree, hf_cmp_iface_msg_total_tx, tvb, offset, 4, ENC_BIG_ENDIAN);
3432
67
            offset += 4;
3433
3434
67
            proto_tree_add_item(subtree, hf_cmp_iface_msg_dropped_rx, tvb, offset, 4, ENC_BIG_ENDIAN);
3435
67
            offset += 4;
3436
3437
67
            proto_tree_add_item(subtree, hf_cmp_iface_msg_dropped_tx, tvb, offset, 4, ENC_BIG_ENDIAN);
3438
67
            offset += 4;
3439
3440
67
            proto_tree_add_item(subtree, hf_cmp_iface_errs_total_rx, tvb, offset, 4, ENC_BIG_ENDIAN);
3441
67
            offset += 4;
3442
3443
67
            proto_tree_add_item(subtree, hf_cmp_iface_errs_total_tx, tvb, offset, 4, ENC_BIG_ENDIAN);
3444
67
            offset += 4;
3445
3446
67
            proto_tree_add_item_ret_uint(subtree, hf_cmp_iface_iface_type, tvb, offset, 1, ENC_NA, &ifacetype);
3447
67
            offset += 1;
3448
3449
67
            if (descr != NULL) {
3450
0
                proto_item_append_text(ti_interface, " %s, Type: %s", descr, val_to_str(pinfo->pool, ifacetype, data_msg_type_names, "Unknown (0x%x)"));
3451
67
            } else {
3452
67
                proto_item_append_text(ti_interface, " 0x%x, Type: %s", ifaceid, val_to_str(pinfo->pool, ifacetype, data_msg_type_names, "Unknown (0x%x)"));
3453
67
            }
3454
3455
67
            proto_tree_add_item(subtree, hf_cmp_iface_iface_status, tvb, offset, 1, ENC_NA);
3456
67
            offset += 1;
3457
3458
67
            proto_tree_add_item(subtree, hf_cmp_iface_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
3459
67
            offset += 2;
3460
3461
67
            offset += dissect_asam_cmp_status_interface_support_mask(tvb, subtree, offset, (uint8_t)ifacetype);
3462
3463
67
            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);
3464
67
            offset += 2;
3465
3466
67
            if (asam_cmp_status_msg_iface_stream_id_count > 0) {
3467
31
                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);
3468
31
                stream_ids_subtree = proto_item_add_subtree(ti_stream_ids, ett_asam_cmp_status_stream_ids);
3469
3470
3.26k
                for (unsigned i = 0; i < asam_cmp_status_msg_iface_stream_id_count; i++) {
3471
3.22k
                    proto_tree_add_item(stream_ids_subtree, hf_cmp_iface_stream_id, tvb, offset, 1, ENC_NA);
3472
3.22k
                    offset += 1;
3473
3.22k
                }
3474
31
                offset += (asam_cmp_status_msg_iface_stream_id_count % 2); /* padding to 16bit */
3475
31
            }
3476
3477
67
            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);
3478
67
            offset += 2;
3479
3480
67
            if (asam_cmp_status_msg_vendor_data_length > 0) {
3481
11
                proto_tree_add_item(subtree, hf_cmp_iface_vendor_data, tvb, offset, asam_cmp_status_msg_vendor_data_length, ENC_NA);
3482
11
                offset += (int)asam_cmp_status_msg_vendor_data_length;
3483
11
            }
3484
3485
67
            proto_item_set_end(ti_interface, tvb, offset);
3486
67
        }
3487
72
        break;
3488
3489
2
    case CMP_STATUS_MSG_CONF_STAT_MSG:
3490
2
        col_append_str(pinfo->cinfo, COL_INFO, " (Configuration)");
3491
2
        proto_item_append_text(ti_msg_payload, " %s", "(Configuration)");
3492
3493
2
        if (asam_cmp_status_msg_payload_length > 0) {
3494
1
            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);
3495
1
            offset += (int)asam_cmp_status_msg_payload_length;
3496
1
        }
3497
2
        break;
3498
3499
1
    case CMP_STATUS_MSG_DLE_STAT_MSG:
3500
1
        col_append_str(pinfo->cinfo, COL_INFO, " (Data Lost Event)");
3501
1
        proto_item_append_text(ti_msg_payload, " %s", "(Data Lost Event)");
3502
3503
1
        proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_dataloss_data_sink_port, tvb, offset, 2, ENC_BIG_ENDIAN);
3504
1
        offset += 2;
3505
3506
1
        proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_dataloss_device_id, tvb, offset, 2, ENC_BIG_ENDIAN);
3507
1
        offset += 2;
3508
3509
1
        proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_dataloss_reserved, tvb, offset, 1, ENC_NA);
3510
1
        offset += 1;
3511
3512
1
        proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_dataloss_stream_id, tvb, offset, 1, ENC_NA);
3513
1
        offset += 1;
3514
3515
1
        proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_dataloss_last_ssq_value, tvb, offset, 2, ENC_BIG_ENDIAN);
3516
1
        offset += 2;
3517
3518
1
        proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_dataloss_current_ssq_value, tvb, offset, 2, ENC_BIG_ENDIAN);
3519
1
        offset += 2;
3520
1
        break;
3521
3522
2
    case CMP_STATUS_MSG_TSLE_STAT_MSG:
3523
2
        col_append_str(pinfo->cinfo, COL_INFO, " (Time Sync Lost Event)");
3524
2
        proto_item_append_text(ti_msg_payload, " %s", "(Time Sync Lost Event)");
3525
3526
2
        proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_timeloss_port_nr, tvb, offset, 2, ENC_BIG_ENDIAN);
3527
2
        offset += 2;
3528
3529
2
        proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_timeloss_device_id, tvb, offset, 2, ENC_BIG_ENDIAN);
3530
2
        offset += 2;
3531
3532
2
        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);
3533
2
        offset += 1;
3534
2
        break;
3535
3536
21
    case CMP_STATUS_MSG_VENDOR_STAT_MSG:
3537
21
        col_append_str(pinfo->cinfo, COL_INFO, " (Vendor specific)");
3538
21
        proto_item_append_text(ti_msg_payload, " %s", "(Vendor specific)");
3539
3540
21
        if (asam_cmp_status_msg_payload_length > 0) {
3541
4
            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);
3542
4
            offset += (int)asam_cmp_status_msg_payload_length;
3543
4
        }
3544
21
        break;
3545
3546
49
    default:
3547
49
        if (asam_cmp_status_msg_payload_length > 0) {
3548
42
            offset += (int)asam_cmp_status_msg_payload_length;
3549
42
        }
3550
3551
49
        proto_item_set_end(ti_msg_payload, tvb, offset);
3552
49
        break;
3553
151
    }
3554
3555
113
    if ((CMP_MSG_HEADER_LEN + asam_cmp_status_msg_payload_length) < (offset - offset_orig)) {
3556
3
        proto_tree_add_expert(tree, pinfo, &ei_asam_cmp_length_mismatch, tvb, offset_orig + CMP_MSG_HEADER_LEN, asam_cmp_status_msg_payload_length);
3557
3
        proto_item_set_end(ti_msg_payload, tvb, offset);
3558
3
    }
3559
3560
113
    return CMP_MSG_HEADER_LEN + asam_cmp_status_msg_payload_length;
3561
151
}
3562
3563
static int
3564
64
dissect_asam_cmp_vendor_msg(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset_orig) {
3565
64
    proto_item *ti = NULL;
3566
64
    proto_item *ti_msg_header = NULL;
3567
64
    proto_item *ti_msg_payload = NULL;
3568
64
    proto_tree *asam_cmp_vendor_msg_header_tree = NULL;
3569
64
    proto_tree *subtree = NULL;
3570
64
    unsigned asam_cmp_vendor_msg_payload_type = 0;
3571
64
    unsigned asam_cmp_vendor_msg_payload_length = 0;
3572
64
    unsigned offset = offset_orig;
3573
3574
64
    static int * const asam_cmp_common_flags[] = {
3575
64
        &hf_cmp_common_flag_reserved_0xf0,
3576
64
        &hf_cmp_common_flag_seg,
3577
64
        &hf_cmp_common_flag_insync,
3578
64
        &hf_cmp_common_flag_recal,
3579
64
        NULL
3580
64
    };
3581
3582
64
    ti_msg_header = proto_tree_add_item(tree, hf_cmp_msg_header, tvb, offset, 8, ENC_BIG_ENDIAN);
3583
64
    asam_cmp_vendor_msg_header_tree = proto_item_add_subtree(ti_msg_header, ett_asam_cmp_header);
3584
64
    proto_item_append_text(ti_msg_header, " %s", "- Vendor-Defined Message");
3585
3586
64
    uint64_t ns = tvb_get_uint64(tvb, offset, ENC_BIG_ENDIAN);
3587
64
    nstime_t timestamp = { .secs = (time_t)(ns / 1000000000), .nsecs = (int)(ns % 1000000000) };
3588
3589
64
    ti = proto_tree_add_time(asam_cmp_vendor_msg_header_tree, hf_cmp_msg_timestamp, tvb, offset, 8, &timestamp);
3590
3591
64
    subtree = proto_item_add_subtree(ti, ett_asam_cmp_timestamp);
3592
64
    proto_tree_add_item(subtree, hf_cmp_msg_timestamp_ns, tvb, offset, 8, ENC_BIG_ENDIAN);
3593
64
    offset += 8;
3594
3595
64
    proto_tree_add_item(asam_cmp_vendor_msg_header_tree, hf_cmp_msg_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
3596
64
    offset += 2;
3597
3598
64
    proto_tree_add_item(asam_cmp_vendor_msg_header_tree, hf_cmp_msg_vendor_id, tvb, offset, 2, ENC_BIG_ENDIAN);
3599
64
    offset += 2;
3600
3601
64
    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);
3602
64
    offset += 1;
3603
3604
64
    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);
3605
64
    offset += 1;
3606
3607
64
    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);
3608
64
    offset += 2;
3609
3610
64
    proto_item_set_end(ti_msg_header, tvb, offset);
3611
3612
64
    ti_msg_payload = proto_tree_add_item(tree, hf_cmp_msg_payload, tvb, offset, asam_cmp_vendor_msg_payload_length, ENC_BIG_ENDIAN);
3613
64
    proto_item_append_text(ti_msg_payload, " %s", "- Vendor-Defined Message");
3614
3615
64
    if (asam_cmp_vendor_msg_payload_length > 0) {
3616
23
        offset += (int)asam_cmp_vendor_msg_payload_length;
3617
23
        proto_item_set_end(ti_msg_payload, tvb, offset);
3618
23
    }
3619
3620
64
    return CMP_MSG_HEADER_LEN + asam_cmp_vendor_msg_payload_length;
3621
64
}
3622
3623
static int
3624
400
dissect_asam_cmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
3625
400
    proto_item *ti_root = NULL;
3626
400
    proto_item *ti_header = NULL;
3627
400
    proto_item *ti = NULL;
3628
400
    proto_tree *asam_cmp_tree = NULL;
3629
400
    proto_tree *asam_cmp_header_tree = NULL;
3630
400
    unsigned msg_type = 0;
3631
400
    unsigned device_id = 0;
3632
400
    unsigned offset = 0;
3633
3634
400
    col_clear(pinfo->cinfo, COL_INFO);
3635
400
    col_set_str(pinfo->cinfo, COL_INFO, "ASAM-CMP");
3636
400
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "ASAM-CMP");
3637
3638
400
    ti_root = proto_tree_add_item(tree, proto_asam_cmp, tvb, 0, -1, ENC_NA);
3639
400
    asam_cmp_tree = proto_item_add_subtree(ti_root, ett_asam_cmp);
3640
3641
400
    ti_header = proto_tree_add_item(asam_cmp_tree, hf_cmp_header, tvb, offset, CMP_HEADER_LEN, ENC_BIG_ENDIAN);
3642
400
    asam_cmp_header_tree = proto_item_add_subtree(ti_header, ett_asam_cmp_header);
3643
3644
400
    proto_tree_add_item(asam_cmp_header_tree, hf_cmp_version, tvb, offset, 1, ENC_NA);
3645
400
    offset += 1;
3646
3647
400
    proto_tree_add_item(asam_cmp_header_tree, hf_cmp_header_res, tvb, offset, 1, ENC_NA);
3648
400
    offset += 1;
3649
3650
400
    ti = proto_tree_add_item_ret_uint(asam_cmp_header_tree, hf_cmp_device_id, tvb, offset, 2, ENC_BIG_ENDIAN, &device_id);
3651
400
    add_device_id_text(ti, (uint16_t)device_id);
3652
400
    offset += 2;
3653
3654
400
    proto_tree_add_item_ret_uint(asam_cmp_header_tree, hf_cmp_msg_type, tvb, offset, 1, ENC_NA, &msg_type);
3655
400
    offset += 1;
3656
3657
400
    proto_tree_add_item(asam_cmp_header_tree, hf_cmp_stream_id, tvb, offset, 1, ENC_NA);
3658
400
    offset += 1;
3659
3660
400
    proto_tree_add_item(asam_cmp_header_tree, hf_cmp_stream_seq_ctr, tvb, offset, 2, ENC_BIG_ENDIAN);
3661
400
    offset += 2;
3662
3663
400
    proto_item_append_text(ti_root, ", Device: 0x%04x, Type: %s", (uint16_t)device_id, val_to_str(pinfo->pool, msg_type, msg_type_names, "Unknown (0x%x)"));
3664
3665
744
    while (tvb_reported_length_remaining(tvb, offset) >= 16) {
3666
502
        unsigned bytes_parsed = 0;
3667
3668
502
        switch (msg_type) {
3669
219
        case CMP_MSG_TYPE_CAP_DATA_MSG:
3670
219
            col_append_str(pinfo->cinfo, COL_INFO, ", Data Msg (Capturing)");
3671
219
            bytes_parsed += dissect_asam_cmp_data_msg(tvb, pinfo, tree, asam_cmp_tree, offset, false);
3672
219
            break;
3673
38
        case CMP_MSG_TYPE_CTRL_MSG:
3674
38
            col_append_str(pinfo->cinfo, COL_INFO, ", Control Msg");
3675
38
            bytes_parsed = dissect_asam_cmp_ctrl_msg(tvb, pinfo, asam_cmp_tree, offset);
3676
38
            break;
3677
160
        case CMP_MSG_TYPE_STATUS_MSG:
3678
160
            col_append_str(pinfo->cinfo, COL_INFO, ", Status Msg");
3679
160
            bytes_parsed = dissect_asam_cmp_status_msg(tvb, pinfo, asam_cmp_tree, offset);
3680
160
            break;
3681
18
        case CMP_MSG_TYPE_TX_DATA_MSG:
3682
18
            col_append_str(pinfo->cinfo, COL_INFO, ", Data Msg (Transmit)");
3683
18
            bytes_parsed += dissect_asam_cmp_data_msg(tvb, pinfo, tree, asam_cmp_tree, offset, true);
3684
18
            break;
3685
64
        case CMP_MSG_TYPE_VENDOR:
3686
64
            col_append_str(pinfo->cinfo, COL_INFO, ", Vendor Msg");
3687
64
            bytes_parsed = dissect_asam_cmp_vendor_msg(tvb, pinfo, asam_cmp_tree, offset);
3688
64
            break;
3689
3
        default:
3690
3
            proto_item_set_end(ti_root, tvb, offset);
3691
3
            return offset;
3692
502
        }
3693
3694
373
        offset += bytes_parsed;
3695
3696
        /* Bytes are not being parsed, if detected as Ethernet padding, so we need to bail out. */
3697
373
        if (bytes_parsed == 0) {
3698
29
            proto_item_set_end(ti_root, tvb, offset);
3699
29
            return offset;
3700
29
        }
3701
3702
373
    }
3703
3704
242
    proto_item_set_end(ti_root, tvb, offset);
3705
242
    return offset;
3706
400
}
3707
3708
void
3709
16
proto_register_asam_cmp(void) {
3710
16
    module_t *asam_cmp_module = NULL;
3711
16
    expert_module_t *expert_module_asam_cmp;
3712
16
    uat_t *asam_cmp_deviceid_uat = NULL;
3713
16
    uat_t *asam_cmp_interfaceid_uat = NULL;
3714
3715
16
    static hf_register_info hf[] = {
3716
        /* Header */
3717
16
        { &hf_cmp_header,                           { "ASAM CMP Header", "asam-cmp.hdr", FT_PROTOCOL, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3718
3719
16
        { &hf_cmp_version,                          { "Version", "asam-cmp.hdr.version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3720
16
        { &hf_cmp_header_res,                       { "Reserved", "asam-cmp.hdr.res", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3721
16
        { &hf_cmp_device_id,                        { "Device ID", "asam-cmp.hdr.device_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3722
16
        { &hf_cmp_msg_type,                         { "Message Type", "asam-cmp.hdr.msg_type", FT_UINT8, BASE_HEX, VALS(msg_type_names), 0x0, NULL, HFILL }},
3723
16
        { &hf_cmp_stream_id,                        { "Stream ID", "asam-cmp.hdr.stream_id", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3724
16
        { &hf_cmp_stream_seq_ctr,                   { "Stream Sequence Counter", "asam-cmp.hdr.stream_seq_cnt", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3725
3726
        /* Message Header*/
3727
16
        { &hf_cmp_msg_header,                       { "ASAM CMP Msg Header", "asam-cmp.msg_hdr", FT_PROTOCOL, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3728
3729
16
        { &hf_cmp_msg_timestamp,                    { "Timestamp", "asam-cmp.msg_hdr.timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }},
3730
16
        { &hf_cmp_msg_timestamp_ns,                 { "Timestamp (ns)", "asam-cmp.msg_hdr.timestamp_ns", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3731
16
        { &hf_cmp_msg_deadline,                     { "Deadline", "asam-cmp.msg_hdr.deadline", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_nanoseconds), 0x0, NULL, HFILL }},
3732
16
        { &hf_cmp_msg_reserved,                     { "Reserved", "asam-cmp.msg_hdr.reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3733
3734
16
        { &hf_cmp_msg_trans_opts,                   { "Transmission Options", "asam-cmp.msg_hdr.trans_opts", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3735
16
        { &hf_cmp_msg_trans_opts_res,               { "Reserved", "asam-cmp.msg_hdr.trans_opts.res", FT_UINT32, BASE_HEX, NULL, 0xFFFFFFFF, NULL, HFILL } },
3736
16
        { &hf_cmp_msg_trans_opts_lin_wup_dura,      { "Wake Up Duration", "asam-cmp.msg_hdr.trans_opts.lin.wup_duration", FT_UINT32, BASE_DEC, NULL, 0xFFFF0000, NULL, HFILL } },
3737
16
        { &hf_cmp_msg_trans_opts_lin_res,           { "Reserved", "asam-cmp.msg_hdr.trans_opts.lin.reserved", FT_UINT32, BASE_HEX, NULL, 0x0000FFFF, NULL, HFILL } },
3738
16
        { &hf_cmp_msg_trans_opts_fr_op,             { "Operation", "asam-cmp.msg_hdr.trans_opts.flexray.operation", FT_UINT32, BASE_HEX,  VALS(flexray_transmission_operations), 0xFF000000, NULL, HFILL}},
3739
16
        { &hf_cmp_msg_trans_opts_fr_cycle_rep,      { "Cycle Repetition", "asam-cmp.msg_hdr.trans_opts.flexray.cycle_repetition", FT_UINT32, BASE_DEC, NULL, 0x00FF0000, NULL, HFILL } },
3740
16
        { &hf_cmp_msg_trans_opts_fr_res,            { "Reserved", "asam-cmp.msg_hdr.trans_opts.flexray.reserved", FT_UINT32, BASE_HEX, NULL, 0x0000FFFF, NULL, HFILL } },
3741
3742
16
        { &hf_cmp_msg_common_flags,                 { "Common Flags", "asam-cmp.msg_hdr.common_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3743
16
        { &hf_cmp_common_flag_recal,                { "Timestamp recalculated", "asam-cmp.msg_hdr.recalculated", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},
3744
16
        { &hf_cmp_common_flag_relative,             { "Relative", "asam-cmp.msg_hdr.timestamp_relative", FT_BOOLEAN, 8, TFS(&timestamp_rel_abs), 0x01, NULL, HFILL}},
3745
16
        { &hf_cmp_common_flag_insync,               { "Synchronized", "asam-cmp.msg_hdr.sync", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL } },
3746
16
        { &hf_cmp_common_flag_reserved_0x02,        { "Reserved", "asam-cmp.msg_hdr.res3", FT_UINT8, BASE_HEX, NULL, 0x02, NULL, HFILL } },
3747
16
        { &hf_cmp_common_flag_seg,                  { "Segmentation", "asam-cmp.msg_hdr.seg", FT_UINT8, BASE_HEX, VALS(seg_flag_names), 0x0C, NULL, HFILL } },
3748
16
        { &hf_cmp_common_flag_dir_on_if,            { "Direction", "asam-cmp.msg_hdr.dir_on_if", FT_BOOLEAN, 8, TFS(&interface_direction), 0x10, NULL, HFILL } },
3749
16
        { &hf_cmp_common_flag_overflow,             { "Overflow", "asam-cmp.msg_hdr.overflow", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL } },
3750
16
        { &hf_cmp_common_flag_err_in_payload,       { "Error in payload", "asam-cmp.msg_hdr.error_in_payload", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL } },
3751
16
        { &hf_cmp_common_flag_reserved,             { "Reserved", "asam-cmp.msg_hdr.res", FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL } },
3752
16
        { &hf_cmp_common_flag_reserved_0xf0,        { "Reserved", "asam-cmp.msg_hdr.res2", FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL } },
3753
3754
16
        { &hf_cmp_msg_vendor_id,                    { "Vendor ID", "asam-cmp.msg_hdr.vendor_id", FT_UINT16, BASE_HEX, VALS(vendor_ids), 0x0, NULL, HFILL }},
3755
16
        { &hf_cmp_msg_payload_length,               { "Payload Length", "asam-cmp.msg_hdr.payload_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3756
16
        { &hf_cmp_msg_payload,                      { "Payload", "asam-cmp.msg_payload", FT_PROTOCOL, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3757
3758
        /* Data Message Header */
3759
16
        { &hf_cmp_interface_id,                     { "Interface ID", "asam-cmp.msg_hdr.interface_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3760
16
        { &hf_cmp_payload_type,                     { "Payload Type", "asam-cmp.msg_hdr.payload_type", FT_UINT8, BASE_HEX, VALS(data_msg_type_names), 0x0, NULL, HFILL }},
3761
3762
        /* Additional Control Message Header */
3763
16
        { &hf_cmp_ctrl_msg_reserved,                { "Reserved", "asam-cmp.msg_hdr.reserved", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3764
16
        { &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 }},
3765
3766
        /* Additional Status Message Header */
3767
16
        { &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 }},
3768
3769
        /* Additional Vendor Message Header */
3770
16
        { &hf_cmp_vendor_msg_payload_type,          { "Payload Type", "asam-cmp.msg_hdr.payload_type", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3771
3772
        /* Data Message Payloads */
3773
        /* CAN Data */
3774
16
        { &hf_cmp_can_flags,                        { "Flags", "asam-cmp.msg.can.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3775
16
        { &hf_cmp_can_flag_crc_err,                 { "CRC Error", "asam-cmp.msg.can.flags.crc_err", FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL }},
3776
16
        { &hf_cmp_can_flag_ack_err,                 { "ACK Error", "asam-cmp.msg.can.flags.ack_err", FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL } },
3777
16
        { &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 } },
3778
16
        { &hf_cmp_can_flag_reserved_0004,           { "Reserved", "asam-cmp.msg.can.flags.reserved_0x0004", FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL } },
3779
16
        { &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 } },
3780
16
        { &hf_cmp_can_flag_reserved_0008,           { "Reserved", "asam-cmp.msg.can.flags.reserved_0x0008", FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL } },
3781
16
        { &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 } },
3782
16
        { &hf_cmp_can_flag_form_err,                { "Form Error", "asam-cmp.msg.can.flags.form_err", FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL } },
3783
16
        { &hf_cmp_can_flag_stuff_err,               { "Stuff Error", "asam-cmp.msg.can.flags.stuff_err", FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL } },
3784
16
        { &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 } },
3785
16
        { &hf_cmp_can_flag_eof_err,                 { "EOF Error", "asam-cmp.msg.can.flags.eof_err", FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL } },
3786
16
        { &hf_cmp_can_flag_bit_err,                 { "Bit Error", "asam-cmp.msg.can.flags.bit_err", FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL } },
3787
16
        { &hf_cmp_can_flag_r0,                      { "R0", "asam-cmp.msg.can.flags.r0", FT_BOOLEAN, 16, TFS(&can_rec_dom), 0x0400, NULL, HFILL } },
3788
16
        { &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 } },
3789
16
        { &hf_cmp_can_flag_reserved,                { "Reserved", "asam-cmp.msg.can.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xF000, NULL, HFILL } },
3790
16
        { &hf_cmp_can_flag_reserved_1000,           { "Reserved", "asam-cmp.msg.can.flags.reserved_0x1000", FT_UINT16, BASE_HEX, NULL, 0x1000, NULL, HFILL } },
3791
16
        { &hf_cmp_can_flag_reserved_2000,           { "Reserved", "asam-cmp.msg.can.flags.reserved_0x2000", FT_UINT16, BASE_HEX, NULL, 0x2000, NULL, HFILL } },
3792
16
        { &hf_cmp_can_flag_gen_err,                 { "Generic Error", "asam-cmp.msg.can.flags.gen_err", FT_UINT16, BASE_HEX, NULL, 0x4000, NULL, HFILL } },
3793
16
        { &hf_cmp_can_flag_reserved_tx,             { "Reserved", "asam-cmp.msg.can.flags.reserved_tx", FT_UINT16, BASE_HEX, NULL, 0x8000, NULL, HFILL } },
3794
3795
16
        { &hf_cmp_can_reserved,                     { "Reserved", "asam-cmp.msg.can.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3796
3797
16
        { &hf_cmp_can_id,                           { "ID", "asam-cmp.msg.can.id_field", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3798
16
        { &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 }},
3799
16
        { &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 }},
3800
16
        { &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 }},
3801
16
        { &hf_cmp_can_id_err,                       { "ID_ERR", "asam-cmp.msg.can.id_err", FT_BOOLEAN, 32, TFS(&tfs_invalid_valid), CMP_CAN_ID_ERR, NULL, HFILL}},
3802
16
        { &hf_cmp_can_id_rtr,                       { "RTR", "asam-cmp.msg.can.rtr", FT_BOOLEAN, 32, TFS(&can_id_rtr), CMP_CAN_ID_RTR, NULL, HFILL }},
3803
16
        { &hf_cmp_can_id_ide,                       { "IDE", "asam-cmp.msg.can.ide", FT_BOOLEAN, 32, TFS(&can_id_ide), CMP_CAN_ID_IDE, NULL, HFILL }},
3804
3805
16
        { &hf_cmp_can_crc,                          { "CRC", "asam-cmp.msg.can.crc_field", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3806
16
        { &hf_cmp_can_crc_crc,                      { "CRC", "asam-cmp.msg.can.crc", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CAN_CRC_CRC, NULL, HFILL }},
3807
16
        { &hf_cmp_can_crc_res,                      { "Reserved", "asam-cmp.msg.can.crc_res", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CAN_CRC_RES, NULL, HFILL }},
3808
16
        { &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 }},
3809
3810
16
        { &hf_cmp_can_err_pos,                      { "Error Position", "asam-cmp.msg.can.err_pos", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3811
16
        { &hf_cmp_can_dlc,                          { "DLC", "asam-cmp.msg.can.dlc", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3812
16
        { &hf_cmp_can_data_len,                     { "Data length", "asam-cmp.msg.can.data_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3813
3814
        /* CAN-FD Data */
3815
16
        { &hf_cmp_canfd_flags,                      { "Flags", "asam-cmp.msg.canfd.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3816
16
        { &hf_cmp_canfd_flag_crc_err,               { "CRC Error", "asam-cmp.msg.canfd.flags.crc_err", FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL }},
3817
16
        { &hf_cmp_canfd_flag_ack_err,               { "ACK Error", "asam-cmp.msg.canfd.flags.ack_err", FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL } },
3818
16
        { &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 } },
3819
16
        { &hf_cmp_canfd_flag_reserved_0004,         { "Reserved", "asam-cmp.msg.canfd.flags.reserved_0x0004", FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL } },
3820
16
        { &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 } },
3821
16
        { &hf_cmp_canfd_flag_reserved_0008,         { "Reserved", "asam-cmp.msg.canfd.flags.reserved_0x0008", FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL } },
3822
16
        { &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 } },
3823
16
        { &hf_cmp_canfd_flag_form_err,              { "Form Error", "asam-cmp.msg.canfd.flags.form_err", FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL } },
3824
16
        { &hf_cmp_canfd_flag_stuff_err,             { "Stuff Error", "asam-cmp.msg.canfd.flags.stuff_err", FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL } },
3825
16
        { &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 } },
3826
16
        { &hf_cmp_canfd_flag_eof_err,               { "EOF Error", "asam-cmp.msg.canfd.flags.eof_err", FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL } },
3827
16
        { &hf_cmp_canfd_flag_bit_err,               { "Bit Error", "asam-cmp.msg.canfd.flags.bit_err", FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL } },
3828
16
        { &hf_cmp_canfd_flag_res,                   { "Reserved Bit", "asam-cmp.msg.canfd.flags.res", FT_BOOLEAN, 16, TFS(&can_rec_dom), 0x0400, NULL, HFILL } },
3829
16
        { &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 } },
3830
16
        { &hf_cmp_canfd_flag_brs,                   { "BRS", "asam-cmp.msg.canfd.flags.brs", FT_BOOLEAN, 16, NULL, 0x1000, NULL, HFILL } },
3831
16
        { &hf_cmp_canfd_flag_esi,                   { "ESI", "asam-cmp.msg.canfd.flags.esi",  FT_BOOLEAN, 16, TFS(&canfd_act_pas), 0x2000, NULL, HFILL } },
3832
16
        { &hf_cmp_canfd_flag_reserved,              { "Reserved", "asam-cmp.msg.canfd.flags.reserved",  FT_UINT16, BASE_HEX, NULL, 0xC000, NULL, HFILL } },
3833
3834
16
        { &hf_cmp_canfd_flag_gen_err,               { "Generic Error", "asam-cmp.msg.canfd.flags.gen_err", FT_UINT16, BASE_HEX, NULL, 0x4000, NULL, HFILL } },
3835
16
        { &hf_cmp_canfd_flag_reserved_tx,           { "Reserved", "asam-cmp.msg.canfd.flags.reserved_tx",  FT_UINT16, BASE_HEX, NULL, 0x8000, NULL, HFILL } },
3836
3837
16
        { &hf_cmp_canfd_reserved,                   { "Reserved", "asam-cmp.msg.canfd.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3838
3839
16
        { &hf_cmp_canfd_id,                         { "ID", "asam-cmp.msg.canfd.id_field", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3840
16
        { &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 }},
3841
16
        { &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 }},
3842
16
        { &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 }},
3843
16
        { &hf_cmp_canfd_id_err,                     { "ID_ERR", "asam-cmp.msg.canfd.id_err", FT_BOOLEAN, 32, TFS(&tfs_invalid_valid), CMP_CANFD_ID_ERR, NULL, HFILL}},
3844
16
        { &hf_cmp_canfd_id_rrs,                     { "RRS", "asam-cmp.msg.canfd.rrs", FT_BOOLEAN, 32, NULL, CMP_CANFD_ID_RRS, NULL, HFILL }},
3845
16
        { &hf_cmp_canfd_id_ide,                     { "IDE", "asam-cmp.msg.canfd.ide", FT_BOOLEAN, 32, NULL, CMP_CANFD_ID_IDE, NULL, HFILL }},
3846
3847
16
        { &hf_cmp_canfd_crc,                        { "CRC SBC", "asam-cmp.msg.canfd.crc_field", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3848
16
        { &hf_cmp_canfd_crc_crc17,                  { "CRC (17bit)", "asam-cmp.msg.canfd.crc17", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CANFD_CRC_CRC17, NULL, HFILL }},
3849
16
        { &hf_cmp_canfd_crc_crc21,                  { "CRC (21bit)", "asam-cmp.msg.canfd.crc21", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CANFD_CRC_CRC21, NULL, HFILL }},
3850
16
        { &hf_cmp_canfd_crc_sbc,                    { "SBC", "asam-cmp.msg.canfd.sbc", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CANFD_CRC_SBC, NULL, HFILL }},
3851
16
        { &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 }},
3852
16
        { &hf_cmp_canfd_crc_res,                    { "Reserved", "asam-cmp.msg.canfd.crc_res", FT_UINT32, BASE_HEX_DEC, NULL, CMP_CANFD_CRC_RES, NULL, HFILL }},
3853
16
        { &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 }},
3854
16
        { &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 }},
3855
3856
16
        { &hf_cmp_canfd_err_pos,                    { "Error Position", "asam-cmp.msg.canfd.err_pos", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3857
16
        { &hf_cmp_canfd_dlc,                        { "DLC", "asam-cmp.msg.canfd.dlc", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3858
16
        { &hf_cmp_canfd_data_len,                   { "Data length", "asam-cmp.msg.canfd.data_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
3859
3860
        /* LIN */
3861
16
        { &hf_cmp_lin_flags,                        { "Flags", "asam-cmp.msg.lin.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3862
16
        { &hf_cmp_lin_flag_checksum_err,            { "Checksum Error", "asam-cmp.msg.lin.flags.checksum_err", FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL } },
3863
16
        { &hf_cmp_lin_flag_col_err,                 { "Collision Error", "asam-cmp.msg.lin.flags.col_err", FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL } },
3864
16
        { &hf_cmp_lin_flag_reserved_0x0002,         { "Reserved", "asam-cmp.msg.lin.flags.reserved_0x0002", FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL } },
3865
16
        { &hf_cmp_lin_flag_parity_err,              { "Parity Error", "asam-cmp.msg.lin.flags.parity_err", FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL } },
3866
16
        { &hf_cmp_lin_flag_no_slave_res,            { "No Slave Response", "asam-cmp.msg.lin.flags.no_slave_response", FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL } },
3867
16
        { &hf_cmp_lin_flag_reserved_0x0008,         { "Reserved", "asam-cmp.msg.lin.flags.reserved_0x0008", FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL } },
3868
16
        { &hf_cmp_lin_flag_sync_err,                { "Sync Error", "asam-cmp.msg.lin.flags.sync_err", FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL } },
3869
16
        { &hf_cmp_lin_flag_framing_err,             { "Framing Error", "asam-cmp.msg.lin.flags.framing_err", FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL } },
3870
16
        { &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 } },
3871
16
        { &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 } },
3872
16
        { &hf_cmp_lin_flag_wup,                     { "Wake Up Request Detection (WUP)", "asam-cmp.msg.lin.flags.wup", FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL } },
3873
16
        { &hf_cmp_lin_flag_reserved,                { "Reserved", "asam-cmp.msg.lin.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xFE00, NULL, HFILL } },
3874
3875
16
        { &hf_cmp_lin_reserved,                     { "Reserved", "asam-cmp.msg.lin.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3876
16
        { &hf_cmp_lin_pid,                          { "PID", "asam-cmp.msg.lin.pid", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3877
16
        { &hf_cmp_lin_pid_id,                       { "ID", "asam-cmp.msg.lin.pid.id", FT_UINT8, BASE_HEX, NULL, CMP_CANFD_PID_ID_MASK, NULL, HFILL } },
3878
16
        { &hf_cmp_lin_pid_parity,                   { "Parity", "asam-cmp.msg.lin.pid.parity", FT_UINT8, BASE_HEX, NULL, CMP_CANFD_PID_PARITY_MASK, NULL, HFILL } },
3879
16
        { &hf_cmp_lin_reserved_2,                   { "Reserved", "asam-cmp.msg.lin.res_2", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3880
16
        { &hf_cmp_lin_checksum,                     { "Checksum", "asam-cmp.msg.lin.checksum", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3881
16
        { &hf_cmp_lin_data_len,                     { "Data length", "asam-cmp.msg.lin.data_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
3882
3883
        /* FlexRay */
3884
16
        { &hf_cmp_flexray_flags,                    { "Flags", "asam-cmp.msg.flexray.flags.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3885
16
        { &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 } },
3886
16
        { &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 } },
3887
16
        { &hf_cmp_flexray_flag_nf,                  { "Null Frame", "asam-cmp.msg.flexray.flags.nf", FT_BOOLEAN, 16, NULL, CMP_FLEXRAY_FLAGS_NF, NULL, HFILL } },
3888
16
        { &hf_cmp_flexray_flag_sf,                  { "Startup Frame", "asam-cmp.msg.flexray.flags.sf", FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL } },
3889
16
        { &hf_cmp_flexray_flag_sync,                { "Sync Frame", "asam-cmp.msg.flexray.flags.sync", FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL } },
3890
16
        { &hf_cmp_flexray_flag_wus,                 { "Wake Up Symbol", "asam-cmp.msg.flexray.flags.wus", FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL } },
3891
16
        { &hf_cmp_flexray_flag_ppi,                 { "Preamble Indicator", "asam-cmp.msg.flexray.flags.ppi", FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL } },
3892
16
        { &hf_cmp_flexray_flag_cas,                 { "Collision avoidance Symbol (CAS)", "asam-cmp.msg.flexray.flags.cas", FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL } },
3893
16
        { &hf_cmp_flexray_flag_leading,             { "Leading", "asam-cmp.msg.flexray.flags.leading", FT_BOOLEAN, 16, TFS(&flexray_leading_following), 0x0100, NULL, HFILL}},
3894
16
        { &hf_cmp_flexray_flag_reserved_0x0100,     { "Reserved", "asam-cmp.msg.flexray.flags.reserved_0x0100", FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL}},
3895
16
        { &hf_cmp_flexray_flag_channel,             { "Channel", "asam-cmp.msg.flexray.flags.channel", FT_BOOLEAN, 16, TFS(&flexray_channel_b_a), 0x0200, NULL, HFILL}},
3896
16
        { &hf_cmp_flexray_flag_reserved,            { "Reserved", "asam-cmp.msg.flexray.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xFC00, NULL, HFILL } },
3897
3898
16
        { &hf_cmp_flexray_reserved,                 { "Reserved", "asam-cmp.msg.flexray.flags.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3899
16
        { &hf_cmp_flexray_header_crc,               { "Header CRC", "asam-cmp.msg.flexray.flags.header_crc", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3900
16
        { &hf_cmp_flexray_frame_id,                 { "Frame ID", "asam-cmp.msg.flexray.flags.frame_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3901
16
        { &hf_cmp_flexray_cycle,                    { "Cycle", "asam-cmp.msg.flexray.flags.cycle", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3902
16
        { &hf_cmp_flexray_frame_crc,                { "Frame CRC", "asam-cmp.msg.flexray.flags.frame_crc", FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3903
16
        { &hf_cmp_flexray_reserved_2,               { "Reserved", "asam-cmp.msg.flexray.flags.res_2", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3904
16
        { &hf_cmp_flexray_data_len,                 { "Data length", "asam-cmp.msg.flexray.flags.data_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3905
3906
        /* Digital */
3907
16
        { &hf_cmp_digital_flags,                    { "Flags", "asam-cmp.msg.digital.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3908
16
        { &hf_cmp_digital_flag_trig_present,        { "Trigger Information Present", "asam-cmp.msg.digital.flags.trigger_present",  FT_UINT16, BASE_HEX, NULL, 0x0001, NULL, HFILL } },
3909
16
        { &hf_cmp_digital_flag_sampl_present,       { "Sampling Information Present", "asam-cmp.msg.digital.flags.sampling_present",  FT_UINT16, BASE_HEX, NULL, 0x0002, NULL, HFILL } },
3910
16
        { &hf_cmp_digital_flag_reserved,            { "Reserved", "asam-cmp.msg.digital.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xFFFC, NULL, HFILL } },
3911
3912
16
        { &hf_cmp_digital_reserved,                 { "Reserved", "asam-cmp.msg.digital.res", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3913
16
        { &hf_cmp_digital_pin_count,                { "Pin Count", "asam-cmp.msg.digital.pin_count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
3914
3915
16
        { &hf_cmp_digital_trig_pattern,             { "Trigger Pattern", "asam-cmp.msg.digital.trigger.pattern", FT_UINT8, BASE_DEC, VALS(digital_trigger_pattern), 0x0, NULL, HFILL}},
3916
16
        { &hf_cmp_digital_trig_pin,                 { "Trigger Pin", "asam-cmp.msg.digital.trigger.pin", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
3917
16
        { &hf_cmp_digital_flag_reserved2,           { "Reserved", "asam-cmp.msg.digital.trigger.reserved2", FT_UINT16, BASE_HEX, NULL, 0x0 , NULL, HFILL } },
3918
3919
16
        { &hf_cmp_digital_sample_interval,          { "Sample Interval", "asam-cmp.msg.digital.sample.interval", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } },
3920
16
        { &hf_cmp_digital_sample_count,             { "Sample Count", "asam-cmp.msg.digital.sample.count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
3921
16
        { &hf_cmp_digital_sample,                   { "Sample", "asam-cmp.msg.digital.sample", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
3922
3923
16
        { &hf_cmp_digital_sample_pin_0,             { "GPIO 0", "asam-cmp.msg.digital.sample.pin_0", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x01, NULL, HFILL } },
3924
16
        { &hf_cmp_digital_sample_pin_1,             { "GPIO 1", "asam-cmp.msg.digital.sample.pin_1", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x02, NULL, HFILL } },
3925
16
        { &hf_cmp_digital_sample_pin_2,             { "GPIO 2", "asam-cmp.msg.digital.sample.pin_2", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x04, NULL, HFILL } },
3926
16
        { &hf_cmp_digital_sample_pin_3,             { "GPIO 3", "asam-cmp.msg.digital.sample.pin_3", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x08, NULL, HFILL } },
3927
16
        { &hf_cmp_digital_sample_pin_4,             { "GPIO 4", "asam-cmp.msg.digital.sample.pin_4", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x10, NULL, HFILL } },
3928
16
        { &hf_cmp_digital_sample_pin_5,             { "GPIO 5", "asam-cmp.msg.digital.sample.pin_5", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x20, NULL, HFILL } },
3929
16
        { &hf_cmp_digital_sample_pin_6,             { "GPIO 6", "asam-cmp.msg.digital.sample.pin_6", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x40, NULL, HFILL } },
3930
16
        { &hf_cmp_digital_sample_pin_7,             { "GPIO 7", "asam-cmp.msg.digital.sample.pin_7", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x80, NULL, HFILL } },
3931
3932
16
        { &hf_cmp_digital_sample_pin_8,             { "GPIO 8", "asam-cmp.msg.digital.sample.pin_8", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x01, NULL, HFILL } },
3933
16
        { &hf_cmp_digital_sample_pin_9,             { "GPIO 9", "asam-cmp.msg.digital.sample.pin_9", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x02, NULL, HFILL } },
3934
16
        { &hf_cmp_digital_sample_pin_10,            { "GPIO 10", "asam-cmp.msg.digital.sample.pin_10", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x04, NULL, HFILL } },
3935
16
        { &hf_cmp_digital_sample_pin_11,            { "GPIO 11", "asam-cmp.msg.digital.sample.pin_11", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x08, NULL, HFILL } },
3936
16
        { &hf_cmp_digital_sample_pin_12,            { "GPIO 12", "asam-cmp.msg.digital.sample.pin_12", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x10, NULL, HFILL } },
3937
16
        { &hf_cmp_digital_sample_pin_13,            { "GPIO 13", "asam-cmp.msg.digital.sample.pin_13", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x20, NULL, HFILL } },
3938
16
        { &hf_cmp_digital_sample_pin_14,            { "GPIO 14", "asam-cmp.msg.digital.sample.pin_14", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x40, NULL, HFILL } },
3939
16
        { &hf_cmp_digital_sample_pin_15,            { "GPIO 15", "asam-cmp.msg.digital.sample.pin_15", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x80, NULL, HFILL } },
3940
3941
16
        { &hf_cmp_digital_sample_pin_16,            { "GPIO 16", "asam-cmp.msg.digital.sample.pin_16", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x01, NULL, HFILL } },
3942
16
        { &hf_cmp_digital_sample_pin_17,            { "GPIO 17", "asam-cmp.msg.digital.sample.pin_17", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x02, NULL, HFILL } },
3943
16
        { &hf_cmp_digital_sample_pin_18,            { "GPIO 18", "asam-cmp.msg.digital.sample.pin_18", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x04, NULL, HFILL } },
3944
16
        { &hf_cmp_digital_sample_pin_19,            { "GPIO 19", "asam-cmp.msg.digital.sample.pin_19", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x08, NULL, HFILL } },
3945
16
        { &hf_cmp_digital_sample_pin_20,            { "GPIO 20", "asam-cmp.msg.digital.sample.pin_20", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x10, NULL, HFILL } },
3946
16
        { &hf_cmp_digital_sample_pin_21,            { "GPIO 21", "asam-cmp.msg.digital.sample.pin_21", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x20, NULL, HFILL } },
3947
16
        { &hf_cmp_digital_sample_pin_22,            { "GPIO 22", "asam-cmp.msg.digital.sample.pin_22", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x40, NULL, HFILL } },
3948
16
        { &hf_cmp_digital_sample_pin_23,            { "GPIO 23", "asam-cmp.msg.digital.sample.pin_23", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x80, NULL, HFILL } },
3949
3950
16
        { &hf_cmp_digital_sample_pin_24,            { "GPIO 24", "asam-cmp.msg.digital.sample.pin_24", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x01, NULL, HFILL } },
3951
16
        { &hf_cmp_digital_sample_pin_25,            { "GPIO 25", "asam-cmp.msg.digital.sample.pin_25", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x02, NULL, HFILL } },
3952
16
        { &hf_cmp_digital_sample_pin_26,            { "GPIO 26", "asam-cmp.msg.digital.sample.pin_26", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x04, NULL, HFILL } },
3953
16
        { &hf_cmp_digital_sample_pin_27,            { "GPIO 27", "asam-cmp.msg.digital.sample.pin_27", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x08, NULL, HFILL } },
3954
16
        { &hf_cmp_digital_sample_pin_28,            { "GPIO 28", "asam-cmp.msg.digital.sample.pin_28", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x10, NULL, HFILL } },
3955
16
        { &hf_cmp_digital_sample_pin_29,            { "GPIO 29", "asam-cmp.msg.digital.sample.pin_29", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x20, NULL, HFILL } },
3956
16
        { &hf_cmp_digital_sample_pin_30,            { "GPIO 30", "asam-cmp.msg.digital.sample.pin_30", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x40, NULL, HFILL } },
3957
16
        { &hf_cmp_digital_sample_pin_31,            { "GPIO 31", "asam-cmp.msg.digital.sample.pin_31", FT_BOOLEAN, 8, TFS(&tfs_high_low), 0x80, NULL, HFILL } },
3958
3959
        /* UART/RS-232 */
3960
16
        { &hf_cmp_uart_flags,                       { "Flags", "asam-cmp.msg.uart.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3961
16
        { &hf_cmp_uart_flag_cl,                     { "CL", "asam-cmp.msg.uart.flags.cl",  FT_UINT16, BASE_HEX, VALS(uart_cl_names), 0x0007, NULL, HFILL } },
3962
16
        { &hf_cmp_uart_flag_reserved,               { "Reserved", "asam-cmp.msg.uart.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xFFF8, NULL, HFILL } },
3963
3964
16
        { &hf_cmp_uart_reserved,                    { "Reserved", "asam-cmp.msg.uart.reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3965
16
        { &hf_cmp_uart_data_len,                    { "Data entry count", "asam-cmp.msg.uart.data_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
3966
16
        { &hf_cmp_uart_data,                        { "Data", "asam-cmp.msg.uart.data", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3967
16
        { &hf_cmp_uart_data_data,                   { "Data", "asam-cmp.msg.uart.data.data", FT_UINT16, BASE_HEX, NULL, CMP_UART_DATA_DATA_MASK, NULL, HFILL }},
3968
16
        { &hf_cmp_uart_data_reserved,               { "Reserved", "asam-cmp.msg.uart.data.reserved", FT_UINT16, BASE_HEX, NULL, 0x1E00, NULL, HFILL }},
3969
16
        { &hf_cmp_uart_data_framing_err,            { "Framing Error", "asam-cmp.msg.uart.flags.framing_err", FT_BOOLEAN, 16, NULL, 0x2000, NULL, HFILL }},
3970
16
        { &hf_cmp_uart_data_break_condition,        { "Break Condition", "asam-cmp.msg.uart.flags.break_condition", FT_BOOLEAN, 16, NULL, 0x4000, NULL, HFILL }},
3971
16
        { &hf_cmp_uart_data_parity_err,             { "Parity Error", "asam-cmp.msg.uart.data.parity_err", FT_BOOLEAN, 16, NULL, 0x8000, NULL, HFILL }},
3972
3973
        /* Analog */
3974
16
        { &hf_cmp_analog_flags,                     { "Flags", "asam-cmp.msg.analog.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3975
16
        { &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 } },
3976
16
        { &hf_cmp_analog_flag_reserved,             { "Reserved", "asam-cmp.msg.analog.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xfffc, NULL, HFILL } },
3977
3978
16
        { &hf_cmp_analog_reserved,                  { "Reserved", "asam-cmp.msg.analog.reserved",  FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
3979
16
        { &hf_cmp_analog_unit,                      { "Unit", "asam-cmp.msg.analog.unit", FT_UINT8, BASE_HEX, VALS(analog_units), 0x0, NULL, HFILL } },
3980
16
        { &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 } },
3981
16
        { &hf_cmp_analog_sample_offset,             { "Sample Offset", "asam-cmp.msg.analog.sample_offset", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } },
3982
16
        { &hf_cmp_analog_sample_scalar,             { "Sample Scalar", "asam-cmp.msg.analog.sample_scalar", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } },
3983
16
        { &hf_cmp_analog_sample,                    { "Sample", "asam-cmp.msg.analog.sample", FT_DOUBLE, BASE_EXP, NULL, 0x0, NULL, HFILL } },
3984
16
        { &hf_cmp_analog_sample_raw,                { "Sample Raw", "asam-cmp.msg.analog.sample_raw", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
3985
3986
        /* Ethernet */
3987
16
        { &hf_cmp_eth_flags,                        { "Flags", "asam-cmp.msg.eth.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3988
16
        { &hf_cmp_eth_flag_fcs_err,                 { "FCS Error", "asam-cmp.msg.eth.flags.crc_err", FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL } },
3989
16
        { &hf_cmp_eth_flag_short_err,               { "Short Frame Error", "asam-cmp.msg.eth.flags.short_err", FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL } },
3990
16
        { &hf_cmp_eth_flag_tx_down,                 { "TX Port Down", "asam-cmp.msg.eth.flags.tx_down", FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL } },
3991
16
        { &hf_cmp_eth_flag_collision,               { "Collision detected", "asam-cmp.msg.eth.flags.collision", FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL } },
3992
16
        { &hf_cmp_eth_flag_long_err,                { "Long Frame Error", "asam-cmp.msg.eth.flags.long_err", FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL } },
3993
16
        { &hf_cmp_eth_flag_phy_err,                 { "PHY Error", "asam-cmp.msg.eth.flags.phy_err", FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL } },
3994
16
        { &hf_cmp_eth_flag_truncated,               { "Frame truncated", "asam-cmp.msg.eth.flags.truncated", FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL } },
3995
16
        { &hf_cmp_eth_flag_fcs_supported,           { "FCS supported", "asam-cmp.msg.eth.flags.fcs_supported", FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL } },
3996
16
        { &hf_cmp_eth_flag_reserved_cap,            { "Reserved", "asam-cmp.msg.eth.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xFF00, NULL, HFILL } },
3997
3998
16
        { &hf_cmp_eth_flag_reserved_tx,             { "Reserved", "asam-cmp.msg.eth.flags.reserved_tx", FT_UINT16, BASE_HEX, NULL, 0x00FF, NULL, HFILL } },
3999
16
        { &hf_cmp_eth_flag_fcs_sending,             { "FCS sending", "asam-cmp.msg.eth.flags.fcs_sending", FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL } },
4000
16
        { &hf_cmp_eth_flag_reserved_tx2,            { "Reserved", "asam-cmp.msg.eth.flags.reserved_tx2", FT_UINT16, BASE_HEX, NULL, 0xFE00, NULL, HFILL } },
4001
4002
16
        { &hf_cmp_eth_reserved,                     { "Reserved", "asam-cmp.msg.eth.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4003
16
        { &hf_cmp_eth_payload_length,               { "Data length", "asam-cmp.msg.eth.data_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4004
4005
        /* SPI */
4006
16
        { &hf_cmp_spi_flags,                        { "Flags", "asam-cmp.msg.spi.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4007
16
        { &hf_cmp_spi_flag_reserved,                { "Reserved", "asam-cmp.msg.spi.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xFFFF, NULL, HFILL } },
4008
4009
16
        { &hf_cmp_spi_reserved,                     { "Reserved", "asam-cmp.msg.spi.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4010
16
        { &hf_cmp_spi_cipo_length,                  { "Controller In Peripheral Out Length", "asam-cmp.msg.spi.cipo_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4011
16
        { &hf_cmp_spi_cipo,                         { "Controller In Peripheral Out (CIPO)", "asam-cmp.msg.spi.cipo", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4012
16
        { &hf_cmp_spi_copi_length,                  { "Controller Out Peripheral In Length", "asam-cmp.msg.spi.copi_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4013
16
        { &hf_cmp_spi_copi,                         { "Controller Out Peripheral In (COPI)", "asam-cmp.msg.spi.copi", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4014
4015
        /* I2C */
4016
16
        { &hf_cmp_i2c_flags,                        { "Flags", "asam-cmp.msg.i2c.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4017
16
        { &hf_cmp_i2c_flag_dir,                     { "Direction", "asam-cmp.msg.i2c.flags.dir", FT_BOOLEAN, 16, TFS(&i2c_read_write), 0x0001, NULL, HFILL} },
4018
16
        { &hf_cmp_i2c_flag_addr_len,                { "Address Length", "asam-cmp.msg.i2c.flags.addr_len", FT_BOOLEAN, 16, TFS(&i2c_addr_length), 0x0002, NULL, HFILL } },
4019
16
        { &hf_cmp_i2c_flag_addr_ack,                { "Address Ack", "asam-cmp.msg.i2c.flags.addr_ack", FT_BOOLEAN, 16, TFS(&i2c_nack_ack), 0x0004, NULL, HFILL } },
4020
16
        { &hf_cmp_i2c_flag_addr_err,                { "Ack Error", "asam-cmp.msg.i2c.flags.ack_err", FT_BOOLEAN, 16, TFS(&cmp_err_noerr), 0x0008, NULL, HFILL } },
4021
16
        { &hf_cmp_i2c_flag_stop_cond,               { "Stop Condition", "asam-cmp.msg.i2c.flags.stop_cond", FT_BOOLEAN, 16, TFS(&i2c_stop_repeated_start), 0x0010, NULL, HFILL } },
4022
16
        { &hf_cmp_i2c_flag_start_cond,              { "Start Condition", "asam-cmp.msg.i2c.flags.start_cond", FT_BOOLEAN, 16, TFS(&i2c_repeated_start_start), 0x0020, NULL, HFILL } },
4023
16
        { &hf_cmp_i2c_flag_reserved,                { "Reserved", "asam-cmp.msg.i2c.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xFFC0, NULL, HFILL } },
4024
4025
16
        { &hf_cmp_i2c_reserved,                     { "Reserved", "asam-cmp.msg.i2c.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4026
16
        { &hf_cmp_i2c_addr,                         { "Address", "asam-cmp.msg.i2c.addr", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4027
16
        { &hf_cmp_i2c_data_entry_count,             { "Data Entry Count", "asam-cmp.msg.i2c.data_entry_count", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4028
16
        { &hf_cmp_i2c_data,                         { "Data Entry", "asam-cmp.msg.i2c.data_entry", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4029
16
        { &hf_cmp_i2c_data_byte,                    { "Data Byte", "asam-cmp.msg.i2c.data_entry.data", FT_UINT16, BASE_HEX, NULL, 0x00FF, NULL, HFILL } },
4030
16
        { &hf_cmp_i2c_data_control_ack,             { "Ack", "asam-cmp.msg.i2c.data_entry.control.ack", FT_BOOLEAN, 16, TFS(&i2c_nack_ack), 0x0100, NULL, HFILL } },
4031
16
        { &hf_cmp_i2c_data_control_res,             { "Reserved", "asam-cmp.msg.i2c.data_entry.control.reserved", FT_UINT16, BASE_HEX, NULL, 0xFE00, NULL, HFILL } },
4032
4033
        /* GigE Vision */
4034
16
        { &hf_cmp_gige_flags,                       { "Flags", "asam-cmp.msg.gige.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4035
16
        { &hf_cmp_gige_flag_reserved,               { "Reserved", "asam-cmp.msg.gige.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xFFFF, NULL, HFILL } },
4036
4037
16
        { &hf_cmp_gige_reserved,                    { "Reserved", "asam-cmp.msg.gige.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4038
16
        { &hf_cmp_gige_payload_length,              { "Data length", "asam-cmp.msg.gige.data_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4039
16
        { &hf_cmp_gige_payload,                     { "Data", "asam-cmp.msg.gige.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4040
4041
        /* MIPI CSI-2 */
4042
16
        { &hf_cmp_mipi_csi2_flags,                  { "Flags", "asam-cmp.msg.mipi_csi2.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4043
16
        { &hf_cmp_mipi_csi2_flag_crc_err,           { "CRC Error", "asam-cmp.msg.mipi_csi2.flags.crc_err", FT_BOOLEAN, 16, TFS(&cmp_err_noerr), 0x0001, NULL, HFILL} },
4044
16
        { &hf_cmp_mipi_csi2_flag_ecc_err_c,         { "Correctable ECC Error", "asam-cmp.msg.mipi_csi2.flags.ecc_err_c", FT_BOOLEAN, 16, TFS(&cmp_err_noerr), 0x0002, NULL, HFILL } },
4045
16
        { &hf_cmp_mipi_csi2_flag_ecc_err_uc,        { "Uncorrectable ECC Error", "asam-cmp.msg.mipi_csi2.flags.ecc_err_uc", FT_BOOLEAN, 16, TFS(&cmp_err_noerr), 0x0004, NULL, HFILL } },
4046
16
        { &hf_cmp_mipi_csi2_flag_ecc_fmt,           { "ECC Format", "asam-cmp.msg.mipi_csi2.flags.ecc_fmt", FT_BOOLEAN, 16, TFS(&mipi_csi2_ecc_noecc), 0x0008, NULL, HFILL } },
4047
16
        { &hf_cmp_mipi_csi2_flag_frame_ctr_src,     { "Frame Counter Source", "asam-cmp.msg.mipi_csi2.flags.frame_counter_source", FT_BOOLEAN, 16, TFS(&mipi_csi2_cmcounter_csicounter), 0x0010, NULL, HFILL } },
4048
16
        { &hf_cmp_mipi_csi2_flag_line_ctr_src,      { "Line Counter Source", "asam-cmp.msg.mipi_csi2.flags.line_counter_source", FT_BOOLEAN, 16, TFS(&mipi_csi2_cmcounter_csicounter), 0x0020, NULL, HFILL } },
4049
16
        { &hf_cmp_mipi_csi2_flag_cs_support,        { "Checksum Support", "asam-cmp.msg.mipi_csi2.flags.checksum_support", FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x0040, NULL, HFILL } },
4050
16
        { &hf_cmp_mipi_csi2_flag_reserved,          { "Reserved", "asam-cmp.msg.mipi_csi2.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xFF80, NULL, HFILL } },
4051
4052
16
        { &hf_cmp_mipi_csi2_flag_reserved_tx,       { "Reserved", "asam-cmp.msg.mipi_csi2.flags.reserved_tx", FT_UINT16, BASE_HEX, NULL, 0xFFFF, NULL, HFILL } },
4053
4054
16
        { &hf_cmp_mipi_csi2_reserved,               { "Reserved", "asam-cmp.msg.mipi_csi2.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4055
16
        { &hf_cmp_mipi_csi2_frame_counter,          { "Frame Counter", "asam-cmp.msg.mipi_csi2.frame_counter", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4056
16
        { &hf_cmp_mipi_csi2_line_counter,           { "Line Counter", "asam-cmp.msg.mipi_csi2.line_counter", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4057
16
        { &hf_cmp_mipi_csi2_dt,                     { "Data Type", "asam-cmp.msg.mipi_csi2.data_type", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4058
16
        { &hf_cmp_mipi_csi2_dt_res,                 { "Reserved", "asam-cmp.msg.mipi_csi2.data_type.res", FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL } },
4059
16
        { &hf_cmp_mipi_csi2_dt_dt,                  { "Data Type", "asam-cmp.msg.mipi_csi2.data_type.data_type", FT_UINT8, BASE_HEX, VALS(mipi_csi2_data_type_names), MIPI_CSI2_DT_BITS, NULL, HFILL}},
4060
16
        { &hf_cmp_mipi_csi2_vci,                    { "Virtual Channel Identifier", "asam-cmp.msg.mipi_csi2.vci", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4061
16
        { &hf_cmp_mipi_csi2_vci_res,                { "Reserved", "asam-cmp.msg.mipi_csi2.vci.res", FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL } },
4062
16
        { &hf_cmp_mipi_csi2_vci_vcx,                { "Virtual Channel Exctension", "asam-cmp.msg.mipi_csi2.vci.vcx", FT_UINT8, BASE_HEX, NULL, 0x0C, NULL, HFILL } },
4063
16
        { &hf_cmp_mipi_csi2_vci_vci,                { "Virtual Channel Identifier", "asam-cmp.msg.mipi_csi2.vci.vci", FT_UINT8, BASE_HEX, NULL, 0x03, NULL, HFILL } },
4064
16
        { &hf_cmp_mipi_csi2_reserved2,              { "Reserved", "asam-cmp.msg.mipi_csi2.res2", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4065
16
        { &hf_cmp_mipi_csi2_ecc,                    { "ECC", "asam-cmp.msg.mipi_csi2.ecc", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4066
16
        { &hf_cmp_mipi_csi2_ecc_res,                { "Reserved", "asam-cmp.msg.mipi_csi2.ecc.res", FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL } },
4067
16
        { &hf_cmp_mipi_csi2_ecc_ecc,                { "ECC", "asam-cmp.msg.mipi_csi2.ecc.ecc", FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL } },
4068
16
        { &hf_cmp_mipi_csi2_cs,                     { "Checksum", "asam-cmp.msg.mipi_csi2.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4069
16
        { &hf_cmp_mipi_csi2_wc,                     { "Word Count", "asam-cmp.msg.mipi_csi2.word_count", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4070
16
        { &hf_cmp_mipi_csi2_short_packet_data,      { "Short Packet Data Field", "asam-cmp.msg.mipi_csi2.short_packet_data_field", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4071
16
        { &hf_cmp_mipi_csi2_data,                   { "Data", "asam-cmp.msg.mipi_csi2.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4072
4073
        /* Ethernet Raw */
4074
16
        { &hf_cmp_raw_eth_flags,                    { "Flags", "asam-cmp.msg.raw_eth.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4075
16
        { &hf_cmp_raw_eth_flag_reserved,            { "Reserved", "asam-cmp.msg.raw_eth.flags.reserved", FT_UINT16, BASE_HEX, NULL, 0xFFFF, NULL, HFILL } },
4076
4077
16
        { &hf_cmp_raw_eth_reserved,                 { "Reserved", "asam-cmp.msg.raw_eth.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4078
16
        { &hf_cmp_raw_eth_payload_length,           { "Data length", "asam-cmp.msg.raw_eth.data_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4079
16
        { &hf_cmp_raw_eth_preamble,                 { "Preamble", "asam-cmp.msg.raw_eth.preamble", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4080
16
        { &hf_cmp_raw_eth_sfd,                      { "SFD", "asam-cmp.msg.raw_eth.sfd", FT_UINT8, BASE_HEX, VALS(eth_raw_sfd), 0x0, NULL, HFILL } },
4081
16
        { &hf_cmp_raw_eth_mpacket,                  { "mPacket", "asam-cmp.msg.raw_eth.mpacket", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4082
4083
        /* 10BASE-T1S Symbols */
4084
16
        { &hf_cmp_10t1s_symb_flags,                 { "Flags", "asam-cmp.msg.10baset1s_symbols.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4085
16
        { &hf_cmp_10t1s_symb_flag_decode_err,       { "Decode Error", "asam-cmp.msg.10baset1s_symbols.flags.decode_error", FT_BOOLEAN, 16, TFS(&cmp_err_noerr), 0x0001, NULL, HFILL} },
4086
16
        { &hf_cmp_10t1s_symb_flag_miss_beacon,      { "Missing Beacon Error", "asam-cmp.msg.10baset1s_symbols.flags.missing_beacon", FT_BOOLEAN, 16, TFS(&cmp_err_noerr), 0x0002, NULL, HFILL} },
4087
16
        { &hf_cmp_10t1s_symb_flag_res,              { "Reserved", "asam-cmp.msg.10baset1s_symbols.flags.reserved", FT_BOOLEAN, 16, NULL, 0x7FFC, NULL, HFILL } },
4088
16
        { &hf_cmp_10t1s_symb_flag_first_beacon,     { "First Beacon", "asam-cmp.msg.10baset1s_symbols.flags.first_beacon", FT_BOOLEAN, 16, TFS(&eth_10baset1s_firstbeacon_notfirstbeacon), 0x8000, NULL, HFILL} },
4089
4090
16
        { &hf_cmp_10t1s_symb_data_length,           { "Data length", "asam-cmp.msg.10baset1s_symbols.data_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4091
16
        { &hf_cmp_10t1s_symb_data,                  { "Data", "asam-cmp.msg.10baset1s_symbols.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4092
16
        { &hf_cmp_10t1s_symb_data_symbol,           { "Symbol", "asam-cmp.msg.10baset1s_symbols.data.symbol", FT_UINT8, BASE_HEX, VALS(eth_10baset1s_symbol_names), 0x0, NULL, HFILL}},
4093
4094
        /* A2B */
4095
16
        { &hf_cmp_a2b_flags,                        { "Flags", "asam-cmp.msg.a2b.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
4096
16
        { &hf_cmp_a2b_flag_fin,                     { "Switch Activation Finished", "asam-cmp.msg.a2b.flags.fin", FT_BOOLEAN, 16, TFS(&a2b_switch_closed_open), 00001, NULL, HFILL} },
4097
16
        { &hf_cmp_a2b_flag_fault_err,               { "Cable Fault (FAULT)", "asam-cmp.msg.a2b.flags.fault_err", FT_BOOLEAN, 16, TFS(&a2b_cable_fault_no_fault), 0x0002, NULL, HFILL}},
4098
16
        { &hf_cmp_a2b_flag_fault_code,              { "Cable Fault Code (FAULT_CODE)", "asam-cmp.msg.a2b.flags.fault_code", FT_UINT16, BASE_DEC, VALS(a2b_fault_code_names), 0x001c, NULL, HFILL}},
4099
16
        { &hf_cmp_a2b_flag_fault_nloc,              { "Cable Fault Not Localized (FAULT_NLOC)", "asam-cmp.msg.a2b.flags.fault_nloc", FT_BOOLEAN, 16, TFS(&a2b_cable_fault_not_localized_localized), 0x0020, NULL, HFILL} },
4100
16
        { &hf_cmp_a2b_flag_hdcnt_err,               { "Header Count Error (HDCNTERR)", "asam-cmp.msg.a2b.flags.hdcnt_err", FT_BOOLEAN, 16, TFS(&tfs_enabled_disabled), 0x0040, NULL, HFILL} },
4101
16
        { &hf_cmp_a2b_flag_dd_err,                  { "Data Decoding Error (DDERR)", "asam-cmp.msg.a2b.flags.dd_err", FT_BOOLEAN, 16, TFS(&a2b_data_decode_error_no_error), 0x0080, NULL, HFILL} },
4102
16
        { &hf_cmp_a2b_flag_crc_err,                 { "CRC Error (CRCERR)", "asam-cmp.msg.a2b.flags.crc_err", FT_BOOLEAN, 16, TFS(&a2b_crc_error_no_error), 0x0100, NULL, HFILL} },
4103
16
        { &hf_cmp_a2b_flag_dp_err,                  { "Data Parity Error (DPERR)", "asam-cmp.msg.a2b.flags.dp_err", FT_BOOLEAN, 16, TFS(&a2b_data_parity_error_no_error), 0x0200, NULL, HFILL} },
4104
16
        { &hf_cmp_a2b_flag_pwd_err,                 { "Downstream Power Switch Error (PWRERR)", "asam-cmp.msg.a2b.flags.pwr_err", FT_BOOLEAN, 16, TFS(&a2b_downstream_power_switch_error_no_error), 0x0400, NULL, HFILL} },
4105
16
        { &hf_cmp_a2b_flag_becovf_err,              { "Bit Error Count Error (BECOVFERR)", "asam-cmp.msg.a2b.flags.becovf_err", FT_BOOLEAN, 16, TFS(&a2b_bit_error_count_error_no_error), 0x0800, NULL, HFILL} },
4106
16
        { &hf_cmp_a2b_flag_srf_err,                 { "SRF Miss Error (SRFERR)", "asam-cmp.msg.a2b.flags.srf_err", FT_BOOLEAN, 16, TFS(&a2b_srf_miss_error_no_error), 0x1000, NULL, HFILL} },
4107
16
        { &hf_cmp_a2b_flag_srfcrc_err,              { "SRF CRC Error (SRFCRCERR Subordinate Node Only)", "asam-cmp.msg.a2b.flags.srfcrc_err", FT_BOOLEAN, 16, TFS(&a2b_srf_crc_error_no_error), 0x2000, NULL, HFILL} },
4108
16
        { &hf_cmp_a2b_flag_icrc_err,                { "Interrupt Frame CRC Error (ICRCERR)", "asam-cmp.msg.a2b.flags.icrc_err", FT_BOOLEAN, 16, TFS(&a2b_iocrc_error_no_error), 0x4000, NULL, HFILL} },
4109
16
        { &hf_cmp_a2b_flag_i2c_err,                 { "I2C Transaction Error (I2CERR)", "asam-cmp.msg.a2b.flags.i2c_err", FT_BOOLEAN, 16, TFS(&a2b_i2c_transaction_error_no_error), 0x8000, NULL, HFILL} },
4110
4111
16
        { &hf_cmp_a2b_reserved,                     { "Reserved", "asam-cmp.msg.a2b.reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4112
16
        { &hf_cmp_a2b_upstream_set,                 { "Upstream Settings", "asam-cmp.msg.a2b.upstream_settings", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL} },
4113
16
        { &hf_cmp_a2b_upstream_set_upfmt,           { "Upstream Format", "asam-cmp.msg.a2b.upstream_settings.upfmt", FT_BOOLEAN, 16, TFS(&a2b_fmt_alternate_normal), 0x0001, NULL, HFILL} },
4114
16
        { &hf_cmp_a2b_upstream_set_ups,             { "Upstream Slots Enabled", "asam-cmp.msg.a2b.upstream_settings.ups", FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL} },
4115
16
        { &hf_cmp_a2b_upstream_set_upsize,          { "Upstream Slot Size", "asam-cmp.msg.a2b.upstream_settings.upsize", FT_UINT16, BASE_HEX, VALS(a2b_slot_sizes), 0x001C, NULL, HFILL} },
4116
16
        { &hf_cmp_a2b_upstream_set_upslots,         { "Number of Upstream Slots", "asam-cmp.msg.a2b.upstream_settings.upslots", FT_UINT16, BASE_DEC, NULL, 0x07E0, NULL, HFILL} },
4117
16
        { &hf_cmp_a2b_upstream_set_upoffset,        { "Upstream Channel Offset", "asam-cmp.msg.a2b.upstream_settings.upoffset", FT_UINT16, BASE_DEC, NULL, 0xF800, NULL, HFILL} },
4118
4119
16
        { &hf_cmp_a2b_downstream_set,               { "Downstream Settings", "asam-cmp.msg.a2b.downstream_settings", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL} },
4120
16
        { &hf_cmp_a2b_downstream_set_dnfmt,         { "Downstream Format", "asam-cmp.msg.a2b.downstream_settings.dnfmt", FT_BOOLEAN, 16, TFS(&a2b_fmt_alternate_normal), 0x0001, NULL, HFILL} },
4121
16
        { &hf_cmp_a2b_downstream_set_dns,           { "Downstream Slots Enabled", "asam-cmp.msg.a2b.downstream_settings.dns", FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL} },
4122
16
        { &hf_cmp_a2b_downstream_set_dnsize,        { "Downstream Slot Size", "asam-cmp.msg.a2b.downstream_settings.dnsize", FT_UINT16, BASE_HEX, VALS(a2b_slot_sizes), 0x001C, NULL, HFILL} },
4123
16
        { &hf_cmp_a2b_downstream_set_dnslots,       { "Number of Downstream Slots", "asam-cmp.msg.a2b.downstream_settings.dnslots", FT_UINT16, BASE_DEC, NULL, 0x07E0, NULL, HFILL} },
4124
16
        { &hf_cmp_a2b_downstream_set_dnoffset,      { "Downstream Channel Offset", "asam-cmp.msg.a2b.downstream_settings.dnoffset", FT_UINT16, BASE_DEC, NULL, 0xF800, NULL, HFILL} },
4125
4126
16
        { &hf_cmp_a2b_general_set,                  { "General Settings", "asam-cmp.msg.a2b.general_settings", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL} },
4127
16
        { &hf_cmp_a2b_general_set_mstr,             { "Main Node Enable", "asam-cmp.msg.a2b.general_settings.mstr", FT_BOOLEAN, 64, NULL, 0x0000000000000001, NULL, HFILL} },
4128
16
        { &hf_cmp_a2b_general_set_standby,          { "Standby Mode Enable", "asam-cmp.msg.a2b.general_settings.standby", FT_BOOLEAN, 64, NULL, 0x0000000000000002, NULL, HFILL} },
4129
16
        { &hf_cmp_a2b_general_set_endsniff,         { "Bus Monitor Node Data Output Enable", "asam-cmp.msg.a2b.general_settings.endsniff", FT_BOOLEAN, 64, NULL, 0x0000000000000004, NULL, HFILL} },
4130
16
        { &hf_cmp_a2b_general_set_discvd,           { "Node Discovered", "asam-cmp.msg.a2b.general_settings.discvd", FT_BOOLEAN, 64, NULL, 0x0000000000000008, NULL, HFILL} },
4131
16
        { &hf_cmp_a2b_general_set_tx2pintl,         { "TX 2 Pin Interleave", "asam-cmp.msg.a2b.general_settings.tx2pintl", FT_BOOLEAN, 64, NULL, 0x0000000000000010, NULL, HFILL} },
4132
16
        { &hf_cmp_a2b_general_set_rx2pintl,         { "RX 2 Pin Interleave", "asam-cmp.msg.a2b.general_settings.rx2pintl", FT_BOOLEAN, 64, NULL, 0x0000000000000020, NULL, HFILL} },
4133
16
        { &hf_cmp_a2b_general_set_tdmmode,          { "TDM Mode", "asam-cmp.msg.a2b.general_settings.tdmmode", FT_UINT64, BASE_HEX|BASE_VAL64_STRING, VALS64(a2b_tdmmode_values), 0x00000000000001C0, NULL, HFILL}},
4134
16
        { &hf_cmp_a2b_general_set_tdmss,            { "TDM Channel Size", "asam-cmp.msg.a2b.general_settings.tdmss", FT_BOOLEAN, 64, TFS(&a2b_tdmss_16_32), 0x0000000000000200, NULL, HFILL}},
4135
16
        { &hf_cmp_a2b_general_set_bmmen,            { "Bus Monitor Mode Enable", "asam-cmp.msg.a2b.general_settings.bmmen", FT_BOOLEAN, 64, NULL, 0x0000000000000400, NULL, HFILL}},
4136
16
        { &hf_cmp_a2b_general_set_bclkrate,         { "BCLK Frequency Select", "asam-cmp.msg.a2b.general_settings.bclkrate", FT_UINT64, BASE_HEX|BASE_VAL64_STRING, VALS64(a2b_blckrate_values), 0x0000000000003800, NULL, HFILL} },
4137
16
        { &hf_cmp_a2b_general_set_i2srate,          { "I2S Rate Select", "asam-cmp.msg.a2b.general_settings.i2srate", FT_UINT64, BASE_HEX|BASE_VAL64_STRING, VALS64(a2b_i2srate_values), 0x000000000001C000, NULL, HFILL} },
4138
16
        { &hf_cmp_a2b_general_set_txoffset,         { "TX Offset", "asam-cmp.msg.a2b.general_settings.txoffset", FT_UINT64, BASE_HEX, NULL, 0x00000000007E0000, NULL, HFILL} },
4139
16
        { &hf_cmp_a2b_general_set_rxoffset,         { "RX Offset", "asam-cmp.msg.a2b.general_settings.rxoffset", FT_UINT64, BASE_HEX, NULL, 0x000000001F800000, NULL, HFILL} },
4140
16
        { &hf_cmp_a2b_general_set_syncoffset,       { "SYNC Offset", "asam-cmp.msg.a2b.general_settings.syncoffset", FT_UINT64, BASE_HEX, NULL, 0x0000001FE0000000, NULL, HFILL} },
4141
16
        { &hf_cmp_a2b_general_set_rrdiv,            { "Reduced Rate Divide Select", "asam-cmp.msg.a2b.general_settings.rrdiv", FT_UINT64, BASE_DEC|BASE_VAL64_STRING, VALS64(a2b_rrdiv_values), 0x000007E000000000, NULL, HFILL} },
4142
16
        { &hf_cmp_a2b_general_set_rrsoffset,        { "Reduced Rate SYNC Offset Select", "asam-cmp.msg.a2b.general_settings.rrsoffset", FT_UINT64, BASE_DEC|BASE_VAL64_STRING, VALS64(a2b_rrsoffset_values), 0x0000180000000000, NULL, HFILL} },
4143
16
        { &hf_cmp_a2b_general_set_reserved,         { "Reserved", "asam-cmp.msg.a2b.general_settings.reserved", FT_UINT64, BASE_HEX, NULL, 0x7FFFE00000000000, NULL, HFILL} },
4144
16
        { &hf_cmp_a2b_general_set_raw_cap,          { "Raw Capturing", "asam-cmp.msg.a2b.general_settings.raw_capturing", FT_BOOLEAN, 64, TFS(&a2b_raw_capturing), 0x8000000000000000, NULL, HFILL}},
4145
4146
16
        { &hf_cmp_a2b_data_length,                  { "Data Length", "asam-cmp.msg.a2b.data_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL} },
4147
16
        { &hf_cmp_a2b_data,                         { "Data", "asam-cmp.msg.a2b.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL} },
4148
4149
        /* Link State */
4150
16
        { &hf_cmp_link_state_flags,                 { "Flags", "asam-cmp.msg.link_state.flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4151
16
        { &hf_cmp_link_state_flag_link_err,         { "Link Error", "asam-cmp.msg.link_state.flags.link_err", FT_BOOLEAN, 16, TFS(&cmp_err_noerr), 0x0001, NULL, HFILL} },
4152
16
        { &hf_cmp_link_state_flag_reserved,         { "Reserved", "asam-cmp.msg.link_state.flags.reserved", FT_BOOLEAN, 16, NULL, 0xFFFE, NULL, HFILL } },
4153
4154
16
        { &hf_cmp_link_state_flag_reserved_tx,      { "Reserved", "asam-cmp.msg.link_state.flags.reserved_tx", FT_BOOLEAN, 16, NULL, 0xFFFF, NULL, HFILL } },
4155
4156
16
        { &hf_cmp_link_state_interface_status,      { "Interface Status", "asam-cmp.msg.link_state.interface_status", FT_UINT8, BASE_HEX, VALS(link_state_names), 0x0, NULL, HFILL} },
4157
16
        { &hf_cmp_link_state_reserved,              { "Reserved", "asam-cmp.msg.link_state.reserved", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4158
4159
        /* User-Defined */
4160
16
        { &hf_cmp_vendor_def_vendor_id,             { "Vendor ID", "asam-cmp.msg.vendor_def.vendor_id", FT_UINT16, BASE_HEX, VALS(vendor_ids), 0x0, NULL, HFILL } },
4161
16
        { &hf_cmp_vendor_def_vendor_payload_type,   { "Vendor Payload Type", "asam-cmp.msg.vendor_def.payload_type", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4162
16
        { &hf_cmp_vendor_def_vendor_payload_data,   { "Vendor Payload", "asam-cmp.msg.vendor_def.payload", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4163
4164
        /* Control Message Payloads */
4165
        /* Data Sink Ready */
4166
16
        { &hf_cmp_ctrl_msg_device_id,               { "Device ID", "asam-cmp.msg.dsr.device_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4167
4168
         /* User Event */
4169
16
        { &hf_cmp_ctrl_msg_event_id,                { "Event ID", "asam-cmp.msg.ue.event_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4170
4171
         /* Vendor specific */
4172
16
        { &hf_cmp_ctrl_msg_vendor_id,               { "Vendor ID", "asam-cmp.msg.vs.vendor_id", FT_UINT16, BASE_HEX, VALS(vendor_ids), 0x0, NULL, HFILL } },
4173
16
        { &hf_cmp_ctrl_msg_vendor_payload_type,     { "Payload Type", "asam-cmp.msg.vs.payload_type", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4174
4175
        /* Status Message Payloads */
4176
        /* Capture Module Status Message */
4177
16
        { &hf_cmp_status_msg_cm_uptime_ns,          { "Uptime (ns)", "asam-cmp.msg.cm.uptime_ns", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4178
16
        { &hf_cmp_status_msg_cm_uptime_s,           { "Uptime (s)", "asam-cmp.msg.cm.uptime_s", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4179
16
        { &hf_cmp_status_msg_gm_identity,           { "gPTP grandmasterIdentity", "asam-cmp.msg.cm.gm_identity", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4180
16
        { &hf_cmp_status_msg_gm_clock_quality,      { "gPTP grandmasterClockQuality", "asam-cmp.msg.cm.gm_clock_quality", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4181
16
        { &hf_cmp_status_msg_current_utc_offset,    { "gPTP currentUtcOffset", "asam-cmp.msg.cm.current_utc_offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4182
16
        { &hf_cmp_status_msg_time_source,           { "gPTP timeSource", "asam-cmp.msg.cm.time_source", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4183
16
        { &hf_cmp_status_msg_domain_num,            { "gPTP domainNumber", "asam-cmp.msg.cm.domain_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4184
16
        { &hf_cmp_status_msg_res,                   { "Reserved", "asam-cmp.msg.cm.res", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4185
16
        { &hf_cmp_gptp_flags,                       { "gPTP Flags", "asam-cmp.msg.cm.gptp_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4186
4187
16
        { &hf_cmp_gptp_flags_leap61,                { "Leap61", "asam-cmp.msg.cm.gptp_flags.leap61", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL } },
4188
16
        { &hf_cmp_gptp_flags_leap59,                { "Leap59", "asam-cmp.msg.cm.gptp_flags.leap59", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL } },
4189
16
        { &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 } },
4190
16
        { &hf_cmp_gptp_flags_ptp_timescale,         { "PTP Timescale", "asam-cmp.msg.cm.gptp_flags.ptp_timescale", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL } },
4191
16
        { &hf_cmp_gptp_flags_time_traceable,        { "Time Traceable", "asam-cmp.msg.cm.gptp_flags.time_traceable", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL } },
4192
16
        { &hf_cmp_gptp_flags_freq_traceable,        { "Frequency Traceable", "asam-cmp.msg.cm.gptp_flags.freq_traceable", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL } },
4193
16
        { &hf_cmp_gptp_flags_reserved,              { "Reserved", "asam-cmp.msg.cm.gptp_flags.res", FT_UINT8, BASE_HEX, NULL, 0xC0, NULL, HFILL } },
4194
4195
16
        { &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 } },
4196
16
        { &hf_cmp_status_dev_desc,                  { "Device Description", "asam-cmp.msg.cm.dev_desc", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4197
16
        { &hf_cmp_status_sn_length,                 { "Length of Serial Number", "asam-cmp.msg.cm.sn_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4198
16
        { &hf_cmp_status_sn,                        { "Serial Number (SN)", "asam-cmp.msg.cm.sn", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4199
16
        { &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 } },
4200
16
        { &hf_cmp_status_hw_ver,                    { "HW version", "asam-cmp.msg.cm.hw_ver", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4201
16
        { &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 } },
4202
16
        { &hf_cmp_status_sw_ver,                    { "SW version", "asam-cmp.msg.cm.sw_ver", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4203
16
        { &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 } },
4204
16
        { &hf_cmp_status_vendor_data,               { "Vendor Data", "asam-cmp.msg.cm.vendor_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4205
4206
        /* Interface Status Message */
4207
16
        { &hf_cmp_iface_interface,                  { "Interface", "asam-cmp.msg.iface", FT_PROTOCOL, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4208
16
        { &hf_cmp_iface_iface_id,                   { "Interface ID", "asam-cmp.msg.iface.iface_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4209
16
        { &hf_cmp_iface_msg_total_rx,               { "Messages Total RX", "asam-cmp.msg.iface.msg_total_rx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4210
16
        { &hf_cmp_iface_msg_total_tx,               { "Messages Total TX", "asam-cmp.msg.iface.msg_total_tx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4211
16
        { &hf_cmp_iface_msg_dropped_rx,             { "Messages Dropped RX", "asam-cmp.msg.iface.msg_drop_rx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4212
16
        { &hf_cmp_iface_msg_dropped_tx,             { "Messages Dropped TX", "asam-cmp.msg.iface.msg_drop_tx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4213
16
        { &hf_cmp_iface_errs_total_rx,              { "Errors Total RX", "asam-cmp.msg.iface.errors_total_rx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4214
16
        { &hf_cmp_iface_errs_total_tx,              { "Errors Total TX", "asam-cmp.msg.iface.errors_total_tx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4215
16
        { &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 } },
4216
16
        { &hf_cmp_iface_iface_status,               { "Interface Status", "asam-cmp.msg.iface.interface_status", FT_UINT8, BASE_HEX, VALS(interface_status_names), 0x0, NULL, HFILL } },
4217
16
        { &hf_cmp_iface_stream_id_cnt,              { "Stream ID count", "asam-cmp.msg.iface.stream_id_count", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4218
16
        { &hf_cmp_iface_reserved,                   { "Reserved", "asam-cmp.msg.iface.res", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4219
4220
        /* TODO: Update to CMP 1.1!!! */
4221
16
        { &hf_cmp_iface_feat,                       { "Feature Support Bitmask", "asam-cmp.msg.iface.feat_supp", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4222
4223
16
        { &hf_cmp_iface_feat_can_crr_err,           { "CRC Error Supported", "asam-cmp.msg.iface.feat_supp.can.crc_err", FT_BOOLEAN, 32, NULL, 0x00000001, NULL, HFILL } },
4224
16
        { &hf_cmp_iface_feat_can_ack_err,           { "Ack Error Supported", "asam-cmp.msg.iface.feat_supp.can.ack_err", FT_BOOLEAN, 32, NULL, 0x00000002, NULL, HFILL } },
4225
16
        { &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 } },
4226
16
        { &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 } },
4227
16
        { &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 } },
4228
16
        { &hf_cmp_iface_feat_can_form_err,          { "Form Error Supported", "asam-cmp.msg.iface.feat_supp.can.form_err", FT_BOOLEAN, 32, NULL, 0x00000020, NULL, HFILL } },
4229
16
        { &hf_cmp_iface_feat_can_stuff_err,         { "Stuff Error Supported", "asam-cmp.msg.iface.feat_supp.can.stuff_err", FT_BOOLEAN, 32, NULL, 0x00000040, NULL, HFILL } },
4230
16
        { &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 } },
4231
16
        { &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 } },
4232
16
        { &hf_cmp_iface_feat_can_bit_err,           { "Bit Error Supported", "asam-cmp.msg.iface.feat_supp.can.bit_err", FT_BOOLEAN, 32, NULL, 0x00000200, NULL, HFILL } },
4233
16
        { &hf_cmp_iface_feat_can_r0,                { "R0 Supported", "asam-cmp.msg.iface.feat_supp.can.r0", FT_BOOLEAN, 32, NULL, 0x00000400, NULL, HFILL } },
4234
16
        { &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 } },
4235
16
        { &hf_cmp_iface_feat_can_gen_err,           { "Generic Error Supported", "asam-cmp.msg.iface.feat_supp.can.gen_err", FT_BOOLEAN, 32, NULL, 0x00004000, NULL, HFILL } },
4236
4237
16
        { &hf_cmp_iface_feat_canfd_crr_err,         { "CRC Error Supported", "asam-cmp.msg.iface.feat_supp.canfd.crc_err", FT_BOOLEAN, 32, NULL, 0x00000001, NULL, HFILL } },
4238
16
        { &hf_cmp_iface_feat_canfd_ack_err,         { "Ack Error Supported", "asam-cmp.msg.iface.feat_supp.canfd.ack_err", FT_BOOLEAN, 32, NULL, 0x00000002, NULL, HFILL } },
4239
16
        { &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 } },
4240
16
        { &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 } },
4241
16
        { &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 } },
4242
16
        { &hf_cmp_iface_feat_canfd_form_err,        { "Form Error Supported", "asam-cmp.msg.iface.feat_supp.canfd.form_err", FT_BOOLEAN, 32, NULL, 0x00000020, NULL, HFILL } },
4243
16
        { &hf_cmp_iface_feat_canfd_stuff_err,       { "Stuff Error Supported", "asam-cmp.msg.iface.feat_supp.canfd.stuff_err", FT_BOOLEAN, 32, NULL, 0x00000040, NULL, HFILL } },
4244
16
        { &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 } },
4245
16
        { &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 } },
4246
16
        { &hf_cmp_iface_feat_canfd_bit_err,         { "Bit Error Supported", "asam-cmp.msg.iface.feat_supp.canfd.bit_err", FT_BOOLEAN, 32, NULL, 0x00000200, NULL, HFILL } },
4247
16
        { &hf_cmp_iface_feat_canfd_rsvd,            { "RRSV Supported", "asam-cmp.msg.iface.feat_supp.canfd.rsvd", FT_BOOLEAN, 32, NULL, 0x00000400, NULL, HFILL } },
4248
16
        { &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 } },
4249
16
        { &hf_cmp_iface_feat_canfd_brs,             { "BRS Supported", "asam-cmp.msg.iface.feat_supp.canfd.brs", FT_BOOLEAN, 32, NULL, 0x00001000, NULL, HFILL } },
4250
16
        { &hf_cmp_iface_feat_canfd_esi,             { "ESI Supported", "asam-cmp.msg.iface.feat_supp.canfd.esi", FT_BOOLEAN, 32, NULL, 0x00002000, NULL, HFILL } },
4251
16
        { &hf_cmp_iface_feat_canfd_gen_err,         { "Generic Error Supported", "asam-cmp.msg.iface.feat_supp.canfd.gen_err", FT_BOOLEAN, 32, NULL, 0x00004000, NULL, HFILL } },
4252
4253
16
        { &hf_cmp_iface_feat_lin_checksum_err,      { "Checksum Error Supported", "asam-cmp.msg.iface.feat_supp.lin.checksum_err", FT_BOOLEAN, 32, NULL, 0x00000001, NULL, HFILL } },
4254
16
        { &hf_cmp_iface_feat_lin_coll_err,          { "Collision Error Supported", "asam-cmp.msg.iface.feat_supp.lin.coll_err", FT_BOOLEAN, 32, NULL, 0x00000002, NULL, HFILL } },
4255
16
        { &hf_cmp_iface_feat_lin_parity_err,        { "Parity Error Supported", "asam-cmp.msg.iface.feat_supp.lin.parity_err", FT_BOOLEAN, 32, NULL, 0x00000004, NULL, HFILL } },
4256
16
        { &hf_cmp_iface_feat_lin_no_slave_resp_err, { "No Slave Response Error Supported", "asam-cmp.msg.iface.feat_supp.lin.no_slave_resp_err", FT_BOOLEAN, 32, NULL, 0x00000008, NULL, HFILL } },
4257
16
        { &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 } },
4258
16
        { &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 } },
4259
16
        { &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 } },
4260
16
        { &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 } },
4261
16
        { &hf_cmp_iface_feat_lin_wup,               { "WUP Supported", "asam-cmp.msg.iface.feat_supp.lin.wup", FT_BOOLEAN, 32, NULL, 0x00000100, NULL, HFILL } },
4262
4263
16
        { &hf_cmp_iface_feat_fr_crc_frame_err,      { "CRC Frame Error Supported", "asam-cmp.msg.iface.feat_supp.fr.crc_frame_err", FT_BOOLEAN, 32, NULL, 0x00000001, NULL, HFILL } },
4264
16
        { &hf_cmp_iface_feat_fr_crc_header_err,     { "CRC Header Error Supported", "asam-cmp.msg.iface.feat_supp.fr.crc_header_err", FT_BOOLEAN, 32, NULL, 0x00000002, NULL, HFILL } },
4265
16
        { &hf_cmp_iface_feat_fr_nf,                 { "Null Frame Supported", "asam-cmp.msg.iface.feat_supp.fr.nf", FT_BOOLEAN, 32, NULL, 0x00000004, NULL, HFILL } },
4266
16
        { &hf_cmp_iface_feat_fr_sf,                 { "Startup Frame Supported", "asam-cmp.msg.iface.feat_supp.fr.sf", FT_BOOLEAN, 32, NULL, 0x00000008, NULL, HFILL } },
4267
16
        { &hf_cmp_iface_feat_fr_sync,               { "Sync Supported", "asam-cmp.msg.iface.feat_supp.fr.sync", FT_BOOLEAN, 32, NULL, 0x00000010, NULL, HFILL } },
4268
16
        { &hf_cmp_iface_feat_fr_wus,                { "Wake Up Symbol Supported", "asam-cmp.msg.iface.feat_supp.fr.wus", FT_BOOLEAN, 32, NULL, 0x00000020, NULL, HFILL } },
4269
16
        { &hf_cmp_iface_feat_fr_ppi,                { "Preamble Indicator Supported", "asam-cmp.msg.iface.feat_supp.fr.ppi", FT_BOOLEAN, 32, NULL, 0x00000040, NULL, HFILL } },
4270
16
        { &hf_cmp_iface_feat_fr_cas,                { "Collision Avoidance Symbol Supported", "asam-cmp.msg.iface.feat_supp.fr.cas", FT_BOOLEAN, 32, NULL, 0x00000080, NULL, HFILL } },
4271
16
        { &hf_cmp_iface_feat_fr_channel,            { "Channel Supported", "asam-cmp.msg.iface.feat_supp.fr.channel", FT_BOOLEAN, 32, NULL, 0x00000200, NULL, HFILL } },
4272
4273
16
        { &hf_cmp_iface_feat_eth_fcs_err,           { "FCS Error Supported", "asam-cmp.msg.iface.feat_supp.eth.fcs_err", FT_BOOLEAN, 32, NULL, 0x00000001, NULL, HFILL } },
4274
16
        { &hf_cmp_iface_feat_eth_too_short,         { "Frame too short Supported", "asam-cmp.msg.iface.feat_supp.eth.frame_too_short", FT_BOOLEAN, 32, NULL, 0x00000002, NULL, HFILL } },
4275
16
        { &hf_cmp_iface_feat_eth_tx_port_down,      { "TX Port Down Supported", "asam-cmp.msg.iface.feat_supp.eth.tx_port_down", FT_BOOLEAN, 32, NULL, 0x00000004, NULL, HFILL } },
4276
16
        { &hf_cmp_iface_feat_eth_collision,         { "Collision Supported", "asam-cmp.msg.iface.feat_supp.eth.collision", FT_BOOLEAN, 32, NULL, 0x00000008, NULL, HFILL } },
4277
16
        { &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 } },
4278
16
        { &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 } },
4279
16
        { &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 } },
4280
16
        { &hf_cmp_iface_feat_eth_fcs,               { "FCS Supported", "asam-cmp.msg.iface.feat_supp.eth.fcs", FT_BOOLEAN, 32, NULL, 0x00000080, NULL, HFILL } },
4281
4282
16
        { &hf_cmp_iface_feat_10t1s_sym_decode,      { "Decode Error Supported", "asam-cmp.msg.iface.feat_supp.10baset1s_symbols.decode_err", FT_BOOLEAN, 32, NULL, 0x00000001, NULL, HFILL } },
4283
16
        { &hf_cmp_iface_feat_10t1s_mis_beacon,      { "Missing Beacon Error Supported", "asam-cmp.msg.iface.feat_supp.10baset1s_symbols.missing_beacon_err", FT_BOOLEAN, 32, NULL, 0x00000002, NULL, HFILL } },
4284
16
        { &hf_cmp_iface_feat_10t1s_first_beacon,    { "First Beacon Supported", "asam-cmp.msg.iface.feat_supp.10baset1s_symbols.first_beacon", FT_BOOLEAN, 32, NULL, 0x80000000, NULL, HFILL } },
4285
4286
16
        { &hf_cmp_iface_feat_link_err,              { "Link Error Supported", "asam-cmp.msg.iface.feat_supp.link_state.link_err", FT_BOOLEAN, 32, NULL, 0x00000001, NULL, HFILL } },
4287
4288
16
        { &hf_cmp_iface_stream_ids,                 { "Stream IDs", "asam-cmp.msg.iface.stream_ids", FT_PROTOCOL, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4289
16
        { &hf_cmp_iface_stream_id,                  { "Stream ID", "asam-cmp.msg.iface.stream_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4290
16
        { &hf_cmp_iface_vendor_data_len,            { "Vendor Data Length", "asam-cmp.msg.iface.vendor_data_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4291
16
        { &hf_cmp_iface_vendor_data,                { "Vendor Data", "asam-cmp.msg.iface.vendor_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4292
4293
        /* Configuration Status Message */
4294
16
        { &hf_cmp_status_msg_config,                { "Data", "asam-cmp.msg.config.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4295
4296
        /* Data Lost Event Status Message */
4297
16
        { &hf_cmp_dataloss_data_sink_port,          { "Data Sink Port", "asam-cmp.msg.dataloss.data_sink_port", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4298
16
        { &hf_cmp_dataloss_device_id,               { "Device ID", "asam-cmp.msg.dataloss.device_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4299
16
        { &hf_cmp_dataloss_reserved,                { "Reserved", "asam-cmp.msg.dataloss.res", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4300
16
        { &hf_cmp_dataloss_stream_id,               { "Stream ID", "asam-cmp.msg.dataloss.stream_id", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4301
16
        { &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 } },
4302
16
        { &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 } },
4303
4304
        /* Time Sync Lost Event Status Message */
4305
16
        { &hf_cmp_timeloss_port_nr,                 { "Port Number", "asam-cmp.msg.timesyncloss.port_nr", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4306
16
        { &hf_cmp_timeloss_device_id,               { "Device ID", "asam-cmp.msg.timesyncloss.device_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
4307
16
        { &hf_cmp_timeloss_error_flags,             { "Time Sync Loss Error Flags", "asam-cmp.msg.timesyncloss.err_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
4308
4309
16
        { &hf_cmp_timeloss_error_flags_ts,          { "Was Time Synced before", "asam-cmp.msg.timesyncloss.err_flags.ts", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL } },
4310
16
        { &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 } },
4311
16
        { &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 } },
4312
16
        { &hf_cmp_timeloss_error_flags_reserved,    { "Reserved", "asam-cmp.msg.timesyncloss.err_flags.res", FT_UINT8, BASE_HEX, NULL, 0xF8, NULL, HFILL } },
4313
4314
        /* Vendor Specific Status Message */
4315
16
        { &hf_cmp_status_msg_vendor_specific,       { "Vendor Specific", "asam-cmp.msg.vendor_specific", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
4316
16
    };
4317
4318
16
    static int *ett[] = {
4319
16
        &ett_asam_cmp,
4320
16
        &ett_asam_cmp_header,
4321
16
        &ett_asam_cmp_timestamp,
4322
16
        &ett_asam_cmp_common_flags,
4323
16
        &ett_asam_cmp_trans_opts,
4324
16
        &ett_asam_cmp_payload,
4325
16
        &ett_asam_cmp_payload_flags,
4326
16
        &ett_asam_cmp_payload_data,
4327
16
        &ett_asam_cmp_lin_pid,
4328
16
        &ett_asam_cmp_can_id,
4329
16
        &ett_asam_cmp_can_crc,
4330
16
        &ett_asam_cmp_digital_sample,
4331
16
        &ett_asam_cmp_uart_data,
4332
16
        &ett_asam_cmp_analog_sample,
4333
16
        &ett_asam_cmp_i2c_data_entry,
4334
16
        &ett_asam_cmp_a2b_upstream_settings,
4335
16
        &ett_asam_cmp_a2b_downstream_settings,
4336
16
        &ett_asam_cmp_a2b_general_settings,
4337
16
        &ett_asam_cmp_status_cm_flags,
4338
16
        &ett_asam_cmp_status_cm_uptime,
4339
16
        &ett_asam_cmp_status_timeloss_flags,
4340
16
        &ett_asam_cmp_status_interface,
4341
16
        &ett_asam_cmp_status_feature_support,
4342
16
        &ett_asam_cmp_status_stream_ids
4343
16
    };
4344
4345
16
    static ei_register_info ei[] = {
4346
16
        { &ei_asam_cmp_length_mismatch, {"asam-cmp.expert.length_mismatch", PI_MALFORMED, PI_WARN, "Malformed message, length mismatch!", EXPFILL } },
4347
16
        { &ei_asam_cmp_unsupported_crc_not_zero, {"asam-cmp.export.deactivated_crc_not_zero", PI_MALFORMED, PI_WARN, "Unsupported CRC is not zero!", EXPFILL } },
4348
16
    };
4349
4350
    /* UATs for user_data fields */
4351
16
    static uat_field_t asam_cmp_device_id_uat_fields[] = {
4352
16
        UAT_FLD_HEX(asam_cmp_devices, id, "Device ID", "Device ID (hex uint16 without leading 0x)"),
4353
16
        UAT_FLD_CSTRING(asam_cmp_devices, name, "Device Name", "Device Name (string)"),
4354
16
        UAT_END_FIELDS
4355
16
    };
4356
4357
16
    static uat_field_t asam_cmp_interface_id_uat_fields[] = {
4358
16
        UAT_FLD_HEX(asam_cmp_interfaces, id, "Interface ID", "Interface ID (hex uint32 without leading 0x)"),
4359
16
        UAT_FLD_CSTRING(asam_cmp_interfaces, name, "Interface Name", "Interface Name (string)"),
4360
16
        UAT_FLD_HEX(asam_cmp_interfaces, bus_id, "Bus ID", "Bus ID of the Interface (hex uint16 without leading 0x)"),
4361
16
        UAT_END_FIELDS
4362
16
    };
4363
4364
16
    proto_asam_cmp = proto_register_protocol("ASAM Capture Module Protocol", "ASAM CMP", "asam-cmp");
4365
16
    proto_register_field_array(proto_asam_cmp, hf, array_length(hf));
4366
16
    proto_register_subtree_array(ett, array_length(ett));
4367
16
    asam_cmp_module = prefs_register_protocol(proto_asam_cmp, NULL);
4368
4369
16
    expert_module_asam_cmp = expert_register_protocol(proto_asam_cmp);
4370
16
    expert_register_field_array(expert_module_asam_cmp, ei, array_length(ei));
4371
4372
    /* Configuration Items */
4373
16
    asam_cmp_deviceid_uat = uat_new("ASAM CMP Devices",
4374
16
        sizeof(generic_one_id_string_t),        /* record size           */
4375
16
        DATAFILE_ASAM_CMP_DEVICES_IDS,          /* filename              */
4376
16
        true,                                   /* from profile          */
4377
16
        (void**)&asam_cmp_devices,              /* data_ptr              */
4378
16
        &asam_cmp_devices_num,                  /* numitems_ptr          */
4379
16
        UAT_AFFECTS_DISSECTION,                 /* but not fields        */
4380
16
        NULL,                                   /* help                  */
4381
16
        copy_generic_one_id_string_cb,          /* copy callback         */
4382
16
        update_generic_one_identifier_16bit,    /* update callback       */
4383
16
        free_generic_one_id_string_cb,          /* free callback         */
4384
16
        post_update_asam_cmp_devices_cb,        /* post update callback  */
4385
16
        reset_asam_cmp_devices_cb,              /* reset callback        */
4386
16
        asam_cmp_device_id_uat_fields           /* UAT field definitions */
4387
16
    );
4388
4389
16
    prefs_register_uat_preference(asam_cmp_module, "_udf_asam_cmp_devices", "Devices",
4390
16
        "A table to define names of Devices.", asam_cmp_deviceid_uat);
4391
4392
16
    asam_cmp_interfaceid_uat = uat_new("ASAM CMP Interfaces",
4393
16
        sizeof(interface_config_t),             /* record size           */
4394
16
        DATAFILE_ASAM_CMP_IFACE_IDS,            /* filename              */
4395
16
        true,                                   /* from profile          */
4396
16
        (void**)&asam_cmp_interfaces,           /* data_ptr              */
4397
16
        &asam_cmp_interface_num,                /* numitems_ptr          */
4398
16
        UAT_AFFECTS_DISSECTION,                 /* but not fields        */
4399
16
        NULL,                                   /* help                  */
4400
16
        copy_interface_config_cb,               /* copy callback         */
4401
16
        update_interface_config,                /* update callback       */
4402
16
        free_interface_config_cb,               /* free callback         */
4403
16
        post_update_interface_config_cb,        /* post update callback  */
4404
16
        reset_interface_config_cb,              /* reset callback        */
4405
16
        asam_cmp_interface_id_uat_fields        /* UAT field definitions */
4406
16
    );
4407
4408
16
    prefs_register_uat_preference(asam_cmp_module, "_udf_asam_cmp_interfaces", "Interfaces",
4409
16
        "A table to define names and mappings of Interfaces.", asam_cmp_interfaceid_uat);
4410
4411
16
    prefs_register_bool_preference(asam_cmp_module, "try_heuristic_first",
4412
16
        "Try heuristic sub-dissectors first",
4413
16
        "Try to decode a packet using an heuristic sub-dissector"
4414
16
        " before using a sub-dissector registered to \"decode as\"",
4415
16
        &heuristic_first);
4416
4417
16
    prefs_register_bool_preference(asam_cmp_module, "use_old_canid_11bit_format",
4418
16
        "Use old encoding of 11bit CAN/CAN-FD IDs",
4419
16
        "Use the old encoding of 11bit CAN/CAN-FD IDs",
4420
16
        &old_11bit_canid_encoding);
4421
16
}
4422
4423
void
4424
16
proto_reg_handoff_asam_cmp(void) {
4425
16
    dissector_handle_t asam_cmp_handle;
4426
4427
16
    asam_cmp_handle = register_dissector("asam-cmp", dissect_asam_cmp, proto_asam_cmp);
4428
16
    eth_handle = find_dissector("eth_maybefcs");
4429
4430
16
    dissector_add_for_decode_as("ethertype", asam_cmp_handle);
4431
16
    dissector_add_for_decode_as_with_preference("udp.port", asam_cmp_handle);
4432
16
}
4433
4434
  /*
4435
   * Editor modelines
4436
   *
4437
   * Local Variables:
4438
   * c-basic-offset: 4
4439
   * tab-width: 8
4440
   * indent-tabs-mode: nil
4441
   * End:
4442
   *
4443
   * ex: set shiftwidth=4 tabstop=8 expandtab:
4444
   * :indentSize=4:tabSize=8:noTabs=true:
4445
   */