2 * Routines for Excentis DOCSIS31 XRA31 sniffer dissection
3 * Copyright 2017, Bruno Verstuyft <bruno.verstuyft[AT]excentis.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include <epan/packet.h>
15 #include <wiretap/wtap.h>
16 #include <wsutil/utf8_entities.h>
17 #include <epan/expert.h>
18 #include <epan/crc16-tvb.h>
20 #include <wsutil/array.h>
22 void proto_register_xra(void);
23 void proto_reg_handoff_xra(void);
25 /* Initialize the protocol and registered fields */
26 static dissector_handle_t docsis_handle
;
27 static dissector_handle_t xra_handle
;
33 static int proto_segment
;
34 static int proto_init_ranging
;
37 static int ett_xra_tlv
;
38 static int ett_xra_tlv_cw_info
;
39 static int ett_xra_tlv_ms_info
;
40 static int ett_xra_tlv_burst_info
;
42 static int ett_plc_mb
;
43 static int ett_plc_timestamp
;
45 static int ett_ncp_mb
;
46 static int ett_init_ranging
;
48 static int hf_xra_version
;
49 static int hf_xra_direction
;
50 static int hf_xra_packettype
;
51 static int hf_xra_tlvlength
;
52 static int hf_xra_tlv
;
55 static int hf_xra_tlv_ds_channel_id
;
56 static int hf_xra_tlv_ds_channel_frequency
;
57 static int hf_xra_tlv_modulation
;
58 static int hf_xra_tlv_annex
;
59 static int hf_xra_tlv_us_channel_id
;
60 static int hf_xra_tlv_profile_id
;
61 static int hf_xra_tlv_sid
;
62 static int hf_xra_tlv_iuc
;
63 static int hf_xra_tlv_burstid
;
64 static int hf_xra_tlv_ms_info
;
65 static int hf_xra_tlv_burst_info
;
66 static int hf_xra_tlv_ucd_ccc_parity
;
67 static int hf_xra_tlv_grant_size
;
68 static int hf_xra_tlv_segment_header_present
;
69 static int hf_xra_tlv_ncp_trunc
;
70 static int hf_xra_tlv_ncp_symbolid
;
73 static int hf_xra_tlv_start_minislot_id_abs
;
74 static int hf_xra_tlv_start_minislot_id_rel
;
75 static int hf_xra_tlv_stop_minislot_id_rel
;
78 static int hf_xra_tlv_ranging_number_ofdma_frames
;
79 static int hf_xra_tlv_ranging_timing_adjust
;
81 static int hf_xra_tlv_power_level
;
82 static int hf_xra_tlv_mer
;
83 static int hf_xra_tlv_subslot_id
;
84 static int hf_xra_tlv_control_word
;
86 static int hf_xra_unknown
;
88 /* Codeword Info TLV */
89 static int hf_xra_tlv_cw_info
;
90 static int hf_xra_tlv_cw_info_nr_of_info_bytes
;
91 static int hf_xra_tlv_cw_info_bch_decoding_successful
;
92 static int hf_xra_tlv_cw_info_profile_parity
;
93 static int hf_xra_tlv_cw_info_bch_number_of_corrected_bits
;
94 static int hf_xra_tlv_cw_info_ldpc_nr_of_code_bits
;
95 static int hf_xra_tlv_cw_info_ldpc_decoding_successful
;
96 static int hf_xra_tlv_cw_info_ldpc_number_of_corrected_bits
;
97 static int hf_xra_tlv_cw_info_ldpc_number_of_iterations
;
98 static int hf_xra_tlv_cw_info_rs_decoding_successful
;
99 static int hf_xra_tlv_cw_info_rs_number_of_corrected_symbols
;
102 static int hf_xra_tlv_burst_info_burst_id_reference
;
105 static int hf_plc_mb
;
108 static int hf_ncp_mb
;
109 static int hf_ncp_mb_profileid
;
110 static int hf_ncp_mb_z
;
111 static int hf_ncp_mb_c
;
112 static int hf_ncp_mb_n
;
113 static int hf_ncp_mb_l
;
114 static int hf_ncp_mb_t
;
115 static int hf_ncp_mb_u
;
116 static int hf_ncp_mb_r
;
117 static int hf_ncp_mb_subcarrier_start_pointer
;
118 static int hf_ncp_crc
;
120 /* Init Ranging Specific */
121 static int hf_xra_init_ranging_mac
;
122 static int hf_xra_init_ranging_ds_channel_id
;
123 static int hf_xra_init_ranging_crc
;
126 static int hf_plc_em_mb
;
127 static int hf_plc_trigger_mb
;
129 /* PLC Timestamp MB Specific */
130 static int hf_plc_mb_ts_reserved
;
131 static int hf_plc_mb_ts_timestamp
;
132 static int hf_plc_mb_ts_timestamp_epoch
;
133 static int hf_plc_mb_ts_timestamp_d30timestamp
;
134 static int hf_plc_mb_ts_timestamp_extra_204_8
;
135 static int hf_plc_mb_ts_timestamp_extra_204_8_X_16
;
136 static int hf_plc_mb_ts_timestamp_formatted
;
137 static int hf_plc_mb_ts_crc24d
;
139 /* PLC Message Channel MB Specific */
140 static int hf_plc_mb_mc_reserved
;
141 static int hf_plc_mb_mc_pspf_present
;
142 static int hf_plc_mb_mc_psp
;
145 static int hf_docsis_segment_pfi
;
146 static int hf_docsis_segment_reserved
;
147 static int hf_docsis_segment_pointerfield
;
148 static int hf_docsis_segment_sequencenumber
;
149 static int hf_docsis_segment_sidclusterid
;
150 static int hf_docsis_segment_request
;
151 static int hf_docsis_segment_hcs
;
152 static int hf_docsis_segment_hcs_status
;
153 static int hf_docsis_segment_data
;
155 static expert_field ei_docsis_segment_hcs_bad
;
157 static int dissect_xra(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, void* data _U_
);
158 static int dissect_xra_tlv(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, void* data _U_
, uint16_t tlvLength
, unsigned* segmentHeaderPresent
);
159 static int dissect_plc(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, void* data _U_
);
160 static int dissect_ncp(tvbuff_t
* tvb
, proto_tree
* tree
, void* data _U_
);
161 static int dissect_init_ranging(tvbuff_t
* tvb
, proto_tree
* tree
, void* data _U_
);
162 static int dissect_ofdma_segment(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, void* data _U_
);
164 #define XRA_DIRECTION_DOWNSTREAM 0
165 #define XRA_DIRECTION_UPSTREAM 1
167 #define XRA_PACKETTYPE_DS_SCQAM_DOCSIS_MACFRAME 1
168 #define XRA_PACKETTYPE_OFDM_DOCSIS 8
169 #define XRA_PACKETTYPE_OFDM_NCP 9
170 #define XRA_PACKETTYPE_OFDM_PLC 10
171 #define XRA_PACKETTYPE_OFDM_PLC_MMM 11
173 #define XRA_PACKETTYPE_TDMA_BURST 65
174 #define XRA_PACKETTYPE_OFDMA_DATA_BURST 72
175 #define XRA_PACKETTTYPE_OFDMA_INITIAL_RANGING 73
176 #define XRA_PACKETTTYPE_OFDMA_FINE_RANGING 74
177 #define XRA_PACKETTYPE_OFDMA_REQ 75
178 #define XRA_PACKETTYPE_OFDMA_PROBING_SEQUENCE 76
179 #define XRA_PACKETTYPE_US_DOCSIS_MACFRAME 80
182 #define XRA_DS_CHANNEL_ID 1
183 #define XRA_DS_FREQUENCY 2
184 #define XRA_MODULATION 3
186 #define XRA_PROFILE_ID 5
187 #define XRA_CODEWORD_INFO 6
188 #define XRA_NCP_TRUNC 7
189 #define XRA_NCP_SYMBOLID 8
191 #define XRA_US_CHANNEL_ID 10
194 #define XRA_BURST_ID 13
195 #define XRA_BURST_INFO 14
196 #define XRA_MINISLOT_INFO 15
197 #define XRA_UCD_CCC_PARITY 16
198 #define XRA_GRANT_SIZE 17
199 #define XRA_SEGMENT_HEADER_PRESENT 18
200 #define XRA_NUMBER_OFDMA_FRAMES 19
201 #define XRA_ESTIMATED_TIMING_ADJUST 20
202 #define XRA_ESTIMATED_POWER_LEVEL 21
203 #define XRA_SUBSLOT_ID 22
204 #define XRA_CONTROL_WORD 23
206 #define XRA_CONFIGURATION_INFO 254
207 #define XRA_EXTENSION_TYPE 255
209 /* Codeword Info Sub-TLVs */
210 #define XRA_TLV_CW_INFO_PROFILE_PARITY 1
211 #define XRA_TLV_CW_INFO_NR_OF_INFO_BYTES 2
212 #define XRA_TLV_CW_INFO_BCH_DECODING_SUCCESFUL 3
213 #define XRA_TLV_CW_INFO_BCH_NUMBER_OF_CORRECTED_BITS 4
214 #define XRA_TLV_CW_INFO_LDPC_NUMBER_OF_CODE_BITS 5
215 #define XRA_TLV_CW_INFO_LDPC_DECODING_SUCCESSFUL 6
216 #define XRA_TLV_CW_INFO_LDPC_NUMBER_OF_CORRECTED_BITS 7
217 #define XRA_TLV_CW_INFO_LDPC_NUMBER_OF_ITERATIONS 8
218 #define XRA_TLV_CW_INFO_RS_DECODING_SUCCESFUL 9
219 #define XRA_TLV_CW_INFO_RS_NUMBER_OF_CORRECTED_SYMBOLS 10
221 /* Burst Info Sub-TLV */
222 #define XRA_BURST_INFO_BURST_ID_REFERENCE 1
224 /* Minislot Info Sub-TLVs */
225 #define XRA_TLV_MINISLOT_INFO_START_MINISLOT_ID 1
226 #define XRA_TLV_MINISLOT_INFO_REL_START_MINISLOT 2
227 #define XRA_TLV_MINISLOT_INFO_REL_STOP_MINISLOT 3
229 /* PLC Message Block Types */
230 #define PLC_TIMESTAMP_MB 1
231 #define PLC_ENERGY_MANAGEMENT_MB 2
232 #define PLC_MESSAGE_CHANNEL_MB 3
233 #define PLC_TRIGGER_MB 4
235 static const value_string direction_vals
[] = {
236 {XRA_DIRECTION_DOWNSTREAM
, "Downstream"},
237 {XRA_DIRECTION_UPSTREAM
, "Upstream"},
241 static const value_string packettype
[] = {
242 {XRA_PACKETTYPE_DS_SCQAM_DOCSIS_MACFRAME
, "SC-QAM DOCSIS MAC Frame"},
243 {XRA_PACKETTYPE_OFDM_DOCSIS
, "OFDM DOCSIS"},
244 {XRA_PACKETTYPE_OFDM_NCP
, "OFDM NCP"},
245 {XRA_PACKETTYPE_OFDM_PLC
, "OFDM PLC"},
246 {XRA_PACKETTYPE_OFDM_PLC_MMM
, "OFDM PLC MMM"},
247 {XRA_PACKETTYPE_TDMA_BURST
, "TDMA Burst"},
248 {XRA_PACKETTYPE_OFDMA_DATA_BURST
, "OFDMA Data Burst"},
249 {XRA_PACKETTTYPE_OFDMA_INITIAL_RANGING
, "OFDMA Initial Ranging"},
250 {XRA_PACKETTTYPE_OFDMA_FINE_RANGING
, "OFDMA Fine Ranging"},
251 {XRA_PACKETTYPE_OFDMA_REQ
, "OFDMA REQ"},
252 {XRA_PACKETTYPE_OFDMA_PROBING_SEQUENCE
, "OFDMA Probing Sequence"},
253 {XRA_PACKETTYPE_US_DOCSIS_MACFRAME
, "US DOCSIS MAC Frame"},
257 static const value_string annex_vals
[] = {
263 static const value_string modulation_vals
[] = {
269 static const value_string profile_id
[] = {
289 static const value_string message_block_type
[] = {
290 {PLC_TIMESTAMP_MB
, "Timestamp Message Block"},
291 {PLC_ENERGY_MANAGEMENT_MB
, "Energy Management Message Block"},
292 {PLC_MESSAGE_CHANNEL_MB
, "Message Channel Message Block"},
293 {PLC_TRIGGER_MB
, "Trigger Message Block"},
297 static const true_false_string zero_bit_loading
= {
298 "subcarriers are all zero-bit-loaded",
299 "subcarriers follow profile"
302 static const true_false_string data_profile_update
= {
307 static const true_false_string ncp_profile_select
= {
312 static const true_false_string last_ncp_block
= {
313 "this is the last NCP in the chain and is followed by an NCP CRC message block",
314 "this NCP is followed by another NCP"
317 static const true_false_string codeword_tagging
= {
318 "this codeword is included in the codeword counts reported by the CM in the OPT-RSP message",
319 "this codeword is not included in the codeword counts reported by the CM in the OPT-RSP message"
322 static const value_string local_proto_checksum_vals
[] = {
323 { PROTO_CHECKSUM_E_BAD
, "Bad"},
324 { PROTO_CHECKSUM_E_GOOD
, "Good"},
328 static const value_string control_word_vals
[] = {
349 dissect_xra(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, void* data _U_
) {
351 proto_tree
*xra_tree
;
353 it
= proto_tree_add_protocol_format (tree
, proto_xra
, tvb
, 0, -1, "XRA");
355 xra_tree
= proto_item_add_subtree (it
, ett_xra
);
357 tvbuff_t
*docsis_tvb
;
360 tvbuff_t
*xra_tlv_tvb
;
361 tvbuff_t
*segment_tvb
;
362 tvbuff_t
*init_ranging_tvb
;
364 unsigned direction
, packet_type
, tlv_length
;
366 proto_tree_add_item (xra_tree
, hf_xra_version
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
367 proto_tree_add_item_ret_uint (xra_tree
, hf_xra_direction
, tvb
, 1, 1, ENC_BIG_ENDIAN
, &direction
);
368 proto_tree_add_item_ret_uint (xra_tree
, hf_xra_packettype
, tvb
, 1, 1, ENC_BIG_ENDIAN
, &packet_type
);
369 proto_tree_add_item_ret_uint (xra_tree
, hf_xra_tlvlength
, tvb
, 2, 2, ENC_BIG_ENDIAN
, &tlv_length
);
371 uint16_t xra_length
= 4 + tlv_length
;
372 proto_item_append_text(it
, " (Excentis XRA header: %d bytes). DOCSIS frame is %d bytes.", xra_length
, tvb_reported_length_remaining(tvb
, xra_length
));
373 proto_item_set_len(it
, xra_length
);
375 col_add_str(pinfo
->cinfo
, COL_INFO
, val_to_str(packet_type
, packettype
, "Unknown XRA Packet Type: %u"));
377 /* Dissecting TLVs */
378 unsigned segment_header_present
= 0;
379 xra_tlv_tvb
= tvb_new_subset_length(tvb
, 4, tlv_length
);
380 dissect_xra_tlv(xra_tlv_tvb
, pinfo
, xra_tree
, data
, tlv_length
, &segment_header_present
);
382 if(tvb_reported_length_remaining(tvb
, xra_length
) == 0) {
385 /* Dissecting contents */
386 switch(packet_type
) {
387 case XRA_PACKETTYPE_DS_SCQAM_DOCSIS_MACFRAME
:
388 case XRA_PACKETTYPE_OFDM_DOCSIS
:
389 case XRA_PACKETTYPE_OFDM_PLC_MMM
:
390 /* Calling DOCSIS dissector */
391 docsis_tvb
= tvb_new_subset_remaining(tvb
, xra_length
);
393 call_dissector (docsis_handle
, docsis_tvb
, pinfo
, tree
);
396 case XRA_PACKETTYPE_OFDM_PLC
:
397 plc_tvb
= tvb_new_subset_remaining(tvb
, xra_length
);
398 return dissect_plc(plc_tvb
, pinfo
, tree
, data
);
399 case XRA_PACKETTYPE_OFDM_NCP
:
400 ncp_tvb
= tvb_new_subset_remaining(tvb
, xra_length
);
401 return dissect_ncp(ncp_tvb
, tree
, data
);
402 case XRA_PACKETTYPE_TDMA_BURST
:
403 case XRA_PACKETTYPE_OFDMA_DATA_BURST
:
404 if(segment_header_present
) {
405 col_append_str(pinfo
->cinfo
, COL_INFO
, ": Segment");
406 segment_tvb
= tvb_new_subset_remaining(tvb
, xra_length
);
407 return dissect_ofdma_segment(segment_tvb
, pinfo
, tree
, data
);
410 case XRA_PACKETTYPE_OFDMA_REQ
:
411 case XRA_PACKETTYPE_US_DOCSIS_MACFRAME
:
412 /* Calling DOCSIS dissector */
413 docsis_tvb
= tvb_new_subset_remaining(tvb
, xra_length
);
415 call_dissector (docsis_handle
, docsis_tvb
, pinfo
, tree
);
418 case XRA_PACKETTTYPE_OFDMA_FINE_RANGING
:
419 /* Calling DOCSIS dissector */
420 docsis_tvb
= tvb_new_subset_remaining(tvb
, xra_length
);
422 call_dissector (docsis_handle
, docsis_tvb
, pinfo
, tree
);
425 case XRA_PACKETTTYPE_OFDMA_INITIAL_RANGING
:
426 init_ranging_tvb
= tvb_new_subset_remaining(tvb
, xra_length
);
427 return dissect_init_ranging(init_ranging_tvb
, tree
, data
);
429 proto_tree_add_item (xra_tree
, hf_xra_unknown
, tvb
, 1, 1, ENC_NA
);
433 return tvb_captured_length(tvb
);
437 dissect_xra_tlv_cw_info(tvbuff_t
* tvb
, proto_tree
* tree
, void* data _U_
, uint16_t tlv_length
) {
439 proto_tree
*xra_tlv_cw_info_tree
;
441 it
= proto_tree_add_item (tree
, hf_xra_tlv_cw_info
, tvb
, 0, tlv_length
, ENC_NA
);
442 xra_tlv_cw_info_tree
= proto_item_add_subtree (it
, ett_xra_tlv_cw_info
);
444 unsigned tlv_index
= 0;
445 while (tlv_index
< tlv_length
) {
446 uint8_t type
= tvb_get_uint8 (tvb
, tlv_index
);
448 uint8_t length
= tvb_get_uint8 (tvb
, tlv_index
);
451 case XRA_TLV_CW_INFO_NR_OF_INFO_BYTES
:
452 proto_tree_add_item (xra_tlv_cw_info_tree
, hf_xra_tlv_cw_info_nr_of_info_bytes
, tvb
, tlv_index
, length
, ENC_NA
);
454 case XRA_TLV_CW_INFO_BCH_DECODING_SUCCESFUL
:
455 proto_tree_add_item (xra_tlv_cw_info_tree
, hf_xra_tlv_cw_info_bch_decoding_successful
, tvb
, tlv_index
, length
, ENC_NA
);
457 case XRA_TLV_CW_INFO_PROFILE_PARITY
:
458 proto_tree_add_item (xra_tlv_cw_info_tree
, hf_xra_tlv_cw_info_profile_parity
, tvb
, tlv_index
, length
, ENC_NA
);
460 case XRA_TLV_CW_INFO_BCH_NUMBER_OF_CORRECTED_BITS
:
461 proto_tree_add_item (xra_tlv_cw_info_tree
, hf_xra_tlv_cw_info_bch_number_of_corrected_bits
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
463 case XRA_TLV_CW_INFO_LDPC_NUMBER_OF_CODE_BITS
:
464 proto_tree_add_item (xra_tlv_cw_info_tree
, hf_xra_tlv_cw_info_ldpc_nr_of_code_bits
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
466 case XRA_TLV_CW_INFO_LDPC_DECODING_SUCCESSFUL
:
467 proto_tree_add_item (xra_tlv_cw_info_tree
, hf_xra_tlv_cw_info_ldpc_decoding_successful
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
469 case XRA_TLV_CW_INFO_LDPC_NUMBER_OF_CORRECTED_BITS
:
470 proto_tree_add_item (xra_tlv_cw_info_tree
, hf_xra_tlv_cw_info_ldpc_number_of_corrected_bits
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
472 case XRA_TLV_CW_INFO_LDPC_NUMBER_OF_ITERATIONS
:
473 proto_tree_add_item (xra_tlv_cw_info_tree
, hf_xra_tlv_cw_info_ldpc_number_of_iterations
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
475 case XRA_TLV_CW_INFO_RS_DECODING_SUCCESFUL
:
476 proto_tree_add_item(xra_tlv_cw_info_tree
, hf_xra_tlv_cw_info_rs_decoding_successful
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
478 case XRA_TLV_CW_INFO_RS_NUMBER_OF_CORRECTED_SYMBOLS
:
479 proto_tree_add_item(xra_tlv_cw_info_tree
, hf_xra_tlv_cw_info_rs_number_of_corrected_symbols
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
482 proto_tree_add_item (xra_tlv_cw_info_tree
, hf_xra_unknown
, tvb
, tlv_index
, length
, ENC_NA
);
488 return tvb_captured_length(tvb
);
492 dissect_xra_tlv_ms_info(tvbuff_t
* tvb
, proto_tree
* tree
, void* data _U_
, uint16_t tlv_length
) {
494 proto_tree
*xra_tlv_ms_info_tree
;
496 it
= proto_tree_add_item (tree
, hf_xra_tlv_ms_info
, tvb
, 0, tlv_length
, ENC_NA
);
497 xra_tlv_ms_info_tree
= proto_item_add_subtree (it
, ett_xra_tlv_ms_info
);
499 unsigned tlv_index
= 0;
500 while (tlv_index
< tlv_length
) {
501 uint8_t type
= tvb_get_uint8 (tvb
, tlv_index
);
503 uint8_t length
= tvb_get_uint8 (tvb
, tlv_index
);
506 case XRA_TLV_MINISLOT_INFO_START_MINISLOT_ID
:
507 proto_tree_add_item (xra_tlv_ms_info_tree
, hf_xra_tlv_start_minislot_id_abs
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
509 case XRA_TLV_MINISLOT_INFO_REL_START_MINISLOT
:
510 proto_tree_add_item (xra_tlv_ms_info_tree
, hf_xra_tlv_start_minislot_id_rel
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
512 case XRA_TLV_MINISLOT_INFO_REL_STOP_MINISLOT
:
513 proto_tree_add_item (xra_tlv_ms_info_tree
, hf_xra_tlv_stop_minislot_id_rel
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
516 proto_tree_add_item (xra_tlv_ms_info_tree
, hf_xra_unknown
, tvb
, tlv_index
, length
, ENC_NA
);
522 return tvb_captured_length(tvb
);
526 dissect_xra_tlv_burst_info(tvbuff_t
* tvb
, proto_tree
* tree
, void* data _U_
, uint16_t tlv_length
) {
528 proto_tree
*xra_tlv_burst_info_tree
;
530 it
= proto_tree_add_item (tree
, hf_xra_tlv_burst_info
, tvb
, 0, tlv_length
, ENC_NA
);
531 xra_tlv_burst_info_tree
= proto_item_add_subtree (it
, ett_xra_tlv_burst_info
);
533 unsigned tlv_index
= 0;
534 while (tlv_index
< tlv_length
) {
535 uint8_t type
= tvb_get_uint8 (tvb
, tlv_index
);
537 uint8_t length
= tvb_get_uint8 (tvb
, tlv_index
);
540 case XRA_BURST_INFO_BURST_ID_REFERENCE
:
541 proto_tree_add_item (xra_tlv_burst_info_tree
, hf_xra_tlv_burst_info_burst_id_reference
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
543 case XRA_US_CHANNEL_ID
:
544 proto_tree_add_item (xra_tlv_burst_info_tree
, hf_xra_tlv_us_channel_id
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
547 proto_tree_add_item (xra_tlv_burst_info_tree
, hf_xra_tlv_sid
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
550 proto_tree_add_item (xra_tlv_burst_info_tree
, hf_xra_tlv_iuc
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
554 proto_tree_add_item (xra_tlv_burst_info_tree
, hf_xra_unknown
, tvb
, tlv_index
, length
, ENC_NA
);
560 return tvb_captured_length(tvb
);
564 dissect_xra_tlv(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, void* data _U_
, uint16_t tlv_length
, unsigned* segment_header_present
) {
566 proto_tree
*xra_tlv_tree
;
568 double mer
, power_level
;
570 it
= proto_tree_add_item (tree
, hf_xra_tlv
, tvb
, 0, tlv_length
, ENC_NA
);
571 xra_tlv_tree
= proto_item_add_subtree (it
, ett_xra_tlv
);
573 unsigned tlv_index
= 0;
574 tvbuff_t
*xra_tlv_cw_info_tvb
, *xra_tlv_ms_info_tvb
, *xra_tlv_burst_info_tvb
;
576 while (tlv_index
< tlv_length
) {
577 uint8_t type
= tvb_get_uint8 (tvb
, tlv_index
);
579 uint8_t length
= tvb_get_uint8 (tvb
, tlv_index
);
582 case XRA_DS_CHANNEL_ID
:
583 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_ds_channel_id
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
585 case XRA_DS_FREQUENCY
:
586 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_ds_channel_frequency
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
589 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_modulation
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
592 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_annex
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
595 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_profile_id
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
597 case XRA_CODEWORD_INFO
:
598 xra_tlv_cw_info_tvb
= tvb_new_subset_length(tvb
, tlv_index
, length
);
599 dissect_xra_tlv_cw_info(xra_tlv_cw_info_tvb
, xra_tlv_tree
, data
, length
);
602 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_ncp_trunc
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
604 case XRA_NCP_SYMBOLID
:
605 proto_tree_add_item_ret_uint (xra_tlv_tree
, hf_xra_tlv_ncp_symbolid
, tvb
, tlv_index
, length
, false, &symbol_id
);
606 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ": (Symbol ID: %u):", symbol_id
);
609 mer
= tvb_get_uint8(tvb
, tlv_index
)/4.0;
610 proto_tree_add_double_format_value(xra_tlv_tree
, hf_xra_tlv_mer
, tvb
, tlv_index
, length
, mer
, "%.2f dB", mer
);
612 case XRA_US_CHANNEL_ID
:
613 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_us_channel_id
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
616 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_sid
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
619 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_iuc
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
622 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_burstid
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
625 xra_tlv_burst_info_tvb
= tvb_new_subset_length(tvb
, tlv_index
, length
);
626 dissect_xra_tlv_burst_info(xra_tlv_burst_info_tvb
, xra_tlv_tree
, data
, length
);
628 case XRA_MINISLOT_INFO
:
629 xra_tlv_ms_info_tvb
= tvb_new_subset_length(tvb
, tlv_index
, length
);
630 dissect_xra_tlv_ms_info(xra_tlv_ms_info_tvb
, xra_tlv_tree
, data
, length
);
632 case XRA_UCD_CCC_PARITY
:
633 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_ucd_ccc_parity
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
636 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_grant_size
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
638 case XRA_SEGMENT_HEADER_PRESENT
:
639 proto_tree_add_item_ret_uint (xra_tlv_tree
, hf_xra_tlv_segment_header_present
, tvb
, tlv_index
, length
, false, segment_header_present
);
641 case XRA_NUMBER_OFDMA_FRAMES
:
642 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_ranging_number_ofdma_frames
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
644 case XRA_ESTIMATED_TIMING_ADJUST
:
645 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_ranging_timing_adjust
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
647 case XRA_ESTIMATED_POWER_LEVEL
:
648 power_level
= ((int16_t) (256*tvb_get_uint8(tvb
, tlv_index
) + tvb_get_uint8(tvb
, tlv_index
+1)) )/10.0;
649 proto_tree_add_double_format_value(xra_tlv_tree
, hf_xra_tlv_power_level
, tvb
, tlv_index
, length
, power_level
, "%.1f dBmV", power_level
);
652 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_subslot_id
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
654 case XRA_CONTROL_WORD
:
655 proto_tree_add_item (xra_tlv_tree
, hf_xra_tlv_control_word
, tvb
, tlv_index
, length
, ENC_BIG_ENDIAN
);
658 proto_tree_add_item (xra_tlv_tree
, hf_xra_unknown
, tvb
, tlv_index
, length
, ENC_NA
);
664 return tvb_captured_length(tvb
);
668 dissect_timestamp_mb(tvbuff_t
* tvb
, proto_tree
* tree
) {
670 uint64_t plc_timestamp
, plc_timestamp_ns
;
671 proto_item
* timestamp_it
;
672 proto_tree
* timestamp_tree
;
674 static int * const timestamp_parts
[] = {
675 &hf_plc_mb_ts_timestamp_epoch
,
676 &hf_plc_mb_ts_timestamp_d30timestamp
,
677 &hf_plc_mb_ts_timestamp_extra_204_8
,
678 &hf_plc_mb_ts_timestamp_extra_204_8_X_16
,
682 proto_tree_add_item (tree
, hf_plc_mb_ts_reserved
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
684 timestamp_it
= proto_tree_add_item_ret_uint64 (tree
, hf_plc_mb_ts_timestamp
, tvb
, 1, 8, ENC_BIG_ENDIAN
, &plc_timestamp
);
685 timestamp_tree
= proto_item_add_subtree (timestamp_it
, ett_plc_timestamp
);
687 /* See Figure 104 of CM-SP-MULPIv3.1-115-180509 */
688 proto_tree_add_bitmask_list(timestamp_tree
, tvb
, 1, 8, timestamp_parts
, ENC_BIG_ENDIAN
);
690 /* Timestamp calculation in ns. Beware of overflow of uint64_t. Splitting off timestamp in composing contributions
691 * Epoch (bits 63-41): 10.24 MHz/2^32 clock: *100000*2^22 ns
692 * D3.0 timestamp (bits 40-9): 204.8MHz/20 clock: 10.24MHz clock
693 * Bits 8-4: 204.8MHz clock
694 * Lowest 4 bits (bits 3-0): 16*204.8MHz clock
696 plc_timestamp_ns
= ((plc_timestamp
>>41)&0x7FFFFF)*100000*4194304 + ((plc_timestamp
>>9)&0xFFFFFFFF)*100000/1024 + ((plc_timestamp
>>4)&0x1F)*10000/2048 + (plc_timestamp
&0x0F)*10000/2048/16;
698 ts
.secs
= (time_t)(plc_timestamp_ns
/1000000000);
699 ts
.nsecs
=plc_timestamp_ns
%1000000000;
700 proto_tree_add_time(timestamp_tree
, hf_plc_mb_ts_timestamp_formatted
, tvb
, 1, 8, &ts
);
702 proto_tree_add_item (tree
, hf_plc_mb_ts_crc24d
, tvb
, 9, 3, ENC_NA
);
706 dissect_message_channel_mb(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, uint16_t remaining_length
) {
707 proto_tree_add_item (tree
, hf_plc_mb_mc_reserved
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
709 bool packet_start_pointer_field_present
;
710 unsigned packet_start_pointer
;
712 proto_tree_add_item_ret_boolean(tree
, hf_plc_mb_mc_pspf_present
, tvb
, 0, 1, false, &packet_start_pointer_field_present
);
714 /* If not present, this contains stuff from other packet. We can't do much in this case */
715 if(packet_start_pointer_field_present
) {
716 proto_tree_add_item_ret_uint (tree
, hf_plc_mb_mc_psp
, tvb
, 1, 2, false, &packet_start_pointer
);
718 unsigned docsis_start
= 3 + packet_start_pointer
;
719 while (docsis_start
+ 6 < remaining_length
) {
720 /* DOCSIS header in packet */
721 uint8_t fc
= tvb_get_uint8(tvb
,docsis_start
+ 0);
723 /* Skip fill bytes */
727 unsigned docsis_length
= 256*tvb_get_uint8(tvb
,docsis_start
+ 2) + tvb_get_uint8(tvb
,docsis_start
+ 3);
728 if (docsis_start
+ 6 + docsis_length
<= remaining_length
) {
729 /* DOCSIS packet included in packet */
730 tvbuff_t
*docsis_tvb
;
732 docsis_tvb
= tvb_new_subset_length(tvb
, docsis_start
, docsis_length
+ 6);
734 call_dissector (docsis_handle
, docsis_tvb
, pinfo
, tree
);
735 col_append_str(pinfo
->cinfo
, COL_INFO
, "; ");
736 col_set_fence(pinfo
->cinfo
,COL_INFO
);
739 docsis_start
+= 6 + docsis_length
;
745 dissect_message_block(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, uint8_t mb_type
, uint16_t mb_length
) {
746 proto_tree
* mb_tree
;
749 mb_item
= proto_tree_add_item (tree
, hf_plc_mb
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
751 mb_tree
= proto_item_add_subtree (mb_item
, ett_plc_mb
);
754 case PLC_TIMESTAMP_MB
:
755 dissect_timestamp_mb(tvb
, mb_tree
);
757 case PLC_ENERGY_MANAGEMENT_MB
:
758 proto_tree_add_item (mb_tree
, hf_plc_em_mb
, tvb
, 0, mb_length
, ENC_NA
);
760 case PLC_MESSAGE_CHANNEL_MB
:
761 dissect_message_channel_mb(tvb
, pinfo
, mb_tree
, mb_length
);
764 proto_tree_add_item (mb_tree
, hf_plc_trigger_mb
, tvb
, 0, mb_length
, ENC_NA
);
766 /* Future Use Message Block */
770 return tvb_captured_length(tvb
);
774 dissect_ncp_message_block(tvbuff_t
* tvb
, proto_tree
* tree
) {
775 proto_tree
* mb_tree
;
778 mb_item
= proto_tree_add_item (tree
, hf_ncp_mb
, tvb
, 0, 3, ENC_NA
);
779 mb_tree
= proto_item_add_subtree (mb_item
, ett_ncp_mb
);
781 proto_tree_add_item (mb_tree
, hf_ncp_mb_profileid
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
782 proto_tree_add_item (mb_tree
, hf_ncp_mb_z
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
783 proto_tree_add_item (mb_tree
, hf_ncp_mb_c
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
784 proto_tree_add_item (mb_tree
, hf_ncp_mb_n
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
785 proto_tree_add_item (mb_tree
, hf_ncp_mb_l
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
786 proto_tree_add_item (mb_tree
, hf_ncp_mb_t
, tvb
, 1, 1, ENC_BIG_ENDIAN
);
787 proto_tree_add_item (mb_tree
, hf_ncp_mb_u
, tvb
, 1, 1, ENC_BIG_ENDIAN
);
788 proto_tree_add_item (mb_tree
, hf_ncp_mb_r
, tvb
, 1, 1, ENC_BIG_ENDIAN
);
789 proto_tree_add_item (mb_tree
, hf_ncp_mb_subcarrier_start_pointer
, tvb
, 1, 2, ENC_BIG_ENDIAN
);
791 return tvb_captured_length(tvb
);
795 dissect_plc(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, void* data _U_
) {
798 proto_tree
*plc_tree
;
799 proto_item
*plc_item
;
802 plc_item
= proto_tree_add_protocol_format (tree
, proto_plc
, tvb
, 0, -1, "DOCSIS PLC");
803 plc_tree
= proto_item_add_subtree (plc_item
, ett_plc
);
805 while (tvb_reported_length_remaining(tvb
, offset
) > 0) {
806 uint8_t mb_type
= tvb_get_uint8 (tvb
, offset
) >>4;
807 uint8_t mb_nibble2
= tvb_get_uint8 (tvb
, offset
) & 0x0F;
808 uint8_t mb_byte2
= tvb_get_uint8 (tvb
, offset
+1);
811 /* Do not initialize with 0, otherwise an infinite loop results in case mbLength is not initialized. */
812 uint16_t mb_length
= 1000;
814 if(mb_type
== 0xFF) {
818 case PLC_TIMESTAMP_MB
:
820 /* Note that a Timestamp Message Block is mandatory and always comes first. */
821 col_append_str(pinfo
->cinfo
, COL_INFO
, ": TS-MB");
823 case PLC_ENERGY_MANAGEMENT_MB
:
824 mb_length
= 4 + mb_nibble2
*6;
825 col_append_str(pinfo
->cinfo
, COL_INFO
, ", EM-MB");
827 case PLC_MESSAGE_CHANNEL_MB
:
829 mb_length
= tvb_reported_length_remaining(tvb
, offset
);
830 col_append_str(pinfo
->cinfo
, COL_INFO
, ", MC-MB");
834 col_append_str(pinfo
->cinfo
, COL_INFO
, ", TR-MB");
836 /* Future Use Message Block */
838 mb_length
= 5 + 256*(mb_nibble2
&0x01) + mb_byte2
;
839 col_append_str(pinfo
->cinfo
, COL_INFO
, ", FUT-MB");
842 mb_tvb
= tvb_new_subset_remaining(tvb
, offset
);
843 dissect_message_block(mb_tvb
,pinfo
, plc_tree
, mb_type
, mb_length
);
852 return tvb_captured_length(tvb
);
856 dissect_ncp(tvbuff_t
* tvb
, proto_tree
* tree
, void* data _U_
) {
858 proto_tree
*ncp_tree
;
859 proto_item
*ncp_item
;
860 tvbuff_t
*ncp_mb_tvb
;
862 ncp_item
= proto_tree_add_protocol_format (tree
, proto_ncp
, tvb
, 0, -1, "DOCSIS NCP");
863 ncp_tree
= proto_item_add_subtree (ncp_item
, ett_ncp
);
865 while (tvb_captured_length_remaining(tvb
, offset
) > 3) {
866 ncp_mb_tvb
= tvb_new_subset_length(tvb
, offset
, 3);
867 dissect_ncp_message_block(ncp_mb_tvb
, ncp_tree
);
871 proto_tree_add_item (ncp_tree
, hf_ncp_crc
, tvb
, offset
, 3, ENC_NA
);
873 return tvb_captured_length(tvb
);
877 dissect_init_ranging(tvbuff_t
* tvb
, proto_tree
* tree
, void* data _U_
) {
879 proto_tree
*init_ranging_tree
;
880 proto_item
*init_ranging_item
;
882 init_ranging_item
= proto_tree_add_protocol_format (tree
, proto_init_ranging
, tvb
, 0, -1, "OFDMA Initial Ranging Request");
883 init_ranging_tree
= proto_item_add_subtree (init_ranging_item
, ett_init_ranging
);
885 proto_tree_add_item (init_ranging_tree
, hf_xra_init_ranging_mac
, tvb
, 0, 6, ENC_NA
);
886 proto_tree_add_item (init_ranging_tree
, hf_xra_init_ranging_ds_channel_id
, tvb
, 6, 1, ENC_BIG_ENDIAN
);
887 proto_tree_add_item (init_ranging_tree
, hf_xra_init_ranging_crc
, tvb
, 7, 3, ENC_NA
);
889 return tvb_captured_length(tvb
);
893 dissect_ofdma_segment(tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
, void* data _U_
) {
894 proto_tree
*segment_tree
;
895 proto_item
*segment_item
;
897 segment_item
= proto_tree_add_protocol_format (tree
, proto_segment
, tvb
, 0, -1, "DOCSIS Segment");
898 segment_tree
= proto_item_add_subtree (segment_item
, ett_plc
);
900 proto_tree_add_item (segment_tree
, hf_docsis_segment_pfi
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
901 proto_tree_add_item (segment_tree
, hf_docsis_segment_reserved
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
902 proto_tree_add_item (segment_tree
, hf_docsis_segment_pointerfield
, tvb
, 0, 2, ENC_BIG_ENDIAN
);
903 proto_tree_add_item (segment_tree
, hf_docsis_segment_sequencenumber
, tvb
, 2, 2, ENC_BIG_ENDIAN
);
904 proto_tree_add_item (segment_tree
, hf_docsis_segment_sidclusterid
, tvb
, 3, 1, ENC_BIG_ENDIAN
);
905 proto_tree_add_item (segment_tree
, hf_docsis_segment_request
, tvb
, 4, 2, ENC_BIG_ENDIAN
);
907 /* Dissect the header check sequence. */
908 /* CRC-CCITT(16+12+5+1). */
909 uint16_t fcs
= g_ntohs(crc16_ccitt_tvb(tvb
, 6));
910 proto_tree_add_checksum(segment_tree
, tvb
, 6, hf_docsis_segment_hcs
, hf_docsis_segment_hcs_status
, &ei_docsis_segment_hcs_bad
, pinfo
, fcs
, ENC_BIG_ENDIAN
, PROTO_CHECKSUM_VERIFY
);
912 proto_tree_add_item (segment_tree
, hf_docsis_segment_data
, tvb
, 8, tvb_reported_length_remaining(tvb
, 8), ENC_NA
);
914 return tvb_captured_length(tvb
);
918 proto_register_xra (void)
920 static hf_register_info hf
[] = {
922 {"Version", "xra.version",
923 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
924 "XRA Header Version", HFILL
}
927 {"Direction", "xra.direction",
928 FT_UINT8
, BASE_DEC
, VALS(direction_vals
), 0xC0,
932 {"Packet Type", "xra.packettype",
933 FT_UINT8
, BASE_DEC
, VALS(packettype
), 0x0,
937 {"TLV Length", "xra.tlvlength",
938 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
942 {"XRA TLV", "xra.tlv",
943 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
947 {&hf_xra_tlv_ds_channel_id
,
948 {"DS Channel ID", "xra.tlv.ds_channel_id",
949 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
952 {&hf_xra_tlv_ds_channel_frequency
,
953 {"DS Channel Frequency", "xra.tlv.ds_channel_frequency",
954 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
957 {&hf_xra_tlv_modulation
,
958 {"Modulation", "xra.tlv.modulation",
959 FT_UINT8
, BASE_DEC
, VALS(modulation_vals
), 0x0,
963 {"Annex", "xra.tlv.annex",
964 FT_UINT8
, BASE_DEC
, VALS(annex_vals
), 0x0,
967 {&hf_xra_tlv_us_channel_id
,
968 {"US Channel ID", "xra.tlv.us_channel_id",
969 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
972 {&hf_xra_tlv_profile_id
,
973 {"Profile", "xra.tlv.profile_id",
974 FT_UINT8
, BASE_DEC
, VALS(profile_id
), 0x0,
978 {"SID", "xra.tlv.sid",
979 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
983 {"IUC", "xra.tlv.iuc",
984 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
987 {&hf_xra_tlv_burstid
,
988 {"Burst ID", "xra.tlv.burstid",
989 FT_UINT64
, BASE_DEC
, NULL
, 0x0,
992 {&hf_xra_tlv_ms_info
,
993 {"Minislot Info", "xra.tlv.ms_info",
994 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
997 {&hf_xra_tlv_ucd_ccc_parity
,
998 {"UCD CCC Parity", "xra.tlv.ucd_ccc_parity",
999 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1002 {&hf_xra_tlv_grant_size
,
1003 {"Grant Size (bits)", "xra.tlv.grant_size",
1004 FT_UINT32
, BASE_DEC
, NULL
, 0x00FFFFFF,
1007 {&hf_xra_tlv_segment_header_present
,
1008 {"Segment Header Present", "xra.tlv.segment_header_present",
1009 FT_UINT8
, BASE_DEC
, NULL
,0x0,
1012 {&hf_xra_tlv_ncp_trunc
,
1013 {"Truncated due to Uncorrectables", "xra.tlv.ncp.trunc",
1014 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1017 {&hf_xra_tlv_ncp_symbolid
,
1018 {"Symbol ID", "xra.tlv.ncp.symbolid",
1019 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1022 {&hf_xra_tlv_start_minislot_id_abs
,
1023 {"Start Minislot ID (absolute)", "xra.tlv.ms_info.start_minislot_id_abs",
1024 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1027 {&hf_xra_tlv_start_minislot_id_rel
,
1028 {"Start Minislot ID (relative)", "xra.tlv.ms_info.start_minislot_id_rel",
1029 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1032 {&hf_xra_tlv_stop_minislot_id_rel
,
1033 {"Stop Minislot ID (relative)", "xra.tlv.ms_info.stop_minislot_id_rel",
1034 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1038 {&hf_xra_tlv_ranging_number_ofdma_frames
,
1039 {"Number of OFDMA Frames", "xra.tlv.ranging.number_ofdma_frames",
1040 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1043 {&hf_xra_tlv_ranging_timing_adjust
,
1044 {"Estimated Timing Adjust (in 1/204.8 "UTF8_MICRO_SIGN
"s units)", "xra.tlv.ranging.timing_adjust",
1045 FT_INT32
, BASE_DEC
, NULL
, 0x0,
1048 {&hf_xra_tlv_power_level
,
1049 {"Estimated Power Level", "xra.tlv.power_level",
1050 FT_DOUBLE
, BASE_NONE
, NULL
, 0x0,
1054 {"MER", "xra.tlv.mer",
1055 FT_DOUBLE
, BASE_NONE
, NULL
, 0x0,
1058 {&hf_xra_tlv_subslot_id
,
1059 {"Subslot ID", "xra.tlv.subslot_id",
1060 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1063 {&hf_xra_tlv_control_word
,
1064 {"Control Word", "xra.tlv.control_word",
1065 FT_UINT8
, BASE_DEC
, VALS(control_word_vals
), 0x0,
1069 {&hf_xra_tlv_cw_info
,
1070 {"Codeword Info", "xra.tlv.cw_info",
1071 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1074 {&hf_xra_tlv_cw_info_nr_of_info_bytes
,
1075 {"Number of Info Bytes", "xra.tlv.cw_info.nr_of_info_bytes",
1076 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1079 {&hf_xra_tlv_cw_info_bch_decoding_successful
,
1080 {"BCH Decoding Successful", "xra.tlv.cw_info.bch_decoding_successful",
1081 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1084 {&hf_xra_tlv_cw_info_profile_parity
,
1085 {"Codeword Parity", "xra.tlv.cw_info.profile_parity",
1086 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1089 {&hf_xra_tlv_cw_info_bch_number_of_corrected_bits
,
1090 {"BCH Number of Corrected Bits", "xra.tlv.cw_info.bch_number_of_corrected_bits",
1091 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1094 {&hf_xra_tlv_cw_info_ldpc_nr_of_code_bits
,
1095 {"Number of Code Bits", "xra.tlv.cw_info.ldpc_nr_of_code_bits",
1096 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1099 {&hf_xra_tlv_cw_info_ldpc_decoding_successful
,
1100 {"LDPC Decoding Successful", "xra.tlv.cw_info.ldpc_decoding_successful",
1101 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1104 {&hf_xra_tlv_cw_info_ldpc_number_of_iterations
,
1105 {"LDPC Number of Iterations", "xra.tlv.cw_info.ldpc_number_of_iterations",
1106 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1109 {&hf_xra_tlv_cw_info_ldpc_number_of_corrected_bits
,
1110 {"LDPC Number of Corrected Info Bits", "xra.tlv.cw_info.ldpc_number_of_corrected_bits",
1111 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1114 {&hf_xra_tlv_cw_info_rs_decoding_successful
,
1115 {"Reed-Solomon Decoding Successful", "xra.tlv.cw_info.rs_decoding_successful",
1116 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
1119 {&hf_xra_tlv_cw_info_rs_number_of_corrected_symbols
,
1120 {"Reed-Solomon Number of Corrected Symbols", "xra.tlv.cw_info.rs_number_of_corrected_symbols",
1121 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1125 {"Unknown", "xra.unknown",
1126 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1130 {&hf_xra_tlv_burst_info
,
1131 {"Burst Info", "xra.tlv.burst_info",
1132 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1135 {&hf_xra_tlv_burst_info_burst_id_reference
,
1136 {"Burst ID Reference", "xra.tlv.burst_info.burst_id_reference",
1137 FT_UINT64
, BASE_DEC
, NULL
, 0x0,
1142 {"PLC Message Block", "docsis_plc.mb_type",
1143 FT_UINT8
, BASE_DEC
,VALS(message_block_type
) , 0xF0,
1148 {"NCP Message Block", "docsis_ncp.mb",
1149 FT_BYTES
, BASE_NONE
,NULL
, 0x0,
1152 {&hf_ncp_mb_profileid
,
1153 {"NCP MB Profile ID", "docsis_ncp.mb.profileid",
1154 FT_UINT8
, BASE_DEC
,NULL
, 0xF0,
1158 {"NCP MB Zero Bit-Loading", "docsis_ncp.mb.z",
1159 FT_BOOLEAN
, 8, TFS(&zero_bit_loading
) , 0x08,
1163 {"NCP MB Data Profile Update", "docsis_ncp.mb.c",
1164 FT_BOOLEAN
, 8, TFS(&data_profile_update
) , 0x04,
1168 {"NCP MB NCP Profile Selected", "docsis_ncp.mb.n",
1169 FT_BOOLEAN
, 8, TFS(&ncp_profile_select
) , 0x02,
1173 {"NCP MB Last NCP Block", "docsis_ncp.mb.l",
1174 FT_BOOLEAN
, 8, TFS(&last_ncp_block
) , 0x01,
1178 {"NCP MB Codeword Tagging", "docsis_ncp.mb.t",
1179 FT_BOOLEAN
, 8, TFS(&codeword_tagging
) , 0x80,
1183 {"NCP MB NCP Profile Update Indicator", "docsis_ncp.mb.u",
1184 FT_BOOLEAN
, 8, NULL
, 0x40,
1188 {"NCP MB Reserved", "docsis_ncp.mb.r",
1189 FT_BOOLEAN
, 8, NULL
, 0x20,
1192 {&hf_ncp_mb_subcarrier_start_pointer
,
1193 {"NCP MB Subcarrier Start Pointer", "docsis_ncp.mb.subcarrier_start_pointer",
1194 FT_UINT16
, BASE_DEC
, NULL
, 0x1FFF,
1198 {"NCP CRC", "docsis_ncp.crc",
1199 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1202 /* Init Ranging Specific */
1203 {&hf_xra_init_ranging_mac
,
1204 {"MAC Address", "xra.init_ranging.mac",
1205 FT_ETHER
, BASE_NONE
, NULL
, 0x0,
1208 {&hf_xra_init_ranging_ds_channel_id
,
1209 {"DS Channel ID", "xra.init_ranging.ds_channel_id",
1210 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
1213 {&hf_xra_init_ranging_crc
,
1214 {"CRC", "xra.init_ranging.crc",
1215 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1220 {"PLC EM MB", "docsis_plc.em_mb",
1221 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1224 {&hf_plc_trigger_mb
,
1225 {"PLC Trigger MB", "docsis_plc.trigger_mb",
1226 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1230 {&hf_plc_mb_ts_reserved
,
1231 {"Reserved", "docsis_plc.mb_ts_reserved",
1232 FT_UINT8
, BASE_DEC
,0 , 0x0F,
1235 {&hf_plc_mb_ts_timestamp
,
1236 {"Timestamp", "docsis_plc.mb_ts_timestamp",
1237 FT_UINT64
, BASE_DEC
,0 , 0x0,
1240 {&hf_plc_mb_ts_timestamp_epoch
,
1241 {"Timestamp Epoch", "docsis_plc.mb_ts_timestamp_epoch",
1242 FT_UINT64
, BASE_HEX
,0 , 0xFFFFFE0000000000,
1245 {&hf_plc_mb_ts_timestamp_d30timestamp
,
1246 {"D3.0 Timestamp", "docsis_plc.mb_ts_timestamp_d30timestamp",
1247 FT_UINT64
, BASE_HEX
,0 , 0x000001FFFFFFFE00,
1250 {&hf_plc_mb_ts_timestamp_extra_204_8
,
1251 {"Timestamp: Extra 204.8MHz Samples", "docsis_plc.mb_ts_timestamp_extra_204_8",
1252 FT_UINT64
, BASE_DEC
,0 , 0x00000000000001F0,
1255 {&hf_plc_mb_ts_timestamp_extra_204_8_X_16
,
1256 {"Timestamp: Extra 16 x 204.8MHz Samples", "docsis_plc.mb_ts_timestamp_extra_204_8_X_16",
1257 FT_UINT64
, BASE_DEC
, 0 , 0x000000000000000F,
1260 {&hf_plc_mb_ts_timestamp_formatted
,
1261 {"Formatted PLC Timestamp", "docsis_plc.mb_ts_timestamp_formatted",
1262 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0,
1265 {&hf_plc_mb_ts_crc24d
,
1266 {"CRC-24-D", "docsis_plc.mb_ts_crc24d",
1267 FT_BYTES
, BASE_NONE
, 0 , 0x0,
1270 /* Message Channel MB */
1271 {&hf_plc_mb_mc_reserved
,
1272 {"Reserved", "docsis_plc.mb_mc_reserved",
1273 FT_UINT8
, BASE_DEC
,0 , 0x0E,
1276 {&hf_plc_mb_mc_pspf_present
,
1277 {"Packet Start Pointer Field", "docsis_plc.mb_mc_pspf_present",
1278 FT_BOOLEAN
, 8, TFS(&tfs_present_not_present
), 0x01,
1282 {"Packet Start Pointer", "docsis_plc.mb_mc_psp",
1283 FT_UINT16
, BASE_DEC
, 0 , 0x0,
1286 /* DOCSIS Segment */
1287 {&hf_docsis_segment_pfi
,
1288 {"Pointer Field Indicator", "docsis_segment.pfi",
1289 FT_UINT8
, BASE_DEC
, NULL
, 0x80,
1292 {&hf_docsis_segment_reserved
,
1293 {"Reserved", "docsis_segment.reserved",
1294 FT_UINT8
, BASE_DEC
, NULL
, 0x40,
1297 {&hf_docsis_segment_pointerfield
,
1298 {"Pointer Field", "docsis_segment.pointerfield",
1299 FT_UINT16
, BASE_DEC
, NULL
, 0x3FFF,
1302 {&hf_docsis_segment_sequencenumber
,
1303 {"Sequence Number", "docsis_segment.sequencenumber",
1304 FT_UINT16
, BASE_DEC
, NULL
, 0xFFF8,
1307 {&hf_docsis_segment_sidclusterid
,
1308 {"SID Cluster ID", "docsis_segment.sidclusterid",
1309 FT_UINT8
, BASE_DEC
, NULL
, 0x07,
1312 {&hf_docsis_segment_request
,
1313 {"Request (N bytes)", "docsis_segment.request",
1314 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1317 {&hf_docsis_segment_hcs
,
1318 {"HCS", "docsis_segment.hcs",
1319 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
1322 { &hf_docsis_segment_hcs_status
,
1323 { "Segment HCS Status", "docsis_segment.hcs.status",
1324 FT_UINT8
, BASE_NONE
, VALS(local_proto_checksum_vals
), 0x0,
1327 {&hf_docsis_segment_data
,
1328 {"Data", "docsis_segment.data",
1329 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1334 static ei_register_info ei
[] = {
1335 { &ei_docsis_segment_hcs_bad
, { "docsis_segment.hcs_bad", PI_CHECKSUM
, PI_ERROR
, "Bad Checksum", EXPFILL
}},
1338 /* Setup protocol subtree array */
1339 static int *ett
[] = {
1342 &ett_xra_tlv_cw_info
,
1343 &ett_xra_tlv_ms_info
,
1344 &ett_xra_tlv_burst_info
,
1353 expert_module_t
* expert_xra
;
1355 /* Register the protocol name and description */
1356 proto_xra
= proto_register_protocol ("Excentis XRA Header", "XRA", "xra");
1357 proto_segment
= proto_register_protocol("DOCSIS Segment", "DOCSIS Segment", "docsis_segment");
1358 proto_plc
= proto_register_protocol("DOCSIS PHY Link Channel", "DOCSIS PLC", "docsis_plc");
1359 proto_ncp
= proto_register_protocol("DOCSIS_NCP", "DOCSIS_NCP", "docsis_ncp");
1360 proto_init_ranging
= proto_register_protocol("DOCSIS_INIT_RANGING", "DOCSIS_INIT_RANGING", "docsis_init_ranging");
1362 /* Register expert notifications */
1363 expert_xra
= expert_register_protocol(proto_xra
);
1364 expert_register_field_array(expert_xra
, ei
, array_length(ei
));
1366 /* Required function calls to register the header fields and subtrees used */
1367 proto_register_field_array (proto_xra
, hf
, array_length (hf
));
1368 proto_register_subtree_array (ett
, array_length (ett
));
1370 xra_handle
= register_dissector ("xra", dissect_xra
, proto_xra
);
1375 proto_reg_handoff_xra(void)
1377 docsis_handle
= find_dissector ("docsis");
1379 dissector_add_uint("wtap_encap", WTAP_ENCAP_DOCSIS31_XRA31
, xra_handle
);
1383 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1388 * indent-tabs-mode: nil
1391 * ex: set shiftwidth=2 tabstop=8 expandtab:
1392 * :indentSize=2:tabSize=8:noTabs=true: