Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-ebhscr.c
blob211b0cd5acfb294be040f2a6d73d527354ef3f2c
1 /* packet-ebhscr.c
2 * Routines for EBHSCR dissection
3 * Copyright 2019, Ana Pantar <ana.pantar@gmail.com> for Elektrobit
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * For more information on this protocol see:
10 * https://www.elektrobit.com/ebhscr
12 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include <config.h>
16 #include <epan/packet.h>
17 #include <epan/decode_as.h>
18 #include <epan/prefs.h>
19 #include <wiretap/wtap.h>
20 #include <epan/expert.h>
22 void proto_reg_handoff_ebhscr(void);
23 void proto_register_ebhscr(void);
25 static int proto_ebhscr;
27 static int hf_ebhscr_packet_header;
28 static int hf_ebhscr_major_number;
29 static int hf_ebhscr_slot;
30 static int hf_ebhscr_channel;
31 static int hf_ebhscr_status;
32 static int hf_ebhscr_status_unused;
34 static int hf_can_proto_type;
35 static int hf_can_status_available;
36 static int hf_can_LEC;
37 static int hf_can_ERRP;
38 static int hf_can_ERRW;
39 static int hf_can_BOFF;
40 static int hf_can_DLEC;
41 static int hf_can_TEC;
42 static int hf_can_REC;
43 static int hf_can_CEL;
44 static int hf_can_reserved_bytes;
46 static int hf_eth_reserved_bytes;
47 static int hf_eth_tx_trunc;
48 static int hf_eth_trans_undrun;
49 static int hf_eth_retrans_limit;
50 static int hf_eth_late_collision;
51 static int hf_eth_link_up_down;
52 static int hf_eth_master_slave;
53 static int hf_eth_fcs_unavailable;
54 static int hf_eth_rsvd_bit;
55 static int hf_eth_speed;
57 static int hf_eth_crc_error;
58 static int hf_eth_mii_foe;
59 static int hf_eth_payload_foe;
60 static int hf_eth_hdr_foe;
61 static int hf_eth_rcv_dec_err;
62 static int hf_eth_sym_error;
63 static int hf_eth_jabber_event;
64 static int hf_eth_pol_ch_event;
65 static int hf_eth_fls_carrier_event;
66 static int hf_eth_rx_trunc;
67 static int hf_eth_transmission_disc_err;
68 static int hf_eth_wait_frame_sep_bit;
70 static int hf_ts_time_offset_valid;
71 static int hf_ts_last_offset_change_valid;
72 static int hf_ts_nano_seconds_last_jump_valid;
73 static int hf_ts_UTC_leap_seconds_valid;
74 static int hf_ts_sync_state_valid;
75 static int hf_ts_time_source;
77 static int hf_ts_time_offset_ns;
78 static int hf_ts_last_offset_ns;
79 static int hf_ts_last_jump_ns;
80 static int hf_ts_utc_leap_sec;
81 static int hf_ts_sync_state;
83 static int hf_lin_1_3_classic_chksum;
84 static int hf_lin_1_2_enhanced_chksum;
85 static int hf_lin_wakeup;
86 static int hf_lin_time_jump;
88 static int hf_lin_reserved_bytes;
89 static int hf_lin_wakeup_length;
90 static int hf_lin_sts_reserved;
91 static int hf_lin_sts_syn;
92 static int hf_lin_sts_par;
93 static int hf_lin_sts_res;
94 static int hf_lin_sts_dat;
95 static int hf_lin_sts_chk;
96 static int hf_lin_sts_sta;
97 static int hf_lin_sts_sto;
98 static int hf_lin_sts_emp;
99 static int hf_lin_payload;
100 static int hf_lin_payload_pid;
101 static int hf_lin_payload_id_parity_0;
102 static int hf_lin_payload_id_parity_1;
103 static int hf_lin_payload_id;
104 static int hf_lin_payload_data;
105 static int hf_lin_payload_checksum;
107 static int hf_dio_overflow_mon_unit;
108 static int hf_dio_jump_occurred;
109 static int hf_dio_value_type;
110 static int hf_dio_reserved_bytes;
112 static int hf_flexray_ch_a;
113 static int hf_flexray_ch_b;
114 static int hf_flexray_ctrl_id;
115 static int hf_flexray_monitoring_bit;
116 static int hf_flexray_sync_bit;
117 static int hf_flexray_packet_type;
118 static int hf_flexray_CODERR;
119 static int hf_flexray_TSSVIOL;
120 static int hf_flexray_HCRCERR;
121 static int hf_flexray_FCRCERR;
122 static int hf_flexray_FESERR;
123 static int hf_flexray_FSSERR;
124 static int hf_flexray_BSSERR;
125 static int hf_flexray_jump_occurred;
126 static int hf_flexray_slot_information;
127 static int hf_flexray_SBV;
128 static int hf_flexray_ACI;
129 static int hf_flexray_CED;
130 static int hf_flexray_SED;
131 static int hf_flexray_VFR;
132 static int hf_flexray_SID;
133 static int hf_flexray_frame_status;
134 static int hf_flexray_SPLERR;
135 static int hf_flexray_CCERR;
136 static int hf_flexray_FIDERR;
137 static int hf_flexray_SSERR;
138 static int hf_flexray_NERR;
139 static int hf_flexray_SOVERR;
140 static int hf_flexray_SWVIOL;
141 static int hf_flexray_NITVIOL;
142 static int hf_flexray_BVIOL;
143 static int hf_flexray_PCD;
144 static int hf_flexray_SYNCERR;
145 static int hf_flexray_CP;
146 static int hf_flexray_BRC;
147 static int hf_flexray_symbol_length_and_status;
148 static int hf_flexray_SYERR;
149 static int hf_flexray_SL;
150 static int hf_flexray_POC_state;
151 static int hf_flexray_following_cycle_counter;
152 static int hf_flexray_supercycle_counter;
154 static int hf_ebhscr_version;
155 static int hf_ebhscr_length;
156 static int hf_ebhscr_start_timestamp;
157 static int hf_ebhscr_stop_timestamp;
158 static int hf_ebhscr_mjr_hdr;
159 static int hf_ebhscr_mjr_hdr_unused;
161 static int ett_ebhscr;
162 static int ett_ebhscr_channel;
163 static int ett_ebhscr_packet_header;
164 static int ett_ebhscr_status;
165 static int ett_ebhscr_mjr_hdr;
167 static int ett_lin_payload;
169 static int * const can_status_bits[] = {
170 &hf_can_proto_type,
171 &hf_can_status_available,
172 NULL
175 static int * const can_mjr_hdr_bits[] = {
176 & hf_can_reserved_bytes,
177 & hf_can_LEC,
178 & hf_can_ERRP,
179 & hf_can_ERRW,
180 & hf_can_BOFF,
181 & hf_can_DLEC,
182 & hf_can_TEC,
183 & hf_can_REC,
184 & hf_can_CEL,
185 NULL
188 static const value_string can_proto_type_strings[] = {
189 { 0, "Classical CAN" },
190 { 1, "CAN FD data frame" },
191 { 0, NULL },
194 static const value_string can_status_available_strings[] = {
195 { 0, "CAN protocol status not available" },
196 { 1, "CAN protocol status available" },
197 { 0, NULL },
200 static const val64_string can_last_err_code_strings[] = {
201 { 0, "No Error" },
202 { 1, "Stuff Error" },
203 { 2, "Form Error" },
204 { 3, "Ack Error" },
205 { 4, "Bit1 Error" },
206 { 5, "Bit0 Error" },
207 { 6, "CRC Error" },
208 { 7, "Reserved" },
209 { 0, NULL },
212 static const val64_string can_ERRP_strings[] = {
213 { 0, "Error counters are below the error passive limit (128)" },
214 { 1, "One of the error counters has reached the error passive limit (128)" },
215 { 0, NULL },
218 static const val64_string can_ERRW_strings[] = {
219 { 0, "Error counters are below the error warning limit (96)" },
220 { 1, "One of the error counters has reached the error warning limit (96)" },
221 { 0, NULL },
223 static const val64_string can_BOFF_strings[] = {
224 { 0, "Not in Bus Off state" },
225 { 1, "In Bus Off state." },
226 { 0, NULL },
230 static int * const eth_rx_error_bits[] = {
231 &hf_eth_crc_error,
232 &hf_eth_mii_foe,
233 &hf_eth_payload_foe,
234 &hf_eth_hdr_foe,
235 &hf_eth_rcv_dec_err,
236 &hf_eth_sym_error,
237 &hf_eth_jabber_event,
238 &hf_eth_pol_ch_event,
239 &hf_eth_fls_carrier_event,
240 &hf_eth_rx_trunc,
241 &hf_eth_transmission_disc_err,
242 &hf_eth_wait_frame_sep_bit,
243 NULL
246 static int * const eth_mjr_hdr_bits[] = {
247 &hf_eth_reserved_bytes,
248 &hf_eth_tx_trunc,
249 &hf_eth_trans_undrun,
250 &hf_eth_retrans_limit,
251 &hf_eth_late_collision,
252 &hf_eth_link_up_down,
253 &hf_eth_master_slave,
254 &hf_eth_fcs_unavailable,
255 &hf_eth_rsvd_bit,
256 &hf_eth_speed,
257 NULL
260 static const val64_string eth_link_strings[] = {
261 { 0, "Link Down" },
262 { 1, "Link Up" },
263 { 0, NULL },
266 static const val64_string eth_master_strings[] = {
267 { 0, "Slave" },
268 { 1, "Master" },
269 { 0, NULL },
272 static const val64_string eth_fcs_strings[] = {
273 { 0, "FCS appended to payload" },
274 { 1, "FCS not appended to payload." },
275 { 0, NULL },
278 static const val64_string eth_speed_strings[] = {
279 { 0, "Speed 10M" },
280 { 1, "Speed 100M" },
281 { 2, "Speed 1000M" },
282 { 3, "Speed 2.5G" },
283 { 4, "Speed 5G" },
284 { 5, "Speed 10G" },
285 { 6, "Speed 25G" },
286 { 7, "Speed 40G" },
287 { 8, "Speed 100G" },
288 { 9, "Reserved" },
289 { 10, "Reserved" },
290 { 11, "Reserved" },
291 { 12, "Reserved" },
292 { 13, "Reserved" },
293 { 14, "Reserved" },
294 { 15, "Speed unknown. This value can be used when the speed could not be detected." },
295 { 0, NULL },
298 static int * const ts_status_bits[] = {
299 &hf_ts_time_offset_valid,
300 &hf_ts_last_offset_change_valid,
301 &hf_ts_nano_seconds_last_jump_valid,
302 &hf_ts_UTC_leap_seconds_valid,
303 &hf_ts_sync_state_valid,
304 NULL
307 static const val64_string ts_time_source_strings[] = {
308 { 0x00, "TimeSourceNone" },
309 { 0x01, "TimeSourceEBTimesyncHard" },
310 { 0x02, "TimeSourceXTSS" },
311 { 0x03, "TimeSourcePTPHW" },
312 { 0x10, "TimeSourcePTPSW" },
313 { 0x20, "TimeSourceGPS" },
314 { 0x30, "TimeSourceEBTimesyncSoft" },
315 { 0x40, "TimeSourceCAN" },
316 { 0x50, "TimeSourceEBVirt" },
317 { 0, NULL },
319 static const value_string ts_sync_state_strings[] = {
320 { 0, "Free running" },
321 { 1, "Locked to master" },
322 { 0, NULL },
325 static int * const lin_status_bits[] = {
326 &hf_lin_time_jump,
327 &hf_lin_wakeup,
328 &hf_lin_1_2_enhanced_chksum,
329 &hf_lin_1_3_classic_chksum,
330 NULL
333 static int * const lin_mjr_hdr_bits[] = {
335 &hf_lin_wakeup_length,
336 &hf_lin_sts_emp,
337 &hf_lin_sts_sto,
338 &hf_lin_sts_sta,
339 &hf_lin_sts_chk,
340 &hf_lin_sts_dat,
341 &hf_lin_sts_res,
342 &hf_lin_sts_par,
343 &hf_lin_sts_syn,
344 &hf_lin_sts_reserved,
345 &hf_lin_reserved_bytes,
346 NULL
349 static int * const lin_payload_pid_bits[] = {
350 &hf_lin_payload_id,
351 &hf_lin_payload_id_parity_0,
352 &hf_lin_payload_id_parity_1,
353 NULL
356 static int * const dio_status_bits[] = {
357 &hf_dio_overflow_mon_unit,
358 &hf_dio_jump_occurred,
359 NULL
362 static int * const dio_mjr_hdr_bits[] = {
363 &hf_dio_value_type,
364 &hf_dio_reserved_bytes,
365 NULL
368 static const val64_string dio_val_type_strings[] = {
369 { 0, "Event triggered falling edge" },
370 { 1, "Event triggered rising edge" },
371 { 0, NULL },
374 static int * const flexray_channel_bits[] = {
375 &hf_flexray_ch_a,
376 &hf_flexray_ch_b,
377 &hf_flexray_ctrl_id,
378 NULL
381 static int * const flexray_status_bits[] = {
382 &hf_flexray_monitoring_bit,
383 &hf_flexray_sync_bit,
384 &hf_flexray_packet_type,
385 &hf_flexray_jump_occurred,
386 NULL
389 static int * const flexray_frame_status_bits[] = {
390 &hf_flexray_monitoring_bit,
391 &hf_flexray_sync_bit,
392 &hf_flexray_packet_type,
393 &hf_flexray_CODERR,
394 &hf_flexray_TSSVIOL,
395 &hf_flexray_HCRCERR,
396 &hf_flexray_FCRCERR,
397 &hf_flexray_FESERR,
398 &hf_flexray_FSSERR,
399 &hf_flexray_BSSERR,
400 &hf_flexray_jump_occurred,
401 NULL
404 static int * const flexray_mhdr_slot_information_bits[] = {
405 &hf_flexray_SBV,
406 &hf_flexray_ACI,
407 &hf_flexray_CED,
408 &hf_flexray_SED,
409 &hf_flexray_VFR,
410 &hf_flexray_SID,
411 NULL
414 static int * const flexray_mhdr_frame_status_bits[] = {
415 &hf_flexray_SPLERR,
416 &hf_flexray_CCERR,
417 &hf_flexray_FIDERR,
418 &hf_flexray_SSERR,
419 &hf_flexray_NERR,
420 &hf_flexray_SOVERR,
421 &hf_flexray_SWVIOL,
422 &hf_flexray_NITVIOL,
423 &hf_flexray_BVIOL,
424 &hf_flexray_PCD,
425 &hf_flexray_SYNCERR,
426 &hf_flexray_CP,
427 &hf_flexray_BRC,
428 NULL
431 static int * const flexray_mhdr_symbol_length_and_status_bits[] = {
432 &hf_flexray_SYERR,
433 &hf_flexray_SL,
434 NULL
437 static const value_string flexray_monitoring_bit_strings[] = {
438 { 0x00, "Packet was generated by asynchronous monitoring" },
439 { 0x01, "Packet was generated by FlexRay synchronous monitoring" },
440 { 0, NULL },
443 #define FLEXRAY_FRAME_PACKET 0x00
444 #define FLEXRAY_SYMBOL_PACKET 0x01
445 #define FLEXRAY_SLOT_STATUS_PACKET 0x02
446 #define FLEXRAY_START_OF_CYCLE_PACKET 0x03
448 #define FLEXRAY_CHANNEL_B_MASK 0x02
449 #define FLEXRAY_TSSVIOL_MASK 0x0020
450 #define FLEXRAY_CODERR_MASK 0x0010
451 #define FLEXRAY_FESERR_MASK 0x0100
452 #define FLEXRAY_HCRCERR_MASK 0x0040
453 #define FLEXRAY_FCRCERR_MASK 0x0080
455 static const value_string flexray_packet_type_strings[] = {
456 { FLEXRAY_FRAME_PACKET, "Frame" },
457 { FLEXRAY_SYMBOL_PACKET, "Symbol" },
458 { FLEXRAY_SLOT_STATUS_PACKET, "Slot status" },
459 { FLEXRAY_START_OF_CYCLE_PACKET, "Start of cycle" },
460 { 0, NULL },
463 static const value_string flexray_CP_strings[] = {
464 { 0x00, "Static part" },
465 { 0x01, "Dynamic part" },
466 { 0x02, "Symbol window" },
467 { 0x03, "NIT" },
468 { 0, NULL },
471 static const value_string flexray_POC_state_strings[] = {
472 { 0x00, "DEFAULT_CONFIG state" },
473 { 0x01, "READY state" },
474 { 0x02, "NORMAL_ACTIVE state" },
475 { 0x03, "NORMAL_PASSIVE state" },
476 { 0x04, "HALT state" },
477 { 0x05, "MONITOR_MODE state" },
478 { 0x0F, "CONFIG state" },
479 { 0x10, "WAKEUP_STANDBY state" },
480 { 0x11, "WAKEUP_LISTEN state" },
481 { 0x12, "WAKEUP_SEND state" },
482 { 0x13, "WAKEUP_DETECT state" },
483 { 0x20, "STARTUP_PREPARE state" },
484 { 0x21, "COLDSTART_LISTEN state" },
485 { 0x22, "COLDSTART_COLLISION_RESOLUTION state" },
486 { 0x23, "COLDSTART_CONSISTENCY_CHECK state" },
487 { 0x24, "COLDSTART_GAP state" },
488 { 0x25, "COLDSTART_JOIN state" },
489 { 0x26, "INTEGRATION_COLDSTART_CHECK state" },
490 { 0x27, "INTEGRATION_LISTEN state" },
491 { 0x28, "INTEGRATION_CONSISTENCY_CHECK state" },
492 { 0x29, "INITIALIZE_SCHEDULE state" },
493 { 0x2A, "ABORT_STARTUP state" },
494 { 0x2B, "STARTUP_SUCCESS state" },
495 { 0, NULL },
499 static expert_field ei_ebhscr_frame_header;
500 static expert_field ei_ebhscr_err_status_flag;
501 static expert_field ei_ebhscr_info_status_flag;
503 static dissector_handle_t ebhscr_handle;
505 static dissector_handle_t can_handle;
506 static dissector_handle_t can_fd_handle;
507 static dissector_handle_t eth_withfcs_handle;
508 static dissector_handle_t eth_withoutfcs_handle;
509 static dissector_handle_t flexray_handle;
510 static dissector_handle_t ebhscr_user_handle;
512 static dissector_table_t subdissector_table;
514 #define EBHSCR_USER_FIRST 0X43
515 #define EBHSCR_USER_LAST 0X4F
517 #define ETHERNET_FRAME 0x50
518 #define NMEA_FRAME 0x51
519 #define TIME_STATE_FRAME 0x52
520 #define CAN_FRAME 0x53
521 #define LIN_FRAME 0x55
522 #define DIO_FRAME 0x56
523 #define FLEXRAY_FRAME 0x57
524 #define EBHSCR_HEADER_LENGTH 32
526 static int dissect_ebhscr_can(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
527 proto_tree *ebhscr_packet_header_tree, uint16_t ebhscr_status,
528 uint32_t ebhscr_frame_length)
530 uint16_t can_proto_status, can_type;
531 uint32_t ebhscr_current_payload_length;
532 tvbuff_t* next_tvb;
533 proto_item *ti;
535 ti = proto_tree_add_bitmask(ebhscr_packet_header_tree, tvb, 2, hf_ebhscr_status, ett_ebhscr_status,
536 can_status_bits, ENC_BIG_ENDIAN);
538 can_proto_status = (ebhscr_status & 0x0002);
539 if (can_proto_status) {
540 proto_tree_add_bitmask(ebhscr_packet_header_tree, tvb, 24, hf_ebhscr_mjr_hdr, ett_ebhscr_mjr_hdr,
541 can_mjr_hdr_bits, ENC_BIG_ENDIAN);
542 expert_add_info(pinfo, ti, &ei_ebhscr_info_status_flag);
544 else {
545 proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_mjr_hdr, tvb, 24, 8, ENC_BIG_ENDIAN);
548 /* received hdr only and no data */
549 if (ebhscr_frame_length == EBHSCR_HEADER_LENGTH) {
550 return tvb_captured_length(tvb);
552 ebhscr_current_payload_length = ebhscr_frame_length - EBHSCR_HEADER_LENGTH;
553 /* payload is CAN or CAN FD frame */
554 next_tvb = tvb_new_subset_length(tvb, 32, ebhscr_current_payload_length);
556 can_type = (ebhscr_status & 0x0001);
558 if (can_type) {
559 call_dissector(can_fd_handle, next_tvb, pinfo, tree);
561 else {
562 call_dissector(can_handle, next_tvb, pinfo, tree);
564 return tvb_captured_length(tvb);
567 static int dissect_ebhscr_eth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
568 proto_tree *ebhscr_packet_header_tree, uint16_t ebhscr_status,
569 uint32_t ebhscr_frame_length)
571 tvbuff_t* next_tvb;
572 proto_item *ti;
573 uint8_t channel;
574 uint32_t ebhscr_current_payload_length;
575 uint64_t major_hrd, fsc_not_present, link_up, link_speed;
576 ebhscr_current_payload_length = ebhscr_frame_length - EBHSCR_HEADER_LENGTH;
578 ti = proto_tree_add_bitmask(ebhscr_packet_header_tree, tvb, 2, hf_ebhscr_status,
579 ett_ebhscr_status, eth_rx_error_bits, ENC_BIG_ENDIAN);
581 if (ebhscr_status) {
582 expert_add_info(pinfo, ti, &ei_ebhscr_err_status_flag);
585 channel = (tvb_get_uint8(tvb, 1) & 0x1C) >> 2;
586 major_hrd = tvb_get_uint64(tvb, 24, ENC_BIG_ENDIAN);
588 proto_tree_add_bitmask(ebhscr_packet_header_tree, tvb, 24, hf_ebhscr_mjr_hdr, ett_ebhscr_mjr_hdr,
589 eth_mjr_hdr_bits, ENC_BIG_ENDIAN);
591 fsc_not_present = (major_hrd & 0x0000000400000000);
592 link_up = (major_hrd & 0x0000000100000000) ? 1 : 0;
593 link_speed = (major_hrd & 0x00000000F0000000) >> 28U;
594 /* received hdr only and no data */
595 if (ebhscr_frame_length == EBHSCR_HEADER_LENGTH) {
596 col_append_fstr(pinfo->cinfo, COL_INFO, "Ethernet controller %d %s", channel, val64_to_str_const(link_up, eth_link_strings, ""));
597 if (link_up)
599 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val64_to_str_const(link_speed, eth_speed_strings, "Speed unknown"));
601 return tvb_captured_length(tvb);
603 /* payload is 802.3 Ethernet frame */
604 next_tvb = tvb_new_subset_length(tvb, 32, ebhscr_current_payload_length);
605 if (fsc_not_present) {
606 call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
608 else {
609 call_dissector(eth_withfcs_handle, next_tvb, pinfo, tree);
611 return tvb_captured_length(tvb);
614 static int dissect_ebhscr_nmea(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
615 proto_tree *ebhscr_packet_header_tree, uint32_t ebhscr_frame_length,
616 uint32_t ebhscr_length)
618 tvbuff_t* next_tvb;
619 uint8_t *nmea_str;
620 uint32_t ebhscr_current_payload_length;
622 if (ebhscr_frame_length == EBHSCR_HEADER_LENGTH) {
623 return tvb_captured_length(tvb);
626 ebhscr_current_payload_length = ebhscr_frame_length - EBHSCR_HEADER_LENGTH;
628 proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_status_unused, tvb, 2, 2, ENC_BIG_ENDIAN);
629 proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_mjr_hdr_unused, tvb, 24, 8, ENC_BIG_ENDIAN);
631 next_tvb = tvb_new_subset_length(tvb, 32, ebhscr_current_payload_length);
632 call_data_dissector(next_tvb, pinfo, tree);
633 nmea_str = tvb_get_string_enc(pinfo->pool, tvb, 32, ebhscr_length, ENC_UTF_8);
634 col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", "NMEA:", nmea_str);
635 return tvb_captured_length(tvb);
638 static int dissect_ebhscr_ts(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
639 proto_tree *ebhscr_packet_header_tree, uint16_t ebhscr_status,
640 uint32_t ebhscr_frame_length)
642 tvbuff_t* next_tvb;
643 uint32_t ebhscr_current_payload_length;
644 uint64_t time_source = 0;
645 proto_item *ti;
647 col_set_str(pinfo->cinfo, COL_INFO, "TimeState ");
648 ti = proto_tree_add_bitmask(ebhscr_packet_header_tree, tvb, 2, hf_ebhscr_status, ett_ebhscr_status,
649 ts_status_bits, ENC_BIG_ENDIAN);
651 if (ebhscr_status) {
652 expert_add_info(pinfo, ti, &ei_ebhscr_info_status_flag);
654 proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_mjr_hdr, tvb, 24, 8, ENC_BIG_ENDIAN);
655 proto_tree_add_item_ret_uint64(ebhscr_packet_header_tree, hf_ts_time_source, tvb, 24, 8, ENC_BIG_ENDIAN, &time_source);
656 col_append_str(pinfo->cinfo, COL_INFO, val64_to_str_const(time_source, ts_time_source_strings, "Unknown Time Source"));
658 if (ebhscr_frame_length == EBHSCR_HEADER_LENGTH) {
659 return tvb_captured_length(tvb);
662 ebhscr_current_payload_length = ebhscr_frame_length - EBHSCR_HEADER_LENGTH;
663 if (ebhscr_current_payload_length < 28) {
664 return tvb_captured_length(tvb);
667 /* display params only if the appropriate valid bit is set */
668 if ((ebhscr_status & 0x001) != 0) {
669 proto_tree_add_item(ebhscr_packet_header_tree, hf_ts_time_offset_ns, tvb, 32, 8, ENC_BIG_ENDIAN);
671 if ((ebhscr_status & 0x002) != 0) {
672 proto_tree_add_item(ebhscr_packet_header_tree, hf_ts_last_offset_ns, tvb, 40, 8, ENC_BIG_ENDIAN);
674 if ((ebhscr_status & 0x004) != 0) {
675 proto_tree_add_item(ebhscr_packet_header_tree, hf_ts_last_jump_ns, tvb, 48, 8, ENC_BIG_ENDIAN);
677 if ((ebhscr_status & 0x008) != 0) {
678 proto_tree_add_item(ebhscr_packet_header_tree, hf_ts_utc_leap_sec, tvb, 56, 2, ENC_BIG_ENDIAN);
680 if ((ebhscr_status & 0x010) != 0) {
681 proto_tree_add_item(ebhscr_packet_header_tree, hf_ts_sync_state, tvb, 58, 2, ENC_BIG_ENDIAN);
684 next_tvb = tvb_new_subset_length(tvb, 32, ebhscr_current_payload_length);
685 call_data_dissector(next_tvb, pinfo, tree);
687 return tvb_captured_length(tvb);
690 static int dissect_ebhscr_lin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ebhscr_tree,
691 proto_tree *ebhscr_packet_header_tree, uint16_t ebhscr_status, uint32_t ebhscr_frame_length)
693 proto_item* ti;
694 proto_tree *lin_payload_tree, *lin_pid_tree;
695 uint32_t ebhscr_current_payload_length;
697 col_set_str(pinfo->cinfo, COL_PROTOCOL, "LIN (EBHSCR)");
698 ebhscr_current_payload_length = ebhscr_frame_length - EBHSCR_HEADER_LENGTH;
700 ti = proto_tree_add_bitmask(ebhscr_packet_header_tree, tvb, 2, hf_ebhscr_status,
701 ett_ebhscr_status, lin_status_bits, ENC_BIG_ENDIAN);
703 if (ebhscr_status) {
704 expert_add_info(pinfo, ti, &ei_ebhscr_info_status_flag);
707 if ((ebhscr_status & 0x0010) != 0) {
708 col_set_str(pinfo->cinfo, COL_INFO, "LIN Wake-Up Packet");
710 else {
711 col_set_str(pinfo->cinfo, COL_INFO, "LIN Frame");
714 proto_tree_add_bitmask(ebhscr_packet_header_tree, tvb, 24, hf_ebhscr_mjr_hdr, ett_ebhscr_mjr_hdr,
715 lin_mjr_hdr_bits, ENC_BIG_ENDIAN);
717 /* received hdr only and no data */
718 if (ebhscr_frame_length == EBHSCR_HEADER_LENGTH) {
719 return tvb_captured_length(tvb);
722 ti = proto_tree_add_item(ebhscr_tree, hf_lin_payload, tvb, 32, ebhscr_current_payload_length, ENC_NA);
723 lin_payload_tree = proto_item_add_subtree(ti, ett_lin_payload);
725 ti = proto_tree_add_item(lin_payload_tree, hf_lin_payload_pid, tvb, 32, 1, ENC_BIG_ENDIAN);
726 lin_pid_tree = proto_item_add_subtree(ti, ett_lin_payload);
727 proto_tree_add_bitmask_list(lin_pid_tree, tvb, 32, 1, lin_payload_pid_bits, ENC_BIG_ENDIAN);
729 proto_tree_add_item(lin_payload_tree, hf_lin_payload_data, tvb, EBHSCR_HEADER_LENGTH + 1, ebhscr_current_payload_length - 2, ENC_NA);
730 proto_tree_add_item(lin_payload_tree, hf_lin_payload_checksum, tvb, EBHSCR_HEADER_LENGTH + ebhscr_current_payload_length - 1, 1, ENC_BIG_ENDIAN);
732 return tvb_captured_length(tvb);
735 static int
736 dissect_ebhscr_dio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
737 proto_tree *ebhscr_packet_header_tree, uint16_t ebhscr_status, uint32_t ebhscr_frame_length)
739 tvbuff_t* next_tvb;
740 proto_item *ti;
741 uint32_t ebhscr_current_payload_length;
743 col_set_str(pinfo->cinfo, COL_INFO, "DIO");
744 ebhscr_current_payload_length = ebhscr_frame_length - EBHSCR_HEADER_LENGTH;
746 ti = proto_tree_add_bitmask(ebhscr_packet_header_tree, tvb, 2, hf_ebhscr_status,
747 ett_ebhscr_status, dio_status_bits, ENC_BIG_ENDIAN);
749 if (ebhscr_status) {
750 expert_add_info(pinfo, ti, &ei_ebhscr_err_status_flag);
752 proto_tree_add_bitmask(ebhscr_packet_header_tree, tvb, 24, hf_ebhscr_mjr_hdr, ett_ebhscr_mjr_hdr,
753 dio_mjr_hdr_bits, ENC_BIG_ENDIAN);
755 if (ebhscr_frame_length == EBHSCR_HEADER_LENGTH) {
756 return tvb_captured_length(tvb);
759 next_tvb = tvb_new_subset_length(tvb, 32, ebhscr_current_payload_length);
760 call_data_dissector(next_tvb, pinfo, tree);
762 return tvb_captured_length(tvb);
765 static int dissect_ebhscr_flexray_frame_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
766 proto_tree *ebhscr_packet_header_tree, uint16_t ebhscr_status,
767 uint32_t ebhscr_current_payload_length)
769 proto_item *ti;
770 proto_tree *flexray_mhdr_tree, *flexray_mhdr_sub_tree, *flexray_status_tree;
771 tvbuff_t *fr_tvb, *hdr_tvb;
772 uint8_t channel;
773 uint8_t header_data[2U];
775 ti = proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_status, tvb, 2, 2, ENC_BIG_ENDIAN);
776 flexray_status_tree = proto_item_add_subtree(ti, ett_ebhscr_status);
777 proto_tree_add_bitmask_list(flexray_status_tree, tvb, 2, 2, flexray_frame_status_bits, ENC_BIG_ENDIAN);
779 ti = proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_mjr_hdr, tvb, 24, 8, ENC_BIG_ENDIAN);
780 flexray_mhdr_tree = proto_item_add_subtree(ti, ett_ebhscr_mjr_hdr);
782 ti = proto_tree_add_item(flexray_mhdr_tree, hf_flexray_slot_information, tvb, 24, 2, ENC_BIG_ENDIAN);
783 flexray_mhdr_sub_tree = proto_item_add_subtree(ti, ett_ebhscr_mjr_hdr);
784 proto_tree_add_bitmask_list(flexray_mhdr_sub_tree, tvb, 24, 2, flexray_mhdr_slot_information_bits, ENC_BIG_ENDIAN);
786 ti = proto_tree_add_item(flexray_mhdr_tree, hf_flexray_frame_status, tvb, 26, 2, ENC_BIG_ENDIAN);
787 flexray_mhdr_sub_tree = proto_item_add_subtree(ti, ett_ebhscr_mjr_hdr);
788 proto_tree_add_bitmask_list(flexray_mhdr_sub_tree, tvb, 26, 2, flexray_mhdr_frame_status_bits, ENC_BIG_ENDIAN);
790 proto_tree_add_item(flexray_mhdr_tree, hf_flexray_supercycle_counter, tvb, 28, 4, ENC_BIG_ENDIAN);
792 fr_tvb = tvb_new_composite();
794 header_data[0] = 0x01;
795 channel = tvb_get_uint8(tvb, 1);
797 if ((channel & FLEXRAY_CHANNEL_B_MASK) != 0) {
798 header_data[0] |= 0x80;
801 header_data[1] = 0x00;
803 if ((ebhscr_status & FLEXRAY_TSSVIOL_MASK) != 0) {
804 header_data[1] |= 0x01;
806 if ((ebhscr_status & FLEXRAY_CODERR_MASK) != 0) {
807 header_data[1] |= 0x02;
809 if ((ebhscr_status & FLEXRAY_FESERR_MASK) != 0) {
810 header_data[1] |= 0x04;
812 if ((ebhscr_status & FLEXRAY_HCRCERR_MASK) != 0) {
813 header_data[1] |= 0x08;
815 if ((ebhscr_status & FLEXRAY_FCRCERR_MASK) != 0) {
816 header_data[1] |= 0x10;
819 hdr_tvb = tvb_new_real_data(header_data, 2U, 2U);
821 tvb_composite_append(fr_tvb, hdr_tvb);
822 tvb_composite_append(fr_tvb, tvb_new_subset_length(tvb, 32, ebhscr_current_payload_length));
824 tvb_composite_finalize(fr_tvb);
825 call_dissector(flexray_handle, fr_tvb, pinfo, tree);
827 return tvb_captured_length(tvb);
830 static int dissect_ebhscr_flexray_symbol_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
831 proto_tree *ebhscr_packet_header_tree)
833 tvbuff_t* symbol_tvb;
834 proto_item *ti;
835 proto_tree *flexray_mhdr_tree, *flexray_mhdr_sub_tree, *flexray_status_tree;
836 uint8_t symbol_length, channel;
837 uint8_t flexray_symbol_packet[2U];
839 ti = proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_status, tvb, 2, 2, ENC_BIG_ENDIAN);
840 flexray_status_tree = proto_item_add_subtree(ti, ett_ebhscr_status);
841 proto_tree_add_bitmask_list(flexray_status_tree, tvb, 2, 2, flexray_status_bits, ENC_BIG_ENDIAN);
843 ti = proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_mjr_hdr, tvb, 24, 8, ENC_BIG_ENDIAN);
844 flexray_mhdr_tree = proto_item_add_subtree(ti, ett_ebhscr_mjr_hdr);
846 ti = proto_tree_add_item(flexray_mhdr_tree, hf_flexray_slot_information, tvb, 24, 2, ENC_BIG_ENDIAN);
847 flexray_mhdr_sub_tree = proto_item_add_subtree(ti, ett_ebhscr_mjr_hdr);
848 proto_tree_add_bitmask_list(flexray_mhdr_sub_tree, tvb, 24, 2, flexray_mhdr_slot_information_bits, ENC_BIG_ENDIAN);
850 ti = proto_tree_add_item(flexray_mhdr_tree, hf_flexray_frame_status, tvb, 26, 2, ENC_BIG_ENDIAN);
851 flexray_mhdr_sub_tree = proto_item_add_subtree(ti, ett_ebhscr_mjr_hdr);
852 proto_tree_add_bitmask_list(flexray_mhdr_sub_tree, tvb, 26, 2, flexray_mhdr_frame_status_bits, ENC_BIG_ENDIAN);
854 ti = proto_tree_add_item(flexray_mhdr_tree, hf_flexray_symbol_length_and_status, tvb, 28, 1, ENC_BIG_ENDIAN);
855 flexray_mhdr_sub_tree = proto_item_add_subtree(ti, ett_ebhscr_mjr_hdr);
856 proto_tree_add_bitmask_list(flexray_mhdr_sub_tree, tvb, 28, 1, flexray_mhdr_symbol_length_and_status_bits, ENC_BIG_ENDIAN);
858 symbol_length = tvb_get_uint8(tvb, 28) & 0x7F;
860 flexray_symbol_packet[0] = 0x02;
862 channel = tvb_get_uint8(tvb, 1);
864 if ((channel & FLEXRAY_CHANNEL_B_MASK) != 0) {
865 flexray_symbol_packet[0] |= 0x80;
868 flexray_symbol_packet[1] = symbol_length;
870 symbol_tvb = tvb_new_real_data(flexray_symbol_packet, 2U, 2U);
871 call_dissector(flexray_handle, symbol_tvb, pinfo, tree);
873 return tvb_captured_length(tvb);
876 static int dissect_ebhscr_flexray_slot_status_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ebhscr_packet_header_tree)
878 uint32_t supercycle_counter;
879 proto_item *ti;
880 proto_tree *flexray_mhdr_tree, *flexray_mhdr_sub_tree, *flexray_status_tree;
882 supercycle_counter = tvb_get_uint32(tvb, 28, ENC_BIG_ENDIAN);
883 col_append_fstr(pinfo->cinfo, COL_INFO, "SLSTS: SCC %d", supercycle_counter);
885 ti = proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_status, tvb, 2, 2, ENC_BIG_ENDIAN);
886 flexray_status_tree = proto_item_add_subtree(ti, ett_ebhscr_status);
887 proto_tree_add_bitmask_list(flexray_status_tree, tvb, 2, 2, flexray_status_bits, ENC_BIG_ENDIAN);
889 ti = proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_mjr_hdr, tvb, 24, 8, ENC_BIG_ENDIAN);
890 flexray_mhdr_tree = proto_item_add_subtree(ti, ett_ebhscr_mjr_hdr);
892 ti = proto_tree_add_item(flexray_mhdr_tree, hf_flexray_slot_information, tvb, 24, 2, ENC_BIG_ENDIAN);
893 flexray_mhdr_sub_tree = proto_item_add_subtree(ti, ett_ebhscr_mjr_hdr);
894 proto_tree_add_bitmask_list(flexray_mhdr_sub_tree, tvb, 24, 2, flexray_mhdr_slot_information_bits, ENC_BIG_ENDIAN);
896 ti = proto_tree_add_item(flexray_mhdr_tree, hf_flexray_frame_status, tvb, 26, 2, ENC_BIG_ENDIAN);
897 flexray_mhdr_sub_tree = proto_item_add_subtree(ti, ett_ebhscr_mjr_hdr);
898 proto_tree_add_bitmask_list(flexray_mhdr_sub_tree, tvb, 26, 2, flexray_mhdr_frame_status_bits, ENC_BIG_ENDIAN);
900 proto_tree_add_item(flexray_mhdr_tree, hf_flexray_supercycle_counter, tvb, 28, 4, ENC_BIG_ENDIAN);
902 return tvb_captured_length(tvb);
905 static int dissect_ebhscr_flexray_start_of_cycle_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ebhscr_packet_header_tree)
907 uint8_t cycle_counter;
908 uint32_t supercycle_counter;
909 proto_item *ti;
910 proto_tree *flexray_mhdr_tree, *flexray_status_tree;
912 cycle_counter = tvb_get_uint8(tvb, 25);
913 supercycle_counter = tvb_get_uint32(tvb, 28, ENC_BIG_ENDIAN);
915 col_append_fstr(pinfo->cinfo, COL_INFO, "SOC: CC %2d SCC %d", cycle_counter, supercycle_counter);
917 ti = proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_status, tvb, 2, 2, ENC_BIG_ENDIAN);
918 flexray_status_tree = proto_item_add_subtree(ti, ett_ebhscr_status);
919 proto_tree_add_bitmask_list(flexray_status_tree, tvb, 2, 2, flexray_status_bits, ENC_BIG_ENDIAN);
921 ti = proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_mjr_hdr, tvb, 24, 8, ENC_BIG_ENDIAN);
922 flexray_mhdr_tree = proto_item_add_subtree(ti, ett_ebhscr_mjr_hdr);
924 proto_tree_add_item(flexray_mhdr_tree, hf_flexray_POC_state, tvb, 24, 1, ENC_BIG_ENDIAN);
926 proto_tree_add_item(flexray_mhdr_tree, hf_flexray_following_cycle_counter, tvb, 25, 1, ENC_BIG_ENDIAN);
928 proto_tree_add_item(flexray_mhdr_tree, hf_flexray_supercycle_counter, tvb, 28, 4, ENC_BIG_ENDIAN);
930 return tvb_captured_length(tvb);
933 static int dissect_ebhscr_flexray(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
934 proto_tree *ebhscr_packet_header_tree, proto_item *ebhscr_channel,
935 uint16_t ebhscr_status, uint32_t ebhscr_frame_length)
937 proto_tree *flexray_channel_tree;
938 uint32_t flexray_packet_type;
939 uint32_t ebhscr_current_payload_length;
941 col_set_str(pinfo->cinfo, COL_PROTOCOL, "FLEXRAY (EBHSCR)");
942 ebhscr_current_payload_length = ebhscr_frame_length - EBHSCR_HEADER_LENGTH;
944 flexray_channel_tree = proto_item_add_subtree(ebhscr_channel, ett_ebhscr_channel);
945 proto_tree_add_bitmask_list(flexray_channel_tree, tvb, 1, 1, flexray_channel_bits, ENC_BIG_ENDIAN);
947 flexray_packet_type = (ebhscr_status & 0xC) >> 2U;
949 if (flexray_packet_type == FLEXRAY_FRAME_PACKET) {
950 dissect_ebhscr_flexray_frame_packet(tvb, pinfo, tree, ebhscr_packet_header_tree, ebhscr_status, ebhscr_current_payload_length);
952 else if (flexray_packet_type == FLEXRAY_SYMBOL_PACKET) {
953 dissect_ebhscr_flexray_symbol_packet(tvb, pinfo, tree, ebhscr_packet_header_tree);
955 else if (flexray_packet_type == FLEXRAY_SLOT_STATUS_PACKET) {
956 dissect_ebhscr_flexray_slot_status_packet(tvb, pinfo, ebhscr_packet_header_tree);
958 else if (flexray_packet_type == FLEXRAY_START_OF_CYCLE_PACKET) {
959 dissect_ebhscr_flexray_start_of_cycle_packet(tvb, pinfo, ebhscr_packet_header_tree);
962 return tvb_captured_length(tvb);
965 static int
966 dissect_ebhscr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
968 proto_item *ti;
969 proto_tree *ebhscr_packet_header_tree;
970 proto_tree *ebhscr_tree;
971 proto_tree *proto_ebhscr_channel;
972 tvbuff_t* next_tvb;
973 uint32_t ebhscr_frame_length, ebhscr_length;
974 int ebhscr_current_payload_length;
975 uint8_t ebhscr_major_num;
976 uint16_t ebhscr_status = 0;
978 col_set_str(pinfo->cinfo, COL_PROTOCOL, "EBHSCR");
979 col_clear(pinfo->cinfo, COL_INFO);
981 ebhscr_frame_length = tvb_captured_length(tvb);
983 ti = proto_tree_add_item(tree, proto_ebhscr, tvb, 0, -1, ENC_NA);
984 ebhscr_tree = proto_item_add_subtree(ti, ett_ebhscr);
986 if (ebhscr_frame_length < EBHSCR_HEADER_LENGTH) {
987 expert_add_info(pinfo, ebhscr_tree, &ei_ebhscr_frame_header);
988 return tvb_captured_length(tvb);
991 ebhscr_major_num = tvb_get_uint8(tvb, 0);
992 ebhscr_status = tvb_get_uint16(tvb, 2, ENC_BIG_ENDIAN) & 0x0FFF;
994 ti = proto_tree_add_item(ebhscr_tree, hf_ebhscr_packet_header, tvb, 0, 4, ENC_BIG_ENDIAN);
995 ebhscr_packet_header_tree = proto_item_add_subtree(ti, ett_ebhscr_packet_header);
996 proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_major_number, tvb, 0, 1, ENC_BIG_ENDIAN);
997 proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_slot, tvb, 1, 1, ENC_BIG_ENDIAN);
998 proto_ebhscr_channel = proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_channel, tvb, 1, 1, ENC_BIG_ENDIAN);
999 proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_version, tvb, 2, 2, ENC_BIG_ENDIAN);
1000 proto_tree_add_item_ret_uint(ebhscr_packet_header_tree, hf_ebhscr_length, tvb, 4, 4, ENC_BIG_ENDIAN, &ebhscr_length);
1001 proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_start_timestamp, tvb, 8, 8, ENC_BIG_ENDIAN);
1002 proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_stop_timestamp, tvb, 16, 8, ENC_BIG_ENDIAN);
1004 ebhscr_current_payload_length = ebhscr_frame_length - EBHSCR_HEADER_LENGTH;
1006 if ((ebhscr_major_num >= EBHSCR_USER_FIRST) && (ebhscr_major_num <= EBHSCR_USER_LAST)) {
1007 if (ebhscr_user_handle != NULL) {
1008 next_tvb = tvb_new_subset_length(tvb, 0, ebhscr_frame_length);
1009 call_dissector(ebhscr_user_handle, next_tvb, pinfo, ebhscr_tree);
1011 else {
1012 proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_status, tvb, 2, 2, ENC_BIG_ENDIAN);
1013 proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_mjr_hdr, tvb, 24, 8, ENC_BIG_ENDIAN);
1014 next_tvb = tvb_new_subset_length(tvb, 32, ebhscr_current_payload_length);
1015 call_data_dissector(next_tvb, pinfo, tree);
1016 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", tvb_bytes_to_str_punct(pinfo->pool, tvb, 32,
1017 ebhscr_current_payload_length, ' '));
1019 return tvb_captured_length(tvb);
1022 /* each dissect function handles Status and Major number specific header bits */
1023 if (ebhscr_major_num == CAN_FRAME) {
1024 dissect_ebhscr_can(tvb, pinfo, tree, ebhscr_packet_header_tree, ebhscr_status, ebhscr_frame_length);
1027 else if (ebhscr_major_num == ETHERNET_FRAME) {
1028 dissect_ebhscr_eth(tvb, pinfo, tree, ebhscr_packet_header_tree, ebhscr_status, ebhscr_frame_length);
1031 else if (ebhscr_major_num == NMEA_FRAME)
1033 dissect_ebhscr_nmea(tvb, pinfo, tree, ebhscr_packet_header_tree, ebhscr_frame_length, ebhscr_length);
1036 else if (ebhscr_major_num == TIME_STATE_FRAME) {
1037 dissect_ebhscr_ts(tvb, pinfo, tree, ebhscr_packet_header_tree, ebhscr_status, ebhscr_frame_length);
1039 else if (ebhscr_major_num == LIN_FRAME) {
1040 dissect_ebhscr_lin(tvb, pinfo, ebhscr_tree, ebhscr_packet_header_tree, ebhscr_status, ebhscr_frame_length);
1043 else if (ebhscr_major_num == DIO_FRAME) {
1044 dissect_ebhscr_dio(tvb, pinfo, tree, ebhscr_packet_header_tree, ebhscr_status, ebhscr_frame_length);
1047 else if (ebhscr_major_num == FLEXRAY_FRAME) {
1048 dissect_ebhscr_flexray(tvb, pinfo, tree, ebhscr_packet_header_tree, proto_ebhscr_channel, ebhscr_status, ebhscr_frame_length);
1051 else {
1052 proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_status, tvb, 2, 2, ENC_BIG_ENDIAN);
1053 proto_tree_add_item(ebhscr_packet_header_tree, hf_ebhscr_mjr_hdr, tvb, 24, 8, ENC_BIG_ENDIAN);
1054 next_tvb = tvb_new_subset_length(tvb, 32, ebhscr_current_payload_length);
1055 call_data_dissector(next_tvb, pinfo, tree);
1058 return tvb_captured_length(tvb);
1061 void
1062 proto_register_ebhscr(void)
1064 expert_module_t *expert_ebhscr;
1066 static hf_register_info hf[] = {
1067 { &hf_ebhscr_packet_header,
1068 { "Packet header", "ebhscr.hdr",
1069 FT_UINT32, BASE_HEX,
1070 NULL, 0x0,
1071 NULL, HFILL }
1073 { &hf_ebhscr_major_number,
1074 { "Major number", "ebhscr.mjr",
1075 FT_UINT8, BASE_HEX,
1076 NULL, 0x0,
1077 NULL, HFILL }
1079 { &hf_ebhscr_slot,
1080 { "Slot", "ebhscr.slot",
1081 FT_UINT8, BASE_HEX,
1082 NULL, 0xc0,
1083 NULL, HFILL }
1085 { &hf_ebhscr_channel,
1086 { "Channel", "ebhscr.channel",
1087 FT_UINT8, BASE_HEX,
1088 NULL, 0x3f,
1089 NULL, HFILL }
1091 { &hf_ebhscr_status,
1092 { "Status", "ebhscr.sts",
1093 FT_UINT16, BASE_HEX,
1094 NULL, 0x0FFF,
1095 NULL, HFILL }
1097 { &hf_ebhscr_status_unused,{
1098 "Status [Unused]", "ebhscr.sts.unused",
1099 FT_UINT32, BASE_HEX,
1100 NULL, 0x0FFF,
1101 NULL, HFILL }
1103 { &hf_ebhscr_version,
1104 { "Version", "ebhscr.ver",
1105 FT_UINT16, BASE_HEX,
1106 NULL, 0xF000,
1107 NULL, HFILL }
1109 { &hf_ebhscr_length,
1110 { "Length", "ebhscr.len",
1111 FT_UINT32, BASE_DEC,
1112 NULL, 0x0,
1113 NULL, HFILL }
1115 { &hf_ebhscr_start_timestamp,
1116 { "Start timestamp", "ebhscr.strt",
1117 FT_UINT64, BASE_HEX,
1118 NULL, 0x0,
1119 NULL, HFILL }
1121 { &hf_ebhscr_stop_timestamp,
1122 { "Stop timestamp", "ebhscr.stpt",
1123 FT_UINT64, BASE_HEX,
1124 NULL, 0x0,
1125 NULL, HFILL }
1127 { &hf_ebhscr_mjr_hdr,
1128 { "Major number specific header", "ebhscr.mjrhdr",
1129 FT_UINT64, BASE_HEX,
1130 NULL, 0x0,
1131 NULL, HFILL }
1133 { &hf_ebhscr_mjr_hdr_unused,
1134 { "Major number specific header [Unused]", "ebhscr.mjrhdr.unused",
1135 FT_UINT64, BASE_HEX,
1136 NULL, 0x0,
1137 NULL, HFILL }
1139 { &hf_can_proto_type,
1140 { "CAN FD flag", "ebhscr.can.type",
1141 FT_UINT16, BASE_HEX,
1142 VALS(can_proto_type_strings), 0x0001,
1143 NULL, HFILL }
1145 { &hf_can_status_available,
1146 { "CAN protocol status availability", "ebhscr.can.asts",
1147 FT_UINT16, BASE_HEX,
1148 VALS(can_status_available_strings), 0x0002,
1149 NULL, HFILL }
1151 { &hf_can_LEC,
1152 { "CAN Last error code", "ebhscr.can.LEC",
1153 FT_UINT64, BASE_DEC | BASE_VAL64_STRING,
1154 VALS64(can_last_err_code_strings), 0x0000000700000000,
1155 NULL, HFILL }
1157 { &hf_can_ERRP,
1158 { "CAN Counters reached Error passive limit", "ebhscr.can.errp",
1159 FT_UINT64, BASE_DEC | BASE_VAL64_STRING,
1160 VALS64(can_ERRP_strings), 0x0000002000000000,
1161 NULL, HFILL }
1163 { &hf_can_ERRW,
1164 { "CAN Counters reached Error warning limit", "ebhscr.can.errw",
1165 FT_UINT64, BASE_DEC | BASE_VAL64_STRING,
1166 VALS64(can_ERRW_strings), 0x0000004000000000,
1167 NULL, HFILL }
1169 { &hf_can_BOFF,
1170 { "CAN Bus Off state", "ebhscr.can.boff",
1171 FT_UINT64, BASE_DEC | BASE_VAL64_STRING,
1172 VALS64(can_BOFF_strings), 0x0000008000000000,
1173 NULL, HFILL }
1175 { &hf_can_DLEC,
1176 { "CAN Data phase of CAN FD frame (with BRS flag set) last error code.", "ebhscr.can.dlec",
1177 FT_UINT64, BASE_HEX | BASE_VAL64_STRING,
1178 VALS64(can_last_err_code_strings), 0x0000070000000000,
1179 NULL, HFILL }
1181 { &hf_can_TEC,
1182 { "CAN Transmit Error Counter", "ebhscr.can.tec",
1183 FT_UINT64, BASE_HEX,
1184 NULL, 0x00FF000000000000,
1185 NULL, HFILL }
1187 { &hf_can_REC,
1188 { "CAN Receive Error Counter", "ebhscr.can.rec",
1189 FT_UINT64, BASE_DEC | BASE_VAL64_STRING,
1190 NULL, 0x7F00000000000000,
1191 NULL, HFILL }
1193 { &hf_can_CEL,
1194 { "Can Error Logging Counter", "ebhscr.can.cel",
1195 FT_UINT64, BASE_DEC | BASE_VAL64_STRING,
1196 NULL, 0x00000000000000FF,
1197 NULL, HFILL }
1199 { &hf_can_reserved_bytes,
1200 { "Reserved Flags", "ebhscr.can.rsv",
1201 FT_BOOLEAN, 64, NULL,
1202 0x00000000FFFFFF00,
1203 NULL, HFILL }
1205 { &hf_eth_reserved_bytes,
1206 { "Reserved Flags", "ebhscr.eth.rsv",
1207 FT_BOOLEAN, 64, NULL,
1208 0xFFF0FF00FFFFFFFF,
1209 NULL, HFILL }
1211 { &hf_eth_link_up_down,
1212 { "Link Up or Down", "ebhscr.eth.lud",
1213 FT_UINT64, BASE_HEX | BASE_VAL64_STRING,
1214 VALS64(eth_link_strings), 0x0000000100000000,
1215 NULL, HFILL }
1217 { &hf_eth_master_slave,
1218 { "Master or Slave (if supported)", "ebhscr.eth.ms",
1219 FT_UINT64, BASE_HEX | BASE_VAL64_STRING,
1220 VALS64(eth_master_strings), 0x0000000200000000,
1221 NULL, HFILL }
1223 { &hf_eth_fcs_unavailable,
1224 { "FCS unavailable", "ebhscr.eth.fcsua",
1225 FT_UINT64, BASE_HEX | BASE_VAL64_STRING,
1226 VALS64(eth_fcs_strings), 0x0000000400000000,
1227 NULL, HFILL }
1229 { &hf_eth_rsvd_bit,
1230 { "Reserved", "ebhscr.eth.rsvd",
1231 FT_BOOLEAN, 64, NULL,
1232 0x0000000800000000,
1233 NULL, HFILL }
1235 { &hf_eth_speed,
1236 { "Ethernet speed", "ebhscr.eth.spd",
1237 FT_UINT64, BASE_HEX | BASE_VAL64_STRING,
1238 VALS64(eth_speed_strings), 0x000000F000000000,
1239 NULL, HFILL }
1241 { &hf_eth_crc_error,
1242 { "Ethernet CRC Error", "ebhscr.eth.crc",
1243 FT_BOOLEAN, 16,
1244 NULL, 0x0001,
1245 NULL, HFILL }
1247 { &hf_eth_mii_foe,
1248 { "Media-independent interface FIFO Overflow Error", "ebhscr.eth.miifoe",
1249 FT_BOOLEAN, 16,
1250 NULL, 0x0002,
1251 NULL, HFILL }
1253 { &hf_eth_payload_foe,
1254 { "Payload FIFO Overflow Error", "ebhscr.eth.pfoe",
1255 FT_BOOLEAN, 16,
1256 NULL, 0x0004,
1257 NULL, HFILL }
1259 { &hf_eth_hdr_foe,
1260 { "Header FIFO Overflow Error", "ebhscr.eth.hfoe",
1261 FT_BOOLEAN, 16,
1262 NULL, 0x0008,
1263 NULL, HFILL }
1265 { &hf_eth_rcv_dec_err,
1266 { "Receiver Decoder Error", "ebhscr.eth.rde",
1267 FT_BOOLEAN, 16,
1268 NULL, 0x0010,
1269 NULL, HFILL }
1271 { &hf_eth_sym_error,
1272 { "Symbol Error", "ebhscr.eth.se",
1273 FT_BOOLEAN, 16,
1274 NULL, 0x0020,
1275 NULL, HFILL }
1277 { &hf_eth_jabber_event,
1278 { "Jabber", "ebhscr.eth.jbr",
1279 FT_BOOLEAN, 16,
1280 NULL, 0x0040,
1281 NULL, HFILL }
1283 { &hf_eth_pol_ch_event,
1284 { "Polarity Change", "ebhscr.eth.pche",
1285 FT_BOOLEAN, 16,
1286 NULL, 0x0080,
1287 NULL, HFILL }
1289 { &hf_eth_fls_carrier_event,
1290 { "False Carrier", "ebhscr.eth.flsc",
1291 FT_BOOLEAN, 16,
1292 NULL, 0x0100,
1293 NULL, HFILL }
1295 { &hf_eth_rx_trunc,
1296 { "Truncation", "ebhscr.eth.rxtrc",
1297 FT_BOOLEAN, 16,
1298 NULL, 0x0200,
1299 NULL, HFILL }
1301 { &hf_eth_transmission_disc_err,
1302 { "Capture: Transmission Discarded Error, Replay: Start Frame Separation Bit", "ebhscr.eth.trdis",
1303 FT_BOOLEAN, 16,
1304 NULL, 0x0400,
1305 NULL, HFILL }
1307 { &hf_eth_wait_frame_sep_bit,
1308 { "Wait Frame Separation Bit", "ebhscr.eth.wfsb",
1309 FT_BOOLEAN, 16,
1310 NULL, 0x0800,
1311 NULL, HFILL }
1313 { &hf_eth_tx_trunc,
1314 { "If value 1 then a Truncation occurred. The frame is sent truncated.", "ebhscr.eth.trc",
1315 FT_BOOLEAN, 64, NULL,
1316 0x0001000000000000,
1317 NULL, HFILL }
1319 { &hf_eth_trans_undrun,
1320 { "If value 1 then a Transmitter Underrun occurred.", "ebhscr.eth.trudr",
1321 FT_BOOLEAN, 64, NULL,
1322 0x0002000000000000,
1323 NULL, HFILL }
1325 { &hf_eth_retrans_limit,
1326 { "If value 1 then the Retransmission Limit was reached", "ebhscr.eth.rtrlmt",
1327 FT_BOOLEAN, 64, NULL,
1328 0x0004000000000000,
1329 NULL, HFILL }
1331 { &hf_eth_late_collision,
1332 { "If value 1 then a Late collision was detected.", "ebhscr.eth.ltcls",
1333 FT_BOOLEAN, 64, NULL,
1334 0x0008000000000000,
1335 NULL, HFILL }
1337 { &hf_ts_time_offset_valid,
1338 { "Time offset in ns valid (byte 0-7)", "ebhscr.ts.tov",
1339 FT_BOOLEAN, 16, NULL,
1340 0x0001,
1341 NULL, HFILL }
1343 { &hf_ts_last_offset_change_valid,
1344 { "Last offset change in ns valid (byte 8-15)", "ebhscr.ts.locv",
1345 FT_BOOLEAN, 16,
1346 NULL, 0x0002,
1347 NULL, HFILL }
1349 { &hf_ts_nano_seconds_last_jump_valid,
1350 { "Nano seconds last jump valid (byte 16-23)", "ebhscr.ts.nsljv",
1351 FT_BOOLEAN, 16,
1352 NULL, 0x0004,
1353 NULL, HFILL }
1355 { &hf_ts_UTC_leap_seconds_valid,
1356 { "UTC leap seconds valid (byte 24-25)", "ebhscr.ts.utclsv",
1357 FT_BOOLEAN, 16,
1358 NULL, 0x0008,
1359 NULL, HFILL }
1361 { &hf_ts_sync_state_valid,
1362 { "Sync state valid (byte 26-27)", "ebhscr.ts.ssv",
1363 FT_BOOLEAN, 16,
1364 NULL, 0x0010,
1365 NULL, HFILL }
1367 { &hf_ts_time_source,
1368 { "Time source", "ebhscr.ts.tsrc",
1369 FT_UINT64, BASE_DEC | BASE_VAL64_STRING, VALS64(ts_time_source_strings), 0x0,
1370 NULL, HFILL }
1372 { &hf_ts_time_offset_ns,
1373 { "Time offset in nanoseconds", "ebhscr.ts.off", FT_UINT64, BASE_HEX,
1374 NULL, 0, "The offset is the difference of the zero-based capture counter to TAI", HFILL }
1376 { &hf_ts_last_offset_ns,
1377 { "Last offset change in nano seconds", "ebhscr.ts.lstoff", FT_UINT64, BASE_HEX,
1378 NULL, 0, "Point in time of last change of time offset.", HFILL }
1380 { &hf_ts_last_jump_ns,
1381 { "Nano seconds last jump", "ebhscr.ts.lstjmp", FT_UINT64, BASE_HEX,
1382 NULL, 0, "Point in time of last hard change/jump of time count after the jump.", HFILL }
1384 { &hf_ts_utc_leap_sec,
1385 { "UTC leap-seconds", "ebhscr.ts.leap", FT_UINT16, BASE_HEX,
1386 NULL, 0, NULL, HFILL }
1388 { &hf_ts_sync_state,
1389 { "Sync state", "ebhscr.ts.syn", FT_UINT16, BASE_HEX,
1390 VALS(ts_sync_state_strings), 0, NULL, HFILL }
1392 { &hf_lin_1_3_classic_chksum,
1393 { "LIN 1.3 Classic Checksum received", "ebhscr.lin.clchksum",
1394 FT_BOOLEAN, 16,
1395 NULL, 0x0001,
1396 "During reception the checksum is validated to determine this bit."
1397 "If the received checksum is invalid this bit can not be evaluated."
1398 "Version 1.3 checksum is calculated over data bytes.", HFILL }
1400 { &hf_lin_1_2_enhanced_chksum,
1401 { "LIN 2.0 Enhanced Checksum received", "ebhscr.lin.enchksum",
1402 FT_BOOLEAN, 16,
1403 NULL, 0x0002,
1404 "During reception the checksum is validated to determine this bit."
1405 "If the received checksum is invalid this bit can not be evaluated."
1406 "Version 2.0 checksum is calculated over ID and data byes.", HFILL }
1408 { &hf_lin_wakeup,
1409 { "LIN Wake-Up Packet was received", "ebhscr.lin.wakeup",
1410 FT_BOOLEAN, 16,
1411 NULL, 0x0010,
1412 "A wakeup packet contains no payload (Payload length field is set to 0)."
1413 "The wakeup length field in the major number specific header is set.", HFILL }
1415 { &hf_lin_time_jump,
1416 { "Time jump occurred near the edge and thus the timestamp was estimated", "ebhscr.lin.timejmp",
1417 FT_BOOLEAN, 16,
1418 NULL, 0x0400,
1419 "Only relevant for capture, ignored for replay.", HFILL }
1421 { &hf_lin_reserved_bytes,
1422 { "Reserved", "ebhscr.lin.rsv",
1423 FT_BOOLEAN, 64, NULL,
1424 0x00000000FFFFFFFF,
1425 NULL, HFILL }
1427 { &hf_lin_wakeup_length,
1428 { "Wake-Up signal low phase length in us", "ebhscr.lin.wakeup.length",
1429 FT_UINT64, BASE_DEC, NULL,
1430 0xFFFF000000000000,
1431 "Only valid if wakeup bit in status header is set. Set to 0 otherwise.", HFILL }
1433 { &hf_lin_sts_reserved,
1434 { "Reserved bit", "ebhscr.lin.bitrsv",
1435 FT_BOOLEAN, 64,
1436 NULL, 0x0000000100000000,
1437 NULL, HFILL }
1439 { &hf_lin_sts_syn,
1440 { "SYN - Received synchronization field is not 0x55", "ebhscr.lin.syn",
1441 FT_BOOLEAN, 64,
1442 NULL, 0x0000000200000000,
1443 NULL, HFILL }
1445 { &hf_lin_sts_par,
1446 { "PAR - Received parity does not match calculated parity", "ebhscr.lin.par",
1447 FT_BOOLEAN, 64,
1448 NULL, 0x0000000400000000,
1449 NULL, HFILL }
1451 { &hf_lin_sts_res,
1452 { "RES - No response detected after LIN header", "ebhscr.lin.res",
1453 FT_BOOLEAN, 64,
1454 NULL, 0x0000000800000000,
1455 NULL, HFILL }
1457 { &hf_lin_sts_dat,
1458 { "DAT - Too many data bytes received", "ebhscr.lin.dat",
1459 FT_BOOLEAN, 64,
1460 NULL, 0x0000001000000000,
1461 NULL, HFILL }
1463 { &hf_lin_sts_chk,
1464 { "CHK - Checksum is invalid", "ebhscr.lin.chk",
1465 FT_BOOLEAN, 64,
1466 NULL, 0x0000002000000000,
1467 NULL, HFILL }
1469 { &hf_lin_sts_sta,
1470 { "STA - Expected start bit, but detected recessive bus level", "ebhscr.lin.sta",
1471 FT_BOOLEAN, 64,
1472 NULL, 0x0000004000000000,
1473 NULL, HFILL }
1475 { &hf_lin_sts_sto,
1476 { "STO - Expected stop bit, but detected recessive bus level", "ebhscr.lin.sto",
1477 FT_BOOLEAN, 64,
1478 NULL, 0x0000008000000000,
1479 NULL, HFILL }
1481 { &hf_lin_sts_emp,
1482 { "EMP - Break and Sync received, but no further data", "ebhscr.lin.emp",
1483 FT_BOOLEAN, 64,
1484 NULL, 0x0000010000000000,
1485 NULL, HFILL }
1487 { &hf_lin_payload,
1488 { "Payload", "ebhscr.lin.payload",
1489 FT_BYTES, SEP_SPACE,
1490 NULL, 0x0,
1491 NULL, HFILL }
1493 { &hf_lin_payload_pid,
1494 { "LIN protected identifier", "ebhscr.lin.payload.pid",
1495 FT_UINT8, BASE_HEX,
1496 NULL, 0,
1497 NULL, HFILL }
1499 { &hf_lin_payload_id,
1500 { "LIN identifier", "ebhscr.lin.payload.id",
1501 FT_UINT8, BASE_HEX,
1502 NULL, 0x3F,
1503 NULL, HFILL }
1505 { &hf_lin_payload_id_parity_0,
1506 { "LIN identifier parity bit 0", "ebhscr.lin.payload.id_parity0",
1507 FT_UINT8, BASE_HEX,
1508 NULL, 0x40,
1509 NULL, HFILL }
1511 { &hf_lin_payload_id_parity_1,
1512 { "LIN identifier parity bit 1", "ebhscr.lin.payload.id_parity1",
1513 FT_UINT8, BASE_HEX,
1514 NULL, 0x80,
1515 NULL, HFILL }
1517 { &hf_lin_payload_data,
1518 { "Data", "ebhscr.lin.payload.data",
1519 FT_BYTES, SEP_SPACE,
1520 NULL, 0x0,
1521 NULL, HFILL }
1523 { &hf_lin_payload_checksum,
1524 { "Checksum", "ebhscr.lin.payload.checksum",
1525 FT_UINT8, BASE_HEX,
1526 NULL, 0x0,
1527 NULL, HFILL }
1529 { &hf_dio_overflow_mon_unit,
1530 { "Overflow in the monitoring unit", "ebhscr.dio.ofw_mon",
1531 FT_BOOLEAN, 16,
1532 NULL, 0x0001,
1533 "Set to 1 in case of an overflow in the monitoring unit. In this case all remaining fields are invalid.", HFILL }
1535 { &hf_dio_jump_occurred,
1536 { "Time jump occurred", "ebhscr.dio.jump_occ",
1537 FT_BOOLEAN, 16,
1538 NULL, 0x0400,
1539 "Set to 1 if a time jump occurred near the edge and thus the timestamp was estimated.", HFILL }
1541 { &hf_dio_value_type,
1542 { "Digital IO value type", "ebhscr.dio.valtype",
1543 FT_UINT64, BASE_DEC | BASE_VAL64_STRING,
1544 VALS64(dio_val_type_strings), 0x0100000000000000,
1545 NULL, HFILL }
1547 { &hf_dio_reserved_bytes,
1548 { "Reserved Flags", "ebhscr.dio.rsv",
1549 FT_BOOLEAN, 64, NULL,
1550 0x00FFFFFFFFFFFFFF,
1551 NULL, HFILL }
1553 { &hf_flexray_ch_a,
1554 { "Channel A", "ebhscr.flexray.cha",
1555 FT_BOOLEAN, 8, NULL,
1556 0x01,
1557 NULL, HFILL}
1559 { &hf_flexray_ch_b,
1560 { "Channel B", "ebhscr.flexray.chb",
1561 FT_BOOLEAN, 8, NULL,
1562 FLEXRAY_CHANNEL_B_MASK,
1563 NULL, HFILL}
1565 { &hf_flexray_ctrl_id,
1566 { "Controller id", "ebhscr.flexray.ctrl",
1567 FT_UINT8, BASE_HEX,
1568 NULL, 0x1C,
1569 NULL, HFILL}
1571 { &hf_flexray_monitoring_bit,
1572 { "Synchronous monitoring packet", "ebhscr.flexray.syncmon",
1573 FT_UINT16, BASE_HEX,
1574 VALS(flexray_monitoring_bit_strings), 0x0001,
1575 NULL, HFILL }
1577 { &hf_flexray_sync_bit,
1578 { "If value 1 then FlexRay cluster is sync (only valid if bit 0 = 1).", "ebhscr.flexray.sync",
1579 FT_BOOLEAN, 16,
1580 NULL, 0x0002,
1581 NULL, HFILL }
1583 { &hf_flexray_packet_type,
1584 { "FlexRay packet type", "ebhscr.flexray.pkttype",
1585 FT_UINT16, BASE_HEX,
1586 VALS(flexray_packet_type_strings), 0x000C,
1587 NULL, HFILL }
1589 { &hf_flexray_CODERR,
1590 { "Coding error", "ebhscr.flexray.coderr",
1591 FT_BOOLEAN, 16,
1592 NULL, FLEXRAY_CODERR_MASK,
1593 "Indicates if a Frame Start Sequence Error (FSSERR) or a Byte Start Sequence error (BSSERR)", HFILL }
1595 { &hf_flexray_TSSVIOL,
1596 { "TSS violation", "ebhscr.flexray.tssviol",
1597 FT_BOOLEAN, 16,
1598 NULL, FLEXRAY_TSSVIOL_MASK,
1599 NULL, HFILL }
1601 { &hf_flexray_HCRCERR,
1602 { "Header CRC error", "ebhscr.flexray.hcrcerr",
1603 FT_BOOLEAN, 16,
1604 NULL, FLEXRAY_HCRCERR_MASK,
1605 NULL, HFILL }
1607 { &hf_flexray_FCRCERR,
1608 { "Frame CRC error", "ebhscr.flexray.fcrcerr",
1609 FT_BOOLEAN, 16,
1610 NULL, FLEXRAY_FCRCERR_MASK,
1611 NULL, HFILL }
1613 { &hf_flexray_FESERR,
1614 { "Frame end sequence error", "ebhscr.flexray.feserr",
1615 FT_BOOLEAN, 16,
1616 NULL, FLEXRAY_FESERR_MASK,
1617 NULL, HFILL }
1619 { &hf_flexray_FSSERR,
1620 { "Frame start sequence error", "ebhscr.flexray.fsserr",
1621 FT_BOOLEAN, 16,
1622 NULL, 0x0200,
1623 NULL, HFILL }
1625 { &hf_flexray_BSSERR,
1626 { "Byte start sequence error", "ebhscr.flexray.bsserr",
1627 FT_BOOLEAN, 16,
1628 NULL, 0x0400,
1629 NULL, HFILL }
1631 { &hf_flexray_jump_occurred,
1632 { "Time jump occurred", "ebhscr.flexray.jump_occ",
1633 FT_BOOLEAN, 16,
1634 NULL, 0x0800,
1635 "Set to 1 if a time jump occurred near the edge and thus the timestamp was estimated.", HFILL }
1637 { &hf_flexray_slot_information,
1638 { "Slot information", "ebhscr.flexray.slotinfo",
1639 FT_UINT16, BASE_HEX,
1640 NULL, 0,
1641 NULL, HFILL }
1643 { &hf_flexray_SBV,
1644 { "Slot boundary violation", "ebhscr.flexray.slotinfo.sbv",
1645 FT_BOOLEAN, 16,
1646 NULL, 0x8000,
1647 NULL, HFILL }
1649 { &hf_flexray_ACI,
1650 { "Additional communication indicator", "ebhscr.flexray.slotinfo.aci",
1651 FT_BOOLEAN, 16,
1652 NULL, 0x4000,
1653 NULL, HFILL }
1655 { &hf_flexray_CED,
1656 { "Content error detected", "ebhscr.flexray.slotinfo.ced",
1657 FT_BOOLEAN, 16,
1658 NULL, 0x2000,
1659 NULL, HFILL }
1661 { &hf_flexray_SED,
1662 { "Syntax error detected", "ebhscr.flexray.slotinfo.sed",
1663 FT_BOOLEAN, 16,
1664 NULL, 0x1000,
1665 NULL, HFILL }
1667 { &hf_flexray_VFR,
1668 { "Valid Frame Received", "ebhscr.flexray.slotinfo.vfr",
1669 FT_BOOLEAN, 16,
1670 NULL, 0x0800,
1671 NULL, HFILL }
1673 { &hf_flexray_SID,
1674 { "Slot ID", "ebhscr.flexray.slotinfo.sid",
1675 FT_UINT16, BASE_HEX,
1676 NULL, 0x07FF,
1677 NULL, HFILL }
1679 { &hf_flexray_frame_status,
1680 { "Frame status", "ebhscr.flexray.framests",
1681 FT_UINT16, BASE_HEX,
1682 NULL, 0,
1683 NULL, HFILL }
1685 { &hf_flexray_SPLERR,
1686 { "Static payload length error", "ebhscr.flexray.framests.splerr",
1687 FT_BOOLEAN, 16,
1688 NULL, 0x8000,
1689 NULL, HFILL }
1691 { &hf_flexray_CCERR,
1692 { "Cycle counter error", "ebhscr.flexray.framests.ccerr",
1693 FT_BOOLEAN, 16,
1694 NULL, 0x4000,
1695 NULL, HFILL }
1697 { &hf_flexray_FIDERR,
1698 { "Frame ID error", "ebhscr.flexray.framests.fiderr",
1699 FT_BOOLEAN, 16,
1700 NULL, 0x2000,
1701 NULL, HFILL }
1703 { &hf_flexray_SSERR,
1704 { "Sync or startup error", "ebhscr.flexray.framests.sserr",
1705 FT_BOOLEAN, 16,
1706 NULL, 0x1000,
1707 NULL, HFILL }
1709 { &hf_flexray_NERR,
1710 { "Null frame error", "ebhscr.flexray.framests.nerr",
1711 FT_BOOLEAN, 16,
1712 NULL, 0x0800,
1713 NULL, HFILL }
1715 { &hf_flexray_SOVERR,
1716 { "Slot overbooked error", "ebhscr.flexray.framests.soverr",
1717 FT_BOOLEAN, 16,
1718 NULL, 0x0400,
1719 NULL, HFILL }
1721 { &hf_flexray_SWVIOL,
1722 { "Symbol Window violation", "ebhscr.flexray.framests.swviol",
1723 FT_BOOLEAN, 16,
1724 NULL, 0x0200,
1725 NULL, HFILL }
1727 { &hf_flexray_NITVIOL,
1728 { "NIT violation", "ebhscr.flexray.framests.nitviol",
1729 FT_BOOLEAN, 16,
1730 NULL, 0x0100,
1731 NULL, HFILL }
1733 { &hf_flexray_BVIOL,
1734 { "Boundary violation", "ebhscr.flexray.framests.bviol",
1735 FT_BOOLEAN, 16,
1736 NULL, 0x0080,
1737 NULL, HFILL }
1739 { &hf_flexray_PCD,
1740 { "Prolonged channel idle detection", "ebhscr.flexray.framests.pcd",
1741 FT_BOOLEAN, 16,
1742 NULL, 0x0040,
1743 "FES to CHIRP took longer than 11 bit times. This is always true for dynamic frames because of the DTS.", HFILL }
1745 { &hf_flexray_SYNCERR,
1746 { "Sync and/or startup bit wrongly set", "ebhscr.flexray.framests.syncerr",
1747 FT_BOOLEAN, 16,
1748 NULL, 0x0020,
1749 NULL, HFILL }
1751 { &hf_flexray_CP,
1752 { "Communication cycle part", "ebhscr.flexray.framests.cp",
1753 FT_UINT16, BASE_HEX,
1754 VALS(flexray_CP_strings), 0x0018,
1755 NULL, HFILL }
1757 { &hf_flexray_BRC,
1758 { "Byte Received Counter", "ebhscr.flexray.framests.brc",
1759 FT_UINT16, BASE_HEX,
1760 NULL, 0x0007,
1761 "Number of bytes received by the decoder without coding error. When more than 7 bytes are received, the counter is set to 7", HFILL }
1763 { &hf_flexray_symbol_length_and_status,
1764 { "Symbol length and status", "ebhscr.flexray.slsts",
1765 FT_UINT8, BASE_HEX,
1766 NULL, 0,
1767 NULL, HFILL }
1769 { &hf_flexray_SYERR,
1770 { "The low phase was too long", "ebhscr.flexray.slsts.syerr",
1771 FT_BOOLEAN, 8,
1772 NULL, 0x80,
1773 NULL, HFILL }
1775 { &hf_flexray_SL,
1776 { "Symbol length in units of bit cells", "ebhscr.flexray.slsts.sl",
1777 FT_UINT8, BASE_DEC,
1778 NULL, 0x7F,
1779 NULL, HFILL }
1781 { &hf_flexray_POC_state,
1782 { "Protocol operation control state", "ebhscr.flexray.pocstate",
1783 FT_UINT8, BASE_HEX,
1784 VALS(flexray_POC_state_strings), 0,
1785 NULL, HFILL }
1787 { &hf_flexray_following_cycle_counter,
1788 { "Cycle counter of following cycle", "ebhscr.flexray.fcc",
1789 FT_UINT8, BASE_DEC,
1790 NULL, 0,
1791 NULL, HFILL }
1793 { &hf_flexray_supercycle_counter,
1794 { "Supercycle counter", "ebhscr.flexray.scc",
1795 FT_UINT32, BASE_DEC,
1796 NULL, 0,
1797 NULL, HFILL }
1801 static int *ett[] = {
1802 &ett_ebhscr,
1803 &ett_ebhscr_channel,
1804 &ett_ebhscr_packet_header,
1805 &ett_ebhscr_status,
1806 &ett_ebhscr_mjr_hdr,
1807 &ett_lin_payload,
1810 static ei_register_info ei[] = {
1811 { &ei_ebhscr_frame_header,
1812 { "ebhscr.frame_header", PI_MALFORMED, PI_ERROR,
1813 "Frame Header is malformed", EXPFILL }
1815 { &ei_ebhscr_err_status_flag,
1816 { "ebhscr.sts.err.status", PI_PROTOCOL, PI_WARN,
1817 "Status Flag is set", EXPFILL }
1819 { &ei_ebhscr_info_status_flag,
1820 { "ebhscr.sts.info.status", PI_PROTOCOL, PI_CHAT,
1821 "Status Flag is set", EXPFILL }
1825 proto_ebhscr = proto_register_protocol("EBHSCR Protocol", "EBHSCR", "ebhscr");
1827 proto_register_field_array(proto_ebhscr, hf, array_length(hf));
1828 proto_register_subtree_array(ett, array_length(ett));
1830 expert_ebhscr = expert_register_protocol(proto_ebhscr);
1831 expert_register_field_array(expert_ebhscr, ei, array_length(ei));
1833 ebhscr_handle = register_dissector("ebhscr", dissect_ebhscr, proto_ebhscr);
1834 subdissector_table = register_decode_as_next_proto(proto_ebhscr, "ebhscr.subdissector",
1835 "ebhscr next level dissector", NULL);
1838 void
1839 proto_reg_handoff_ebhscr(void)
1841 can_handle = find_dissector_add_dependency("can-hostendian", proto_ebhscr);
1842 can_fd_handle = find_dissector_add_dependency("canfd", proto_ebhscr);
1844 eth_withfcs_handle = find_dissector_add_dependency("eth_withfcs", proto_ebhscr);
1845 eth_withoutfcs_handle = find_dissector_add_dependency("eth_withoutfcs", proto_ebhscr);
1846 ebhscr_user_handle = find_dissector_add_dependency("ebhscr_user", proto_ebhscr);
1848 flexray_handle = find_dissector_add_dependency("flexray", proto_ebhscr);
1850 dissector_add_uint("wtap_encap", WTAP_ENCAP_EBHSCR, ebhscr_handle);
1854 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1856 * Local variables:
1857 * c-basic-offset: 4
1858 * tab-width: 8
1859 * indent-tabs-mode: nil
1860 * End:
1862 * vi: set shiftwidth=4 tabstop=8 expandtab:
1863 * :indentSize=4:tabSize=8:noTabs=false: