checkAPIs.pl: support for new-style dissectors in check_hf_entries
[metze/wireshark/wip.git] / epan / dissectors / packet-docsis-macmgmt.c
1 /* packet-macmgmt.c
2  * Routines for docsis Mac Management Header dissection
3  * Routines for Upstream Channel Change dissection
4  * Routines for Ranging Message dissection
5  * Routines for Registration Message dissection
6  * Routines for Baseline Privacy Key Management Message dissection
7  * Routines for Dynamic Service Addition Message dissection
8  * Routines for Dynamic Service Change Request dissection
9  * Copyright 2002, Anand V. Narwani <anand[AT]narwani.org>
10  *
11  * Routines for Type 2 UCD Message dissection
12  * Copyright 2015, Adrian Simionov <daniel.simionov@gmail.com>
13  * Copyright 2002, Anand V. Narwani <anand[AT]narwani.org>
14  *
15  * Routines for Sync Message dissection
16  * Routines for REG-REQ-MP dissection
17  * Copyright 2007, Bruno Verstuyft  <bruno.verstuyft@excentis.com>
18  *
19  * Routines for DOCSIS 3.1 OFDM Channel Descriptor dissection.
20  * Routines for DOCSIS 3.1 Downstream Profile Descriptor dissection.
21  * Routines for Type 51 UCD - DOCSIS 3.1 only - Message dissection
22  * Copyright 2016, Bruno Verstuyft <bruno.verstuyft@excentis.com>
23  *
24  * Routines for DCC Message dissection
25  * Routines for DCD Message dissection
26  * Copyright 2004, Darryl Hymel <darryl.hymel[AT]arrisi.com>
27  *
28  * Routines for Type 29 UCD - DOCSIS 2.0 only - Message dissection
29  * Copyright 2015, Adrian Simionov <daniel.simionov@gmail.com>
30  * Copyright 2003, Brian Wheeler <brian.wheeler[AT]arrisi.com>
31  *
32  * Routines for Intial Ranging Request Message dissection
33  * Copyright 2003, Brian Wheeler <brian.wheeler[AT]arrisi.com>
34  *
35  * Routines for Baseline Privacy Key Management Attributes dissection
36  * Copyright 2017, Adrian Simionov <daniel.simionov@gmail.com>
37  * Copyright 2002, Anand V. Narwani <anand[AT]narwani.org>
38  *
39  * Routines for MDD Message dissection
40  * Copyright 2014, Adrian Simionov <adrian.simionov@arrisi.com>
41  * Copyright 2007, Bruno Verstuyft <bruno.verstuyft@excentis.com>
42  *
43  * Routines for DOCSIS 3.0 Bonded Intial Ranging Request Message dissection.
44  * Copyright 2009, Geoffrey Kimball <gekimbal[AT]cisco.com>
45  *
46  * Routines for Type 35 UCD - DOCSIS 3.0 only - Message dissection
47  * Copyright 2015, Adrian Simionov <daniel.simionov@gmail.com>
48  *
49  * Routines for DOCSIS 3.0 Dynamic Bonding Change Message dissection.
50  * Routines for DOCSIS 3.0 DOCSIS Path Verify Message dissection.
51  * Routines for DOCSIS 3.0 CM Control Message dissection.
52  * Copyright 2010, Guido Reismueller <g.reismueller[AT]avm.de>
53  *
54  * Wireshark - Network traffic analyzer
55  * By Gerald Combs <gerald@wireshark.org>
56  * Copyright 1998 Gerald Combs
57  *
58  * SPDX-License-Identifier: GPL-2.0-or-later
59  */
60
61 #include "config.h"
62
63 #include <epan/packet.h>
64 #include <epan/expert.h>
65 #include <wsutil/utf8_entities.h>
66 #include "packet-docsis-tlv.h"
67 #include <epan/reassemble.h>
68
69 void proto_register_docsis_mgmt(void);
70 void proto_reg_handoff_docsis_mgmt(void);
71
72 #define MGT_SYNC 1
73 #define MGT_UCD 2
74 #define MGT_MAP 3
75 #define MGT_RNG_REQ 4
76 #define MGT_RNG_RSP 5
77 #define MGT_REG_REQ 6
78 #define MGT_REG_RSP 7
79 #define MGT_UCC_REQ 8
80 #define MGT_UCC_RSP 9
81 #define MGT_TRI_TCD 10
82 #define MGT_TRI_TSI 11
83 #define MGT_BPKM_REQ 12
84 #define MGT_BPKM_RSP 13
85 #define MGT_REG_ACK 14
86 #define MGT_DSA_REQ 15
87 #define MGT_DSA_RSP 16
88 #define MGT_DSA_ACK 17
89 #define MGT_DSC_REQ 18
90 #define MGT_DSC_RSP 19
91 #define MGT_DSC_ACK 20
92 #define MGT_DSD_REQ 21
93 #define MGT_DSD_RSP 22
94 #define MGT_DCC_REQ 23
95 #define MGT_DCC_RSP 24
96 #define MGT_DCC_ACK 25
97 #define MGT_DCI_REQ 26
98 #define MGT_DCI_RSP 27
99 #define MGT_UP_DIS 28
100 #define MGT_TYPE29UCD 29
101 #define MGT_INIT_RNG_REQ 30
102 #define MGT_TEST_REQ 31
103 #define MGT_DS_CH_DESC 32
104 #define MGT_MDD 33
105 #define MGT_B_INIT_RNG_REQ 34
106 #define MGT_TYPE35UCD 35
107 #define MGT_DBC_REQ 36
108 #define MGT_DBC_RSP 37
109 #define MGT_DBC_ACK 38
110 #define MGT_DPV_REQ 39
111 #define MGT_DPV_RSP 40
112 #define MGT_CM_STATUS 41
113 #define MGT_CM_CTRL_REQ 42
114 #define MGT_CM_CTRL_RSP 43
115 #define MGT_REG_REQ_MP 44
116 #define MGT_REG_RSP_MP 45
117 #define MGT_EM_REQ 46
118 #define MGT_EM_RSP 47
119 #define MGT_CM_STATUS_ACK 48
120 #define MGT_OCD 49
121 #define MGT_DPD 50
122 #define MGT_TYPE51UCD 51
123 #define MGT_ODS_REQ 52
124 #define MGT_ODS_RSP 53
125 #define MGT_OPT_REQ 54
126 #define MGT_OPT_RSP 55
127 #define MGT_OPT_ACK 56
128 #define MGT_DPT_REQ 57
129 #define MGT_DPT_RSP 58
130 #define MGT_DPT_ACK 59
131 #define MGT_DPT_INFO 60
132
133 #define UCD_SYMBOL_RATE 1
134 #define UCD_FREQUENCY 2
135 #define UCD_PREAMBLE 3
136 #define UCD_BURST_DESCR 4
137 #define UCD_BURST_DESCR5 5
138 #define UCD_EXT_PREAMBLE 6
139 #define UCD_SCDMA_MODE_ENABLED 7
140 #define UCD_SCDMA_SPREADING_INTERVAL 8
141 #define UCD_SCDMA_CODES_PER_MINI_SLOT 9
142 #define UCD_SCDMA_ACTIVE_CODES 10
143 #define UCD_SCDMA_CODE_HOPPING_SEED 11
144 #define UCD_SCDMA_US_RATIO_NUM 12
145 #define UCD_SCDMA_US_RATIO_DENOM 13
146 #define UCD_SCDMA_TIMESTAMP_SNAPSHOT 14
147 #define UCD_MAINTAIN_POWER_SPECTRAL_DENSITY 15
148 #define UCD_RANGING_REQUIRED 16
149 #define UCD_MAX_SCHEDULED_CODES 17
150 #define UCD_RANGING_HOLD_OFF_PRIORITY_FIELD 18
151 #define UCD_RANGING_CHANNEL_CLASS_ID 19
152 #define UCD_SCDMA_SELECTION_ACTIVE_CODES_AND_CODE_HOPPING 20
153 #define UCD_SCDMA_SELECTION_STRING_FOR_ACTIVE_CODES 21
154 #define UCD_HIGHER_UCD_FOR_SAME_UCID 22
155 #define UCD_BURST_DESCR23 23
156 #define UCD_CHANGE_IND_BITMASK 24
157 #define UCD_OFDMA_TIMESTAMP_SNAPSHOT 25
158 #define UCD_OFDMA_CYCLIC_PREFIX_SIZE 26
159 #define UCD_OFDMA_ROLLOFF_PERIOD_SIZE 27
160 #define UCD_SUBCARRIER_SPACING 28
161 #define UCD_CENTER_FREQ_SUBC_0 29
162 #define UCD_SUBC_EXCL_BAND 30
163 #define UCD_UNUSED_SUBC_SPEC 31
164 #define UCD_SYMB_IN_OFDMA_FRAME 32
165 #define UCD_RAND_SEED 33
166
167 #define UCD_MODULATION 1
168 #define UCD_DIFF_ENCODING 2
169 #define UCD_PREAMBLE_LEN 3
170 #define UCD_PREAMBLE_VAL_OFF 4
171 #define UCD_FEC 5
172 #define UCD_FEC_CODEWORD 6
173 #define UCD_SCRAMBLER_SEED 7
174 #define UCD_MAX_BURST 8
175 #define UCD_GUARD_TIME 9
176 #define UCD_LAST_CW_LEN 10
177 #define UCD_SCRAMBLER_ONOFF 11
178 #define UCD_RS_INT_DEPTH 12
179 #define UCD_RS_INT_BLOCK 13
180 #define UCD_PREAMBLE_TYPE 14
181 #define UCD_SCMDA_SCRAMBLER_ONOFF 15
182 #define UCD_SCDMA_CODES_PER_SUBFRAME 16
183 #define UCD_SCDMA_FRAMER_INT_STEP_SIZE 17
184 #define UCD_TCM_ENABLED 18
185 #define UCD_SUBC_INIT_RANG 19
186 #define UCD_SUBC_FINE_RANG 20
187 #define UCD_OFDMA_PROFILE 21
188 #define UCD_OFDMA_IR_POWER_CONTROL 22
189
190 #define IUC_REQUEST 1
191 #define IUC_REQ_DATA 2
192 #define IUC_INIT_MAINT 3
193 #define IUC_STATION_MAINT 4
194 #define IUC_SHORT_DATA_GRANT 5
195 #define IUC_LONG_DATA_GRANT 6
196 #define IUC_NULL_IE 7
197 #define IUC_DATA_ACK 8
198 #define IUC_ADV_PHY_SHORT_DATA_GRANT 9
199 #define IUC_ADV_PHY_LONG_DATA_GRANT 10
200 #define IUC_ADV_PHY_UGS 11
201 #define IUC_DATA_PROFILE_IUC12 12
202 #define IUC_DATA_PROFILE_IUC13 13
203 #define IUC_RESERVED14 14
204 #define IUC_EXPANSION 15
205
206 #define MAP_v1 1
207 #define MAP_v5 5
208
209 #define RNGRSP_TIMING 1
210 #define RNGRSP_PWR_LEVEL_ADJ 2
211 #define RNGRSP_OFFSET_FREQ_ADJ 3
212 #define RNGRSP_TRANSMIT_EQ_ADJ 4
213 #define RNGRSP_RANGING_STATUS 5
214 #define RNGRSP_DOWN_FREQ_OVER 6
215 #define RNGRSP_UP_CHID_OVER 7
216 #define RNGRSP_T4_TIMEOUT_MULTIPLIER 13
217 #define RNGRSP_DYNAMIC_RANGE_WINDOW_UPPER_EDGE 14
218 #define RNGRSP_TRANSMIT_EQ_ADJUST_OFDMA_CHANNELS 15
219 #define RNGRSP_TRANSMIT_EQ_SET_OFDMA_CHANNELS 16
220 #define RNGRSP_COMMANDED_POWER 17
221
222 /* Commanded Power Sub TLVs*/
223 #define RNGRSP_COMMANDED_POWER_DYNAMIC_RANGE_WINDOW 1
224 #define RNGRSP_COMMANDED_POWER_UCID_AND_POWER_LEVEL_LIST 2
225
226
227
228 /* BPKM Attributes defined in:
229  * http://www.cablemodem.com/downloads/specs/SP-BPI+_I10-030730.pdf
230  */
231 #define BPKM_RESERVED 0
232 #define BPKM_SERIAL_NUM 1
233 #define BPKM_MANUFACTURER_ID 2
234 #define BPKM_MAC_ADDR 3
235 #define BPKM_RSA_PUB_KEY 4
236 #define BPKM_CM_ID 5
237 #define BPKM_DISPLAY_STR 6
238 #define BPKM_AUTH_KEY 7
239 #define BPKM_TEK 8
240 #define BPKM_KEY_LIFETIME 9
241 #define BPKM_KEY_SEQ_NUM 10
242 #define BPKM_HMAC_DIGEST 11
243 #define BPKM_SAID 12
244 #define BPKM_TEK_PARAM 13
245 #define BPKM_OBSOLETED 14
246 #define BPKM_CBC_IV 15
247 #define BPKM_ERROR_CODE 16
248 #define BPKM_CA_CERT 17
249 #define BPKM_CM_CERT 18
250 #define BPKM_SEC_CAPABILITIES 19
251 #define BPKM_CRYPTO_SUITE 20
252 #define BPKM_CRYPTO_SUITE_LIST 21
253 #define BPKM_BPI_VERSION 22
254 #define BPKM_SA_DESCRIPTOR 23
255 #define BPKM_SA_TYPE 24
256 #define BPKM_SA_QUERY 25
257 #define BPKM_SA_QUERY_TYPE 26
258 #define BPKM_IP_ADDRESS 27
259 #define BPKM_DNLD_PARAMS 28
260 #define BPKM_VENDOR_DEFINED 127
261
262 #define DCCREQ_UP_CHAN_ID 1
263 #define DCCREQ_DS_PARAMS 2
264 #define DCCREQ_INIT_TECH 3
265 #define DCCREQ_UCD_SUB 4
266 #define DCCREQ_SAID_SUB 6
267 #define DCCREQ_SF_SUB 7
268 #define DCCREQ_CMTS_MAC_ADDR 8
269 #define DCCREQ_KEY_SEQ_NUM 31
270 #define DCCREQ_HMAC_DIGEST 27
271
272 /* Define Downstrean Parameters subtypes
273  * These are subtype of DCCREQ_DS_PARAMS (2)
274  */
275
276 #define DCCREQ_DS_FREQ 1
277 #define DCCREQ_DS_MOD_TYPE 2
278 #define DCCREQ_DS_SYM_RATE 3
279 #define DCCREQ_DS_INTLV_DEPTH 4
280 #define DCCREQ_DS_CHAN_ID 5
281 #define DCCREQ_DS_SYNC_SUB 6
282 #define DCCREQ_DS_OFDM_BLOCK_FREQ 7
283
284 /* Define Service Flow Substitution subtypes
285  * These are subtypes of DCCREQ_SF_SUB (7)
286  */
287 #define DCCREQ_SF_SFID 1
288 #define DCCREQ_SF_SID 2
289 #define DCCREQ_SF_UNSOL_GRANT_TREF 5
290
291 #define DCCRSP_CM_JUMP_TIME 1
292 #define DCCRSP_KEY_SEQ_NUM 31
293 #define DCCRSP_HMAC_DIGEST 27
294
295 /* Define DCC-RSP CM Jump Time subtypes
296  * These are subtype of DCCRSP_CM_JUMP_TIME (1)
297  */
298 #define DCCRSP_CM_JUMP_TIME_LENGTH 1
299 #define DCCRSP_CM_JUMP_TIME_START 2
300
301 #define DCCACK_KEY_SEQ_NUM 31
302 #define DCCACK_HMAC_DIGEST 27
303
304 #define DCD_DOWN_CLASSIFIER 23
305 #define DCD_DSG_RULE 50
306 #define DCD_DSG_CONFIG 51
307
308 /* Define Downstrean Classifier subtypes
309  * These are subtype of DCD_DOWN_CLASSIFIER (23)
310  */
311
312 #define DCD_CFR_ID 2
313 #define DCD_CFR_RULE_PRI 5
314 #define DCD_CFR_IP_CLASSIFIER 9
315
316 /* Define IP Classifier sub-subtypes
317  * These are subtypes of DCD_CFR_IP_CLASSIFIER (23.9)
318  */
319 #define DCD_CFR_IP_SOURCE_ADDR 3
320 #define DCD_CFR_IP_SOURCE_MASK 4
321 #define DCD_CFR_IP_DEST_ADDR 5
322 #define DCD_CFR_IP_DEST_MASK 6
323 #define DCD_CFR_TCPUDP_SRCPORT_START 7
324 #define DCD_CFR_TCPUDP_SRCPORT_END 8
325 #define DCD_CFR_TCPUDP_DSTPORT_START 9
326 #define DCD_CFR_TCPUDP_DSTPORT_END 10
327
328 /* Define DSG Rule subtypes
329  * These are subtype of DCD_DSG_RULE (50)
330  */
331
332 #define DCD_RULE_ID 1
333 #define DCD_RULE_PRI 2
334 #define DCD_RULE_UCID_RNG 3
335 #define DCD_RULE_CLIENT_ID 4
336 #define DCD_RULE_TUNL_ADDR 5
337 #define DCD_RULE_CFR_ID 6
338 #define DCD_RULE_VENDOR_SPEC 43
339 /* Define DSG Rule Client ID sub-subtypes
340  * These are subtypes of DCD_RULE_CLIENT_ID (50.4)
341  */
342 #define DCD_CLID_BCAST_ID 1
343 #define DCD_CLID_KNOWN_MAC_ADDR 2
344 #define DCD_CLID_CA_SYS_ID 3
345 #define DCD_CLID_APP_ID 4
346
347 /* Define DSG Configuration subtypes
348  * These are subtype of DCD_DSG_CONFIG (51)
349  */
350
351 #define DCD_CFG_CHAN_LST 1
352 #define DCD_CFG_TDSG1 2
353 #define DCD_CFG_TDSG2 3
354 #define DCD_CFG_TDSG3 4
355 #define DCD_CFG_TDSG4 5
356 #define DCD_CFG_VENDOR_SPEC 43
357
358 #define DOWNSTREAM_ACTIVE_CHANNEL_LIST 1
359 #define MAC_DOMAIN_DOWNSTREAM_SERVICE_GROUP 2
360 #define DOWNSTREAM_AMBIGUITY_RESOLUTION_FREQUENCY_LIST 3
361 #define RECEIVE_CHANNEL_PROFILE_REPORTING_CONTROL 4
362 #define IP_INITIALIZATION_PARAMETERS 5
363 #define EARLY_AUTHENTICATION_AND_ENCRYPTION 6
364 #define UPSTREAM_ACTIVE_CHANNEL_LIST 7
365 #define UPSTREAM_AMBIGUITY_RESOLUTION_CHANNEL_LIST 8
366 #define UPSTREAM_FREQUENCY_RANGE 9
367 #define SYMBOL_CLOCK_LOCKING_INDICATOR 10
368 #define CM_STATUS_EVENT_CONTROL 11
369 #define UPSTREAM_TRANSMIT_POWER_REPORTING 12
370 #define DSG_DA_TO_DSID_ASSOCIATION_ENTRY 13
371 #define CM_STATUS_EVENT_ENABLE_NON_CHANNEL_SPECIFIC_EVENTS 15
372 #define EXTENDED_UPSTREAM_TRANSMIT_POWER_SUPPORT 16
373 #define CMTS_DOCSIS_VERSION 17
374 #define CM_PERIODIC_MAINTENANCE_TIMEOUT_INDICATOR 18
375 #define DLS_BROADCAST_AND_MULTICAST_DELIVERY_METHOD 19
376 #define CM_STATUS_EVENT_ENABLE_FOR_DOCSIS_3_1_EVENTS 20
377 #define DIPLEXER_BAND_EDGE 21
378 #define FULL_DUPLEX_DESCRIPTOR 22
379
380
381 /*Downstream Active Channel List*/
382 #define DOWNSTREAM_ACTIVE_CHANNEL_LIST_CHANNEL_ID 1
383 #define DOWNSTREAM_ACTIVE_CHANNEL_LIST_FREQUENCY 2
384 #define DOWNSTREAM_ACTIVE_CHANNEL_LIST_MODULATION_ORDER_ANNEX 3
385 #define DOWNSTREAM_ACTIVE_CHANNEL_LIST_PRIMARY_CAPABLE 4
386 #define DOWNSTREAM_ACTIVE_CHANNEL_LIST_CM_STATUS_EVENT_ENABLE_BITMASK 5
387 #define DOWNSTREAM_ACTIVE_CHANNEL_LIST_MAP_UCD_TRANSPORT_INDICATOR 6
388 #define DOWNSTREAM_ACTIVE_CHANNEL_LIST_OFDM_PLC_PARAMETERS 7
389
390 /*Mac Domain Downstream Service Group*/
391 #define MAC_DOMAIN_DOWNSTREAM_SERVICE_GROUP_MD_DS_SG_IDENTIFIER 1
392 #define MAC_DOMAIN_DOWNSTREAM_SERVICE_GROUP_CHANNEL_IDS 2
393
394 /*Modulation Orders*/
395 #define QAM64 0
396 #define QAM256 1
397
398 /*Annexes*/
399 #define J83_ANNEX_A 0
400 #define J83_ANNEX_B 1
401 #define J83_ANNEX_C 2
402
403 /*Primary Capable*/
404 #define NOT_PRIMARY_CAPABLE 0
405 #define PRIMARY_CAPABLE 1
406
407 /*Can carry MAP and UCD*/
408 #define CANNOT_CARRY_MAP_UCD 0
409 #define CAN_CARRY_MAP_UCD 1
410
411 /*Receive Channel Profile Reporting Control*/
412 #define RCP_CENTER_FREQUENCY_SPACING 1
413 #define VERBOSE_RCP_REPORTING 2
414
415 /*Frequency spacing*/
416 #define ASSUME_6MHZ_CENTER_FREQUENCY_SPACING 0
417 #define ASSUME_8MHZ_CENTER_FREQUENCY_SPACING 1
418
419 /*Verbose RCP reporting*/
420 #define RCP_NO_VERBOSE_REPORTING 0
421 #define RCP_VERBOSE_REPORTING 1
422
423 /*Sub-TLVs for IP Initialization Parameters*/
424 #define IP_PROVISIONING_MODE 1
425 #define PRE_REGISTRATION_DSID 2
426
427 /*IP Provisioning Modes*/
428 #define IPv4_ONLY 0
429 #define IPv6_ONLY 1
430 #define IP_ALTERNATE 2
431 #define DUAL_STACK 3
432
433 /*Early authentication and encryption*/
434 #define EAE_DISABLED 0
435 #define EAE_ENABLED 1
436
437 /*Upstream Active Channel List*/
438 #define UPSTREAM_ACTIVE_CHANNEL_LIST_UPSTREAM_CHANNEL_ID 1
439 #define UPSTREAM_ACTIVE_CHANNEL_LIST_CM_STATUS_EVENT_ENABLE_BITMASK 2
440
441 /*Upstream Frequency Range*/
442 #define STANDARD_UPSTREAM_FREQUENCY_RANGE 0
443 #define EXTENDED_UPSTREAM_FREQUENCY_RANGE 1
444
445 /*Symbol Clock Locking Indicator*/
446 #define NOT_LOCKED_TO_MASTER_CLOCK 0
447 #define LOCKED_TO_MASTER_CLOCK 1
448
449 /*CM-STATUS Event Control */
450 #define EVENT_TYPE_CODE 1
451 #define MAXIMUM_EVENT_HOLDOFF_TIMER 2
452 #define MAXIMUM_NUMBER_OF_REPORTS_PER_EVENT 3
453
454 /*CM-STATUS Events*/
455 #define SECONDARY_CHANNEL_MDD_TIMEOUT 1
456 #define QAM_FEC_LOCK_FAILURE 2
457 #define SEQUENCE_OUT_OF_RANGE 3
458 #define MDD_RECOVERY 4
459 #define QAM_FEC_LOCK_RECOVERY 5
460 #define T4_TIMEOUT 6
461 #define T3_RETRIES_EXCEEDED 7
462 #define SUCCESFUL_RANGING_AFTER_T3_RETRIES_EXCEEDED 8
463 #define CM_OPERATING_ON_BATTERY_BACKUP 9
464 #define CM_RETURNED_TO_AC_POWER 10
465
466 /*Upstream Transmit Power Reporting*/
467 #define CM_DOESNT_REPORT_TRANSMIT_POWER 0
468 #define CM_REPORTS_TRANSMIT_POWER 1
469
470 /*Dsg DA to DSID association entry*/
471 #define DSG_DA_TO_DSID_ASSOCIATION_DA 1
472 #define DSG_DA_TO_DSID_ASSOCIATION_DSID 2
473
474 /*CMTS DOCSIS VERSION*/
475 #define CMTS_MAJOR_DOCSIS_VERSION 1
476 #define CMTS_MINOR_DOCSIS_VERSION 2
477
478 /* Define Tukey raised cosine window */
479 #define TUKEY_0TS 0
480 #define TUKEY_64TS 1
481 #define TUKEY_128TS 2
482 #define TUKEY_192TS 3
483 #define TUKEY_256TS 4
484
485 /* Define Cyclic prefix */
486 #define CYCLIC_PREFIX_192_TS 0
487 #define CYCLIC_PREFIX_256_TS 1
488 #define CYCLIC_PREFIX_512_TS 2
489 #define CYCLIC_PREFIX_768_TS 3
490 #define CYCLIC_PREFIX_1024_TS 4
491
492 /* Define Sub carrier spacing */
493 #define SPACING_25KHZ 0
494 #define SPACING_50KHZ 1
495
496 #define SEC_CH_MDD_TIMEOUT      1
497 #define QAM_FEC_LOCK_FAILURE    2
498 #define SEQ_OUT_OF_RANGE        3
499 #define SEC_CH_MDD_RECOVERY     4
500 #define QAM_FEC_LOCK_RECOVERY   5
501 #define T4_TIMEOUT              6
502 #define T3_RETRIES_EXCEEDED     7
503 #define SUCCESS_RANGING_AFTER_T3_RETRIES_EXCEEDED 8
504 #define CM_ON_BATTERY           9
505 #define CM_ON_AC_POWER         10
506
507 #define EVENT_DESCR             2
508 #define EVENT_DS_CH_ID          4
509 #define EVENT_US_CH_ID          5
510 #define EVENT_DSID              6
511
512 #define CM_CTRL_MUTE 1
513 #define CM_CTRL_MUTE_TIMEOUT 2
514 #define CM_CTRL_REINIT 3
515 #define CM_CTRL_DISABLE_FWD 4
516 #define CM_CTRL_DS_EVENT 5
517 #define CM_CTRL_US_EVENT 6
518 #define CM_CTRL_EVENT 7
519
520 #define DS_EVENT_CH_ID 1
521 #define DS_EVENT_MASK 2
522
523 #define US_EVENT_CH_ID 1
524 #define US_EVENT_MASK 2
525
526 #define DISCRETE_FOURIER_TRANSFORM_SIZE 0
527 #define CYCLIC_PREFIX 1
528 #define ROLL_OFF 2
529 #define OFDM_SPECTRUM_LOCATION 3
530 #define TIME_INTERLEAVING_DEPTH 4
531 #define SUBCARRIER_ASSIGNMENT_RANGE_LIST 5
532 #define PRIMARY_CAPABILITY_INDICATOR 6
533 #define SUBCARRIER_ASSIGNMENT_VECTOR 6
534
535 #define SUBCARRIER_ASSIGNMENT_RANGE_CONT 0
536 #define SUBCARRIER_ASSIGNMENT_RANGE_SKIPBY1 1
537 #define SUBCARRIER_ASSIGNMENT_LIST 2
538
539 #define OPT_REQ_REQ_STAT 1
540 #define OPT_REQ_RXMER_THRESH_PARAMS 2
541 #define OPT_REQ_RXMER_THRESH_PARAMS_MODULATION_ORDER 1
542
543 #define OPT_RSP_RXMER_AND_SNR_MARGIN_DATA 1
544 #define OPT_RSP_RXMER_PER_SUBCARRIER 1
545 #define OPT_RSP_SNR_MARGIN 4
546
547 #define DIPLEXER_US_UPPER_BAND_EDGE 1
548 #define DIPLEXER_DS_LOWER_BAND_EDGE 2
549 #define DIPLEXER_DS_UPPER_BAND_EDGE 3
550
551 #define FDX_ALLOCATED_SPECTRUM 1
552 #define FDX_TOTAL_NUMBER_OF_SUB_BANDS 2
553 #define FDX_SUB_BAND_WIDTH 3
554 #define FDX_SUB_BAND_DESCRIPTOR 4
555
556 #define FDX_SUB_BAND_ID 1
557 #define FDX_SUB_BAND_OFFSET 2
558
559 static int proto_docsis_mgmt = -1;
560 static int proto_docsis_sync = -1;
561 static int proto_docsis_ucd = -1;
562 static int proto_docsis_map_v1 = -1;
563 static int proto_docsis_map_v5 = -1;
564 static int proto_docsis_rngreq = -1;
565 static int proto_docsis_rngrsp = -1;
566 static int proto_docsis_regreq = -1;
567 static int proto_docsis_regrsp = -1;
568 static int proto_docsis_uccreq = -1;
569 static int proto_docsis_uccrsp = -1;
570 static int proto_docsis_bpkmreq = -1;
571 static int proto_docsis_bpkmrsp = -1;
572 static int proto_docsis_regack = -1;
573 static int proto_docsis_dsareq = -1;
574 static int proto_docsis_dsarsp = -1;
575 static int proto_docsis_dsaack = -1;
576 static int proto_docsis_dscreq = -1;
577 static int proto_docsis_dscrsp = -1;
578 static int proto_docsis_dscack = -1;
579 static int proto_docsis_dsdreq = -1;
580 static int proto_docsis_dsdrsp = -1;
581 static int proto_docsis_dccreq = -1;
582 static int proto_docsis_dccrsp = -1;
583 static int proto_docsis_dccack = -1;
584 static int proto_docsis_type29ucd = -1;
585 static int proto_docsis_intrngreq = -1;
586 static int proto_docsis_dcd = -1;
587 static int proto_docsis_mdd = -1;
588 static int proto_docsis_bintrngreq = -1;
589 static int proto_docsis_type35ucd = -1;
590 static int proto_docsis_dbcreq = -1;
591 static int proto_docsis_dbcrsp = -1;
592 static int proto_docsis_dbcack = -1;
593 static int proto_docsis_dpvreq = -1;
594 static int proto_docsis_dpvrsp = -1;
595 static int proto_docsis_cmstatus = -1;
596 static int proto_docsis_cmstatusack = -1;
597 static int proto_docsis_cmctrlreq = -1;
598 static int proto_docsis_cmctrlrsp = -1;
599 static int proto_docsis_regreqmp = -1;
600 static int proto_docsis_regrspmp = -1;
601 static int proto_docsis_ocd = -1;
602 static int proto_docsis_dpd = -1;
603 static int proto_docsis_type51ucd = -1;
604 static int proto_docsis_optreq = -1;
605 static int proto_docsis_optrsp = -1;
606 static int proto_docsis_optack = -1;
607
608 static int hf_docsis_sync_cmts_timestamp = -1;
609
610 static int hf_docsis_ucd_config_ch_cnt = -1;
611 static int hf_docsis_ucd_mini_slot_size = -1;
612 static int hf_docsis_ucd_type = -1;
613 static int hf_docsis_ucd_length = -1;
614 static int hf_docsis_ucd_burst_type = -1;
615 static int hf_docsis_ucd_burst_length = -1;
616 static int hf_docsis_ucd_symbol_rate = -1;
617 static int hf_docsis_ucd_frequency = -1;
618 static int hf_docsis_ucd_preamble_pat = -1;
619 static int hf_docsis_ucd_ext_preamble_pat = -1;
620 static int hf_docsis_ucd_scdma_mode_enabled = -1;
621 static int hf_docsis_ucd_scdma_spreading_interval = -1;
622 static int hf_docsis_ucd_scdma_codes_per_mini_slot = -1;
623 static int hf_docsis_ucd_scdma_active_codes = -1;
624 static int hf_docsis_ucd_scdma_code_hopping_seed = -1;
625 static int hf_docsis_ucd_scdma_us_ratio_num = -1;
626 static int hf_docsis_ucd_scdma_us_ratio_denom = -1;
627 static int hf_docsis_ucd_scdma_timestamp_snapshot = -1;
628 static int hf_docsis_ucd_maintain_power_spectral_density = -1;
629 static int hf_docsis_ucd_ranging_required = -1;
630 static int hf_docsis_ucd_max_scheduled_codes = -1;
631 static int hf_docsis_ucd_rnghoff_cm = -1;
632 static int hf_docsis_ucd_rnghoff_erouter = -1;
633 static int hf_docsis_ucd_rnghoff_emta = -1;
634 static int hf_docsis_ucd_rnghoff_estb = -1;
635 static int hf_docsis_ucd_rnghoff_rsvd = -1;
636 static int hf_docsis_ucd_rnghoff_id_ext = -1;
637 static int hf_docsis_ucd_chan_class_id_cm = -1;
638 static int hf_docsis_ucd_chan_class_id_erouter = -1;
639 static int hf_docsis_ucd_chan_class_id_emta = -1;
640 static int hf_docsis_ucd_chan_class_id_estb = -1;
641 static int hf_docsis_ucd_chan_class_id_rsvd = -1;
642 static int hf_docsis_ucd_chan_class_id_id_ext = -1;
643 static int hf_docsis_ucd_scdma_scrambler_onoff = -1;
644 static int hf_docsis_ucd_scdma_codes_per_subframe = -1;
645 static int hf_docsis_ucd_scdma_framer_int_step_size = -1;
646 static int hf_docsis_ucd_tcm_enabled = -1;
647 static int hf_docsis_ucd_active_code_hopping = -1;
648 static int hf_docsis_ucd_higher_ucd_for_same_ucid = -1;
649 static int hf_docsis_ucd_higher_ucd_for_same_ucid_resv = -1;
650 static int hf_docsis_ucd_scdma_selection_active_codes = -1;
651 static int hf_docsis_ucd_iuc = -1;
652 static int hf_docsis_ucd_change_ind_bitmask_subc_excl_band = -1;
653 static int hf_docsis_ucd_change_ind_bitmask_unused_subc = -1;
654 static int hf_docsis_ucd_change_ind_bitmask_other_subc = -1;
655 static int hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc5 = -1;
656 static int hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc6 = -1;
657 static int hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc9 = -1;
658 static int hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc10 = -1;
659 static int hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc11 = -1;
660 static int hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc12 = -1;
661 static int hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc13 = -1;
662 static int hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc3_or_4 = -1;
663 static int hf_docsis_ucd_change_ind_bitmask_reserved = -1;
664 static int hf_docsis_ucd_ofdma_timestamp_snapshot = -1;
665 static int hf_docsis_ucd_ofdma_cyclic_prefix_size = -1;
666 static int hf_docsis_ucd_ofdma_rolloff_period_size = -1;
667 static int hf_docsis_ucd_subc_spacing = -1;
668 static int hf_docsis_ucd_cent_freq_subc0 = -1;
669 static int hf_docsis_ucd_subcarrier_range = -1;
670 static int hf_docsis_ucd_symb_ofdma_frame = -1;
671 static int hf_docsis_ucd_rand_seed = -1;
672
673 static int hf_docsis_burst_mod_type = -1;
674 static int hf_docsis_burst_diff_encoding = -1;
675 static int hf_docsis_burst_preamble_len = -1;
676 static int hf_docsis_burst_preamble_val_off = -1;
677 static int hf_docsis_burst_fec = -1;
678 static int hf_docsis_burst_fec_codeword = -1;
679 static int hf_docsis_burst_scrambler_seed = -1;
680 static int hf_docsis_burst_max_burst = -1;
681 static int hf_docsis_burst_guard_time = -1;
682 static int hf_docsis_burst_last_cw_len = -1;
683 static int hf_docsis_burst_scrambler_onoff = -1;
684 static int hf_docsis_rs_int_depth = -1;
685 static int hf_docsis_rs_int_block = -1;
686 static int hf_docsis_preamble_type = -1;
687 static int hf_docsis_subc_init_rang = -1;
688 static int hf_docsis_subc_fine_rang = -1;
689 static int hf_docsis_ofdma_prof_mod_order = -1;
690 static int hf_docsis_ofdma_prof_pilot_pattern = -1;
691 static int hf_docsis_ofdma_prof_num_add_minislots = -1;
692 static int hf_docsis_ofdma_ir_pow_ctrl_start_pow = -1;
693 static int hf_docsis_ofdma_ir_pow_ctrl_step_size = -1;
694
695 static int hf_docsis_map_ucd_count = -1;
696 static int hf_docsis_map_numie = -1;
697 static int hf_docsis_map_numie_v5 = -1;
698 static int hf_docsis_map_alloc_start = -1;
699 static int hf_docsis_map_ack_time = -1;
700 static int hf_docsis_map_rng_start = -1;
701 static int hf_docsis_map_rng_end = -1;
702 static int hf_docsis_map_data_start = -1;
703 static int hf_docsis_map_data_end = -1;
704 static int hf_docsis_map_ie = -1;
705 static int hf_docsis_map_probe_ie = -1;
706
707 static int hf_docsis_map_rsvd = -1;
708 static int hf_docsis_map_rsvd_v5 = -1;
709 static int hf_docsis_map_cat = -1;
710
711 static int hf_docsis_map_sid = -1;
712 static int hf_docsis_map_iuc = -1;
713 static int hf_docsis_map_offset = -1;
714 static int hf_docsis_map_mer = -1;
715 static int hf_docsis_map_pw = -1;
716 static int hf_docsis_map_eq = -1;
717 static int hf_docsis_map_st = -1;
718 static int hf_docsis_map_probe_frame = -1;
719 static int hf_docsis_map_symbol_in_frame = -1;
720 static int hf_docsis_map_start_subc = -1;
721 static int hf_docsis_map_subc_skip = -1;
722
723
724 static int hf_docsis_rngreq_sid = -1;
725 static int hf_docsis_rngreq_pend_compl = -1;
726
727 static int hf_docsis_rngrsp_type = -1;
728 static int hf_docsis_rngrsp_length = -1;
729 static int hf_docsis_rngrsp_sid = -1;
730 static int hf_docsis_rngrsp_timing_adj = -1;
731 static int hf_docsis_rngrsp_power_adj = -1;
732 static int hf_docsis_rngrsp_freq_adj = -1;
733 static int hf_docsis_rngrsp_xmit_eq_adj = -1;
734 static int hf_docsis_rngrsp_ranging_status = -1;
735 static int hf_docsis_rngrsp_down_freq_over = -1;
736 static int hf_docsis_rngrsp_upstream_ch_over = -1;
737 static int hf_docsis_rngrsp_rngrsp_t4_timeout_multiplier = -1;
738 static int hf_docsis_rngrsp_dynamic_range_window_upper_edge = -1;
739 static int hf_docsis_rngrsp_tlv_unknown = -1;
740 static int hf_docsis_rngrsp_trans_eq_data = -1;
741 static int hf_docsis_rngrsp_trans_eq_enc_lowest_subc = -1;
742 static int hf_docsis_rngrsp_trans_eq_enc_highest_subc = -1;
743 static int hf_docsis_rngrsp_trans_eq_enc_coef_real = -1;
744 static int hf_docsis_rngrsp_trans_eq_enc_coef_imag = -1;
745 static int hf_docsis_rngrsp_commanded_power_data = -1;
746 static int hf_docsis_rngrsp_commanded_power_dynamic_range_window = -1;
747 static int hf_docsis_rngrsp_commanded_power_ucid = -1;
748 static int hf_docsis_rngrsp_commanded_power_trans_pow_lvl = -1;
749
750
751 static int hf_docsis_regreq_sid = -1;
752 static int hf_docsis_regrsp_sid = -1;
753 static int hf_docsis_regrsp_response = -1;
754
755 static int hf_docsis_bpkm_code = -1;
756 static int hf_docsis_bpkm_length = -1;
757 static int hf_docsis_bpkm_ident = -1;
758 static int hf_docsis_bpkmattr = -1;
759 static int hf_docsis_bpkmattr_serial_num = -1;
760 static int hf_docsis_bpkmattr_manf_id = -1;
761 static int hf_docsis_bpkmattr_mac_addr = -1;
762 static int hf_docsis_bpkmattr_rsa_pub_key = -1;
763 static int hf_docsis_bpkmattr_cm_id = -1;
764 static int hf_docsis_bpkmattr_display_str = -1;
765 static int hf_docsis_bpkmattr_auth_key = -1;
766 static int hf_docsis_bpkmattr_tek = -1;
767 static int hf_docsis_bpkmattr_key_life = -1;
768 static int hf_docsis_bpkmattr_key_seq = -1;
769 static int hf_docsis_bpkmattr_hmac_digest = -1;
770 static int hf_docsis_bpkmattr_said = -1;
771 static int hf_docsis_bpkmattr_tek_params = -1;
772 static int hf_docsis_bpkmattr_cbc_iv = -1;
773 static int hf_docsis_bpkmattr_error_code = -1;
774 static int hf_docsis_bpkmattr_vendor_def = -1;
775 static int hf_docsis_bpkmattr_ca_cert = -1;
776 static int hf_docsis_bpkmattr_cm_cert = -1;
777 static int hf_docsis_bpkmattr_security_cap = -1;
778 static int hf_docsis_bpkmattr_crypto_suite = -1;
779 static int hf_docsis_bpkmattr_crypto_suite_list = -1;
780 static int hf_docsis_bpkmattr_bpi_version = -1;
781 static int hf_docsis_bpkmattr_sa_descr = -1;
782 static int hf_docsis_bpkmattr_sa_type = -1;
783 static int hf_docsis_bpkmattr_sa_query = -1;
784 static int hf_docsis_bpkmattr_sa_query_type = -1;
785 static int hf_docsis_bpkmattr_ip_address = -1;
786 static int hf_docsis_bpkmattr_download_param = -1;
787 static int hf_docsis_bpkmattr_type = -1;
788 static int hf_docsis_bpkmattr_length = -1;
789
790 static int hf_docsis_regack_sid = -1;
791 static int hf_docsis_regack_response = -1;
792
793 static int hf_docsis_dsarsp_response = -1;
794 static int hf_docsis_dsaack_response = -1;
795
796 static int hf_docsis_dscrsp_response = -1;
797 static int hf_docsis_dscack_response = -1;
798
799 static int hf_docsis_dsdreq_rsvd = -1;
800 static int hf_docsis_dsdreq_sfid = -1;
801
802 static int hf_docsis_dsdrsp_confcode = -1;
803 static int hf_docsis_dsdrsp_rsvd = -1;
804
805 static int hf_docsis_dccreq_type = -1;
806 static int hf_docsis_dccreq_length = -1;
807 static int hf_docsis_dccreq_tran_id = -1;
808 static int hf_docsis_dccreq_up_chan_id = -1;
809 static int hf_docsis_dcc_ds_params_subtype = -1;
810 static int hf_docsis_dcc_ds_params_length = -1;
811 static int hf_docsis_dccreq_ds_freq = -1;
812 static int hf_docsis_dccreq_ds_mod_type = -1;
813 static int hf_docsis_dccreq_ds_sym_rate = -1;
814 static int hf_docsis_dccreq_ds_intlv_depth_i = -1;
815 static int hf_docsis_dccreq_ds_intlv_depth_j = -1;
816 static int hf_docsis_dccreq_ds_chan_id = -1;
817 static int hf_docsis_dccreq_ds_sync_sub = -1;
818 static int hf_docsis_dccreq_ds_ofdm_block_freq = -1;
819 static int hf_docsis_dccreq_init_tech = -1;
820 static int hf_docsis_dccreq_ucd_sub = -1;
821 static int hf_docsis_dccreq_said_sub_cur = -1;
822 static int hf_docsis_dccreq_said_sub_new = -1;
823 static int hf_docsis_dcc_sf_sub_subtype = -1;
824 static int hf_docsis_dcc_sf_sub_length = -1;
825 static int hf_docsis_dccreq_sf_sfid_cur = -1;
826 static int hf_docsis_dccreq_sf_sfid_new = -1;
827 static int hf_docsis_dccreq_sf_sid_cur = -1;
828 static int hf_docsis_dccreq_sf_sid_new = -1;
829 static int hf_docsis_dccreq_sf_unsol_grant_tref = -1;
830 static int hf_docsis_dccreq_cmts_mac_addr = -1;
831 static int hf_docsis_dccreq_key_seq_num = -1;
832 static int hf_docsis_dccreq_hmac_digest = -1;
833 static int hf_docsis_dccrsp_conf_code = -1;
834 static int hf_docsis_dccrsp_type = -1;
835 static int hf_docsis_dccrsp_length = -1;
836 static int hf_docsis_dcc_cm_jump_subtype = -1;
837 static int hf_docsis_dcc_cm_jump_length = -1;
838 static int hf_docsis_dccrsp_cm_jump_time_length = -1;
839 static int hf_docsis_dccrsp_cm_jump_time_start = -1;
840 static int hf_docsis_dccrsp_key_seq_num = -1;
841 static int hf_docsis_dccrsp_hmac_digest = -1;
842 static int hf_docsis_dccack_type = -1;
843 static int hf_docsis_dccack_length = -1;
844 static int hf_docsis_dccack_key_seq_num = -1;
845 static int hf_docsis_dccack_hmac_digest = -1;
846
847 static int hf_docsis_intrngreq_sid = -1;
848
849 static int hf_docsis_dcd_config_ch_cnt = -1;
850 static int hf_docsis_dcd_num_of_frag = -1;
851 static int hf_docsis_dcd_frag_sequence_num = -1;
852 static int hf_docsis_dcd_type = -1;
853 static int hf_docsis_dcd_length = -1;
854 static int hf_docsis_dcd_down_classifier_subtype = -1;
855 static int hf_docsis_dcd_down_classifier_length = -1;
856 static int hf_docsis_dcd_cfr_id = -1;
857 static int hf_docsis_dcd_cfr_rule_pri = -1;
858 static int hf_docsis_dcd_cfr_ip_subtype = -1;
859 static int hf_docsis_dcd_cfr_ip_length = -1;
860 static int hf_docsis_dcd_cfr_ip_source_addr = -1;
861 static int hf_docsis_dcd_cfr_ip_source_mask = -1;
862 static int hf_docsis_dcd_cfr_ip_dest_addr = -1;
863 static int hf_docsis_dcd_cfr_ip_dest_mask = -1;
864 static int hf_docsis_dcd_cfr_tcpudp_srcport_start = -1;
865 static int hf_docsis_dcd_cfr_tcpudp_srcport_end = -1;
866 static int hf_docsis_dcd_cfr_tcpudp_dstport_start = -1;
867 static int hf_docsis_dcd_cfr_tcpudp_dstport_end = -1;
868 static int hf_docsis_dcd_rule_id = -1;
869 static int hf_docsis_dcd_rule_pri = -1;
870 static int hf_docsis_dcd_rule_ucid_list = -1;
871 static int hf_docsis_dcd_clid_subtype = -1;
872 static int hf_docsis_dcd_clid_length = -1;
873 static int hf_docsis_dcd_clid_bcast_id = -1;
874 static int hf_docsis_dcd_clid_known_mac_addr = -1;
875 static int hf_docsis_dcd_clid_ca_sys_id = -1;
876 static int hf_docsis_dcd_clid_app_id = -1;
877 static int hf_docsis_dcd_dsg_rule_subtype = -1;
878 static int hf_docsis_dcd_dsg_rule_length = -1;
879 static int hf_docsis_dcd_rule_tunl_addr = -1;
880 static int hf_docsis_dcd_rule_cfr_id = -1;
881 static int hf_docsis_dcd_rule_vendor_spec = -1;
882 static int hf_docsis_dcd_cfg_subtype = -1;
883 static int hf_docsis_dcd_cfg_length = -1;
884 static int hf_docsis_dcd_cfg_chan = -1;
885 static int hf_docsis_dcd_cfg_tdsg1 = -1;
886 static int hf_docsis_dcd_cfg_tdsg2 = -1;
887 static int hf_docsis_dcd_cfg_tdsg3 = -1;
888 static int hf_docsis_dcd_cfg_tdsg4 = -1;
889 static int hf_docsis_dcd_cfg_vendor_spec = -1;
890
891 static int hf_docsis_mdd_ccc = -1;
892 static int hf_docsis_mdd_number_of_fragments = -1;
893 static int hf_docsis_mdd_fragment_sequence_number = -1;
894 static int hf_docsis_mdd_current_channel_dcid = -1;
895 static int hf_docsis_mdd_ds_active_channel_list_subtype = -1;
896 static int hf_docsis_mdd_ds_active_channel_list_length = -1;
897 static int hf_docsis_mdd_downstream_active_channel_list_channel_id = -1;
898 static int hf_docsis_mdd_downstream_active_channel_list_frequency = -1;
899 static int hf_docsis_mdd_downstream_active_channel_list_annex = -1;
900 static int hf_docsis_mdd_downstream_active_channel_list_modulation_order = -1;
901 static int hf_docsis_mdd_downstream_active_channel_list_primary_capable = -1;
902 static int hf_docsis_mdd_downstream_active_channel_list_map_ucd_transport_indicator = -1;
903 static int hf_docsis_mdd_cm_status_event_enable_bitmask = -1;
904 static int hf_docsis_mdd_cm_status_event_enable_bitmask_mdd_timeout = -1;
905 static int hf_docsis_mdd_cm_status_event_enable_bitmask_qam_fec_lock_failure = -1;
906 static int hf_docsis_mdd_cm_status_event_enable_bitmask_mdd_recovery = -1;
907 static int hf_docsis_mdd_cm_status_event_enable_bitmask_qam_fec_lock_recovery = -1;
908 static int hf_docsis_mdd_ofdm_plc_parameters = -1;
909 static int hf_docsis_mdd_ofdm_plc_parameters_tukey_raised_cosine_window = -1;
910 static int hf_docsis_mdd_ofdm_plc_parameters_cyclic_prefix = -1;
911 static int hf_docsis_mdd_ofdm_plc_parameters_sub_carrier_spacing = -1;
912 static int hf_docsis_mdd_up_active_channel_list_subtype = -1;
913 static int hf_docsis_mdd_up_active_channel_list_length = -1;
914 static int hf_docsis_mdd_cm_status_event_enable_bitmask_t4_timeout = -1;
915 static int hf_docsis_mdd_cm_status_event_enable_bitmask_t3_retries_exceeded = -1;
916 static int hf_docsis_mdd_cm_status_event_enable_bitmask_successful_ranging_after_t3_retries_exceeded = -1;
917 static int hf_docsis_mdd_ds_service_group_subtype = -1;
918 static int hf_docsis_mdd_ds_service_group_length = -1;
919 static int hf_docsis_mdd_mac_domain_downstream_service_group_md_ds_sg_identifier = -1;
920 static int hf_docsis_mdd_mac_domain_downstream_service_group_channel_id = -1;
921 static int hf_docsis_mdd_type = -1;
922 static int hf_docsis_mdd_length = -1;
923 static int hf_docsis_mdd_downstream_ambiguity_resolution_frequency = -1;
924 static int hf_docsis_mdd_channel_profile_reporting_control_subtype = -1;
925 static int hf_docsis_mdd_channel_profile_reporting_control_length = -1;
926 static int hf_docsis_mdd_rpc_center_frequency_spacing = -1;
927 static int hf_docsis_mdd_verbose_rcp_reporting = -1;
928 static int hf_docsis_mdd_ip_init_param_subtype = -1;
929 static int hf_docsis_mdd_ip_init_param_length = -1;
930 static int hf_docsis_mdd_ip_provisioning_mode = -1;
931 static int hf_docsis_mdd_pre_registration_dsid = -1;
932 static int hf_docsis_mdd_early_authentication_and_encryption = -1;
933 static int hf_docsis_mdd_upstream_active_channel_list_upstream_channel_id = -1;
934 static int hf_docsis_mdd_upstream_ambiguity_resolution_channel_list_channel_id = -1;
935 static int hf_docsis_mdd_upstream_frequency_range = -1;
936 static int hf_docsis_mdd_symbol_clock_locking_indicator = -1;
937 static int hf_docsis_mdd_cm_status_event_control_subtype = -1;
938 static int hf_docsis_mdd_cm_status_event_control_length = -1;
939 static int hf_docsis_mdd_event_type = -1;
940 static int hf_docsis_mdd_maximum_event_holdoff_timer = -1;
941 static int hf_docsis_mdd_maximum_number_of_reports_per_event = -1;
942 static int hf_docsis_mdd_upstream_transmit_power_reporting = -1;
943 static int hf_docsis_mdd_dsg_da_to_dsid_subtype = -1;
944 static int hf_docsis_mdd_dsg_da_to_dsid_length = -1;
945 static int hf_docsis_mdd_dsg_da_to_dsid_association_da = -1;
946 static int hf_docsis_mdd_dsg_da_to_dsid_association_dsid = -1;
947 static int hf_docsis_mdd_cm_status_event_enable_non_channel_specific_events = -1;
948 static int hf_docsis_mdd_cm_status_event_enable_non_channel_specific_events_sequence_out_of_range = -1;
949 static int hf_docsis_mdd_cm_status_event_enable_non_channel_specific_events_cm_operating_on_battery_backup = -1;
950 static int hf_docsis_mdd_cm_status_event_enable_non_channel_specific_events_cm_returned_to_ac_power = -1;
951 static int hf_docsis_mdd_extended_upstream_transmit_power_support = -1;
952
953 static int hf_docsis_mdd_cmts_major_docsis_version = -1;
954 static int hf_docsis_mdd_cmts_minor_docsis_version = -1;
955
956 static int hf_docsis_mdd_cm_periodic_maintenance_timeout_indicator = -1;
957 static int hf_docsis_mdd_dls_broadcast_and_multicast_delivery_method = -1;
958 static int hf_docsis_mdd_cm_status_event_d31_ofdm_prof_fail = -1;
959 static int hf_docsis_mdd_cm_status_event_d31_prim_down_chan_change = -1;
960 static int hf_docsis_mdd_cm_status_event_d31_dpd_mismatch = -1;
961 static int hf_docsis_mdd_cm_status_event_d31_deprecated = -1;
962 static int hf_docsis_mdd_cm_status_event_d31_ncp_prof_fail = -1;
963 static int hf_docsis_mdd_cm_status_event_d31_loss_fec_plc = -1;
964 static int hf_docsis_mdd_cm_status_event_d31_ncp_prof_recover = -1;
965 static int hf_docsis_mdd_cm_status_event_d31_fec_recover_on_plc = -1;
966 static int hf_docsis_mdd_cm_status_event_d31_fec_recover_on_ofdm_prof = -1;
967 static int hf_docsis_mdd_cm_status_event_d31_ofdma_prof_fail = -1;
968 static int hf_docsis_mdd_cm_status_event_d31_map_stor_overflow_ind = -1;
969 static int hf_docsis_mdd_cm_status_event_d31_ofdm_map_stor_almost_full_ind = -1;
970 static int hf_docsis_mdd_cm_status_event_d31_reserved = -1;
971
972 static int hf_docsis_mdd_diplexer_band_edge = -1;
973 static int hf_docsis_mdd_diplexer_band_edge_length = -1;
974 static int hf_docsis_mdd_diplexer_us_upper_band_edge = -1;
975 static int hf_docsis_mdd_diplexer_ds_lower_band_edge = -1;
976 static int hf_docsis_mdd_diplexer_ds_upper_band_edge = -1;
977
978 static int hf_docsis_mdd_full_duplex_descriptor = -1;
979 static int hf_docsis_mdd_full_duplex_descriptor_length = -1;
980 static int hf_docsis_mdd_full_duplex_allocated_spectrum = -1;
981 static int hf_docsis_mdd_full_duplex_total_number_of_sub_bands = -1;
982 static int hf_docsis_mdd_full_duplex_sub_band_width = -1;
983 static int hf_docsis_mdd_full_duplex_sub_band_descriptor = -1;
984 static int hf_docsis_mdd_full_duplex_sub_band_descriptor_length = -1;
985 static int hf_docsis_mdd_full_duplex_sub_band_id = -1;
986 static int hf_docsis_mdd_full_duplex_sub_band_offset = -1;
987
988 static int hf_docsis_bintrngreq_mddsgid = -1;
989 static int hf_docsis_bintrngreq_capflags = -1;
990 static int hf_docsis_bintrngreq_capflags_frag = -1;
991 static int hf_docsis_bintrngreq_capflags_encrypt = -1;
992
993 static int hf_docsis_dbcreq_number_of_fragments = -1;
994 static int hf_docsis_dbcreq_fragment_sequence_number = -1;
995
996 static int hf_docsis_dbcrsp_conf_code = -1;
997
998 static int hf_docsis_dpv_flags = -1;
999 static int hf_docsis_dpv_us_sf = -1;
1000 static int hf_docsis_dpv_n = -1;
1001 static int hf_docsis_dpv_start = -1;
1002 static int hf_docsis_dpv_end = -1;
1003 static int hf_docsis_dpv_ts_start = -1;
1004 static int hf_docsis_dpv_ts_end = -1;
1005
1006 static int hf_docsis_cmstatus_e_t_mdd_t = -1;
1007 static int hf_docsis_cmstatus_e_t_qfl_f = -1;
1008 static int hf_docsis_cmstatus_e_t_s_o = -1;
1009 static int hf_docsis_cmstatus_e_t_mdd_r = -1;
1010 static int hf_docsis_cmstatus_e_t_qfl_r = -1;
1011 static int hf_docsis_cmstatus_e_t_t4_t = -1;
1012 static int hf_docsis_cmstatus_e_t_t3_e = -1;
1013 static int hf_docsis_cmstatus_e_t_rng_s = -1;
1014 static int hf_docsis_cmstatus_e_t_cm_b = -1;
1015 static int hf_docsis_cmstatus_e_t_cm_a = -1;
1016 static int hf_docsis_cmstatus_ds_ch_id = -1;
1017 static int hf_docsis_cmstatus_us_ch_id = -1;
1018 static int hf_docsis_cmstatus_dsid = -1;
1019 static int hf_docsis_cmstatus_descr = -1;
1020 static int hf_docsis_cmstatus_tlv_data = -1;
1021 static int hf_docsis_cmstatus_type = -1;
1022 static int hf_docsis_cmstatus_length = -1;
1023
1024 static int hf_docsis_cmctrl_tlv_mute = -1;
1025 static int hf_docsis_cmctrl_tlv_mute_timeout = -1;
1026 static int hf_docsis_cmctrl_tlv_reinit = -1;
1027 static int hf_docsis_cmctrl_tlv_disable_fwd = -1;
1028 static int hf_docsis_cmctrl_tlv_ds_event = -1;
1029 static int hf_docsis_cmctrl_tlv_us_event = -1;
1030 static int hf_docsis_cmctrl_tlv_event = -1;
1031 static int hf_docsis_cmctrlreq_tlv_data = -1;
1032 static int hf_docsis_cmctrlreq_type = -1;
1033 static int hf_docsis_cmctrlreq_length = -1;
1034 static int hf_docsis_cmctrlreq_us_type = -1;
1035 static int hf_docsis_cmctrlreq_us_length = -1;
1036 static int hf_docsis_cmctrl_us_event_ch_id = -1;
1037 static int hf_docsis_cmctrl_us_event_mask = -1;
1038 static int hf_docsis_cmctrl_ds_type = -1;
1039 static int hf_docsis_cmctrl_ds_length = -1;
1040 static int hf_docsis_cmctrl_ds_event_ch_id = -1;
1041 static int hf_docsis_cmctrl_ds_event_mask = -1;
1042
1043 static int hf_docsis_regreqmp_sid = -1;
1044 static int hf_docsis_regreqmp_number_of_fragments = -1;
1045 static int hf_docsis_regreqmp_fragment_sequence_number = -1;
1046 static int hf_docsis_regrspmp_sid = -1;
1047 static int hf_docsis_regrspmp_response = -1;
1048 static int hf_docsis_regrspmp_number_of_fragments = -1;
1049 static int hf_docsis_regrspmp_fragment_sequence_number = -1;
1050
1051 static int hf_docsis_ocd_tlv_unknown = -1;
1052 static int hf_docsis_ocd_ccc = -1;
1053 static int hf_docsis_ocd_tlv_four_trans_size = -1;
1054 static int hf_docsis_ocd_tlv_cycl_pref = -1;
1055 static int hf_docsis_ocd_tlv_roll_off = -1;
1056 static int hf_docsis_ocd_tlv_ofdm_spec_loc = -1;
1057 static int hf_docsis_ocd_tlv_time_int_depth = -1;
1058 static int hf_docsis_ocd_tlv_prim_cap_ind = -1;
1059 static int hf_docsis_ocd_tlv_subc_assign_type = -1;
1060 static int hf_docsis_ocd_tlv_subc_assign_value = -1;
1061 static int hf_docsis_ocd_subc_assign_subc_type = -1;
1062 static int hf_docsis_ocd_subc_assign_range = -1;
1063 static int hf_docsis_ocd_subc_assign_index = -1;
1064 static int hf_docsis_ocd_tlv_data = -1;
1065 static int hf_docsis_ocd_type = -1;
1066 static int hf_docsis_ocd_length = -1;
1067
1068 static int hf_docsis_dpd_tlv_unknown = -1;
1069 static int hf_docsis_dpd_prof_id = -1;
1070 static int hf_docsis_dpd_ccc = -1;
1071 static int hf_docsis_dpd_tlv_subc_assign_type = -1;
1072 static int hf_docsis_dpd_tlv_subc_assign_value = -1;
1073 static int hf_docsis_dpd_subc_assign_range = -1;
1074 static int hf_docsis_dpd_tlv_subc_assign_reserved = -1;
1075 static int hf_docsis_dpd_tlv_subc_assign_modulation = -1;
1076 static int hf_docsis_dpd_subc_assign_index = -1;
1077 static int hf_docsis_dpd_tlv_subc_assign_vector_oddness = -1;
1078 static int hf_docsis_dpd_tlv_subc_assign_vector_reserved = -1;
1079 static int hf_docsis_dpd_tlv_subc_assign_vector_subc_start = -1;
1080 static int hf_docsis_dpd_tlv_subc_assign_vector_modulation_odd = -1;
1081 static int hf_docsis_dpd_tlv_subc_assign_vector_modulation_even = -1;
1082 static int hf_docsis_dpd_tlv_data = -1;
1083 static int hf_docsis_dpd_type = -1;
1084 static int hf_docsis_dpd_length = -1;
1085
1086 static int hf_docsis_optreq_tlv_unknown = -1;
1087 static int hf_docsis_optreq_prof_id = -1;
1088 static int hf_docsis_optreq_opcode = -1;
1089 static int hf_docsis_optreq_reserved = -1;
1090 static int hf_docsis_optreq_tlv_data = -1;
1091 static int hf_docsis_optreq_type = -1;
1092 static int hf_docsis_optreq_length = -1;
1093 static int hf_docsis_optreq_reqstat_rxmer_stat_subc = -1;
1094 static int hf_docsis_optreq_reqstat_rxmer_subc_threshold_comp = -1;
1095 static int hf_docsis_optreq_reqstat_snr_marg_cand_prof = -1;
1096 static int hf_docsis_optreq_reqstat_codew_stat_cand_prof = -1;
1097 static int hf_docsis_optreq_reqstat_codew_thresh_comp_cand_prof = -1;
1098 static int hf_docsis_optreq_reqstat_ncp_field_stat = -1;
1099 static int hf_docsis_optreq_reqstat_ncp_crc_thresh_comp = -1;
1100 static int hf_docsis_optreq_reqstat_reserved = -1;
1101 static int hf_docsis_optreq_tlv_xrmer_thresh_data = -1;
1102 static int hf_docsis_optreq_xmer_thresh_params_type = -1;
1103 static int hf_docsis_optreq_xmer_thresh_params_length = -1;
1104 static int hf_docsis_optreq_tlv_xrmer_thresh_data_mod_order = -1;
1105
1106 static int hf_docsis_optrsp_tlv_unknown = -1;
1107 static int hf_docsis_optrsp_prof_id = -1;
1108 static int hf_docsis_optrsp_reserved = -1;
1109 static int hf_docsis_optrsp_status = -1;
1110 static int hf_docsis_optrsp_tlv_data = -1;
1111 static int hf_docsis_optrsp_type = -1;
1112 static int hf_docsis_optrsp_length = -1;
1113 static int hf_docsis_optrsp_tlv_xrmer_snr_margin_data = -1;
1114 static int hf_docsis_optrsp_xmer_snr_margin_type = -1;
1115 static int hf_docsis_optrsp_xmer_snr_margin_length = -1;
1116 static int hf_docsis_optrsp_tlv_xrmer_snr_margin_data_rxmer_subc = -1;
1117 static int hf_docsis_optrsp_tlv_rxmer_snr_margin_data_snr_margin = -1;
1118
1119 static int hf_docsis_optack_prof_id = -1;
1120 static int hf_docsis_optack_reserved = -1;
1121
1122 static int hf_docsis_mgt_upstream_chid = -1;
1123 static int hf_docsis_mgt_down_chid = -1;
1124 static int hf_docsis_mgt_tranid = -1;
1125 static int hf_docsis_mgt_dst_addr = -1;
1126 static int hf_docsis_mgt_src_addr = -1;
1127 static int hf_docsis_mgt_msg_len = -1;
1128 static int hf_docsis_mgt_dsap = -1;
1129 static int hf_docsis_mgt_ssap = -1;
1130 static int hf_docsis_mgt_control = -1;
1131 static int hf_docsis_mgt_version = -1;
1132 static int hf_docsis_mgt_type = -1;
1133 static int hf_docsis_mgt_rsvd = -1;
1134
1135
1136 static int hf_docsis_tlv_fragments = -1;
1137 static int hf_docsis_tlv_fragment = -1;
1138 static int hf_docsis_tlv_fragment_overlap = -1;
1139 static int hf_docsis_tlv_fragment_overlap_conflict = -1;
1140 static int hf_docsis_tlv_fragment_multiple_tails = -1;
1141 static int hf_docsis_tlv_fragment_too_long_fragment = -1;
1142 static int hf_docsis_tlv_fragment_error = -1;
1143 static int hf_docsis_tlv_fragment_count = -1;
1144 static int hf_docsis_tlv_reassembled_in = -1;
1145 static int hf_docsis_tlv_reassembled_length = -1;
1146 static int hf_docsis_tlv_reassembled_data = -1;
1147
1148 static int hf_docsis_tlv_reassembled = -1;
1149
1150 static gint ett_docsis_sync = -1;
1151
1152 static gint ett_docsis_ucd = -1;
1153 static gint ett_docsis_tlv = -1;
1154 static gint ett_docsis_burst_tlv = -1;
1155
1156 static gint ett_docsis_map = -1;
1157 static gint ett_docsis_map_ie = -1;
1158 static gint ett_docsis_map_probe_ie = -1;
1159
1160
1161 static gint ett_docsis_rngreq = -1;
1162
1163 static gint ett_docsis_rngrsp = -1;
1164 static gint ett_docsis_rngrsptlv = -1;
1165 static gint ett_docsis_rngrsp_tlv_transmit_equalization_encodings = -1;
1166 static gint ett_docsis_rngrsp_tlv_transmit_equalization_encodings_coef = -1;
1167 static gint ett_docsis_rngrsp_tlv_commanded_power_subtlv = -1;
1168 static gint ett_docsis_rngrsp_tlv_commanded_power = -1;
1169
1170
1171 static gint ett_docsis_regreq = -1;
1172 static gint ett_docsis_regrsp = -1;
1173
1174 static gint ett_docsis_uccreq = -1;
1175 static gint ett_docsis_uccrsp = -1;
1176
1177 static gint ett_docsis_bpkmreq = -1;
1178 static gint ett_docsis_bpkmrsp = -1;
1179 static gint ett_docsis_bpkmattr = -1;
1180 static gint ett_docsis_bpkmattr_cmid = -1;
1181 static gint ett_docsis_bpkmattr_scap = -1;
1182 static gint ett_docsis_bpkmattr_tekp = -1;
1183 static gint ett_docsis_bpkmattr_sadsc = -1;
1184 static gint ett_docsis_bpkmattr_saqry = -1;
1185 static gint ett_docsis_bpkmattr_dnld = -1;
1186 static gint ett_docsis_bpkmattrtlv = -1;
1187
1188 static gint ett_docsis_regack = -1;
1189
1190 static gint ett_docsis_dsareq = -1;
1191 static gint ett_docsis_dsarsp = -1;
1192 static gint ett_docsis_dsaack = -1;
1193
1194 static gint ett_docsis_dscreq = -1;
1195 static gint ett_docsis_dscrsp = -1;
1196 static gint ett_docsis_dscack = -1;
1197
1198 static gint ett_docsis_dsdreq = -1;
1199 static gint ett_docsis_dsdrsp = -1;
1200
1201 static gint ett_docsis_dccreq = -1;
1202 static gint ett_docsis_dccreq_tlv = -1;
1203 static gint ett_docsis_dccreq_ds_params = -1;
1204 static gint ett_docsis_dccreq_sf_sub = -1;
1205 static gint ett_docsis_dccrsp = -1;
1206 static gint ett_docsis_dccrsp_cm_jump_time = -1;
1207 static gint ett_docsis_dccrsp_tlv = -1;
1208 static gint ett_docsis_dccack = -1;
1209 static gint ett_docsis_dccack_tlv = -1;
1210
1211 static gint ett_docsis_intrngreq = -1;
1212
1213 static gint ett_docsis_dcd = -1;
1214 static gint ett_docsis_dcd_cfr = -1;
1215 static gint ett_docsis_dcd_cfr_ip = -1;
1216 static gint ett_docsis_dcd_rule = -1;
1217 static gint ett_docsis_dcd_clid = -1;
1218 static gint ett_docsis_dcd_cfg = -1;
1219 static gint ett_docsis_dcd_tlv = -1;
1220
1221 static gint ett_docsis_mdd = -1;
1222 static gint ett_tlv = -1;
1223 static gint ett_sub_tlv = -1;
1224 static gint ett_docsis_mdd_cm_status_ev_en_for_docsis31 = -1;
1225 static gint ett_docsis_mdd_ds_active_channel_list = -1;
1226 static gint ett_docsis_mdd_ds_service_group = -1;
1227 static gint ett_docsis_mdd_channel_profile_reporting_control = -1;
1228 static gint ett_docsis_mdd_ip_init_param = -1;
1229 static gint ett_docsis_mdd_up_active_channel_list = -1;
1230 static gint ett_docsis_mdd_cm_status_event_control = -1;
1231 static gint ett_docsis_mdd_dsg_da_to_dsid = -1;
1232 static gint ett_docsis_mdd_diplexer_band_edge = -1;
1233 static gint ett_docsis_mdd_full_duplex_descriptor = -1;
1234 static gint ett_docsis_mdd_full_duplex_sub_band_descriptor = -1;
1235
1236 static gint ett_docsis_bintrngreq = -1;
1237
1238 static gint ett_docsis_dbcreq = -1;
1239 static gint ett_docsis_dbcrsp = -1;
1240 static gint ett_docsis_dbcack = -1;
1241
1242 static gint ett_docsis_dpvreq = -1;
1243 static gint ett_docsis_dpvrsp = -1;
1244
1245 static gint ett_docsis_cmstatus = -1;
1246 static gint ett_docsis_cmstatus_tlv = -1;
1247 static gint ett_docsis_cmstatus_tlvtlv = -1;
1248
1249 static gint ett_docsis_cmstatusack = -1;
1250
1251 static gint ett_docsis_cmctrlreq = -1;
1252 static gint ett_docsis_cmctrlreq_tlv = -1;
1253 static gint ett_docsis_cmctrlreq_tlvtlv = -1;
1254 static gint ett_docsis_cmctrl_tlv_us_event = -1;
1255 static gint ett_docsis_cmctrl_tlv_ds_event = -1;
1256 static gint ett_docsis_cmctrlrsp = -1;
1257
1258 static gint ett_docsis_regreqmp = -1;
1259 static gint ett_docsis_regrspmp = -1;
1260
1261 static gint ett_docsis_ocd = -1;
1262 static gint ett_docsis_ocd_tlv = -1;
1263 static gint ett_docsis_ocd_tlvtlv = -1;
1264
1265 static gint ett_docsis_dpd = -1;
1266 static gint ett_docsis_dpd_tlv = -1;
1267 static gint ett_docsis_dpd_tlvtlv = -1;
1268 static gint ett_docsis_dpd_tlv_subcarrier_assignment = -1;
1269 static gint ett_docsis_dpd_tlv_subcarrier_assignment_vector = -1;
1270
1271 static gint ett_docsis_optreq = -1;
1272 static gint ett_docsis_optreq_tlv = -1;
1273 static gint ett_docsis_optreq_tlvtlv = -1;
1274 static gint ett_docsis_optreq_tlv_rxmer_thresh_params = -1;
1275 static gint ett_docsis_optreq_tlv_rxmer_thresh_params_tlv = -1;
1276
1277 static gint ett_docsis_optrsp = -1;
1278 static gint ett_docsis_optrsp_tlv = -1;
1279 static gint ett_docsis_optrsp_tlvtlv = -1;
1280 static gint ett_docsis_optrsp_tlv_rxmer_snr_margin_data = -1;
1281 static gint ett_docsis_optrsp_tlv_rxmer_snr_margin_tlv =-1;
1282
1283 static gint ett_docsis_optack = -1;
1284
1285 static gint ett_docsis_mgmt = -1;
1286 static gint ett_mgmt_pay = -1;
1287
1288 static gint ett_docsis_tlv_fragments = -1;
1289 static gint ett_docsis_tlv_fragment = -1;
1290 static gint ett_docsis_tlv_reassembled = -1;
1291
1292 static expert_field ei_docsis_mgmt_tlvlen_bad = EI_INIT;
1293 static expert_field ei_docsis_mgmt_tlvtype_unknown = EI_INIT;
1294 static expert_field ei_docsis_mgmt_version_unknown = EI_INIT;
1295
1296 static dissector_table_t docsis_mgmt_dissector_table;
1297 static dissector_handle_t docsis_tlv_handle;
1298 static dissector_handle_t docsis_ucd_handle;
1299
1300 static const value_string channel_tlv_vals[] = {
1301   {UCD_SYMBOL_RATE,  "Symbol Rate"},
1302   {UCD_FREQUENCY,    "Frequency"},
1303   {UCD_PREAMBLE,     "Preamble Pattern"},
1304   {UCD_BURST_DESCR,  "Burst Descriptor Type 4"},
1305   {UCD_BURST_DESCR5, "Burst Descriptor Type 5"},
1306   {UCD_EXT_PREAMBLE, "Extended Preamble Pattern"},
1307   {UCD_SCDMA_MODE_ENABLED, "S-CDMA Mode Enabled"},
1308   {UCD_SCDMA_SPREADING_INTERVAL, "S-CDMA Spreading Intervals per Frame"},
1309   {UCD_SCDMA_CODES_PER_MINI_SLOT, "S-CDMA Codes per Mini-slot"},
1310   {UCD_SCDMA_ACTIVE_CODES, "S-CDMA Number of Active Codes"},
1311   {UCD_SCDMA_CODE_HOPPING_SEED, "S-CDMA Code Hopping Seed"},
1312   {UCD_SCDMA_US_RATIO_NUM, "S-CDMA US ratio numerator M"},
1313   {UCD_SCDMA_US_RATIO_DENOM, "S-CDMA US ratio denominator N"},
1314   {UCD_SCDMA_TIMESTAMP_SNAPSHOT, "S-CDMA Timestamp Snapshot"},
1315   {UCD_MAINTAIN_POWER_SPECTRAL_DENSITY, "Maintain Power Spectral Density"},
1316   {UCD_RANGING_REQUIRED, "Ranging Required"},
1317   {UCD_MAX_SCHEDULED_CODES, "S-CDMA Maximum Scheduled Codes"},
1318   {UCD_RANGING_HOLD_OFF_PRIORITY_FIELD, "Ranging Hold-Off Priority Field"},
1319   {UCD_RANGING_CHANNEL_CLASS_ID, "Ranging Channel Class ID"},
1320   {UCD_SCDMA_SELECTION_ACTIVE_CODES_AND_CODE_HOPPING, "S-CDMA Selection Mode for Active Codes and Code Hopping"},
1321   {UCD_SCDMA_SELECTION_STRING_FOR_ACTIVE_CODES, "S-CDMA Selection String for Active Codes"},
1322   {UCD_HIGHER_UCD_FOR_SAME_UCID,        "Higher UCD for the same UCID present bitmap"},
1323   {UCD_BURST_DESCR23,                   "Burst Descriptor Type 23"},
1324   {UCD_CHANGE_IND_BITMASK,              "UCD Change Indicator Bitmask"},
1325   {UCD_OFDMA_TIMESTAMP_SNAPSHOT,        "OFDMA Timestamp Snapshot"},
1326   {UCD_OFDMA_CYCLIC_PREFIX_SIZE,        "OFDMA Cyclic Prefix Size"},
1327   {UCD_OFDMA_ROLLOFF_PERIOD_SIZE,       "OFDMA Rolloff Period Size"},
1328   {UCD_SUBCARRIER_SPACING,              "Subcarrier Spacing"},
1329   {UCD_CENTER_FREQ_SUBC_0,              "Center Frequency of Subcarrier 0"},
1330   {UCD_SUBC_EXCL_BAND,                  "Subcarrier Exclusion Band"},
1331   {UCD_UNUSED_SUBC_SPEC,                "Unused Subcarrier Specification"},
1332   {UCD_SYMB_IN_OFDMA_FRAME,             "Symbols in OFDMA frame"},
1333   {UCD_RAND_SEED,                       "Randomization Seed"},
1334   {0, NULL}
1335 };
1336
1337 static const value_string burst_tlv_vals[] = {
1338   {UCD_MODULATION,                      "Modulation Type"},
1339   {UCD_DIFF_ENCODING,                   "Differential Encoding"},
1340   {UCD_PREAMBLE_LEN,                    "Preamble Length"},
1341   {UCD_PREAMBLE_VAL_OFF,                "Preamble Value Offset"},
1342   {UCD_FEC,                             "FEC Error Correction (T)"},
1343   {UCD_FEC_CODEWORD,                    "FEC Codeword Information Bytes (k)"},
1344   {UCD_SCRAMBLER_SEED,                  "Scrambler Seed"},
1345   {UCD_MAX_BURST,                       "Maximum Burst Size"},
1346   {UCD_GUARD_TIME,                      "Guard Time Size"},
1347   {UCD_LAST_CW_LEN,                     "Last Codeword Length"},
1348   {UCD_SCRAMBLER_ONOFF,                 "Scrambler on/off"},
1349   {UCD_RS_INT_DEPTH,                    "R-S Interleaver Depth (Ir)"},
1350   {UCD_RS_INT_BLOCK,                    "R-S Interleaver Block Size (Br)"},
1351   {UCD_PREAMBLE_TYPE,                   "Preamble Type"},
1352   {UCD_SCMDA_SCRAMBLER_ONOFF,           "S-CDMA Spreader on/off"},
1353   {UCD_SCDMA_CODES_PER_SUBFRAME,        "S-CDMA Codes per Subframe"},
1354   {UCD_SCDMA_FRAMER_INT_STEP_SIZE,      "S-CDMA Framer Interleaving Step Size"},
1355   {UCD_TCM_ENABLED,                     "TCM Encoding"},
1356   {UCD_SUBC_INIT_RANG,                  "Subcarriers (Nir) Initial Ranging"},
1357   {UCD_SUBC_FINE_RANG,                  "Subcarriers (Nfr) Fine Ranging"},
1358   {UCD_OFDMA_PROFILE,                   "OFDMA Profile"},
1359   {UCD_OFDMA_IR_POWER_CONTROL,          "OFDMA Power Control (Ir)"},
1360   {0, NULL}
1361 };
1362
1363 static const value_string mgmt_type_vals[] = {
1364   {MGT_SYNC,           "Timing Synchronisation"},
1365   {MGT_UCD,            "Upstream Channel Descriptor"},
1366   {MGT_TYPE29UCD,      "Upstream Channel Descriptor Type 29"},
1367   {MGT_TYPE35UCD,      "Upstream Channel Descriptor Type 35"},
1368   {MGT_MAP,            "Upstream Bandwidth Allocation"},
1369   {MGT_RNG_REQ,        "Ranging Request"},
1370   {MGT_RNG_RSP,        "Ranging Response"},
1371   {MGT_REG_REQ,        "Registration Request"},
1372   {MGT_REG_RSP,        "Registration Response"},
1373   {MGT_UCC_REQ,        "Upstream Channel Change Request"},
1374   {MGT_UCC_RSP,        "Upstream Channel Change Response"},
1375   {MGT_TRI_TCD,        "Telephony Channel Descriptor"},
1376   {MGT_TRI_TSI,        "Termination System Information"},
1377   {MGT_BPKM_REQ,       "Privacy Key Management Request"},
1378   {MGT_BPKM_RSP,       "Privacy Key Management Response"},
1379   {MGT_REG_ACK,        "Registration Acknowledge"},
1380   {MGT_DSA_REQ,        "Dynamic Service Addition Request"},
1381   {MGT_DSA_RSP,        "Dynamic Service Addition Response"},
1382   {MGT_DSA_ACK,        "Dynamic Service Addition  Acknowledge"},
1383   {MGT_DSC_REQ,        "Dynamic Service Change Request"},
1384   {MGT_DSC_RSP,        "Dynamic Service Change Response"},
1385   {MGT_DSC_ACK,        "Dynamic Service Change Acknowledge"},
1386   {MGT_DSD_REQ,        "Dynamic Service Delete Request"},
1387   {MGT_DSD_RSP,        "Dynamic Service Delete Response"},
1388   {MGT_DCC_REQ,        "Dynamic Channel Change Request"},
1389   {MGT_DCC_RSP,        "Dynamic Channel Change Response"},
1390   {MGT_DCC_ACK,        "Dynamic Channel Change Acknowledge"},
1391   {MGT_DCI_REQ,        "Device Class Identification Request"},
1392   {MGT_DCI_RSP,        "Device Class Identification Response"},
1393   {MGT_UP_DIS,         "Upstream Channel Disable"},
1394   {MGT_INIT_RNG_REQ,   "Initial Ranging Request"},
1395   {MGT_TEST_REQ,       "Test Request Message"},
1396   {MGT_DS_CH_DESC,     "Downstream Channel Descriptor"},
1397   {MGT_MDD,            "MAC Domain Descriptor"},
1398   {MGT_B_INIT_RNG_REQ, "Bonded Initial Ranging Request"},
1399   {MGT_DBC_REQ,        "Dynamic Bonding Change Request"},
1400   {MGT_DBC_RSP,        "Dynamic Bonding Change Response"},
1401   {MGT_DBC_ACK,        "Dynamic Bonding Change Acknowledge"},
1402   {MGT_DPV_REQ,        "DOCSIS Path Verify Request"},
1403   {MGT_DPV_RSP,        "DOCSIS Path Verify Response"},
1404   {MGT_CM_STATUS,      "CM Status Report"},
1405   {MGT_CM_CTRL_REQ,    "CM Control Request"},
1406   {MGT_CM_CTRL_RSP,    "CM Control Response"},
1407   {MGT_REG_REQ_MP,     "Multipart Registration Request"},
1408   {MGT_REG_RSP_MP,     "Multipart Registration Response"},
1409   {MGT_EM_REQ,         "Energy Management Request"},
1410   {MGT_EM_RSP,         "Energy Management Response"},
1411   {MGT_CM_STATUS_ACK,     "Status Report Acknowledge"},
1412   {MGT_OCD,            "OFDM Channel Descriptor"},
1413   {MGT_DPD,            "Downstream Profile Descriptor"},
1414   {MGT_TYPE51UCD,      "Upstream Channel Descriptor Type 51"},
1415   {MGT_ODS_REQ,        "ODS-REQ"},
1416   {MGT_ODS_RSP,        "ODS-RSP"},
1417   {MGT_OPT_REQ,        "OFDM Downstream Profile Test Request"},
1418   {MGT_OPT_RSP,        "OFDM Downstream Profile Test Response"},
1419   {MGT_OPT_ACK,        "OFDM Downstream Profile Test Acknowledge"},
1420   {MGT_OPT_ACK,        "OFDM Downstream Profile Test Acknowledge"},
1421   {MGT_DPT_REQ,        "DOCSIS Time Protocol Request"},
1422   {MGT_DPT_RSP,        "DOCSIS Time Protocol Response"},
1423   {MGT_DPT_ACK,        "DOCSIS Time Protocol Acknowledge"},
1424   {MGT_DPT_INFO,       "DOCSIS Time Protocol Information"},
1425   {0, NULL}
1426 };
1427
1428 static const value_string on_off_vals[] = {
1429   {1, "On"},
1430   {2, "Off"},
1431   {0, NULL}
1432 };
1433
1434 static const value_string inhibit_allow_vals[] = {
1435   {0, "Inhibit Initial Ranging"},
1436   {1, "Ranging Allowed"},
1437   {0, NULL},
1438 };
1439
1440 static const value_string mod_vals[] = {
1441   {1, "QPSK"},
1442   {2, "16-QAM"},
1443   {3, "8-QAM"},
1444   {4, "32-QAM"},
1445   {5, "64-QAM"},
1446   {6, "128-QAM (SCDMA-only)"},
1447   {7, "Reserved for C-DOCSIS"},
1448   {0, NULL}
1449 };
1450
1451 static const value_string iuc_vals[] = {
1452   {IUC_REQUEST,                  "Request"},
1453   {IUC_REQ_DATA,                 "REQ/Data"},
1454   {IUC_INIT_MAINT,               "Initial Maintenance"},
1455   {IUC_STATION_MAINT,            "Station Maintenance"},
1456   {IUC_SHORT_DATA_GRANT,         "Short Data Grant"},
1457   {IUC_LONG_DATA_GRANT,          "Long Data Grant"},
1458   {IUC_NULL_IE,                  "NULL IE"},
1459   {IUC_DATA_ACK,                 "Data Ack"},
1460   {IUC_ADV_PHY_SHORT_DATA_GRANT, "Advanced Phy Short Data Grant"},
1461   {IUC_ADV_PHY_LONG_DATA_GRANT,  "Advanced Phy Long Data Grant"},
1462   {IUC_ADV_PHY_UGS,              "Advanced Phy UGS"},
1463   {IUC_DATA_PROFILE_IUC12,       "Data Profile IUC12"},
1464   {IUC_DATA_PROFILE_IUC13,       "Data Profile IUC13"},
1465   {IUC_RESERVED14,               "Reserved"},
1466   {IUC_EXPANSION,                "Expanded IUC"},
1467   {0, NULL}
1468 };
1469
1470 static const true_false_string mer_vals = {"measure RxMER at the CMTS on this probe", "do not measure RxMER at the CMTS on this probe"};
1471
1472 static const true_false_string pw_vals = {"transmit using alternate power setting specified by the Start Subc field.", "transmit using normal power settings"};
1473
1474 static const true_false_string eq_vals = {"equalizer disabled", "equalizer enabled"};
1475
1476 static const true_false_string st_vals = {"stagger", "no stagger"};
1477
1478 static const value_string last_cw_len_vals[] = {
1479   {1, "Fixed"},
1480   {2, "Shortened"},
1481   {0, NULL}
1482 };
1483
1484 static const value_string ranging_req_vals[] = {
1485   {0, "No ranging required"},
1486   {1, "Unicast initial ranging required"},
1487   {2, "Broadcast initial ranging required"},
1488   {0, NULL}
1489 };
1490
1491 static const value_string rng_stat_vals[] = {
1492   {1, "Continue"},
1493   {2, "Abort"},
1494   {3, "Success"},
1495   {0, NULL}
1496 };
1497
1498 static void
1499 two_compl_frac(
1500     char *buf,
1501     gint16 value)
1502 {
1503     gint16 frac = value;
1504
1505
1506     g_snprintf(buf, ITEM_LABEL_LENGTH,
1507         "%f",
1508         frac/16384.0);
1509 }
1510
1511 static const value_string rngrsp_tlv_vals[] = {
1512   {RNGRSP_TIMING,            "Timing Adjust (6.25us/64)"},
1513   {RNGRSP_PWR_LEVEL_ADJ,     "Power Level Adjust (0.25dB units)"},
1514   {RNGRSP_OFFSET_FREQ_ADJ,   "Offset Freq Adjust (Hz)"},
1515   {RNGRSP_TRANSMIT_EQ_ADJ,   "Transmit Equalisation Adjust"},
1516   {RNGRSP_RANGING_STATUS,    "Ranging Status"},
1517   {RNGRSP_DOWN_FREQ_OVER,    "Downstream Frequency Override (Hz)"},
1518   {RNGRSP_UP_CHID_OVER,      "Upstream Channel ID Override"},
1519   {RNGRSP_T4_TIMEOUT_MULTIPLIER, "T4 Timeout Multiplier"},
1520   {RNGRSP_DYNAMIC_RANGE_WINDOW_UPPER_EDGE, "Dynamic Range Window Upper Edge"},
1521   {RNGRSP_TRANSMIT_EQ_ADJUST_OFDMA_CHANNELS, "Transmit Equalization Adjust for OFDMA Channels"},
1522   {RNGRSP_TRANSMIT_EQ_SET_OFDMA_CHANNELS, "Transmit Equalization Set for OFDMA Channels"},
1523   {RNGRSP_COMMANDED_POWER, "Commanded Power"},
1524   {0, NULL}
1525 };
1526
1527
1528 static const value_string rngrsp_tlv_commanded_power_subtlv_vals[] = {
1529   {RNGRSP_COMMANDED_POWER_DYNAMIC_RANGE_WINDOW, "Dynamic Range Window"},
1530   {RNGRSP_COMMANDED_POWER_UCID_AND_POWER_LEVEL_LIST, "List of Upstream Channel IDs and Corresponding Transmit Power Levels"},
1531   {0, NULL}
1532 };
1533
1534 static const value_string code_field_vals[] = {
1535   { 0, "Reserved"},
1536   { 1, "Reserved"},
1537   { 2, "Reserved"},
1538   { 3, "Reserved"},
1539   { 4, "Auth Request"},
1540   { 5, "Auth Reply"},
1541   { 6, "Auth Reject"},
1542   { 7, "Key Request"},
1543   { 8, "Key Reply"},
1544   { 9, "Key Reject"},
1545   {10, "Auth Invalid"},
1546   {11, "TEK Invalid"},
1547   {12, "Authent Info"},
1548   {13, "Map Request"},
1549   {14, "Map Reply"},
1550   {15, "Map Reject"},
1551   {0, NULL},
1552 };
1553
1554 static const value_string ds_mod_type_vals[] = {
1555   {0 , "64 QAM"},
1556   {1 , "256 QAM"},
1557   {0, NULL}
1558 };
1559
1560 static const value_string ds_sym_rate_vals[] = {
1561   {0 , "5.056941 Msym/sec"},
1562   {1 , "5.360537 Msym/sec"},
1563   {2 , "6.952 Msym/sec"},
1564   {0, NULL}
1565 };
1566 static const value_string init_tech_vals[] = {
1567   {0 , "Reinitialize MAC"},
1568   {1 , "Broadcast Init RNG on new chanbefore normal op"},
1569   {2 , "Unicast RNG on new chan before normal op"},
1570   {3 , "Either Unicast or broadcast RNG on new chan before normal op"},
1571   {4 , "Use new chan directly without re-init or RNG"},
1572   {0, NULL}
1573 };
1574
1575 static const value_string dcc_tlv_vals[] = {
1576   {DCCREQ_UP_CHAN_ID, "Up Channel ID"},
1577   {DCCREQ_DS_PARAMS, "Downstream Params Encodings"},
1578   {DCCREQ_INIT_TECH, "Initialization Technique"},
1579   {DCCREQ_UCD_SUB, "UCD Substitution"},
1580   {DCCREQ_SAID_SUB, "SAID Sub"},
1581   {DCCREQ_SF_SUB, "Service Flow Substitution Encodings"},
1582   {DCCREQ_CMTS_MAC_ADDR, "CMTS Mac Address"},
1583   {DCCREQ_KEY_SEQ_NUM, "Auth Key Sequence Number"},
1584   {DCCREQ_HMAC_DIGEST, "HMAC-DigestNumber"},
1585   {0, NULL}
1586 };
1587
1588 static const value_string ds_param_subtlv_vals[] = {
1589   {DCCREQ_DS_FREQ, "Frequency"},
1590   {DCCREQ_DS_MOD_TYPE, "Modulation Type"},
1591   {DCCREQ_DS_SYM_RATE, "Symbol Rate"},
1592   {DCCREQ_DS_INTLV_DEPTH, "Interleaver Depth"},
1593   {DCCREQ_DS_CHAN_ID, "Downstream Channel ID"},
1594   {DCCREQ_DS_SYNC_SUB, "SYNC Substitution"},
1595   {DCCREQ_DS_OFDM_BLOCK_FREQ, "OFDM Block Frequency"},
1596   {0, NULL}
1597 };
1598
1599 static const value_string sf_sub_subtlv_vals[] = {
1600   {DCCREQ_SF_SFID, "SFID"},
1601   {DCCREQ_SF_SID, "SID"},
1602   {DCCREQ_SF_UNSOL_GRANT_TREF, "Unsolicited Grant Time Reference"},
1603   {0, NULL}
1604 };
1605
1606 static const value_string dccrsp_tlv_vals[] = {
1607   {DCCRSP_CM_JUMP_TIME, "CM Jump Time Encodings"},
1608   {DCCRSP_KEY_SEQ_NUM, "Auth Key Sequence Number"},
1609   {DCCRSP_HMAC_DIGEST, "HMAC-Digest Number"},
1610   {0, NULL}
1611 };
1612
1613 static const value_string cm_jump_subtlv_vals[] = {
1614   {DCCRSP_CM_JUMP_TIME_LENGTH, "Length of Jump"},
1615   {DCCRSP_CM_JUMP_TIME_START, "Start Time of Jump"},
1616   {0, NULL}
1617 };
1618
1619 static const value_string dccack_tlv_vals[] = {
1620   {DCCACK_HMAC_DIGEST, "HMAC-DigestNumber"},
1621   {DCCACK_KEY_SEQ_NUM, "Auth Key Sequence Number"},
1622   {0, NULL}
1623 };
1624
1625 static const value_string max_scheduled_codes_vals[] = {
1626   {1, "Enabled"},
1627   {2, "Disabled"},
1628   {0, NULL}
1629 };
1630
1631 static const value_string dcd_tlv_vals[] = {
1632   {DCD_DOWN_CLASSIFIER, "DCD_CFR Encodings"},
1633   {DCD_DSG_RULE, "DCD DSG Rule Encodings"},
1634   {DCD_DSG_CONFIG, "DCD DSG Config Encodings"},
1635   {0, NULL}
1636 };
1637
1638 static const value_string dcd_down_classifier_vals[] = {
1639   {DCD_CFR_ID, "Downstream Classifier Id"},
1640   {DCD_CFR_RULE_PRI, "Downstream Classifier Rule Priority"},
1641   {DCD_CFR_IP_CLASSIFIER, "DCD_CFR_IP Encodings"},
1642   {0, NULL}
1643 };
1644
1645 static const value_string dcd_dsg_rule_vals[] = {
1646   {DCD_RULE_ID, "DSG Rule Id"},
1647   {DCD_RULE_PRI, "DSG Rule Priority"},
1648   {DCD_RULE_UCID_RNG, "DSG Rule UCID Range"},
1649   {DCD_RULE_CLIENT_ID, "DCD Rule ClientID Encodings"},
1650   {DCD_RULE_TUNL_ADDR, "DSG Rule Tunnel MAC Address"},
1651   {DCD_RULE_CFR_ID, "DSG Rule Classifier ID"},
1652   {DCD_RULE_VENDOR_SPEC, "DSG Rule Vendor Specific Parameters"},
1653   {0, NULL}
1654 };
1655
1656 static const value_string dcd_clid_vals[] = {
1657   {DCD_CLID_BCAST_ID, "DSG Rule Client ID Broadcast ID"},
1658   {DCD_CLID_KNOWN_MAC_ADDR, "DSG Rule Client ID Known MAC Address"},
1659   {DCD_CLID_CA_SYS_ID, "DSG Rule Client ID CA System ID"},
1660   {DCD_CLID_APP_ID, "DSG Rule Client ID Application ID"},
1661   {0, NULL}
1662 };
1663
1664 static const value_string dcd_cfr_ip_vals[] = {
1665   {DCD_CFR_IP_SOURCE_ADDR, "Downstream Classifier IP Source Address"},
1666   {DCD_CFR_IP_SOURCE_MASK, "Downstream Classifier IP Source Mask"},
1667   {DCD_CFR_IP_DEST_ADDR, "Downstream Classifier IP Destination Address"},
1668   {DCD_CFR_IP_DEST_MASK, "Downstream Classifier IP Destination Mask"},
1669   {DCD_CFR_TCPUDP_SRCPORT_START, "Downstream Classifier IP TCP/UDP Source Port Start"},
1670   {DCD_CFR_TCPUDP_SRCPORT_END, "Downstream Classifier IP TCP/UDP Source Port End"},
1671   {DCD_CFR_TCPUDP_DSTPORT_START, "Downstream Classifier IP TCP/UDP Destination Port Start"},
1672   {DCD_CFR_TCPUDP_DSTPORT_END, "Downstream Classifier IP TCP/UDP Destination Port End"},
1673   {0, NULL}
1674 };
1675
1676 static const value_string dcd_cfg_vals[] = {
1677   {DCD_CFG_CHAN_LST, "DSG Configuration Channel"},
1678   {DCD_CFG_TDSG1, "DSG Initialization Timeout (Tdsg1)"},
1679   {DCD_CFG_TDSG2, "DSG Initialization Timeout (Tdsg2)"},
1680   {DCD_CFG_TDSG3, "DSG Initialization Timeout (Tdsg3)"},
1681   {DCD_CFG_TDSG4, "DSG Initialization Timeout (Tdsg4)"},
1682   {DCD_CFG_VENDOR_SPEC, "DSG Configuration Vendor Specific Parameters"},
1683   {0, NULL}
1684 };
1685
1686 static const value_string J83_annex_vals[] = {
1687   {J83_ANNEX_A, "J.83 Annex A"},
1688   {J83_ANNEX_B, "J.83 Annex B"},
1689   {J83_ANNEX_C, "J.83 Annex C"},
1690   {0, NULL}
1691 };
1692
1693 static const value_string modulation_order_vals[] = {
1694   {QAM64,  "64 QAM"},
1695   {QAM256, "256 QAM"},
1696   {0, NULL}
1697 };
1698
1699 static const value_string primary_capable_vals[] = {
1700   {NOT_PRIMARY_CAPABLE, "Channel is not primary-capable"},
1701   {PRIMARY_CAPABLE,     "channel is primary-capable"},
1702   {0, NULL}
1703 };
1704
1705 static const value_string map_ucd_transport_indicator_vals[] = {
1706   {CANNOT_CARRY_MAP_UCD, "Channel cannot carry MAPs and UCDs for the MAC domain for which the MDD is sent"},
1707   {CAN_CARRY_MAP_UCD,    "Channel can carry MAPs and UCDs for the MAC domain for which the MDD is sent"},
1708   {0, NULL}
1709 };
1710
1711 static const value_string tukey_raised_cosine_vals[] = {
1712   {TUKEY_0TS,   "0 microseconds (0 * Ts)"},
1713   {TUKEY_64TS,  "0.3125 microseconds (64 * Ts)"},
1714   {TUKEY_128TS, "0.625 microseconds (128 * Ts)"},
1715   {TUKEY_192TS, "0.9375 microseconds (192 * Ts)"},
1716   {TUKEY_256TS, "1.25 microseconds (256 * Ts)"},
1717   {0, NULL}
1718 };
1719
1720 static const value_string cyclic_prefix_vals[] = {
1721   {CYCLIC_PREFIX_192_TS,  "0.9375 microseconds (192 * Ts)"},
1722   {CYCLIC_PREFIX_256_TS,  "1.25 microseconds (256 * Ts)"},
1723   {CYCLIC_PREFIX_512_TS,  "2.5 microseconds (512 * Ts) 3"},
1724   {CYCLIC_PREFIX_768_TS,  "3.75 microseconds (768 * Ts)"},
1725   {CYCLIC_PREFIX_1024_TS, "5 microseconds (1024 * Ts)"},
1726   {0, NULL}
1727 };
1728
1729 static const value_string spacing_vals[] = {
1730   {SPACING_25KHZ, "25Khz"},
1731   {SPACING_50KHZ, "50Khz"},
1732   {0, NULL}
1733 };
1734
1735 static const value_string bpkmattr_tlv_vals[] = {
1736   {BPKM_RESERVED,           "Reserved"},
1737   {BPKM_SERIAL_NUM,         "Serial Number"},
1738   {BPKM_MANUFACTURER_ID,    "Manufacturer Id"},
1739   {BPKM_MAC_ADDR,           "Mac Address"},
1740   {BPKM_RSA_PUB_KEY,        "RSA Public Key"},
1741   {BPKM_CM_ID,              "CM Identification"},
1742   {BPKM_DISPLAY_STR,        "Display String"},
1743   {BPKM_AUTH_KEY,           "Auth Key"},
1744   {BPKM_TEK,                "Traffic Encryption Key"},
1745   {BPKM_KEY_LIFETIME,       "Key Lifetime"},
1746   {BPKM_KEY_SEQ_NUM,        "Key Sequence Number"},
1747   {BPKM_HMAC_DIGEST,        "HMAC Digest"},
1748   {BPKM_SAID,               "SAID"},
1749   {BPKM_TEK_PARAM,          "TEK Parameters"},
1750   {BPKM_OBSOLETED,          "Obsoleted"},
1751   {BPKM_CBC_IV,             "CBC IV"},
1752   {BPKM_ERROR_CODE,         "Error Code"},
1753   {BPKM_CA_CERT,            "CA Certificate"},
1754   {BPKM_CM_CERT,            "CM Certificate"},
1755   {BPKM_SEC_CAPABILITIES,   "Security Capabilities"},
1756   {BPKM_CRYPTO_SUITE,       "Cryptographic Suite"},
1757   {BPKM_CRYPTO_SUITE_LIST,  "Cryptographic Suite List"},
1758   {BPKM_BPI_VERSION,        "BPI Version"},
1759   {BPKM_SA_DESCRIPTOR,      "SA Descriptor"},
1760   {BPKM_SA_TYPE,            "SA Type"},
1761   {BPKM_SA_QUERY,           "SA Query"},
1762   {BPKM_SA_QUERY_TYPE,      "SA Query Type"},
1763   {BPKM_IP_ADDRESS,         "IP Address"},
1764   {BPKM_DNLD_PARAMS,        "Download Parameters"},
1765   {BPKM_VENDOR_DEFINED,     "Vendor Defined"},
1766   {0, NULL}
1767 };
1768
1769 static const value_string error_code_vals[] = {
1770   {0, "No Information"},
1771   {1, "Unauthorized CM"},
1772   {2, "Unauthorized SAID"},
1773   {3, "Unsolicited"},
1774   {4, "Invalid Key Sequence Number"},
1775   {5, "Message (Key Request) authentication failure"},
1776   {6, "Permanent Authorization Failure"},
1777   {7, "Not authorized for requested downstream traffic flow"},
1778   {8, "Downstream traffic flow not mapped to SAID"},
1779   {9, "Time of day not acquired"},
1780   {10, "EAE Disabled"},
1781   {0, NULL},
1782 };
1783
1784 static const value_string crypto_suite_attr_vals[] = {
1785   {0x0100, "CBC-Mode 56-bit DES, no data authentication"},
1786   {0x0200, "CBC-Mode 40-bit DES, no data authentication"},
1787   {0x0300, "CBC-Mode 128-bit AES, no data authentication"},
1788   {0, NULL},
1789 };
1790
1791 static const value_string bpi_ver_vals[] = {
1792   {0, "Reserved"},
1793   {1, "BPI+"},
1794   {0, NULL},
1795 };
1796
1797 static const value_string mdd_tlv_vals[] = {
1798   {DOWNSTREAM_ACTIVE_CHANNEL_LIST,                       "Downstream Active Channel List"},
1799   {MAC_DOMAIN_DOWNSTREAM_SERVICE_GROUP,                  "Mac Domain Downstream Service Group"},
1800   {DOWNSTREAM_AMBIGUITY_RESOLUTION_FREQUENCY_LIST,       "Downstream Ambiguity Resolution Frequency List "},
1801   {RECEIVE_CHANNEL_PROFILE_REPORTING_CONTROL ,           "Receive Channel Profile Reporting Control"},
1802   {IP_INITIALIZATION_PARAMETERS ,                        "IP Initialization Parameters"},
1803   {EARLY_AUTHENTICATION_AND_ENCRYPTION ,                 "Early Authentication and Encryption"},
1804   {UPSTREAM_ACTIVE_CHANNEL_LIST ,                        "Upstream Active Channel List"},
1805   {UPSTREAM_AMBIGUITY_RESOLUTION_CHANNEL_LIST ,          "Upstream Ambiguity Resolution Channel List"},
1806   {UPSTREAM_FREQUENCY_RANGE  ,                           "Upstream Frequency Range"},
1807   {SYMBOL_CLOCK_LOCKING_INDICATOR  ,                     "Symbol Clock Locking Indicator"},
1808   {CM_STATUS_EVENT_CONTROL  ,                            "CM-STATUS Event Control"},
1809   {UPSTREAM_TRANSMIT_POWER_REPORTING  ,                  "Upstream Transmit Power Reporting"},
1810   {DSG_DA_TO_DSID_ASSOCIATION_ENTRY  ,                   "DSG DA-to-DSID Association Entry"},
1811   {CM_STATUS_EVENT_ENABLE_NON_CHANNEL_SPECIFIC_EVENTS  , "CM-STATUS Event Enable for Non-Channel-Specific-Events"},
1812   {EXTENDED_UPSTREAM_TRANSMIT_POWER_SUPPORT  ,           "Extended Upstream Transmit Power Support"},
1813   {CMTS_DOCSIS_VERSION  ,                                "CMTS DOCSIS Version"},
1814   {CM_PERIODIC_MAINTENANCE_TIMEOUT_INDICATOR  ,          "CM Periodic Maintenance Timeout Indicator"},
1815   {DLS_BROADCAST_AND_MULTICAST_DELIVERY_METHOD  ,        "DLS Broadcast and Multicast Delivery Method"},
1816   {CM_STATUS_EVENT_ENABLE_FOR_DOCSIS_3_1_EVENTS  ,       "CM-STATUS Event Enable for DOCSIS 3.1 Specific Events"},
1817   {DIPLEXER_BAND_EDGE  ,                                 "Diplexer Band Edge"},
1818   {FULL_DUPLEX_DESCRIPTOR  ,                             "Full Duplex Descriptor"},
1819   {0, NULL}
1820 };
1821
1822
1823 static const value_string rpc_center_frequency_spacing_vals[] = {
1824   {ASSUME_6MHZ_CENTER_FREQUENCY_SPACING  , "CM MUST report only Receive Channel Profiles assuming 6 MHz center frequency spacing"},
1825   {ASSUME_8MHZ_CENTER_FREQUENCY_SPACING  , "CM MUST report only Receive Channel Profiles assuming 8 MHz center frequency spacing"},
1826   {0, NULL}
1827 };
1828
1829 static const value_string verbose_rpc_reporting_vals[] = {
1830   {RCP_NO_VERBOSE_REPORTING  , "CM MUST NOT provide verbose reporting of all its Receive Channel Profile(s) (both standard profiles and manufacturers profiles)."},
1831   {RCP_VERBOSE_REPORTING  ,    "CM MUST provide verbose reporting of Receive Channel Profile(s) (both standard profiles and manufacturers profiles)."},
1832   {0, NULL}
1833 };
1834
1835 static const value_string ip_provisioning_mode_vals[] = {
1836   {IPv4_ONLY  ,  "IPv4 Only"},
1837   {IPv6_ONLY ,   "IPv6 Only"},
1838   {IP_ALTERNATE, "Alternate"},
1839   {DUAL_STACK ,  "Dual Stack"},
1840   {0, NULL}
1841 };
1842
1843 static const value_string eae_vals[] = {
1844   {EAE_DISABLED  , "early authentication and encryption disabled"},
1845   {EAE_ENABLED ,   "early authentication and encryption enabled"},
1846   {0, NULL}
1847 };
1848
1849 static const value_string upstream_frequency_range_vals[] = {
1850   {STANDARD_UPSTREAM_FREQUENCY_RANGE, "Standard Upstream Frequency Range"},
1851   {EXTENDED_UPSTREAM_FREQUENCY_RANGE, "Extended Upstream Frequency Range"},
1852   {0, NULL}
1853 };
1854
1855 static const value_string symbol_clock_locking_indicator_vals[] = {
1856   {NOT_LOCKED_TO_MASTER_CLOCK, "Symbol Clock is not locked to Master Clock"},
1857   {LOCKED_TO_MASTER_CLOCK,     "Symbol Clock is locked to Master Clock"},
1858   {0, NULL}
1859 };
1860
1861 static const value_string symbol_cm_status_event_vals[] = {
1862   {SECONDARY_CHANNEL_MDD_TIMEOUT,               "Secondary Channel MDD timeout"},
1863   {QAM_FEC_LOCK_FAILURE,                        "Qam FEC Lock Failure"},
1864   {SEQUENCE_OUT_OF_RANGE,                       "Sequence out of Range"},
1865   {MDD_RECOVERY,                                "MDD Recovery"},
1866   {QAM_FEC_LOCK_RECOVERY,                       "Qam FEC Lock Recovery"},
1867   {T4_TIMEOUT,                                  "T4 Timeout"},
1868   {T3_RETRIES_EXCEEDED,                         "T3 Retries Exceeded"},
1869   {SUCCESFUL_RANGING_AFTER_T3_RETRIES_EXCEEDED, "Successful ranging after T3 Retries Exceeded"},
1870   {CM_OPERATING_ON_BATTERY_BACKUP,              "CM Operating on Battery Backup"},
1871   {CM_RETURNED_TO_AC_POWER,                     "CM Returned to AC Power"},
1872   {0, NULL}
1873 };
1874
1875 static const value_string upstream_transmit_power_reporting_vals[] = {
1876   {CM_DOESNT_REPORT_TRANSMIT_POWER, "CM does not report transmit power in RNG-REQ, INIT-RNG-REQ, and B-INIT-RNG-REQ messages"},
1877   {CM_REPORTS_TRANSMIT_POWER,       "CM reports transmit power in RNG-REQ, INIT-RNG-REQ, and B-INIT-RNG-REQ messages"},
1878   {0, NULL}
1879 };
1880
1881 static const value_string cm_periodic_maintenance_timeout_indicator_vals[] = {
1882   {0, "use Unicast Ranging opportunity"},
1883   {1, "use Probe opportunity"},
1884   {2, "use Unicast Ranging or Probe opportunity"},
1885   {0, NULL}
1886 };
1887
1888 static const value_string dls_broadcast_and_multicast_delivery_method_vals[] = {
1889   {1, "delayed selected multicast method"},
1890   {2, "selectively replicated multicast method"},
1891   {0, NULL}
1892 };
1893
1894
1895 static const value_string mdd_ds_active_channel_list_vals[] = {
1896   {DOWNSTREAM_ACTIVE_CHANNEL_LIST_CHANNEL_ID, "Channel ID"},
1897   {DOWNSTREAM_ACTIVE_CHANNEL_LIST_FREQUENCY, "Frequency"},
1898   {DOWNSTREAM_ACTIVE_CHANNEL_LIST_MODULATION_ORDER_ANNEX, "Annex/Modulation Order"},
1899   {DOWNSTREAM_ACTIVE_CHANNEL_LIST_PRIMARY_CAPABLE, "Primary Capable"},
1900   {DOWNSTREAM_ACTIVE_CHANNEL_LIST_CM_STATUS_EVENT_ENABLE_BITMASK, "CM-STATUS Event Enable Bitmask"},
1901   {DOWNSTREAM_ACTIVE_CHANNEL_LIST_MAP_UCD_TRANSPORT_INDICATOR, "MAP and UCD transport indicator"},
1902   {DOWNSTREAM_ACTIVE_CHANNEL_LIST_OFDM_PLC_PARAMETERS, "OFDM PLC Parameters"},
1903   {0, NULL}
1904 };
1905
1906 static const value_string mdd_ds_service_group_vals[] = {
1907   {MAC_DOMAIN_DOWNSTREAM_SERVICE_GROUP_MD_DS_SG_IDENTIFIER, "MD-DS-SG Identifier"},
1908   {MAC_DOMAIN_DOWNSTREAM_SERVICE_GROUP_CHANNEL_IDS,       "Channel Ids"},
1909   {0, NULL}
1910 };
1911
1912 static const value_string mdd_channel_profile_reporting_control_vals[] = {
1913   {RCP_CENTER_FREQUENCY_SPACING, "RPC Center Frequency Spacing"},
1914   {VERBOSE_RCP_REPORTING,       "Verbose RCP reporting"},
1915   {0, NULL}
1916 };
1917
1918 static const value_string mdd_ip_init_param_vals[] = {
1919   {IP_PROVISIONING_MODE, "IP Provisioning Mode"},
1920   {PRE_REGISTRATION_DSID, "Pre-registration DSID"},
1921   {0, NULL}
1922 };
1923
1924 static const value_string mdd_up_active_channel_list_vals[] = {
1925   {UPSTREAM_ACTIVE_CHANNEL_LIST_UPSTREAM_CHANNEL_ID, "Upstream Channel Id"},
1926   {UPSTREAM_ACTIVE_CHANNEL_LIST_CM_STATUS_EVENT_ENABLE_BITMASK, "CM-STATUS Event Enable Bitmask"},
1927   {0, NULL}
1928 };
1929
1930 static const value_string mdd_cm_status_event_control_vals[] = {
1931   {EVENT_TYPE_CODE, "Event Type"},
1932   {MAXIMUM_EVENT_HOLDOFF_TIMER,    "Maximum Event Holdoff Timer"},
1933   {MAXIMUM_NUMBER_OF_REPORTS_PER_EVENT,    "Maximum Number of Reports per Event"},
1934   {0, NULL}
1935 };
1936
1937 static const value_string mdd_cm_dsg_da_to_dsid_vals[] = {
1938   {DSG_DA_TO_DSID_ASSOCIATION_DA, "Destination Address"},
1939   {DSG_DA_TO_DSID_ASSOCIATION_DSID, "DSID"},
1940   {0, NULL}
1941 };
1942
1943 static const value_string tlv20_vals[] = {
1944   {0, "Selectable active codes mode 1 enabled and code hopping disabled"},
1945   {1, "Selectable active codes mode 1 enabled and code hopping mode 1 enabled"},
1946   {2, "Selectable active codes mode 2 enabled and code hopping mode 2 enabled"},
1947   {3, "Selectable active codes mode 2 enabled and code hopping disabled"},
1948   {0, NULL}
1949 };
1950
1951 static const value_string mdd_diplexer_band_edge_vals[] = {
1952   {DIPLEXER_US_UPPER_BAND_EDGE, "Diplexer Upstream Upper Band Edge"},
1953   {DIPLEXER_DS_LOWER_BAND_EDGE, "Diplexer Downstream Lower Band Edge"},
1954   {DIPLEXER_DS_UPPER_BAND_EDGE, "Diplexer Downstream Upper Band Edge"},
1955   {0, NULL}
1956 };
1957
1958 static const value_string mdd_diplexer_us_upper_band_edge_vals[] = {
1959   {0, "Upstream Frequency Range up to 42 MHz"},
1960   {1, "Upstream Frequency Range up to 65 MHz"},
1961   {2, "Upstream Frequency Range up to 85 MHz"},
1962   {3, "Upstream Frequency Range up to 117 MHz"},
1963   {4, "Upstream Frequency Range up to 204 MHz"},
1964   {0, NULL}
1965 };
1966
1967 static const value_string mdd_diplexer_ds_lower_band_edge_vals[] = {
1968   {0, "Downstream Frequency Range starting from 108 MHz"},
1969   {1, "Downstream Frequency Range starting from 258 MHz"},
1970   {0, NULL}
1971 };
1972
1973 static const value_string mdd_diplexer_ds_upper_band_edge_vals[] = {
1974   {0, "Downstream Frequency Range up to 1218 MHz"},
1975   {1, "Downstream Frequency Range up to 1794 MHz"},
1976   {2, "Downstream Frequency Range up to 1002 MHz"},
1977   {0, NULL}
1978 };
1979
1980 static const value_string mdd_full_duplex_descriptor_vals[] = {
1981   {FDX_ALLOCATED_SPECTRUM, "Full Duplex Allocated Spectrum"},
1982   {FDX_TOTAL_NUMBER_OF_SUB_BANDS, "Total number of sub-bands"},
1983   {FDX_SUB_BAND_WIDTH, "Full Duplex Sub-band Width"},
1984   {FDX_SUB_BAND_DESCRIPTOR, "Full Duplex Sub-band Descriptor"},
1985   {0, NULL}
1986 };
1987
1988 static const value_string mdd_full_duplex_allocated_spectrum_vals[] = {
1989   {0, "96 MHz"},
1990   {1, "192 MHz"},
1991   {2, "288 MHz"},
1992   {3, "384 MHz"},
1993   {4, "576 MHz"},
1994   {0, NULL}
1995 };
1996
1997 static const value_string mdd_full_duplex_sub_band_width_vals[] = {
1998   {0, "96 MHz"},
1999   {1, "192 MHz"},
2000   {0, NULL}
2001 };
2002
2003 static const value_string mdd_full_duplex_sub_band_vals[] = {
2004   {FDX_SUB_BAND_ID, "Full Duplex Sub-band ID"},
2005   {FDX_SUB_BAND_OFFSET, "Full Duplex Sub-band Offset"},
2006   {0, NULL}
2007 };
2008
2009 static const value_string cmstatus_tlv_vals[] = {
2010   {EVENT_DS_CH_ID, "Downstream Channel ID"},
2011   {EVENT_US_CH_ID, "Upstream Channel ID"},
2012   {EVENT_DSID, "DSID"},
2013   {EVENT_DESCR, "Description"},
2014   {0, NULL}
2015 };
2016
2017 static const value_string cmctrlreq_tlv_vals[] = {
2018   {CM_CTRL_MUTE, "Upstream Channel RF Mute"},
2019   {CM_CTRL_MUTE_TIMEOUT, "RF Mute Timeout Interval"},
2020   {CM_CTRL_REINIT, "CM Reinitialize"},
2021   {CM_CTRL_DISABLE_FWD, "Disable Forwarding"},
2022   {CM_CTRL_DS_EVENT, "Override Downstream Events"},
2023   {CM_CTRL_US_EVENT, "Override Upstream Events"},
2024   {CM_CTRL_EVENT, "Override Non-Channel-Specific Events"},
2025   {0, NULL}
2026 };
2027
2028 static const value_string cmctrlreq_us_tlv_vals[] = {
2029   {US_EVENT_CH_ID, "Upstream Channel ID"},
2030   {US_EVENT_MASK, "Upstream Status Event Enable Bitmask"},
2031   {0, NULL}
2032 };
2033
2034 static const value_string cmctrlreq_ds_tlv_vals[] = {
2035   {DS_EVENT_CH_ID, "Downstream Channel ID"},
2036   {DS_EVENT_MASK,  "Downstream Status Event Enable Bitmask"},
2037   {0, NULL}
2038 };
2039
2040
2041 static const value_string docsis_ocd_subc_assign_type_str[] = {
2042   {0, "range, continuous"},
2043   {1, "range, skip by 1"},
2044   {2, "list"},
2045   {3, "reserved"},
2046   {0, NULL}
2047 };
2048
2049 static const value_string docsis_ocd_subc_assign_value_str[] = {
2050   {0, "specific value"},
2051   {1, "default value"},
2052   {0, NULL}
2053 };
2054
2055 static const value_string docsis_ocd_subc_assign_subc_type_str[] = {
2056   {1, "continuous pilot"},
2057   {16, "excluded subcarriers"},
2058   {20, "PLC, 16-QAM"},
2059   {0, NULL}
2060 };
2061
2062 static const value_string docsis_ocd_four_trans_size[] = {
2063   {0, "4096 subcarriers at 50 kHz spacing"},
2064   {1, "8192 subcarriers at 25 kHz spacing"},
2065   {0, NULL}
2066 };
2067
2068 static const value_string docsis_ocd_cyc_prefix[] = {
2069   {0, "0.9375 "UTF8_MICRO_SIGN"s with 192 samples"},
2070   {1, "1.25 "UTF8_MICRO_SIGN"s with 256 samples"},
2071   {2, "2.5 "UTF8_MICRO_SIGN"s with 512 samples"},
2072   {3, "3.75 "UTF8_MICRO_SIGN"s with 768 samples"},
2073   {4, "5.0 "UTF8_MICRO_SIGN"s with 1024 samples"},
2074   {0, NULL}
2075 };
2076
2077 static const value_string docsis_ocd_roll_off[] = {
2078   {0, "0 "UTF8_MICRO_SIGN"s with 0 samples"},
2079   {1, "0.3125 "UTF8_MICRO_SIGN"s with 64 samples"},
2080   {2, "0.625 "UTF8_MICRO_SIGN"s with 128 samples"},
2081   {3, "0.9375 "UTF8_MICRO_SIGN"s with 192 samples"},
2082   {4, "1.25 "UTF8_MICRO_SIGN"s with 256 samples"},
2083   {0, NULL}
2084 };
2085
2086 static const value_string docsis_ocd_prim_cap_ind_str[] = {
2087   {0, "channel is not primary capable"},
2088   {1, "channel is primary capable"},
2089   {0, NULL}
2090 };
2091
2092 static const value_string ocd_tlv_vals[] = {
2093   {DISCRETE_FOURIER_TRANSFORM_SIZE, "Discrete Fourier Transform Size"},
2094   {CYCLIC_PREFIX, "Cylic Prefix"},
2095   {ROLL_OFF, "Roll Off"},
2096   {OFDM_SPECTRUM_LOCATION, "OFDM Spectrum Location"},
2097   {TIME_INTERLEAVING_DEPTH, "Time Interleaving Depth"},
2098   {SUBCARRIER_ASSIGNMENT_RANGE_LIST, "Subcarrier Assignment Range/List"},
2099   {PRIMARY_CAPABILITY_INDICATOR, "Primary Capable Indicator"},
2100   {0, NULL}
2101 };
2102
2103 static const value_string docsis_dpd_subc_assign_type_str[] = {
2104   {0, "range, continuous"},
2105   {1, "range, skip by 1"},
2106   {2, "list"},
2107   {3, "reserved"},
2108   {0, NULL}
2109 };
2110
2111 static const value_string docsis_dpd_subc_assign_value_str[] = {
2112   {0, "specific value"},
2113   {1, "default value"},
2114   {0, NULL}
2115 };
2116
2117 static const value_string docsis_dpd_subc_assign_modulation_str[] = {
2118   {0, "zero-bit loaded"},
2119   {1, "reserved"},
2120   {2, "QPSK (for NCP profile only)"},
2121   {3, "reserved"},
2122   {4, "16-QAM"},
2123   {5, "reserved"},
2124   {6, "64-QAM"},
2125   {7, "128-QAM"},
2126   {8, "256-QAM"},
2127   {9, "512-QAM"},
2128   {10, "1024-QAM"},
2129   {11, "2048-QAM"},
2130   {12, "4096-QAM"},
2131   {13, "8192-QAM"},
2132   {14, "16384-QAM"},
2133   {15, "reserved"},
2134   {0, NULL}
2135 };
2136
2137 static const value_string docsis_dpd_tlv_subc_assign_vector_oddness_str[] = {
2138   {0, "N is even"},
2139   {1, "N is odd"},
2140   {0, NULL}
2141 };
2142
2143 static const value_string docsis_dpd_tlv_subc_assign_vector_modulation_str[] = {
2144   {0, "zero-bit loaded"},
2145   {1, "continuous pilot"},
2146   {2, "QPSK (for NCP profile only)"},
2147   {3, "reserved"},
2148   {4, "16-QAM"},
2149   {5, "reserved"},
2150   {6, "64-QAM"},
2151   {7, "128-QAM"},
2152   {8, "256-QAM"},
2153   {9, "512-QAM"},
2154   {10, "1024-QAM"},
2155   {11, "2048-QAM"},
2156   {12, "4096-QAM"},
2157   {13, "8192-QAM"},
2158   {14, "16384-QAM"},
2159   {15, "reserved"},
2160   {0, NULL}
2161 };
2162
2163 static const value_string dpd_tlv_vals[] = {
2164   {SUBCARRIER_ASSIGNMENT_RANGE_LIST, "Subcarrier Assignment Range/List"},
2165   {SUBCARRIER_ASSIGNMENT_VECTOR, "Subcarrier Assignment Vector"},
2166   {0, NULL}
2167 };
2168
2169 static const value_string ofdma_cyclic_prefix_size_vals[] = {
2170   {1, "96 samples"},
2171   {2, "128 samples"},
2172   {3, "160 samples"},
2173   {4, "192 samples"},
2174   {5, "224 samples"},
2175   {6, "256 samples"},
2176   {7, "288 samples"},
2177   {8, "320 samples"},
2178   {9, "384 samples"},
2179   {10, "512 samples"},
2180   {11, "640 samples"},
2181   {0, NULL}
2182 };
2183
2184 static const value_string ofdma_rolloff_period_size_vals[] = {
2185   {1, "0 samples"},
2186   {2, "32 samples"},
2187   {3, "64 samples"},
2188   {4, "96 samples"},
2189   {5, "128 samples"},
2190   {6, "160 samples"},
2191   {7, "192 samples"},
2192   {8, "224 samples"},
2193   {0, NULL}
2194 };
2195
2196 static const value_string subc_spacing_vals[] = {
2197   {1, "25 kHz (corresponds to 4096 subcarriers and 16 subcarriers per minislot)"},
2198   {2, "50 kHz (corresponds to 2048 subcarriers and 8 subcarriers per minislot)"},
2199   {0, NULL}
2200 };
2201
2202 static const value_string ofdma_prof_mod_order[] = {
2203   {0, "no bit-loading"},
2204   {1, "BPSK"},
2205   {2, "QPSK"},
2206   {3, "8-QAM"},
2207   {4, "16-QAM"},
2208   {5, "32-QAM"},
2209   {6, "64-QAM"},
2210   {7, "128-QAM"},
2211   {8, "256-QAM"},
2212   {9, "512-QAM"},
2213   {10, "1024-QAM"},
2214   {11, "2048-QAM"},
2215   {12, "4096-QAM"},
2216   {0, NULL}
2217 };
2218
2219 static const value_string profile_id_vals[] = {
2220   {0, "Profile A"},
2221   {1, "Profile B"},
2222   {2, "Profile C"},
2223   {3, "Profile D"},
2224   {4, "Profile E"},
2225   {5, "Profile F"},
2226   {6, "Profile G"},
2227   {7, "Profile H"},
2228   {8, "Profile I"},
2229   {9, "Profile J"},
2230   {10, "Profile K"},
2231   {11, "Profile L"},
2232   {12, "Profile M"},
2233   {13, "Profile N"},
2234   {14, "Profile O"},
2235   {15, "Profile P"},
2236   {254, "Profile for RxMER statistics only"},
2237   {255, "NCP Profile"},
2238   {0, NULL}
2239 };
2240
2241 static const value_string opt_opcode_vals[] = {
2242   {1, "Start"},
2243   {2, "Abort"},
2244   {0, NULL}
2245 };
2246
2247 static const value_string opt_status_vals[] = {
2248   {1, "Testing"},
2249   {2, "Profile already testing from another request"},
2250   {3, "No free profile resource on CM"},
2251   {4, "Maximum duration expired"},
2252   {5, "Aborted"},
2253   {6, "Complete"},
2254   {7, "Profile already assigned to the CM"},
2255   {0, NULL}
2256 };
2257
2258 static const value_string optreq_tlv_vals[] = {
2259   {OPT_REQ_REQ_STAT, "Requested Statistics"},
2260   {OPT_REQ_RXMER_THRESH_PARAMS, "RxMER Thresholding Parameters"},
2261   {0, NULL}
2262 };
2263
2264 static const value_string optreq_tlv_rxmer_thresh_params_vals[] = {
2265   {OPT_REQ_RXMER_THRESH_PARAMS_MODULATION_ORDER, "Modulation Order"},
2266   {0, NULL}
2267 };
2268
2269 static const value_string opreq_tlv_rxmer_thresh_params_mod_order[] = {
2270   {0, "reserved"},
2271   {1, "reserved"},
2272   {2, "QPSK"},
2273   {3, "reserved"},
2274   {4, "16-QAM"},
2275   {5, "reserved"},
2276   {6, "64-QAM"},
2277   {7, "128-QAM"},
2278   {8, "256-QAM"},
2279   {9, "512-QAM"},
2280   {10, "1024-QAM"},
2281   {11, "2048-QAM"},
2282   {12, "4096-QAM"},
2283   {13, "8192-QAM"},
2284   {14, "16384-QAM"},
2285   {15, "reserved"},
2286   {0, NULL}
2287 };
2288
2289 static const value_string optrsp_tlv_vals [] = {
2290   {OPT_RSP_RXMER_AND_SNR_MARGIN_DATA, "RxMER and SNR Margin Data"},
2291   {0, NULL}
2292 };
2293
2294 static const value_string optrsp_tlv_rxmer_snr_margin_vals [] = {
2295   {OPT_RSP_RXMER_PER_SUBCARRIER, "RxMER per Subcarrier"},
2296   {0, NULL}
2297 };
2298
2299
2300 /* Windows does not allow data copy between dlls */
2301 static const true_false_string mdd_tfs_on_off = { "On", "Off" };
2302 static const true_false_string mdd_tfs_en_dis = { "Enabled", "Disabled" };
2303
2304 static const true_false_string tfs_ucd_change_ind_vals = {"Changes", "No changes"};
2305
2306 static const true_false_string tfs_allow_inhibit = { "Inhibit Initial Ranging", "Ranging Allowed" };
2307 const true_false_string type35ucd_tfs_present_not_present = { "UCD35 is present for this UCID",
2308                                                               "UCD35 is not present for this UCID" };
2309
2310 static const true_false_string req_not_req_tfs = {"Requested", "Not Requested"};
2311
2312 static const value_string unique_unlimited[] = {
2313   { 0, "Unlimited" },
2314   {0, NULL}
2315 };
2316
2317 static const unit_name_string local_units_hz = { "Hz", NULL };
2318
2319 static void
2320 ofdma_ir_pow_ctrl_start_pow(char *buf, guint32 value)
2321 {
2322     g_snprintf(buf, ITEM_LABEL_LENGTH, "%f dBmV/1.6MHz", value/4.0);
2323 }
2324
2325 static void
2326 ofdma_ir_pow_ctrl_step_size(char *buf, guint32 value)
2327 {
2328     g_snprintf(buf, ITEM_LABEL_LENGTH, "%f dB", value/4.0);
2329 }
2330
2331 static void
2332 mer_fourth_db(char *buf, guint32 value)
2333 {
2334     g_snprintf(buf, ITEM_LABEL_LENGTH, "%f dB", value/4.0);
2335 }
2336
2337 static void
2338 subc_assign_range(char *buf, guint32 value)
2339 {
2340     g_snprintf(buf, ITEM_LABEL_LENGTH, "%u - %u", value >> 16, value &0xFFFF);
2341 }
2342
2343
2344 static reassembly_table docsis_tlv_reassembly_table;
2345 static reassembly_table docsis_opt_tlv_reassembly_table;
2346
2347 static const fragment_items docsis_tlv_frag_items = {
2348   &ett_docsis_tlv_fragment,
2349   &ett_docsis_tlv_fragments,
2350   &hf_docsis_tlv_fragments,
2351   &hf_docsis_tlv_fragment,
2352   &hf_docsis_tlv_fragment_overlap,
2353   &hf_docsis_tlv_fragment_overlap_conflict,
2354   &hf_docsis_tlv_fragment_multiple_tails,
2355   &hf_docsis_tlv_fragment_too_long_fragment,
2356   &hf_docsis_tlv_fragment_error,
2357   &hf_docsis_tlv_fragment_count,
2358   &hf_docsis_tlv_reassembled_in,
2359   &hf_docsis_tlv_reassembled_length,
2360   &hf_docsis_tlv_reassembled_data,
2361   "TLV fragments"
2362 };
2363
2364
2365 static int
2366 dissect_sync (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
2367 {
2368   proto_item *it;
2369   proto_tree *sync_tree;
2370
2371   col_set_str(pinfo->cinfo, COL_INFO, "Sync Message");
2372
2373   it = proto_tree_add_item(tree, proto_docsis_sync, tvb, 0, -1, ENC_NA);
2374   sync_tree = proto_item_add_subtree (it, ett_docsis_sync);
2375
2376   proto_tree_add_item (sync_tree, hf_docsis_sync_cmts_timestamp, tvb, 0, 4, ENC_BIG_ENDIAN);
2377
2378   return tvb_captured_length(tvb);
2379 }
2380
2381 static void
2382 dissect_ucd_burst_descr(tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, proto_item * item, int pos, guint16 len)
2383 {
2384   int tlvpos, endtlvpos;
2385   guint8 tlvtype;
2386   guint32 i, tlvlen;
2387   proto_tree *burst_tree;
2388   proto_item *burst_item, *burst_len_item;
2389   guint iuc;
2390
2391   tlvpos = pos;
2392   endtlvpos = tlvpos + len;
2393   proto_tree_add_item_ret_uint (tree, hf_docsis_ucd_iuc, tvb, tlvpos++, 1, ENC_BIG_ENDIAN, &iuc);
2394   proto_item_append_text(item, ": IUC %d (%s)", iuc, val_to_str(iuc,iuc_vals, "Unknown IUC"));
2395   while (tlvpos < endtlvpos)
2396   {
2397     tlvtype = tvb_get_guint8 (tvb, tlvpos);
2398     burst_tree = proto_tree_add_subtree (tree, tvb, tlvpos, -1,
2399                                                         ett_docsis_burst_tlv, &burst_item,
2400                                                         val_to_str(tlvtype, burst_tlv_vals,
2401                                                         "Unknown TLV (%u)"));
2402     proto_tree_add_uint (burst_tree, hf_docsis_ucd_burst_type, tvb, tlvpos++, 1, tlvtype);
2403     burst_len_item = proto_tree_add_item_ret_uint (burst_tree, hf_docsis_ucd_burst_length, tvb, tlvpos++, 1, ENC_NA, &tlvlen);
2404     proto_item_set_len(burst_item, tlvlen + 2);
2405     switch (tlvtype)
2406     {
2407     case UCD_MODULATION:
2408       if (tlvlen == 1)
2409       {
2410         proto_tree_add_item (burst_tree, hf_docsis_burst_mod_type, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2411       }
2412       else
2413       {
2414         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2415       }
2416       break;
2417     case UCD_DIFF_ENCODING:
2418       if (tlvlen == 1)
2419       {
2420         proto_tree_add_item (burst_tree, hf_docsis_burst_diff_encoding, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2421       }
2422       else
2423       {
2424         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2425       }
2426       break;
2427     case UCD_PREAMBLE_LEN:
2428       if (tlvlen == 2)
2429       {
2430         proto_tree_add_item (burst_tree, hf_docsis_burst_preamble_len, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2431       }
2432       else
2433       {
2434         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2435       }
2436       break;
2437     case UCD_PREAMBLE_VAL_OFF:
2438       if (tlvlen == 2)
2439       {
2440         proto_tree_add_item (burst_tree, hf_docsis_burst_preamble_val_off, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2441       }
2442       else
2443       {
2444         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2445       }
2446       break;
2447     case UCD_FEC:
2448       if (tlvlen == 1)
2449       {
2450         proto_tree_add_item (burst_tree, hf_docsis_burst_fec, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2451       }
2452       else
2453       {
2454         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2455       }
2456       break;
2457     case UCD_FEC_CODEWORD:
2458       if (tlvlen == 1)
2459       {
2460         proto_tree_add_item (burst_tree, hf_docsis_burst_fec_codeword, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2461       }
2462       else
2463       {
2464         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2465       }
2466       break;
2467     case UCD_SCRAMBLER_SEED:
2468       if (tlvlen == 2)
2469       {
2470         proto_tree_add_item (burst_tree, hf_docsis_burst_scrambler_seed, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2471       }
2472       else
2473       {
2474         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2475       }
2476       break;
2477     case UCD_MAX_BURST:
2478       if (tlvlen == 1)
2479       {
2480         proto_tree_add_item (burst_tree, hf_docsis_burst_max_burst, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2481       }
2482       else
2483       {
2484         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2485       }
2486       break;
2487     case UCD_GUARD_TIME:
2488       if (tlvlen == 1)
2489       {
2490         proto_tree_add_item (burst_tree, hf_docsis_burst_guard_time, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2491       }
2492       else
2493       {
2494         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2495       }
2496       break;
2497     case UCD_LAST_CW_LEN:
2498       if (tlvlen == 1)
2499       {
2500         proto_tree_add_item (burst_tree, hf_docsis_burst_last_cw_len, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2501       }
2502       else
2503       {
2504         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2505       }
2506       break;
2507     case UCD_SCRAMBLER_ONOFF:
2508       if (tlvlen == 1)
2509       {
2510         proto_tree_add_item (burst_tree, hf_docsis_burst_scrambler_onoff, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2511       }
2512       else
2513       {
2514         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2515       }
2516       break;
2517     case UCD_RS_INT_DEPTH:
2518       if (tlvlen == 1)
2519       {
2520         proto_tree_add_item (burst_tree, hf_docsis_rs_int_depth, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2521       }
2522       else
2523       {
2524         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2525       }
2526       break;
2527     case UCD_RS_INT_BLOCK:
2528       if (tlvlen == 2)
2529       {
2530         proto_tree_add_item (burst_tree, hf_docsis_rs_int_block, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2531       }
2532       else
2533       {
2534         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2535       }
2536       break;
2537     case UCD_PREAMBLE_TYPE:
2538       if (tlvlen == 1)
2539       {
2540         proto_tree_add_item (burst_tree, hf_docsis_preamble_type, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2541       }
2542       else
2543       {
2544         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2545       }
2546       break;
2547     case UCD_SCMDA_SCRAMBLER_ONOFF:
2548       if (tlvlen == 1)
2549       {
2550         proto_tree_add_item (burst_tree, hf_docsis_ucd_scdma_scrambler_onoff, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2551       }
2552       else
2553       {
2554         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2555       }
2556       break;
2557     case UCD_SCDMA_CODES_PER_SUBFRAME:
2558       if (tlvlen == 1)
2559       {
2560         proto_tree_add_item (burst_tree, hf_docsis_ucd_scdma_codes_per_subframe, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2561       }
2562       else
2563       {
2564         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2565       }
2566       break;
2567     case UCD_SCDMA_FRAMER_INT_STEP_SIZE:
2568       if (tlvlen == 1)
2569       {
2570         proto_tree_add_item (burst_tree, hf_docsis_ucd_scdma_framer_int_step_size, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2571       }
2572       else
2573       {
2574         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2575       }
2576       break;
2577     case UCD_TCM_ENABLED:
2578       if (tlvlen == 1)
2579       {
2580         proto_tree_add_item (burst_tree, hf_docsis_ucd_tcm_enabled, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2581       }
2582       else
2583       {
2584         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2585       }
2586       break;
2587     case UCD_SUBC_INIT_RANG:
2588       if (tlvlen == 2)
2589       {
2590         proto_tree_add_item (burst_tree, hf_docsis_subc_init_rang, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2591       }
2592       else
2593       {
2594         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2595       }
2596       break;
2597     case UCD_SUBC_FINE_RANG:
2598       if (tlvlen == 2)
2599       {
2600         proto_tree_add_item (burst_tree, hf_docsis_subc_fine_rang, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2601       }
2602       else
2603       {
2604         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2605       }
2606       break;
2607     case UCD_OFDMA_PROFILE:
2608       if ((tlvlen % 2) == 0)
2609       {
2610         for(i =0; i < tlvlen; i+=2) {
2611           proto_tree_add_item (burst_tree, hf_docsis_ofdma_prof_mod_order, tvb, tlvpos + i, 1, ENC_BIG_ENDIAN);
2612           proto_tree_add_item (burst_tree, hf_docsis_ofdma_prof_pilot_pattern, tvb, tlvpos + i, 1, ENC_BIG_ENDIAN);
2613           proto_tree_add_item (burst_tree, hf_docsis_ofdma_prof_num_add_minislots, tvb, tlvpos + i + 1, 1, ENC_BIG_ENDIAN);
2614         }
2615       }
2616       else
2617       {
2618         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u (even length expected)", tlvlen);
2619       }
2620       break;
2621     case UCD_OFDMA_IR_POWER_CONTROL:
2622       if (tlvlen == 2)
2623       {
2624         proto_tree_add_item (burst_tree, hf_docsis_ofdma_ir_pow_ctrl_start_pow, tvb, tlvpos, tlvlen, ENC_BIG_ENDIAN);
2625         proto_tree_add_item (burst_tree, hf_docsis_ofdma_ir_pow_ctrl_step_size, tvb, tlvpos + 1, tlvlen, ENC_BIG_ENDIAN);
2626       }
2627       else
2628       {
2629         expert_add_info_format(pinfo, burst_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
2630       }
2631       break;
2632
2633     } /* switch(tlvtype) */
2634
2635   tlvpos += tlvlen;
2636   } /* while (tlvpos < endtlvpos) */
2637
2638 }
2639
2640 static int
2641 dissect_any_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, int proto_id, int type_number)
2642 {
2643   int pos;
2644   guint32 i, upchid, length;
2645   guint8 type, symrate;
2646   proto_tree *ucd_tree, *tlv_tree;
2647   proto_item *ucd_item, *tlv_item, *tlv_len_item;
2648
2649   ucd_item = proto_tree_add_item(tree, proto_id, tvb, 0, -1, ENC_NA);
2650   ucd_tree = proto_item_add_subtree (ucd_item, ett_docsis_ucd);
2651   proto_tree_add_item_ret_uint (ucd_tree, hf_docsis_mgt_upstream_chid, tvb, 0, 1, ENC_BIG_ENDIAN, &upchid);
2652   proto_tree_add_item (ucd_tree, hf_docsis_ucd_config_ch_cnt, tvb, 1, 1, ENC_BIG_ENDIAN);
2653   proto_tree_add_item (ucd_tree, hf_docsis_ucd_mini_slot_size, tvb, 2, 1, ENC_BIG_ENDIAN);
2654   proto_tree_add_item (ucd_tree, hf_docsis_mgt_down_chid, tvb, 3, 1, ENC_BIG_ENDIAN);
2655
2656   /* if the upstream Channel ID is 0 then this is for Telephony Return) */
2657   if (upchid > 0)
2658     col_add_fstr (pinfo->cinfo, COL_INFO,
2659                   "Type %d UCD Message: Channel ID = %u (U%u)", type_number, upchid,
2660                   upchid - 1);
2661   else
2662     col_add_fstr (pinfo->cinfo, COL_INFO,
2663                   "Type %d UCD Message: Channel ID = %u (Telephony Return)",
2664                   type_number, upchid);
2665
2666   pos = 4;
2667   while (tvb_reported_length_remaining(tvb, pos) > 0)
2668   {
2669     type = tvb_get_guint8 (tvb, pos);
2670     tlv_tree = proto_tree_add_subtree(ucd_tree, tvb, pos, -1,
2671                                             ett_docsis_tlv, &tlv_item,
2672                                             val_to_str(type, channel_tlv_vals,
2673                                                        "Unknown TLV (%u)"));
2674     proto_tree_add_uint (tlv_tree, hf_docsis_ucd_type, tvb, pos, 1, type);
2675     pos++;
2676     tlv_len_item = proto_tree_add_item_ret_uint (tlv_tree, hf_docsis_ucd_length, tvb, pos, 1, ENC_NA, &length);
2677     pos++;
2678     proto_item_set_len(tlv_item, length + 2);
2679
2680     switch (type)
2681     {
2682     case UCD_SYMBOL_RATE:
2683       if (length == 1)
2684       {
2685         symrate = tvb_get_guint8 (tvb, pos);
2686         proto_tree_add_uint (tlv_tree, hf_docsis_ucd_symbol_rate, tvb, pos, length, symrate * 160);
2687       }
2688       else
2689       {
2690         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2691       }
2692       break;
2693     case UCD_FREQUENCY:
2694       if (length == 4)
2695       {
2696         proto_tree_add_item (tlv_tree, hf_docsis_ucd_frequency, tvb, pos, length, ENC_BIG_ENDIAN);
2697       }
2698       else
2699       {
2700         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2701       }
2702       break;
2703     case UCD_PREAMBLE:
2704       proto_tree_add_item (tlv_tree, hf_docsis_ucd_preamble_pat, tvb, pos, length, ENC_NA);
2705       break;
2706     case UCD_BURST_DESCR:
2707     case UCD_BURST_DESCR5: /* DOCSIS 2.0 Upstream Channel Descriptor */
2708     case UCD_BURST_DESCR23:
2709       dissect_ucd_burst_descr(tvb, pinfo, tlv_tree, tlv_item, pos, length);
2710       break;
2711     case UCD_EXT_PREAMBLE:
2712       proto_tree_add_item (tlv_tree, hf_docsis_ucd_ext_preamble_pat, tvb, pos, length, ENC_NA);
2713       break;
2714     case UCD_SCDMA_MODE_ENABLED:
2715       if (length == 1)
2716       {
2717         proto_tree_add_item (tlv_tree, hf_docsis_ucd_scdma_mode_enabled, tvb, pos, length, ENC_BIG_ENDIAN);
2718       }
2719       else
2720       {
2721         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2722       }
2723       break;
2724     case UCD_SCDMA_SPREADING_INTERVAL:
2725       if (length == 1)
2726       {
2727         proto_tree_add_item (tlv_tree, hf_docsis_ucd_scdma_spreading_interval, tvb, pos, length, ENC_NA);
2728       }
2729       else
2730       {
2731         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2732       }
2733       break;
2734     case UCD_SCDMA_CODES_PER_MINI_SLOT:
2735       if (length == 1)
2736       {
2737         proto_tree_add_item (tlv_tree, hf_docsis_ucd_scdma_codes_per_mini_slot, tvb, pos, length, ENC_NA);
2738       }
2739       else
2740       {
2741         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2742       }
2743       break;
2744     case UCD_SCDMA_ACTIVE_CODES:
2745       if (length == 1)
2746       {
2747         proto_tree_add_item (tlv_tree, hf_docsis_ucd_scdma_active_codes, tvb, pos, length, ENC_NA);
2748       }
2749       else
2750       {
2751         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2752       }
2753       break;
2754     case UCD_SCDMA_CODE_HOPPING_SEED:
2755       if (length == 2)
2756       {
2757         proto_tree_add_item (tlv_tree, hf_docsis_ucd_scdma_code_hopping_seed, tvb, pos, length, ENC_NA);
2758       }
2759       else
2760       {
2761         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2762       }
2763       break;
2764     case UCD_SCDMA_US_RATIO_NUM:
2765       if (length == 2)
2766       {
2767         proto_tree_add_item (tlv_tree, hf_docsis_ucd_scdma_us_ratio_num, tvb, pos, length, ENC_NA);
2768       }
2769       else
2770       {
2771         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2772       }
2773       break;
2774     case UCD_SCDMA_US_RATIO_DENOM:
2775       if (length == 2)
2776       {
2777         proto_tree_add_item (tlv_tree, hf_docsis_ucd_scdma_us_ratio_denom, tvb, pos, length, ENC_NA);
2778       }
2779       else
2780       {
2781         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2782       }
2783       break;
2784     case UCD_SCDMA_TIMESTAMP_SNAPSHOT:
2785       if (length == 9)
2786       {
2787         proto_tree_add_item (tlv_tree, hf_docsis_ucd_scdma_timestamp_snapshot, tvb, pos, length, ENC_NA);
2788       }
2789       else
2790       {
2791         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2792       }
2793       break;
2794     case UCD_MAINTAIN_POWER_SPECTRAL_DENSITY:
2795       if (length == 1)
2796       {
2797         proto_tree_add_item (tlv_tree, hf_docsis_ucd_maintain_power_spectral_density, tvb, pos, length, ENC_BIG_ENDIAN);
2798       }
2799       else
2800       {
2801         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2802       }
2803       break;
2804     case UCD_RANGING_REQUIRED:
2805       if (length == 1)
2806       {
2807         proto_tree_add_item (tlv_tree, hf_docsis_ucd_ranging_required, tvb, pos, length, ENC_BIG_ENDIAN);
2808       }
2809       else
2810       {
2811         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2812       }
2813       break;
2814     case UCD_MAX_SCHEDULED_CODES:
2815       if (length == 1)
2816       {
2817         proto_tree_add_item (tlv_tree, hf_docsis_ucd_max_scheduled_codes, tvb, pos, length, ENC_NA);
2818       }
2819       else
2820       {
2821         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2822       }
2823       break;
2824     case UCD_RANGING_HOLD_OFF_PRIORITY_FIELD:
2825       if (length == 4)
2826       {
2827         static const int * ucd_rnghoff[] = {
2828           &hf_docsis_ucd_rnghoff_cm,
2829           &hf_docsis_ucd_rnghoff_erouter,
2830           &hf_docsis_ucd_rnghoff_emta,
2831           &hf_docsis_ucd_rnghoff_estb,
2832           &hf_docsis_ucd_rnghoff_rsvd,
2833           &hf_docsis_ucd_rnghoff_id_ext,
2834           NULL
2835         };
2836
2837         proto_tree_add_bitmask_list(tlv_tree, tvb, pos, length, ucd_rnghoff, ENC_BIG_ENDIAN);
2838       }
2839       else
2840       {
2841         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2842       }
2843       break;
2844     case UCD_RANGING_CHANNEL_CLASS_ID:
2845       if (length == 4)
2846       {
2847         static const int * ucd_chan_class_id[] = {
2848           &hf_docsis_ucd_chan_class_id_cm,
2849           &hf_docsis_ucd_chan_class_id_erouter,
2850           &hf_docsis_ucd_chan_class_id_emta,
2851           &hf_docsis_ucd_chan_class_id_estb,
2852           &hf_docsis_ucd_chan_class_id_rsvd,
2853           &hf_docsis_ucd_chan_class_id_id_ext,
2854           NULL
2855         };
2856
2857         proto_tree_add_bitmask_list(tlv_tree, tvb, pos, length, ucd_chan_class_id, ENC_BIG_ENDIAN);
2858       }
2859       else
2860       {
2861         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2862       }
2863       break;
2864     case UCD_SCDMA_SELECTION_ACTIVE_CODES_AND_CODE_HOPPING:
2865       if (length == 1)
2866       {
2867         proto_tree_add_item (tlv_tree, hf_docsis_ucd_active_code_hopping, tvb, pos, length, ENC_NA);
2868       }
2869       else
2870       {
2871         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2872       }
2873       break;
2874     case UCD_SCDMA_SELECTION_STRING_FOR_ACTIVE_CODES:
2875       if (length == 16)
2876       {
2877         proto_tree_add_item (tlv_tree, hf_docsis_ucd_scdma_selection_active_codes, tvb, pos, length, ENC_NA);
2878       }
2879       else
2880       {
2881         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2882       }
2883       break;
2884     case UCD_HIGHER_UCD_FOR_SAME_UCID:
2885       if (length == 1)
2886       {
2887         proto_tree_add_item (tlv_tree, hf_docsis_ucd_higher_ucd_for_same_ucid, tvb, pos, length, ENC_NA);
2888         proto_tree_add_item (tlv_tree, hf_docsis_ucd_higher_ucd_for_same_ucid_resv, tvb, pos, length, ENC_BIG_ENDIAN);
2889       }
2890       else
2891       {
2892         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2893       }
2894       break;
2895     case UCD_CHANGE_IND_BITMASK:
2896       if (length == 2)
2897       {
2898         proto_tree_add_item (tlv_tree, hf_docsis_ucd_change_ind_bitmask_subc_excl_band, tvb, pos + 1, 1, ENC_NA);
2899         proto_tree_add_item (tlv_tree, hf_docsis_ucd_change_ind_bitmask_unused_subc, tvb, pos + 1, 1, ENC_NA);
2900         proto_tree_add_item (tlv_tree, hf_docsis_ucd_change_ind_bitmask_other_subc, tvb, pos + 1, 1, ENC_NA);
2901         proto_tree_add_item (tlv_tree, hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc5, tvb, pos + 1, 1, ENC_NA);
2902         proto_tree_add_item (tlv_tree, hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc6, tvb, pos + 1, 1, ENC_NA);
2903         proto_tree_add_item (tlv_tree, hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc9, tvb, pos + 1, 1, ENC_NA);
2904         proto_tree_add_item (tlv_tree, hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc10, tvb, pos + 1, 1, ENC_NA);
2905         proto_tree_add_item (tlv_tree, hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc11, tvb, pos + 1, 1, ENC_NA);
2906         proto_tree_add_item (tlv_tree, hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc12, tvb, pos, 1, ENC_NA);
2907         proto_tree_add_item (tlv_tree, hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc13, tvb, pos, 1, ENC_NA);
2908         proto_tree_add_item (tlv_tree, hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc3_or_4, tvb, pos, 1, ENC_NA);
2909         proto_tree_add_item (tlv_tree, hf_docsis_ucd_change_ind_bitmask_reserved, tvb, pos, 1, ENC_NA);
2910       }
2911       else
2912       {
2913         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2914       }
2915       break;
2916     case UCD_OFDMA_TIMESTAMP_SNAPSHOT:
2917       if (length == 9)
2918       {
2919         proto_tree_add_item (tlv_tree, hf_docsis_ucd_ofdma_timestamp_snapshot, tvb, pos, length, ENC_NA);
2920       }
2921       else
2922       {
2923         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2924       }
2925       break;
2926     case UCD_OFDMA_CYCLIC_PREFIX_SIZE:
2927       if (length == 1)
2928       {
2929         proto_tree_add_item (tlv_tree, hf_docsis_ucd_ofdma_cyclic_prefix_size, tvb, pos, length, ENC_NA);
2930       }
2931       else
2932       {
2933         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2934       }
2935       break;
2936     case UCD_OFDMA_ROLLOFF_PERIOD_SIZE:
2937       if (length == 1)
2938       {
2939         proto_tree_add_item (tlv_tree, hf_docsis_ucd_ofdma_rolloff_period_size, tvb, pos, length, ENC_NA);
2940       }
2941       else
2942       {
2943         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2944       }
2945       break;
2946     case UCD_SUBCARRIER_SPACING:
2947       if (length == 1)
2948       {
2949         proto_tree_add_item (tlv_tree, hf_docsis_ucd_subc_spacing, tvb, pos, length, ENC_NA);
2950       }
2951       else
2952       {
2953         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2954       }
2955       break;
2956     case UCD_CENTER_FREQ_SUBC_0:
2957       if (length == 4)
2958       {
2959         proto_tree_add_item (tlv_tree, hf_docsis_ucd_cent_freq_subc0, tvb, pos, length, ENC_NA);
2960       }
2961       else
2962       {
2963         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2964       }
2965       break;
2966     case UCD_SUBC_EXCL_BAND:
2967       if ((length % 4) == 0)
2968       {
2969         for(i = 0; i < length; i+=4) {
2970           proto_tree_add_item (tlv_tree, hf_docsis_ucd_subcarrier_range, tvb, pos+i, 4, ENC_NA);
2971         }
2972       }
2973       else
2974       {
2975         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2976       }
2977       break;
2978     case UCD_UNUSED_SUBC_SPEC:
2979       if ((length % 4) == 0)
2980       {
2981         for(i = 0; i < length; i+=4) {
2982           proto_tree_add_item (tlv_tree, hf_docsis_ucd_subcarrier_range, tvb, pos+i, 4, ENC_NA);
2983         }
2984       }
2985       else
2986       {
2987         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2988       }
2989       break;
2990     case UCD_SYMB_IN_OFDMA_FRAME:
2991       if (length == 1)
2992       {
2993         proto_tree_add_item (tlv_tree, hf_docsis_ucd_symb_ofdma_frame, tvb, pos, length, ENC_NA);
2994       }
2995       else
2996       {
2997         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
2998       }
2999       break;
3000     case UCD_RAND_SEED:
3001       if (length == 3)
3002       {
3003         proto_tree_add_item (tlv_tree, hf_docsis_ucd_rand_seed, tvb, pos, length, ENC_NA);
3004       }
3005       else
3006       {
3007         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3008       }
3009       break;
3010     }    /* switch(type) */
3011     pos += length;
3012   }      /* tvb_reported_length_remaining(tvb, pos) > 0 */
3013
3014   return tvb_captured_length(tvb);
3015 }
3016
3017 static int
3018 dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3019 {
3020   return dissect_any_ucd(tvb, pinfo, tree, proto_docsis_ucd, MGT_UCD);
3021 }
3022
3023 static int
3024 dissect_any_map (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint8 version, void* data _U_)
3025 {
3026   guint32 i, numie, upchid, ucd_count, cat = 0;
3027   int pos;
3028   proto_item *it;
3029   proto_tree *map_tree;
3030   static const int * ies[] = {
3031     &hf_docsis_map_sid,
3032     &hf_docsis_map_iuc,
3033     &hf_docsis_map_offset,
3034     NULL
3035   };
3036
3037   static const int * probe_ies[] = {
3038     &hf_docsis_map_sid,
3039     &hf_docsis_map_mer,
3040     &hf_docsis_map_pw,
3041     &hf_docsis_map_eq,
3042     &hf_docsis_map_st,
3043     &hf_docsis_map_probe_frame,
3044     &hf_docsis_map_symbol_in_frame,
3045     &hf_docsis_map_start_subc,
3046     &hf_docsis_map_subc_skip,
3047     NULL
3048   };
3049
3050   switch (version) {
3051     case 1:
3052       it = proto_tree_add_item(tree, proto_docsis_map_v1, tvb, 0, -1, ENC_NA);
3053       break;
3054     case 5:
3055       it = proto_tree_add_item(tree, proto_docsis_map_v5, tvb, 0, -1, ENC_NA);
3056       break;
3057     default:
3058       it = proto_tree_add_item(tree, proto_docsis_map_v1, tvb, 0, -1, ENC_NA);
3059       expert_add_info_format(pinfo, it, &ei_docsis_mgmt_version_unknown, "Unknown MAP Mac Management version: %u", version);
3060       return tvb_captured_length(tvb);
3061   }
3062
3063   map_tree = proto_item_add_subtree (it, ett_docsis_map);
3064
3065   proto_tree_add_item_ret_uint (map_tree, hf_docsis_mgt_upstream_chid, tvb, 0, 1, ENC_BIG_ENDIAN, &upchid);
3066   proto_tree_add_item_ret_uint (map_tree, hf_docsis_map_ucd_count, tvb, 1, 1, ENC_BIG_ENDIAN, &ucd_count);
3067   switch (version) {
3068     case 1:
3069       proto_tree_add_item_ret_uint (map_tree, hf_docsis_map_numie, tvb, 2, 1, ENC_BIG_ENDIAN, &numie);
3070       proto_tree_add_item (map_tree, hf_docsis_map_rsvd, tvb, 3, 1, ENC_BIG_ENDIAN);
3071       break;
3072     case 5:
3073       proto_tree_add_item_ret_uint (map_tree, hf_docsis_map_numie_v5, tvb, 2, 2, ENC_BIG_ENDIAN, &numie);
3074       proto_tree_add_item (map_tree, hf_docsis_map_rsvd_v5, tvb, 3, 1, ENC_BIG_ENDIAN);
3075       proto_tree_add_item_ret_uint (map_tree, hf_docsis_map_cat, tvb, 3, 1, ENC_BIG_ENDIAN, &cat);
3076       break;
3077     default:
3078       it = proto_tree_add_item(tree, proto_docsis_map_v1, tvb, 0, -1, ENC_NA);
3079       expert_add_info_format(pinfo, it, &ei_docsis_mgmt_version_unknown, "Unknown MAP Mac Management version: %u", version);
3080       return tvb_captured_length(tvb);
3081   }
3082
3083   if (upchid > 0)
3084     col_add_fstr (pinfo->cinfo, COL_INFO,
3085                   "Map Message:  Version: %d, Channel ID = %u (U%u), UCD Count = %u,  # IE's = %u",
3086                   version, upchid, upchid - 1, ucd_count, numie);
3087   else
3088     col_add_fstr (pinfo->cinfo, COL_INFO,
3089                   "Map Message:  Version: %d, Channel ID = %u (Telephony Return), UCD Count = %u, # IE's = %u",
3090                   version, upchid, ucd_count, numie);
3091
3092   proto_tree_add_item (map_tree, hf_docsis_map_alloc_start, tvb, 4, 4, ENC_BIG_ENDIAN);
3093   if (cat == 0) {
3094     proto_tree_add_item (map_tree, hf_docsis_map_ack_time, tvb, 8, 4, ENC_BIG_ENDIAN);
3095     proto_tree_add_item (map_tree, hf_docsis_map_rng_start, tvb, 12, 1, ENC_BIG_ENDIAN);
3096     proto_tree_add_item (map_tree, hf_docsis_map_rng_end, tvb, 13, 1, ENC_BIG_ENDIAN);
3097     proto_tree_add_item (map_tree, hf_docsis_map_data_start, tvb, 14, 1, ENC_BIG_ENDIAN);
3098     proto_tree_add_item (map_tree, hf_docsis_map_data_end, tvb, 15, 1, ENC_BIG_ENDIAN);
3099
3100     pos = 16;
3101     for (i = 0; i < numie; i++)
3102     {
3103       proto_tree_add_bitmask_with_flags(map_tree, tvb, pos, hf_docsis_map_ie, ett_docsis_map_ie, ies, ENC_BIG_ENDIAN, BMT_NO_FLAGS);
3104       pos = pos + 4;
3105     }
3106   }
3107   if (cat == 1) {
3108     pos = 8;
3109     for (i = 0; i < numie; i++)
3110     {
3111       proto_tree_add_bitmask_with_flags(map_tree, tvb, pos, hf_docsis_map_probe_ie, ett_docsis_map_probe_ie, probe_ies, ENC_BIG_ENDIAN, BMT_NO_FLAGS);
3112       pos = pos + 4;
3113     }
3114   }
3115
3116   return tvb_captured_length(tvb);
3117 }
3118
3119
3120 static int dissect_map_v1 (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_) {
3121   return dissect_any_map(tvb, pinfo, tree, MAP_v1, data);
3122 }
3123
3124 static int dissect_map_v5 (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_) {
3125   return dissect_any_map(tvb, pinfo, tree, MAP_v5, data);
3126 }
3127
3128 static int
3129 dissect_rngreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3130 {
3131   proto_item *it;
3132   proto_tree *rngreq_tree;
3133   guint32 sid;
3134
3135   it = proto_tree_add_item(tree, proto_docsis_rngreq, tvb, 0, -1, ENC_NA);
3136   rngreq_tree = proto_item_add_subtree (it, ett_docsis_rngreq);
3137   proto_tree_add_item_ret_uint (rngreq_tree, hf_docsis_rngreq_sid, tvb, 0, 2, ENC_BIG_ENDIAN, &sid);
3138
3139   if (sid > 0)
3140     col_add_fstr (pinfo->cinfo, COL_INFO, "Ranging Request: SID = %u",
3141                       sid);
3142   else
3143     col_set_str(pinfo->cinfo, COL_INFO, "Initial Ranging Request SID = 0");
3144
3145   proto_tree_add_item (rngreq_tree, hf_docsis_mgt_down_chid, tvb, 2, 1, ENC_BIG_ENDIAN);
3146   proto_tree_add_item (rngreq_tree, hf_docsis_rngreq_pend_compl, tvb, 3, 1, ENC_BIG_ENDIAN);
3147
3148   return tvb_captured_length(tvb);
3149 }
3150
3151 static void
3152 dissect_rngrsp_transmit_equalization_encodings(tvbuff_t * tvb, proto_tree * tree, guint8 start, guint16 len)
3153 {
3154   guint16 i;
3155   proto_item *it;
3156   proto_tree *transmit_equalization_encodings_tree, *coef_tree;
3157   guint lowest_subc;
3158
3159   it = proto_tree_add_item(tree, hf_docsis_rngrsp_trans_eq_data, tvb, start-2, len+2, ENC_NA);
3160   transmit_equalization_encodings_tree = proto_item_add_subtree (it, ett_docsis_rngrsp_tlv_transmit_equalization_encodings);
3161
3162   proto_tree_add_item_ret_uint (transmit_equalization_encodings_tree, hf_docsis_rngrsp_trans_eq_enc_lowest_subc, tvb, start, 3, ENC_BIG_ENDIAN, &lowest_subc);
3163   proto_tree_add_item (transmit_equalization_encodings_tree, hf_docsis_rngrsp_trans_eq_enc_highest_subc, tvb, start, 3, ENC_BIG_ENDIAN);
3164   for(i=3; i < len; i+=4) {
3165     gint real, imag;
3166     coef_tree = proto_tree_add_subtree_format (transmit_equalization_encodings_tree, tvb, start + i, 4, ett_docsis_rngrsp_tlv_transmit_equalization_encodings_coef, NULL, "Subcarrier %d: ", lowest_subc + (i-3)/4);
3167     proto_tree_add_item_ret_int (coef_tree, hf_docsis_rngrsp_trans_eq_enc_coef_real, tvb, start + i, 2, ENC_BIG_ENDIAN, &real);
3168     proto_tree_add_item_ret_int (coef_tree, hf_docsis_rngrsp_trans_eq_enc_coef_imag, tvb, start + i + 2, 2, ENC_BIG_ENDIAN, &imag);
3169     proto_item_append_text(coef_tree, "real: %f, imag: %f", (gint16) real/16384.0, (gint16) imag/16384.0);
3170   }
3171 }
3172
3173 static void
3174 dissect_rngrsp_commanded_power(tvbuff_t * tvb, proto_tree * tree, guint8 start, guint16 len)
3175 {
3176   guint16 pos;
3177   guint16 i;
3178   guint8 tlvtype, tlvlen;
3179   proto_item *it;
3180   proto_tree *commanded_power_tree;
3181   proto_tree *commanded_power_subtlv_tree;
3182   proto_item *rngrsptlv_commanded_power_subtlv;
3183
3184
3185   it = proto_tree_add_item(tree, hf_docsis_rngrsp_commanded_power_data, tvb, start-2, len+2, ENC_NA);
3186   commanded_power_tree = proto_item_add_subtree (it, ett_docsis_rngrsp_tlv_commanded_power);
3187
3188
3189   pos = start;
3190   while (pos < start + len)
3191   {
3192     tlvtype = tvb_get_guint8 (tvb, pos);
3193     commanded_power_subtlv_tree = proto_tree_add_subtree(commanded_power_tree, tvb, pos, -1,
3194                                   ett_docsis_rngrsp_tlv_commanded_power_subtlv, &rngrsptlv_commanded_power_subtlv,
3195                                   val_to_str(tlvtype, rngrsp_tlv_commanded_power_subtlv_vals,
3196                                   "Unknown TLV (%u)"));
3197     pos++;
3198     tlvlen = tvb_get_guint8 (tvb, pos);
3199     pos++;
3200
3201     switch (tlvtype)
3202     {
3203       case RNGRSP_COMMANDED_POWER_DYNAMIC_RANGE_WINDOW:
3204         if (tlvlen == 1)
3205         {
3206           proto_tree_add_item (commanded_power_subtlv_tree,
3207                                     hf_docsis_rngrsp_commanded_power_dynamic_range_window, tvb, pos,
3208                                     tlvlen, ENC_BIG_ENDIAN);
3209         }
3210         break;
3211       case RNGRSP_COMMANDED_POWER_UCID_AND_POWER_LEVEL_LIST:
3212         if ((tlvlen %3)== 0)
3213         {
3214           for(i=0; i < tlvlen; i+=3)
3215           {
3216              proto_tree_add_item (commanded_power_subtlv_tree,
3217                                       hf_docsis_rngrsp_commanded_power_ucid, tvb, pos + i,
3218                                       1, ENC_BIG_ENDIAN);
3219              proto_tree_add_item (commanded_power_subtlv_tree,
3220                                       hf_docsis_rngrsp_commanded_power_trans_pow_lvl, tvb, pos + i +1,
3221                                       2, ENC_BIG_ENDIAN);
3222           }
3223         }
3224         break;
3225       }
3226       pos += tlvlen;
3227   }
3228 }
3229
3230
3231
3232
3233 static int
3234 dissect_rngrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3235 {
3236   proto_item *it;
3237   proto_tree *rngrsp_tree;
3238   proto_item *rngrsptlv_item;
3239   proto_tree *rngrsptlv_tree;
3240   guint8 tlvtype;
3241   int pos;
3242   guint tlvlen;
3243   guint32 sid, upchid;
3244
3245   it = proto_tree_add_item(tree, proto_docsis_rngrsp, tvb, 0, -1, ENC_NA);
3246   rngrsp_tree = proto_item_add_subtree (it, ett_docsis_rngrsp);
3247
3248   proto_tree_add_item_ret_uint (rngrsp_tree, hf_docsis_rngrsp_sid, tvb, 0, 2, ENC_BIG_ENDIAN, &sid);
3249   proto_tree_add_item_ret_uint (rngrsp_tree, hf_docsis_mgt_upstream_chid, tvb, 2, 1, ENC_BIG_ENDIAN, &upchid);
3250
3251   if (upchid > 0)
3252     col_add_fstr (pinfo->cinfo, COL_INFO,
3253                   "Ranging Response: SID = %u, Upstream Channel = %u (U%u)",
3254                   sid, upchid, upchid - 1);
3255   else
3256     col_add_fstr (pinfo->cinfo, COL_INFO,
3257                   "Ranging Response: SID = %u, Telephony Return", sid);
3258
3259   pos = 3;
3260   while (tvb_reported_length_remaining(tvb, pos) > 0)
3261   {
3262     tlvtype = tvb_get_guint8 (tvb, pos);
3263     rngrsptlv_tree = proto_tree_add_subtree(rngrsp_tree, tvb, pos, -1,
3264                                   ett_docsis_rngrsptlv, &rngrsptlv_item,
3265                                   val_to_str(tlvtype, rngrsp_tlv_vals,
3266                                   "Unknown TLV (%u)"));
3267     proto_tree_add_uint (rngrsptlv_tree, hf_docsis_rngrsp_type, tvb, pos, 1, tlvtype);
3268     pos++;
3269     tlvlen = tvb_get_guint8 (tvb, pos);
3270     if  (tlvtype == RNGRSP_TRANSMIT_EQ_ADJUST_OFDMA_CHANNELS || tlvtype == RNGRSP_TRANSMIT_EQ_SET_OFDMA_CHANNELS) {
3271       proto_tree_add_item_ret_uint (rngrsptlv_tree, hf_docsis_rngrsp_length, tvb, pos, 2, ENC_NA, &tlvlen);
3272       pos += 2;
3273     } else {
3274       proto_tree_add_item_ret_uint (rngrsptlv_tree, hf_docsis_rngrsp_length, tvb, pos, 1, ENC_NA, &tlvlen);
3275       pos++;
3276     }
3277     proto_item_set_len(rngrsptlv_item, tlvlen + 2);
3278     switch (tlvtype)
3279     {
3280     case RNGRSP_TIMING:
3281       if (tlvlen == 4)
3282       {
3283         proto_tree_add_item (rngrsptlv_tree, hf_docsis_rngrsp_timing_adj, tvb, pos, tlvlen, ENC_BIG_ENDIAN);
3284       }
3285       break;
3286     case RNGRSP_PWR_LEVEL_ADJ:
3287       if (tlvlen == 1)
3288       {
3289         proto_tree_add_item (rngrsptlv_tree, hf_docsis_rngrsp_power_adj, tvb, pos, tlvlen, ENC_NA);
3290       }
3291       break;
3292     case RNGRSP_OFFSET_FREQ_ADJ:
3293       if (tlvlen == 2)
3294       {
3295         proto_tree_add_item (rngrsptlv_tree, hf_docsis_rngrsp_freq_adj, tvb, pos, tlvlen, ENC_BIG_ENDIAN);
3296       }
3297       break;
3298     case RNGRSP_TRANSMIT_EQ_ADJ:
3299       proto_tree_add_item (rngrsptlv_tree, hf_docsis_rngrsp_xmit_eq_adj, tvb, pos, tlvlen, ENC_NA);
3300       break;
3301     case RNGRSP_RANGING_STATUS:
3302       if (tlvlen == 1)
3303       {
3304         proto_tree_add_item (rngrsptlv_tree, hf_docsis_rngrsp_ranging_status, tvb, pos, tlvlen, ENC_BIG_ENDIAN);
3305       }
3306       break;
3307     case RNGRSP_DOWN_FREQ_OVER:
3308       if (tlvlen == 4)
3309       {
3310         proto_tree_add_item (rngrsptlv_tree, hf_docsis_rngrsp_down_freq_over, tvb, pos, tlvlen, ENC_BIG_ENDIAN);
3311       }
3312       break;
3313     case RNGRSP_UP_CHID_OVER:
3314       if (tlvlen == 1)
3315       {
3316         proto_tree_add_item (rngrsptlv_tree, hf_docsis_rngrsp_upstream_ch_over, tvb, pos, tlvlen, ENC_BIG_ENDIAN);
3317       }
3318       break;
3319     case RNGRSP_T4_TIMEOUT_MULTIPLIER:
3320       if (tlvlen == 1)
3321         proto_tree_add_item (rngrsptlv_tree, hf_docsis_rngrsp_rngrsp_t4_timeout_multiplier, tvb, pos, tlvlen, ENC_BIG_ENDIAN);
3322       else
3323       {
3324         expert_add_info_format(pinfo, rngrsptlv_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
3325       }
3326       break;
3327     case RNGRSP_DYNAMIC_RANGE_WINDOW_UPPER_EDGE:
3328       if (tlvlen == 1)
3329         proto_tree_add_item (rngrsptlv_tree, hf_docsis_rngrsp_dynamic_range_window_upper_edge, tvb, pos, tlvlen, ENC_BIG_ENDIAN);
3330       else
3331       {
3332         expert_add_info_format(pinfo, rngrsptlv_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", tlvlen);
3333       }
3334       break;
3335     case RNGRSP_TRANSMIT_EQ_ADJUST_OFDMA_CHANNELS:
3336       dissect_rngrsp_transmit_equalization_encodings(tvb, rngrsptlv_tree, pos, tlvlen);
3337       break;
3338     case RNGRSP_TRANSMIT_EQ_SET_OFDMA_CHANNELS:
3339       dissect_rngrsp_transmit_equalization_encodings(tvb, rngrsptlv_tree, pos, tlvlen);
3340       break;
3341     case RNGRSP_COMMANDED_POWER:
3342       dissect_rngrsp_commanded_power(tvb, rngrsptlv_tree, pos, tlvlen);
3343       break;
3344
3345     default:
3346        proto_tree_add_item (rngrsp_tree, hf_docsis_rngrsp_tlv_unknown, tvb, pos, tlvlen, ENC_NA);
3347     }                   /* switch(tlvtype) */
3348     pos += tlvlen;
3349   }                       /* while (tvb_reported_length_remaining(tvb, pos) > 0) */
3350   return tvb_captured_length(tvb);
3351 }
3352
3353 static int
3354 dissect_regreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3355 {
3356   proto_item *it;
3357   proto_tree *regreq_tree;
3358   guint32 sid;
3359   tvbuff_t *next_tvb;
3360
3361   it = proto_tree_add_item(tree, proto_docsis_regreq, tvb, 0, -1, ENC_NA);
3362   regreq_tree = proto_item_add_subtree (it, ett_docsis_regreq);
3363
3364   proto_tree_add_item_ret_uint (regreq_tree, hf_docsis_regreq_sid, tvb, 0, 2, ENC_BIG_ENDIAN, &sid);
3365
3366   col_add_fstr (pinfo->cinfo, COL_INFO, "Registration Request SID = %u", sid);
3367
3368   /* Call Dissector for Appendix C TlV's */
3369   next_tvb = tvb_new_subset_remaining (tvb, 2);
3370   call_dissector (docsis_tlv_handle, next_tvb, pinfo, regreq_tree);
3371   return tvb_captured_length(tvb);
3372 }
3373
3374 static int
3375 dissect_regrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3376 {
3377   proto_item *it;
3378   proto_tree *regrsp_tree;
3379   guint32 sid, response;
3380   tvbuff_t *next_tvb;
3381
3382   it = proto_tree_add_item(tree, proto_docsis_regrsp, tvb, 0, -1, ENC_NA);
3383   regrsp_tree = proto_item_add_subtree (it, ett_docsis_regrsp);
3384   proto_tree_add_item_ret_uint (regrsp_tree, hf_docsis_regrsp_sid, tvb, 0, 2, ENC_BIG_ENDIAN, &sid);
3385   proto_tree_add_item_ret_uint (regrsp_tree, hf_docsis_regrsp_response, tvb, 2, 1, ENC_BIG_ENDIAN, &response);
3386
3387   col_add_fstr (pinfo->cinfo, COL_INFO,
3388                 "Registration Response SID = %u (%s)", sid,
3389                 val_to_str_ext (response, &docsis_conf_code_ext, "%d"));
3390
3391   /* Call Dissector for Appendix C TLV's */
3392   next_tvb = tvb_new_subset_remaining (tvb, 3);
3393   call_dissector (docsis_tlv_handle, next_tvb, pinfo, regrsp_tree);
3394   return tvb_captured_length(tvb);
3395 }
3396
3397 static int
3398 dissect_uccreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3399 {
3400   proto_item *it;
3401   proto_tree *uccreq_tree;
3402   guint32 chid;
3403   tvbuff_t *next_tvb;
3404
3405   it = proto_tree_add_item (tree, proto_docsis_uccreq, tvb, 0, -1, ENC_NA);
3406   uccreq_tree = proto_item_add_subtree (it, ett_docsis_uccreq);
3407
3408   proto_tree_add_item_ret_uint (uccreq_tree, hf_docsis_mgt_upstream_chid, tvb, 0, 1, ENC_BIG_ENDIAN, &chid);
3409
3410   col_add_fstr (pinfo->cinfo, COL_INFO,
3411                 "Upstream Channel Change request  Channel ID = %u (U%u)",
3412                 chid, (chid > 0 ? chid - 1 : chid));
3413
3414   /* call dissector for Appendix C TLV's */
3415   next_tvb = tvb_new_subset_remaining (tvb, 1);
3416   call_dissector (docsis_tlv_handle, next_tvb, pinfo, uccreq_tree);
3417   return tvb_captured_length(tvb);
3418 }
3419
3420 static int
3421 dissect_uccrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3422 {
3423   proto_item *it;
3424   proto_tree *uccrsp_tree;
3425   guint32 chid;
3426
3427   it = proto_tree_add_item(tree, proto_docsis_uccrsp, tvb, 0, -1, ENC_NA);
3428   uccrsp_tree = proto_item_add_subtree (it, ett_docsis_uccrsp);
3429
3430   proto_tree_add_item_ret_uint (uccrsp_tree, hf_docsis_mgt_upstream_chid, tvb, 0, 1, ENC_BIG_ENDIAN, &chid);
3431
3432   col_add_fstr (pinfo->cinfo, COL_INFO,
3433                 "Upstream Channel Change response  Channel ID = %u (U%u)",
3434                 chid, (chid > 0 ? chid - 1 : chid));
3435
3436   return tvb_captured_length(tvb);
3437 }
3438
3439 /* The dissect_attrs() function does the actual work to dissect the
3440  * attributes.  It's called recursively, to dissect embedded attributes
3441  */
3442 static void
3443 dissect_attrs (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
3444 {
3445   guint8 type;
3446   guint32 length;
3447   int pos = 0;
3448   gint total_len;
3449   proto_tree *attr_tree, *attr_subtree;
3450   proto_item *ti, *tlv_item, *tlv_len_item;
3451   tvbuff_t *attr_tvb;
3452
3453   total_len = tvb_reported_length_remaining (tvb, 0);
3454   while (pos < total_len)
3455   {
3456     type = tvb_get_guint8 (tvb, pos);
3457     attr_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
3458                                   ett_docsis_bpkmattrtlv, &tlv_item,
3459                                   val_to_str(type, bpkmattr_tlv_vals,
3460                                   "Unknown TLV (%u)"));
3461     proto_tree_add_uint (attr_tree, hf_docsis_bpkmattr_type, tvb, pos, 1, type);
3462     pos++;
3463     tlv_len_item = proto_tree_add_item_ret_uint (attr_tree, hf_docsis_bpkmattr_length,
3464                            tvb, pos, 2, ENC_BIG_ENDIAN, &length);
3465     pos += 2;
3466     proto_item_set_len(tlv_item, length + 2);
3467
3468     switch (type)
3469     {
3470     case BPKM_RESERVED:
3471       break;
3472     case BPKM_SERIAL_NUM:
3473       proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_serial_num, tvb, pos, length, ENC_ASCII|ENC_NA);
3474       break;
3475     case BPKM_MANUFACTURER_ID:
3476       if (length == 3)
3477         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_manf_id, tvb, pos, length, ENC_NA);
3478       else
3479         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3480       break;
3481     case BPKM_MAC_ADDR:
3482       if (length == 6)
3483         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_mac_addr, tvb, pos, length, ENC_NA);
3484       else
3485         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3486       break;
3487     case BPKM_RSA_PUB_KEY:
3488       proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_rsa_pub_key, tvb, pos, length, ENC_NA);
3489       break;
3490     case BPKM_CM_ID:
3491       ti = proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_cm_id, tvb, pos, length, ENC_NA);
3492       attr_subtree = proto_item_add_subtree(ti, ett_docsis_bpkmattr_cmid);
3493       attr_tvb = tvb_new_subset_length (tvb, pos, length);
3494       dissect_attrs (attr_tvb, pinfo, attr_subtree);
3495       break;
3496     case BPKM_DISPLAY_STR:
3497       proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_display_str, tvb, pos, length, ENC_ASCII|ENC_NA);
3498       break;
3499     case BPKM_AUTH_KEY:
3500       if ((length == 96) || (length == 128) || (length == 256))
3501         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_auth_key, tvb, pos, length, ENC_NA);
3502       else
3503         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3504       break;
3505     case BPKM_TEK:
3506       if (length == 8 || length == 16)
3507         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_tek, tvb, pos, length, ENC_NA);
3508       else
3509         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3510       break;
3511     case BPKM_KEY_LIFETIME:
3512       if (length == 4)
3513         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_key_life, tvb, pos, length, ENC_BIG_ENDIAN);
3514       else
3515         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3516       break;
3517     case BPKM_KEY_SEQ_NUM:
3518       if (length == 1)
3519         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_key_seq, tvb, pos, length, ENC_BIG_ENDIAN);
3520       else
3521         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3522       break;
3523     case BPKM_HMAC_DIGEST:
3524       if (length == 20)
3525         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_hmac_digest, tvb, pos, length, ENC_NA);
3526       else
3527         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3528       break;
3529     case BPKM_SAID:
3530       if (length == 2)
3531         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_said, tvb, pos, length, ENC_BIG_ENDIAN);
3532       else
3533         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3534       break;
3535     case BPKM_TEK_PARAM:
3536       ti = proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_tek_params, tvb, pos, length, ENC_NA);
3537       attr_subtree = proto_item_add_subtree(ti, ett_docsis_bpkmattr_tekp);
3538       attr_tvb = tvb_new_subset_length (tvb, pos, length);
3539       dissect_attrs (attr_tvb, pinfo, attr_subtree);
3540       break;
3541     case BPKM_OBSOLETED:
3542       break;
3543     case BPKM_CBC_IV:
3544       if (length == 8 || length == 16)
3545         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_cbc_iv, tvb, pos, length, ENC_NA);
3546       else
3547         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3548       break;
3549     case BPKM_ERROR_CODE:
3550       if (length == 1)
3551         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_error_code, tvb, pos, length, ENC_BIG_ENDIAN);
3552       else
3553         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3554       break;
3555     case BPKM_CA_CERT:
3556       proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_ca_cert, tvb, pos, length, ENC_NA);
3557       break;
3558     case BPKM_CM_CERT:
3559       proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_cm_cert, tvb, pos, length, ENC_NA);
3560       break;
3561     case BPKM_SEC_CAPABILITIES:
3562       ti = proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_security_cap, tvb, pos, length, ENC_NA);
3563       attr_subtree = proto_item_add_subtree(ti, ett_docsis_bpkmattr_scap);
3564       attr_tvb = tvb_new_subset_length (tvb, pos, length);
3565       dissect_attrs (attr_tvb, pinfo, attr_subtree);
3566       break;
3567     case BPKM_CRYPTO_SUITE:
3568       if (length == 2)
3569         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_crypto_suite, tvb, pos, length, ENC_BIG_ENDIAN);
3570       else
3571         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3572       break;
3573     case BPKM_CRYPTO_SUITE_LIST:
3574       proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_crypto_suite_list, tvb, pos, length, ENC_NA);
3575       break;
3576     case BPKM_BPI_VERSION:
3577       if (length == 1)
3578         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_bpi_version, tvb, pos, length, ENC_BIG_ENDIAN);
3579       else
3580         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3581       break;
3582     case BPKM_SA_DESCRIPTOR:
3583       ti = proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_sa_descr, tvb, pos, length, ENC_NA);
3584       attr_subtree = proto_item_add_subtree(ti, ett_docsis_bpkmattr_sadsc);
3585       attr_tvb = tvb_new_subset_length (tvb, pos, length);
3586       dissect_attrs (attr_tvb, pinfo, attr_subtree);
3587       break;
3588     case BPKM_SA_TYPE:
3589       if (length == 1)
3590         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_sa_type, tvb, pos, length, ENC_BIG_ENDIAN);
3591       else
3592         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3593       break;
3594     case BPKM_SA_QUERY:
3595       ti = proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_sa_query, tvb, pos, length, ENC_NA);
3596       attr_subtree = proto_item_add_subtree(ti, ett_docsis_bpkmattr_saqry);
3597       attr_tvb = tvb_new_subset_length (tvb, pos, length);
3598       dissect_attrs (attr_tvb, pinfo, attr_subtree);
3599       break;
3600     case BPKM_SA_QUERY_TYPE:
3601       if (length == 1)
3602         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_sa_query_type, tvb, pos, length, ENC_BIG_ENDIAN);
3603       else
3604         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3605       break;
3606     case BPKM_IP_ADDRESS:
3607       if (length == 4)
3608         proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_ip_address, tvb, pos, length, ENC_BIG_ENDIAN);
3609       else
3610         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3611       break;
3612     case BPKM_VENDOR_DEFINED:
3613       proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_vendor_def, tvb, pos, length, ENC_NA);
3614       break;
3615     case BPKM_DNLD_PARAMS:
3616       ti = proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_download_param, tvb, pos, length, ENC_NA);
3617       attr_subtree = proto_item_add_subtree(ti, ett_docsis_bpkmattr_dnld);
3618       attr_tvb = tvb_new_subset_length (tvb, pos, length);
3619       dissect_attrs (attr_tvb, pinfo, attr_subtree);
3620       break;
3621     default:
3622       proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_vendor_def, tvb, pos, length, ENC_NA);
3623       break;
3624     }
3625
3626     pos += length;            /* switch */
3627   }                           /* while */
3628 }
3629
3630 static int
3631 dissect_bpkmreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3632 {
3633   proto_item *it;
3634   proto_tree *bpkmreq_tree, *bpkmattr_tree;
3635   guint32 code;
3636   tvbuff_t *attrs_tvb;
3637
3638   it = proto_tree_add_item(tree, proto_docsis_bpkmreq, tvb, 0, -1, ENC_NA);
3639   bpkmreq_tree = proto_item_add_subtree (it, ett_docsis_bpkmreq);
3640   proto_tree_add_item_ret_uint (bpkmreq_tree, hf_docsis_bpkm_code, tvb, 0, 1,
3641                            ENC_BIG_ENDIAN, &code);
3642
3643   col_add_fstr (pinfo->cinfo, COL_INFO, "BPKM Request (%s)",
3644                 val_to_str (code, code_field_vals, "%d"));
3645
3646   proto_tree_add_item (bpkmreq_tree, hf_docsis_bpkm_ident, tvb, 1, 1, ENC_BIG_ENDIAN);
3647   proto_tree_add_item (bpkmreq_tree, hf_docsis_bpkm_length, tvb, 2, 2, ENC_BIG_ENDIAN);
3648   it = proto_tree_add_item(bpkmreq_tree, hf_docsis_bpkmattr, tvb, 4, tvb_reported_length_remaining(tvb, 4), ENC_NA);
3649   bpkmattr_tree = proto_item_add_subtree (it, ett_docsis_bpkmattr);
3650
3651   attrs_tvb = tvb_new_subset_remaining (tvb, 4);
3652   dissect_attrs(attrs_tvb, pinfo, bpkmattr_tree);
3653   return tvb_captured_length(tvb);
3654 }
3655
3656 static int
3657 dissect_bpkmrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3658 {
3659   proto_item *it;
3660   proto_tree *bpkmrsp_tree, *bpkmattr_tree;
3661   guint32 code;
3662   tvbuff_t *attrs_tvb;
3663
3664   it = proto_tree_add_item(tree, proto_docsis_bpkmrsp, tvb, 0, -1, ENC_NA);
3665   bpkmrsp_tree = proto_item_add_subtree (it, ett_docsis_bpkmrsp);
3666
3667   proto_tree_add_item_ret_uint (bpkmrsp_tree, hf_docsis_bpkm_code, tvb, 0, 1, ENC_BIG_ENDIAN, &code);
3668
3669   col_add_fstr (pinfo->cinfo, COL_INFO, "BPKM Response (%s)",
3670                 val_to_str (code, code_field_vals, "Unknown code %u"));
3671
3672   proto_tree_add_item (bpkmrsp_tree, hf_docsis_bpkm_ident, tvb, 1, 1, ENC_BIG_ENDIAN);
3673   proto_tree_add_item (bpkmrsp_tree, hf_docsis_bpkm_length, tvb, 2, 2, ENC_BIG_ENDIAN);
3674   it = proto_tree_add_item(bpkmrsp_tree, hf_docsis_bpkmattr, tvb, 4, tvb_reported_length_remaining(tvb, 4), ENC_NA);
3675   bpkmattr_tree = proto_item_add_subtree (it, ett_docsis_bpkmattr);
3676
3677   attrs_tvb = tvb_new_subset_remaining (tvb, 4);
3678   dissect_attrs(attrs_tvb, pinfo, bpkmattr_tree);
3679   return tvb_captured_length(tvb);
3680 }
3681
3682 static int
3683 dissect_regack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3684 {
3685   proto_item *it;
3686   proto_tree *regack_tree;
3687   guint32 sid, response;
3688   tvbuff_t *next_tvb;
3689
3690   it = proto_tree_add_item (tree, proto_docsis_regack, tvb, 0, -1, ENC_NA);
3691   regack_tree = proto_item_add_subtree (it, ett_docsis_regack);
3692
3693   proto_tree_add_item_ret_uint (regack_tree, hf_docsis_regack_sid, tvb, 0, 2, ENC_BIG_ENDIAN, &sid);
3694   proto_tree_add_item_ret_uint (regack_tree, hf_docsis_regack_response, tvb, 2, 1, ENC_BIG_ENDIAN, &response);
3695
3696   col_add_fstr (pinfo->cinfo, COL_INFO,
3697                 "Registration Acknowledge SID = %u (%s)", sid,
3698                 val_to_str_ext (response, &docsis_conf_code_ext, "%d"));
3699
3700   /* Call Dissector for Appendix C TLV's */
3701   next_tvb = tvb_new_subset_remaining (tvb, 3);
3702   call_dissector (docsis_tlv_handle, next_tvb, pinfo, regack_tree);
3703   return tvb_captured_length(tvb);
3704 }
3705
3706 static int
3707 dissect_dsareq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3708 {
3709   proto_item *it;
3710   proto_tree *dsareq_tree;
3711   guint32 transid;
3712   tvbuff_t *next_tvb;
3713
3714   it = proto_tree_add_item(tree, proto_docsis_dsareq, tvb, 0, -1, ENC_NA);
3715   dsareq_tree = proto_item_add_subtree (it, ett_docsis_dsareq);
3716
3717   proto_tree_add_item_ret_uint (dsareq_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
3718
3719   col_add_fstr (pinfo->cinfo, COL_INFO,
3720                 "Dynamic Service Addition Request Tran-id = %u", transid);
3721
3722   /* Call Dissector for Appendix C TLV's */
3723   next_tvb = tvb_new_subset_remaining (tvb, 2);
3724   call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsareq_tree);
3725   return tvb_captured_length(tvb);
3726 }
3727
3728 static int
3729 dissect_dsarsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3730 {
3731   proto_item *it;
3732   proto_tree *dsarsp_tree;
3733   guint32 transid, response;
3734   tvbuff_t *next_tvb;
3735
3736   it = proto_tree_add_item (tree, proto_docsis_dsarsp, tvb, 0, -1, ENC_NA);
3737   dsarsp_tree = proto_item_add_subtree (it, ett_docsis_dsarsp);
3738   proto_tree_add_item_ret_uint (dsarsp_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
3739   proto_tree_add_item_ret_uint (dsarsp_tree, hf_docsis_dsarsp_response, tvb, 2, 1, ENC_BIG_ENDIAN, &response);
3740
3741   col_add_fstr (pinfo->cinfo, COL_INFO,
3742                 "Dynamic Service Add Response ID = %u (%s)", transid,
3743                 val_to_str_ext (response, &docsis_conf_code_ext, "%d"));
3744
3745   /* Call dissector for Appendix C TLV's */
3746   next_tvb = tvb_new_subset_remaining (tvb, 3);
3747   call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsarsp_tree);
3748   return tvb_captured_length(tvb);
3749 }
3750
3751 static int
3752 dissect_dsaack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3753 {
3754   proto_item *it;
3755   proto_tree *dsaack_tree;
3756   guint32 transid, response;
3757   tvbuff_t *next_tvb;
3758
3759   it = proto_tree_add_item (tree, proto_docsis_dsaack, tvb, 0, -1, ENC_NA);
3760   dsaack_tree = proto_item_add_subtree (it, ett_docsis_dsaack);
3761   proto_tree_add_item_ret_uint (dsaack_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
3762   proto_tree_add_item_ret_uint (dsaack_tree, hf_docsis_dsaack_response, tvb, 2, 1, ENC_BIG_ENDIAN, &response);
3763
3764   col_add_fstr (pinfo->cinfo, COL_INFO,
3765                 "Dynamic Service Add Ack ID = %u (%s)", transid,
3766                 val_to_str_ext (response, &docsis_conf_code_ext, "%d"));
3767
3768   /* Call Dissector for Appendix C TLV's */
3769   next_tvb = tvb_new_subset_remaining (tvb, 3);
3770   call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsaack_tree);
3771   return tvb_captured_length(tvb);
3772 }
3773
3774 static int
3775 dissect_dscreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3776 {
3777   proto_item *it;
3778   proto_tree *dscreq_tree;
3779   guint32 transid;
3780   tvbuff_t *next_tvb;
3781
3782   it = proto_tree_add_item (tree, proto_docsis_dscreq, tvb, 0, -1, ENC_NA);
3783   dscreq_tree = proto_item_add_subtree (it, ett_docsis_dscreq);
3784
3785   proto_tree_add_item_ret_uint (dscreq_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
3786
3787   col_add_fstr (pinfo->cinfo, COL_INFO,
3788                 "Dynamic Service Change Request Tran-id = %u", transid);
3789
3790   /* Call dissector for Appendix C TLV's */
3791   next_tvb = tvb_new_subset_remaining (tvb, 2);
3792   call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscreq_tree);
3793   return tvb_captured_length(tvb);
3794 }
3795
3796 static int
3797 dissect_dscrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3798 {
3799   proto_item *it;
3800   proto_tree *dscrsp_tree;
3801   guint32 transid, response;
3802   tvbuff_t *next_tvb;
3803
3804   it = proto_tree_add_item(tree, proto_docsis_dscrsp, tvb, 0, -1, ENC_NA);
3805   dscrsp_tree = proto_item_add_subtree (it, ett_docsis_dscrsp);
3806   proto_tree_add_item_ret_uint (dscrsp_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
3807   proto_tree_add_item_ret_uint (dscrsp_tree, hf_docsis_dscrsp_response, tvb, 2, 1, ENC_BIG_ENDIAN, &response);
3808
3809   col_add_fstr (pinfo->cinfo, COL_INFO,
3810                 "Dynamic Service Change Response ID = %u (%s)", transid,
3811                 val_to_str_ext (response, &docsis_conf_code_ext, "%d"));
3812
3813   /* Call Dissector for Appendix C TLV's */
3814   next_tvb = tvb_new_subset_remaining (tvb, 3);
3815   call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscrsp_tree);
3816   return tvb_captured_length(tvb);
3817 }
3818
3819 static int
3820 dissect_dscack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3821 {
3822   proto_item *it;
3823   proto_tree *dscack_tree;
3824   guint32 transid, response;
3825   tvbuff_t *next_tvb;
3826
3827   it = proto_tree_add_item(tree, proto_docsis_dscack, tvb, 0, -1, ENC_NA);
3828   dscack_tree = proto_item_add_subtree (it, ett_docsis_dscack);
3829
3830   proto_tree_add_item_ret_uint (dscack_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
3831   proto_tree_add_item_ret_uint (dscack_tree, hf_docsis_dscack_response, tvb, 2, 1, ENC_BIG_ENDIAN, &response);
3832
3833   col_add_fstr (pinfo->cinfo, COL_INFO,
3834                 "Dynamic Service Change Ack ID = %u (%s)", transid,
3835                 val_to_str_ext (response, &docsis_conf_code_ext, "%d"));
3836
3837   /* Call Dissector for Appendix C TLV's */
3838   next_tvb = tvb_new_subset_remaining (tvb, 3);
3839   call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscack_tree);
3840   return tvb_captured_length(tvb);
3841 }
3842
3843 static int
3844 dissect_dsdreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3845 {
3846   proto_item *it;
3847   proto_tree *dsdreq_tree;
3848   guint32 transid;
3849   tvbuff_t *next_tvb;
3850
3851   it = proto_tree_add_item (tree, proto_docsis_dsdreq, tvb, 0, -1, ENC_NA);
3852   dsdreq_tree = proto_item_add_subtree (it, ett_docsis_dsdreq);
3853
3854   proto_tree_add_item_ret_uint (dsdreq_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
3855
3856   col_add_fstr (pinfo->cinfo, COL_INFO,
3857                 "Dynamic Service Delete Request Tran-id = %u", transid);
3858
3859   proto_tree_add_item (dsdreq_tree, hf_docsis_dsdreq_rsvd, tvb, 2, 2, ENC_BIG_ENDIAN);
3860   proto_tree_add_item (dsdreq_tree, hf_docsis_dsdreq_sfid, tvb, 4, 4, ENC_BIG_ENDIAN);
3861
3862   /* Call Dissector for Appendix C TLV's */
3863   next_tvb = tvb_new_subset_remaining (tvb, 8);
3864   call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsdreq_tree);
3865   return tvb_captured_length(tvb);
3866 }
3867
3868 static int
3869 dissect_dsdrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
3870 {
3871   proto_item *it;
3872   proto_tree *dsdrsp_tree;
3873   guint32 tranid, confcode;
3874
3875   it = proto_tree_add_item(tree, proto_docsis_dsdrsp, tvb, 0, -1, ENC_NA);
3876   dsdrsp_tree = proto_item_add_subtree (it, ett_docsis_dsdrsp);
3877   proto_tree_add_item_ret_uint (dsdrsp_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &tranid);
3878   proto_tree_add_item_ret_uint (dsdrsp_tree, hf_docsis_dsdrsp_confcode, tvb, 2, 1, ENC_BIG_ENDIAN, &confcode);
3879   proto_tree_add_item (dsdrsp_tree, hf_docsis_dsdrsp_rsvd, tvb, 3, 1, ENC_BIG_ENDIAN);
3880
3881   col_add_fstr (pinfo->cinfo, COL_INFO,
3882                 "Dynamic Service Delete Response Tran id = %u (%s)",
3883                 tranid, val_to_str_ext (confcode, &docsis_conf_code_ext, "%d"));
3884
3885   return tvb_captured_length(tvb);
3886 }
3887
3888 static void
3889 dissect_dccreq_ds_params (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int start, guint16 len)
3890 {
3891   guint8 type;
3892   guint32 length;
3893   proto_tree *dcc_tree;
3894   proto_item *dcc_item, *tlv_len_item;
3895   int pos;
3896
3897   pos = start;
3898   while ( pos < ( start + len) )
3899   {
3900     type = tvb_get_guint8 (tvb, pos);
3901     dcc_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
3902                                             ett_docsis_dccreq_ds_params, &dcc_item,
3903                                             val_to_str(type, ds_param_subtlv_vals,
3904                                                        "Unknown TLV (%u)"));
3905     proto_tree_add_uint (dcc_tree, hf_docsis_dcc_ds_params_subtype, tvb, pos, 1, type);
3906     pos++;
3907     tlv_len_item = proto_tree_add_item_ret_uint (dcc_tree, hf_docsis_dcc_ds_params_length, tvb, pos, 1, ENC_NA, &length);
3908     pos++;
3909     proto_item_set_len(dcc_item, length + 2);
3910
3911     switch (type)
3912     {
3913     case DCCREQ_DS_FREQ:
3914       if (length == 4)
3915       {
3916         proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_freq, tvb, pos, length, ENC_BIG_ENDIAN);
3917       }
3918       else
3919       {
3920         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3921       }
3922       break;
3923     case DCCREQ_DS_MOD_TYPE:
3924       if (length == 1)
3925       {
3926         proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_mod_type, tvb, pos, length, ENC_BIG_ENDIAN);
3927       }
3928       else
3929       {
3930         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3931       }
3932       break;
3933     case DCCREQ_DS_SYM_RATE:
3934       if (length == 1)
3935       {
3936         proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_sym_rate, tvb, pos, length, ENC_BIG_ENDIAN);
3937       }
3938       else
3939       {
3940         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3941       }
3942       break;
3943     case DCCREQ_DS_INTLV_DEPTH:
3944       if (length == 2)
3945       {
3946         proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_intlv_depth_i, tvb, pos, 1, ENC_BIG_ENDIAN);
3947         proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_intlv_depth_j, tvb, pos + 1, 1, ENC_BIG_ENDIAN);
3948       }
3949       else
3950       {
3951         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3952       }
3953       break;
3954     case DCCREQ_DS_CHAN_ID:
3955       if (length == 1)
3956       {
3957         proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_chan_id, tvb, pos, length, ENC_BIG_ENDIAN);
3958       }
3959       else
3960       {
3961         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3962       }
3963       break;
3964     case DCCREQ_DS_SYNC_SUB:
3965       if (length == 1)
3966       {
3967         proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_sync_sub, tvb, pos, length, ENC_BIG_ENDIAN);
3968       }
3969       else
3970       {
3971         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3972       }
3973       break;
3974     case DCCREQ_DS_OFDM_BLOCK_FREQ:
3975       if (length == 4)
3976       {
3977         proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_ofdm_block_freq, tvb, pos, length, ENC_BIG_ENDIAN);
3978       }
3979       else
3980       {
3981         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
3982       }
3983       break;
3984     }
3985
3986     pos += length;
3987   }
3988 }
3989
3990 static void
3991 dissect_dccreq_sf_sub (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int start, guint16 len)
3992 {
3993   guint8 type;
3994   guint32 length;
3995   proto_tree *dcc_tree;
3996   proto_item *dcc_item, *tlv_len_item;
3997   int pos;
3998
3999   pos = start;
4000   while ( pos < ( start + len) )
4001   {
4002     type = tvb_get_guint8 (tvb, pos);
4003     dcc_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
4004                                             ett_docsis_dccreq_sf_sub, &dcc_item,
4005                                             val_to_str(type, sf_sub_subtlv_vals,
4006                                                        "Unknown TLV (%u)"));
4007     proto_tree_add_uint (dcc_tree, hf_docsis_dcc_sf_sub_subtype, tvb, pos, 1, type);
4008     pos++;
4009     tlv_len_item = proto_tree_add_item_ret_uint (dcc_tree, hf_docsis_dcc_sf_sub_length, tvb, pos, 1, ENC_NA, &length);
4010     pos++;
4011     proto_item_set_len(dcc_item, length + 2);
4012
4013     switch (type)
4014     {
4015     case DCCREQ_SF_SFID:
4016       if (length == 8)
4017       {
4018         proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_sfid_cur, tvb, pos, 4, ENC_BIG_ENDIAN);
4019         proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_sfid_new, tvb, pos + 4, 4, ENC_BIG_ENDIAN);
4020       }
4021       else
4022       {
4023         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4024       }
4025       break;
4026     case DCCREQ_SF_SID:
4027       if (length == 4)
4028       {
4029         proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_sid_cur, tvb, pos, 2, ENC_BIG_ENDIAN);
4030         proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_sid_new, tvb, pos + 2, 2, ENC_BIG_ENDIAN);
4031       }
4032       else
4033       {
4034         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4035       }
4036       break;
4037     case DCCREQ_SF_UNSOL_GRANT_TREF:
4038       if (length == 4)
4039       {
4040         proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_unsol_grant_tref, tvb, pos, length, ENC_BIG_ENDIAN);
4041       }
4042       else
4043       {
4044         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4045       }
4046       break;
4047     }
4048
4049     pos += length;
4050   }
4051 }
4052
4053 static int
4054 dissect_dccreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
4055 {
4056   guint16 pos;
4057   guint8 type;
4058   guint32 length;
4059   proto_tree *dcc_tree, *tlv_tree;
4060   proto_item *dcc_item, *tlv_item, *tlv_len_item;
4061
4062   col_set_str(pinfo->cinfo, COL_INFO, "DCC-REQ Message");
4063
4064   dcc_item = proto_tree_add_item (tree, proto_docsis_dccreq, tvb, 0, -1, ENC_NA);
4065   dcc_tree = proto_item_add_subtree (dcc_item, ett_docsis_dccreq);
4066
4067   proto_tree_add_item (dcc_tree, hf_docsis_dccreq_tran_id, tvb, 0, 2, ENC_BIG_ENDIAN);
4068
4069   pos = 2;
4070   while (tvb_reported_length_remaining(tvb, pos) > 0)
4071   {
4072     type = tvb_get_guint8 (tvb, pos);
4073     tlv_tree = proto_tree_add_subtree(dcc_tree, tvb, pos, -1,
4074                                             ett_docsis_dccreq_tlv, &tlv_item,
4075                                             val_to_str(type, dcc_tlv_vals,
4076                                                        "Unknown TLV (%u)"));
4077     proto_tree_add_uint (tlv_tree, hf_docsis_dccreq_type, tvb, pos, 1, type);
4078     pos++;
4079     tlv_len_item = proto_tree_add_item_ret_uint (tlv_tree, hf_docsis_dccreq_length, tvb, pos, 1, ENC_NA, &length);
4080     pos++;
4081     proto_item_set_len(tlv_item, length + 2);
4082
4083     switch (type)
4084     {
4085     case DCCREQ_UP_CHAN_ID:
4086       if (length == 1)
4087       {
4088         proto_tree_add_item (tlv_tree, hf_docsis_dccreq_up_chan_id, tvb, pos, length, ENC_BIG_ENDIAN);
4089       }
4090       else
4091       {
4092         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4093       }
4094       break;
4095     case DCCREQ_DS_PARAMS:
4096       dissect_dccreq_ds_params (tvb, pinfo, tlv_tree, pos, length);
4097       break;
4098     case DCCREQ_INIT_TECH:
4099       if (length == 1)
4100       {
4101         proto_tree_add_item (tlv_tree, hf_docsis_dccreq_init_tech, tvb, pos, length, ENC_BIG_ENDIAN);
4102       }
4103       else
4104       {
4105         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4106       }
4107       break;
4108     case DCCREQ_UCD_SUB:
4109       proto_tree_add_item (tlv_tree, hf_docsis_dccreq_ucd_sub, tvb, pos, length, ENC_NA);
4110       break;
4111     case DCCREQ_SAID_SUB:
4112       if (length == 4)
4113       {
4114         proto_tree_add_item (tlv_tree, hf_docsis_dccreq_said_sub_cur, tvb, pos, 2, ENC_BIG_ENDIAN);
4115         proto_tree_add_item (tlv_tree, hf_docsis_dccreq_said_sub_new, tvb, pos + 2, 2, ENC_BIG_ENDIAN);
4116       }
4117       else
4118       {
4119         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4120       }
4121       break;
4122     case DCCREQ_SF_SUB:
4123       dissect_dccreq_sf_sub (tvb, pinfo, tlv_tree, pos, length );
4124       break;
4125     case DCCREQ_CMTS_MAC_ADDR:
4126       if (length == 6)
4127       {
4128         proto_tree_add_item (tlv_tree, hf_docsis_dccreq_cmts_mac_addr, tvb, pos, length, ENC_NA);
4129       }
4130       else
4131       {
4132         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4133       }
4134       break;
4135     case DCCREQ_KEY_SEQ_NUM:
4136       if (length == 1)
4137       {
4138         proto_tree_add_item (tlv_tree, hf_docsis_dccreq_key_seq_num, tvb, pos, length, ENC_BIG_ENDIAN);
4139       }
4140       else
4141       {
4142         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4143       }
4144       break;
4145     case DCCREQ_HMAC_DIGEST:
4146       if (length == 20)
4147       {
4148         proto_tree_add_item (tlv_tree, hf_docsis_dccreq_hmac_digest, tvb, pos, length, ENC_NA);
4149       }
4150       else
4151       {
4152         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4153       }
4154       break;
4155     }       /* switch(type) */
4156     pos += length;
4157   }         /* (tvb_reported_length_remaining(tvb, pos) > 0) */
4158   return tvb_captured_length(tvb);
4159 }
4160
4161 static void
4162 dissect_dccrsp_cm_jump_time (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int start, guint16 len)
4163 {
4164   guint8 type;
4165   guint32 length;
4166   proto_tree *dcc_tree;
4167   proto_item *dcc_item, *tlv_len_item;
4168   int pos;
4169
4170   pos = start;
4171   while ( pos < ( start + len) )
4172   {
4173     type = tvb_get_guint8 (tvb, pos);
4174     dcc_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
4175                                             ett_docsis_dccrsp_cm_jump_time, &dcc_item,
4176                                             val_to_str(type, cm_jump_subtlv_vals,
4177                                                        "Unknown TLV (%u)"));
4178     proto_tree_add_uint (dcc_tree, hf_docsis_dcc_cm_jump_subtype, tvb, pos, 1, type);
4179     pos++;
4180     tlv_len_item = proto_tree_add_item_ret_uint (dcc_tree, hf_docsis_dcc_cm_jump_length, tvb, pos, 1, ENC_NA, &length);
4181     pos++;
4182     proto_item_set_len(dcc_item, length + 2);
4183
4184     switch (type)
4185     {
4186     case DCCRSP_CM_JUMP_TIME_LENGTH:
4187       if (length == 4)
4188       {
4189         proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_cm_jump_time_length, tvb, pos, length, ENC_BIG_ENDIAN);
4190       }
4191       else
4192       {
4193         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4194       }
4195       break;
4196     case DCCRSP_CM_JUMP_TIME_START:
4197       if (length == 8)
4198       {
4199         proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_cm_jump_time_start, tvb, pos, length, ENC_BIG_ENDIAN);
4200       }
4201       else
4202       {
4203         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4204       }
4205       break;
4206     }
4207
4208     pos += length;
4209   }
4210 }
4211
4212 static int
4213 dissect_dccrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
4214 {
4215   guint16 pos;
4216   guint8 type;
4217   guint32 length;
4218   proto_tree *dcc_tree, *tlv_tree;
4219   proto_item *dcc_item, *tlv_item, *tlv_len_item;
4220
4221   col_set_str(pinfo->cinfo, COL_INFO, "DCC-RSP Message");
4222
4223   dcc_item = proto_tree_add_item (tree, proto_docsis_dccrsp, tvb, 0, -1, ENC_NA);
4224   dcc_tree = proto_item_add_subtree (dcc_item, ett_docsis_dccrsp);
4225   proto_tree_add_item (dcc_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN);
4226   proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_conf_code, tvb, 2, 1, ENC_BIG_ENDIAN);
4227
4228   pos = 3;
4229   while (tvb_reported_length_remaining(tvb, pos) > 0)
4230   {
4231     type = tvb_get_guint8 (tvb, pos);
4232     tlv_tree = proto_tree_add_subtree(dcc_tree, tvb, pos, -1,
4233                                             ett_docsis_dccrsp_tlv, &tlv_item,
4234                                             val_to_str(type, dccrsp_tlv_vals,
4235                                                        "Unknown TLV (%u)"));
4236     proto_tree_add_uint (tlv_tree, hf_docsis_dccrsp_type, tvb, pos, 1, type);
4237     pos++;
4238     tlv_len_item = proto_tree_add_item_ret_uint (tlv_tree, hf_docsis_dccrsp_length, tvb, pos, 1, ENC_NA, &length);
4239     pos++;
4240     proto_item_set_len(tlv_item, length + 2);
4241
4242     switch (type)
4243     {
4244     case DCCRSP_CM_JUMP_TIME:
4245       dissect_dccrsp_cm_jump_time (tvb, pinfo, tlv_tree, pos, length );
4246       break;
4247     case DCCRSP_KEY_SEQ_NUM:
4248       if (length == 1)
4249       {
4250         proto_tree_add_item (tlv_tree, hf_docsis_dccrsp_key_seq_num, tvb, pos, length, ENC_BIG_ENDIAN);
4251       }
4252       else
4253       {
4254         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4255       }
4256       break;
4257     case DCCRSP_HMAC_DIGEST:
4258       if (length == 20)
4259       {
4260         proto_tree_add_item (tlv_tree, hf_docsis_dccrsp_hmac_digest, tvb, pos, length, ENC_NA);
4261       }
4262       else
4263       {
4264         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4265       }
4266       break;
4267     }      /* switch(type) */
4268
4269     pos += length;
4270   }       /* while (tvb_reported_length_remaining(tvb, pos) > 0) */
4271
4272   return tvb_captured_length(tvb);
4273 }
4274
4275 static int
4276 dissect_dccack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
4277 {
4278   guint16 pos;
4279   guint8 type;
4280   guint32 length;
4281   proto_tree *dcc_tree, *tlv_tree;
4282   proto_item *dcc_item, *tlv_item, *tlv_len_item;
4283
4284   col_set_str(pinfo->cinfo, COL_INFO, "DCC-ACK Message");
4285
4286   dcc_item = proto_tree_add_item(tree, proto_docsis_dccack, tvb, 0, -1, ENC_NA);
4287   dcc_tree = proto_item_add_subtree (dcc_item, ett_docsis_dccack);
4288   proto_tree_add_item (dcc_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN);
4289
4290   pos = 2;
4291   while (tvb_reported_length_remaining(tvb, pos) > 0)
4292   {
4293     type = tvb_get_guint8 (tvb, pos);
4294     tlv_tree = proto_tree_add_subtree(dcc_tree, tvb, pos, -1,
4295                                             ett_docsis_dccack_tlv, &tlv_item,
4296                                             val_to_str(type, dccack_tlv_vals,
4297                                                        "Unknown TLV (%u)"));
4298     proto_tree_add_uint (tlv_tree, hf_docsis_dccack_type, tvb, pos, 1, type);
4299     pos++;
4300     tlv_len_item = proto_tree_add_item_ret_uint (tlv_tree, hf_docsis_dccack_length, tvb, pos, 1, ENC_NA, &length);
4301     pos++;
4302     proto_item_set_len(tlv_item, length + 2);
4303
4304     switch (type)
4305     {
4306     case DCCACK_KEY_SEQ_NUM:
4307       if (length == 1)
4308       {
4309         proto_tree_add_item (tlv_tree, hf_docsis_dccack_key_seq_num, tvb, pos, length, ENC_BIG_ENDIAN);
4310       }
4311       else
4312       {
4313         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4314       }
4315       break;
4316     case DCCACK_HMAC_DIGEST:
4317       if (length == 20)
4318       {
4319         proto_tree_add_item (tlv_tree, hf_docsis_dccack_hmac_digest, tvb, pos, length, ENC_NA);
4320       }
4321       else
4322       {
4323         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4324       }
4325       break;
4326     }      /* switch(type) */
4327
4328     pos += length;
4329   }        /*   while (tvb_reported_length_remaining(tvb, pos) > 0) */
4330
4331   return tvb_captured_length(tvb);
4332 }
4333
4334 static int
4335 dissect_type29ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
4336 {
4337   return dissect_any_ucd(tvb, pinfo, tree, proto_docsis_type29ucd, MGT_TYPE29UCD);
4338 }
4339
4340 static int
4341 dissect_intrngreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
4342 {
4343   proto_item *intrngreq_item;
4344   proto_tree *intrngreq_tree;
4345   guint32 sid;
4346
4347   intrngreq_item = proto_tree_add_item(tree, proto_docsis_intrngreq, tvb, 0, -1, ENC_NA);
4348   intrngreq_tree = proto_item_add_subtree (intrngreq_item, ett_docsis_intrngreq);
4349
4350   proto_tree_add_item_ret_uint (intrngreq_tree, hf_docsis_intrngreq_sid, tvb, 0, 2, ENC_BIG_ENDIAN, &sid);
4351   col_add_fstr (pinfo->cinfo, COL_INFO, "Initial Ranging Request: SID = %u",sid);
4352
4353   proto_tree_add_item (intrngreq_tree, hf_docsis_mgt_down_chid, tvb, 2, 1, ENC_BIG_ENDIAN);
4354   proto_tree_add_item (intrngreq_tree, hf_docsis_mgt_upstream_chid, tvb, 3, 1, ENC_BIG_ENDIAN);
4355
4356   return tvb_captured_length(tvb);
4357 }
4358
4359 static void
4360 dissect_dcd_dsg_cfg (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int start, guint16 len)
4361 {
4362   guint8 type;
4363   guint32 length;
4364   proto_tree *dcd_tree;
4365   proto_tree *dcd_item, *tlv_len_item;
4366   int pos;
4367
4368   pos = start;
4369   while ( pos < ( start + len) )
4370   {
4371     type = tvb_get_guint8 (tvb, pos);
4372     dcd_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
4373                                             ett_docsis_dcd_cfg, &dcd_item,
4374                                             val_to_str(type, dcd_cfg_vals,
4375                                                        "Unknown TLV (%u)"));
4376     proto_tree_add_uint (dcd_tree, hf_docsis_dcd_cfg_subtype, tvb, pos, 1, type);
4377     pos++;
4378     tlv_len_item = proto_tree_add_item_ret_uint (dcd_tree, hf_docsis_dcd_cfg_length, tvb, pos, 1, ENC_NA, &length);
4379     pos++;
4380     proto_item_set_len(dcd_item, length + 2);
4381
4382     switch (type)
4383     {
4384     case DCD_CFG_CHAN_LST:
4385       if (length == 4)
4386       {
4387         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_chan, tvb, pos, length, ENC_BIG_ENDIAN);
4388       }
4389       else
4390       {
4391         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4392       }
4393       break;
4394     case DCD_CFG_TDSG1:
4395       if (length == 2)
4396       {
4397         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_tdsg1, tvb, pos, length, ENC_BIG_ENDIAN);
4398       }
4399       else
4400       {
4401         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4402       }
4403       break;
4404     case DCD_CFG_TDSG2:
4405       if (length == 2)
4406       {
4407         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_tdsg2, tvb, pos, length, ENC_BIG_ENDIAN);
4408       }
4409       else
4410       {
4411         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4412       }
4413       break;
4414     case DCD_CFG_TDSG3:
4415       if (length == 2)
4416       {
4417         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_tdsg3, tvb, pos, length, ENC_BIG_ENDIAN);
4418       }
4419       else
4420       {
4421         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4422       }
4423       break;
4424     case DCD_CFG_TDSG4:
4425       if (length == 2)
4426       {
4427         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_tdsg4, tvb, pos, length, ENC_BIG_ENDIAN);
4428       }
4429       else
4430       {
4431         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4432       }
4433       break;
4434     case DCD_CFG_VENDOR_SPEC:
4435       proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_vendor_spec, tvb, pos, length, ENC_NA);
4436       break;
4437
4438     }
4439
4440     pos += length;
4441   }
4442 }
4443
4444 static void
4445 dissect_dcd_down_classifier_ip (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int start, guint16 len)
4446 {
4447   guint8 type;
4448   guint32 length;
4449   proto_tree *dcd_tree;
4450   proto_tree *dcd_item, *tlv_len_item;
4451   int pos;
4452
4453   pos = start;
4454   while ( pos < ( start + len) )
4455   {
4456     type = tvb_get_guint8 (tvb, pos);
4457     dcd_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
4458                                             ett_docsis_dcd_cfr_ip, &dcd_item,
4459                                             val_to_str(type, dcd_cfr_ip_vals,
4460                                                        "Unknown TLV (%u)"));
4461     proto_tree_add_uint (dcd_tree, hf_docsis_dcd_cfr_ip_subtype, tvb, pos, 1, type);
4462     pos++;
4463     tlv_len_item = proto_tree_add_item_ret_uint (dcd_tree, hf_docsis_dcd_cfr_ip_length, tvb, pos, 1, ENC_NA, &length);
4464     pos++;
4465     proto_item_set_len(dcd_item, length + 2);
4466
4467     switch (type)
4468     {
4469     case DCD_CFR_IP_SOURCE_ADDR:
4470       if (length == 4)
4471       {
4472         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_ip_source_addr, tvb, pos, length, ENC_BIG_ENDIAN);
4473       }
4474       else
4475       {
4476         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4477       }
4478       break;
4479     case DCD_CFR_IP_SOURCE_MASK:
4480       if (length == 4)
4481       {
4482         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_ip_source_mask, tvb, pos, length, ENC_BIG_ENDIAN);
4483       }
4484       else
4485       {
4486         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4487       }
4488       break;
4489     case DCD_CFR_IP_DEST_ADDR:
4490       if (length == 4)
4491       {
4492         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_ip_dest_addr, tvb, pos, length, ENC_BIG_ENDIAN);
4493       }
4494       else
4495       {
4496         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4497       }
4498       break;
4499     case DCD_CFR_IP_DEST_MASK:
4500       if (length == 4)
4501       {
4502         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_ip_dest_mask, tvb, pos, length, ENC_BIG_ENDIAN);
4503       }
4504       else
4505       {
4506         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4507       }
4508       break;
4509     case DCD_CFR_TCPUDP_SRCPORT_START:
4510       if (length == 2)
4511       {
4512         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_tcpudp_srcport_start, tvb, pos, length, ENC_BIG_ENDIAN);
4513       }
4514       else
4515       {
4516         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4517       }
4518       break;
4519     case DCD_CFR_TCPUDP_SRCPORT_END:
4520       if (length == 2)
4521       {
4522         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_tcpudp_srcport_end, tvb, pos, length, ENC_BIG_ENDIAN);
4523       }
4524       else
4525       {
4526         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4527       }
4528       break;
4529     case DCD_CFR_TCPUDP_DSTPORT_START:
4530       if (length == 2)
4531       {
4532         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_tcpudp_dstport_start, tvb, pos, length, ENC_BIG_ENDIAN);
4533       }
4534       else
4535       {
4536         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4537       }
4538       break;
4539     case DCD_CFR_TCPUDP_DSTPORT_END:
4540       if (length == 2)
4541       {
4542         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_tcpudp_dstport_end, tvb, pos, length, ENC_BIG_ENDIAN);
4543       }
4544       else
4545       {
4546         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4547       }
4548       break;
4549     }
4550
4551     pos += length;
4552   }
4553 }
4554
4555 static void
4556 dissect_dcd_clid (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int start, guint16 len)
4557 {
4558   guint8 type;
4559   guint32 length;
4560   proto_tree *dcd_tree;
4561   proto_tree *dcd_item, *tlv_len_item;
4562   int pos;
4563
4564   pos = start;
4565   while ( pos < ( start + len) )
4566   {
4567     type = tvb_get_guint8 (tvb, pos);
4568     dcd_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
4569                                             ett_docsis_dcd_clid, &dcd_item,
4570                                             val_to_str(type, dcd_clid_vals,
4571                                                        "Unknown TLV (%u)"));
4572     proto_tree_add_uint (dcd_tree, hf_docsis_dcd_clid_subtype, tvb, pos, 1, type);
4573     pos++;
4574     tlv_len_item = proto_tree_add_item_ret_uint (dcd_tree, hf_docsis_dcd_clid_length, tvb, pos, 1, ENC_NA, &length);
4575     pos++;
4576     proto_item_set_len(dcd_item, length + 2);
4577
4578     switch (type)
4579     {
4580     case DCD_CLID_BCAST_ID:
4581       if (length == 2)
4582       {
4583         proto_tree_add_item(dcd_tree, hf_docsis_dcd_clid_bcast_id, tvb, pos, length, ENC_BIG_ENDIAN);
4584       }
4585       else
4586       {
4587         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4588       }
4589       break;
4590     case DCD_CLID_KNOWN_MAC_ADDR:
4591       if (length == 6)
4592       {
4593        proto_tree_add_item (dcd_tree, hf_docsis_dcd_clid_known_mac_addr, tvb, pos, length, ENC_NA);
4594       }
4595       else
4596       {
4597         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4598       }
4599       break;
4600     case DCD_CLID_CA_SYS_ID:
4601       if (length == 2)
4602       {
4603         proto_tree_add_item (dcd_tree, hf_docsis_dcd_clid_ca_sys_id, tvb, pos, length, ENC_BIG_ENDIAN);
4604       }
4605       else
4606       {
4607         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4608       }
4609       break;
4610     case DCD_CLID_APP_ID:
4611       if (length == 2)
4612       {
4613         proto_tree_add_item (dcd_tree, hf_docsis_dcd_clid_app_id, tvb, pos, length, ENC_BIG_ENDIAN);
4614       }
4615       else
4616       {
4617         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4618       }
4619       break;
4620     }
4621
4622     pos += length;
4623   }
4624 }
4625
4626 static void
4627 dissect_dcd_dsg_rule (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int start, guint16 len)
4628 {
4629   guint8 type;
4630   guint32 length;
4631   proto_tree *dcd_tree;
4632   proto_tree *dcd_item, *tlv_len_item;
4633   int pos;
4634
4635   pos = start;
4636   while ( pos < ( start + len) )
4637   {
4638     type = tvb_get_guint8 (tvb, pos);
4639     dcd_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
4640                                             ett_docsis_dcd_rule, &dcd_item,
4641                                             val_to_str(type, dcd_dsg_rule_vals,
4642                                                        "Unknown TLV (%u)"));
4643     proto_tree_add_uint (dcd_tree, hf_docsis_dcd_dsg_rule_subtype, tvb, pos, 1, type);
4644     pos++;
4645     tlv_len_item = proto_tree_add_item_ret_uint (dcd_tree, hf_docsis_dcd_dsg_rule_length, tvb, pos, 1, ENC_NA, &length);
4646     pos++;
4647     proto_item_set_len(dcd_item, length + 2);
4648
4649     switch (type)
4650     {
4651     case DCD_RULE_ID:
4652       if (length == 1)
4653       {
4654         proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_id, tvb, pos, length, ENC_BIG_ENDIAN);
4655       }
4656       else
4657       {
4658         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4659       }
4660       break;
4661     case DCD_RULE_PRI:
4662       if (length == 1)
4663       {
4664         proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_pri, tvb, pos, length, ENC_BIG_ENDIAN);
4665       }
4666       else
4667       {
4668         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4669       }
4670       break;
4671     case DCD_RULE_UCID_RNG:
4672       proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_ucid_list, tvb, pos, length, ENC_NA);
4673       break;
4674     case DCD_RULE_CLIENT_ID:
4675       dissect_dcd_clid (tvb, pinfo, dcd_tree, pos, length );
4676       break;
4677     case DCD_RULE_TUNL_ADDR:
4678       if (length == 6)
4679       {
4680         proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_tunl_addr, tvb, pos, length, ENC_NA);
4681       }
4682       else
4683       {
4684         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4685       }
4686       break;
4687     case DCD_RULE_CFR_ID:
4688       if (length == 2)
4689       {
4690         proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_cfr_id, tvb, pos, length, ENC_BIG_ENDIAN);
4691       }
4692       else
4693       {
4694         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4695       }
4696       break;
4697     case DCD_RULE_VENDOR_SPEC:
4698       proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_vendor_spec, tvb, pos, length, ENC_NA);
4699       break;
4700
4701     }
4702
4703     pos += length;
4704   }
4705 }
4706
4707 static void
4708 dissect_dcd_down_classifier (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int start, guint16 len)
4709 {
4710   guint8 type;
4711   guint32 length;
4712   proto_tree *dcd_tree;
4713   proto_tree *dcd_item, *tlv_len_item;
4714   int pos;
4715
4716   pos = start;
4717   while ( pos < ( start + len) )
4718   {
4719     type = tvb_get_guint8 (tvb, pos);
4720     dcd_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
4721                                             ett_docsis_dcd_cfr, &dcd_item,
4722                                             val_to_str(type, dcd_down_classifier_vals,
4723                                                        "Unknown TLV (%u)"));
4724     proto_tree_add_uint (dcd_tree, hf_docsis_dcd_down_classifier_subtype, tvb, pos, 1, type);
4725     pos++;
4726     tlv_len_item = proto_tree_add_item_ret_uint (dcd_tree, hf_docsis_dcd_down_classifier_length, tvb, pos, 1, ENC_NA, &length);
4727     pos++;
4728     proto_item_set_len(dcd_item, length + 2);
4729
4730     switch (type)
4731     {
4732     case DCD_CFR_ID:
4733       if (length == 2)
4734       {
4735         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_id, tvb, pos, length, ENC_BIG_ENDIAN);
4736       }
4737       else
4738       {
4739         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4740       }
4741       break;
4742     case DCD_CFR_RULE_PRI:
4743       if (length == 1)
4744       {
4745         proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_rule_pri, tvb, pos, length, ENC_BIG_ENDIAN);
4746       }
4747       else
4748       {
4749         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
4750       }
4751       break;
4752     case DCD_CFR_IP_CLASSIFIER:
4753       dissect_dcd_down_classifier_ip (tvb , pinfo , dcd_tree , pos , length );
4754       break;
4755     }
4756
4757     pos += length;
4758   }
4759 }
4760
4761 static int
4762 dissect_dcd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
4763 {
4764   guint16 pos;
4765   guint8 type;
4766   guint32 length;
4767   proto_tree *dcd_tree, *tlv_tree;
4768   proto_item *dcd_item, *tlv_item;
4769
4770   col_set_str(pinfo->cinfo, COL_INFO, "DCD Message: ");
4771
4772   dcd_item = proto_tree_add_item(tree, proto_docsis_dcd, tvb, 0, -1, ENC_NA);
4773   dcd_tree = proto_item_add_subtree (dcd_item, ett_docsis_dcd);
4774   proto_tree_add_item (dcd_tree, hf_docsis_dcd_config_ch_cnt, tvb, 0, 1, ENC_BIG_ENDIAN);
4775   proto_tree_add_item (dcd_tree, hf_docsis_dcd_num_of_frag, tvb, 1, 1, ENC_BIG_ENDIAN);
4776   proto_tree_add_item (dcd_tree, hf_docsis_dcd_frag_sequence_num, tvb, 2, 1, ENC_BIG_ENDIAN);
4777
4778   pos = 3;
4779   while (tvb_reported_length_remaining(tvb, pos) > 0)
4780   {
4781     type = tvb_get_guint8 (tvb, pos);
4782     tlv_tree = proto_tree_add_subtree(dcd_tree, tvb, pos, -1,
4783                                             ett_docsis_dcd_tlv, &tlv_item,
4784                                             val_to_str(type, dcd_tlv_vals,
4785                                                        "Unknown TLV (%u)"));
4786     proto_tree_add_uint (tlv_tree, hf_docsis_dcd_type, tvb, pos, 1, type);
4787     pos++;
4788     proto_tree_add_item_ret_uint (tlv_tree, hf_docsis_dcd_length, tvb, pos, 1, ENC_NA, &length);
4789     pos++;
4790     proto_item_set_len(tlv_item, length + 2);
4791
4792     switch (type)
4793     {
4794     case DCD_DOWN_CLASSIFIER:
4795       dissect_dcd_down_classifier (tvb, pinfo, tlv_tree, pos, length);
4796       break;
4797     case DCD_DSG_RULE:
4798       dissect_dcd_dsg_rule (tvb, pinfo, tlv_tree, pos, length);
4799       break;
4800     case DCD_DSG_CONFIG:
4801       dissect_dcd_dsg_cfg (tvb, pinfo, tlv_tree, pos, length);
4802       break;
4803     }     /* switch(type) */
4804
4805      pos += length;
4806   }       /* while (tvb_reported_length_remaining(tvb, pos) > 0) */
4807
4808   return tvb_captured_length(tvb);
4809 }
4810
4811 static void
4812 dissect_mdd_ds_active_channel_list(tvbuff_t * tvb, packet_info* pinfo _U_, proto_tree * tree, int start, guint16 len)
4813 {
4814   guint8 type;
4815   guint32 length;
4816   proto_tree *mdd_tree;
4817   proto_item *mdd_item;
4818   int pos;
4819   static const int * order_annex[] = {
4820     &hf_docsis_mdd_downstream_active_channel_list_modulation_order,
4821     &hf_docsis_mdd_downstream_active_channel_list_annex,
4822     NULL
4823   };
4824   static const int * cm_status_event[] = {
4825     &hf_docsis_mdd_cm_status_event_enable_bitmask_mdd_timeout,
4826     &hf_docsis_mdd_cm_status_event_enable_bitmask_qam_fec_lock_failure,
4827     &hf_docsis_mdd_cm_status_event_enable_bitmask_mdd_recovery,
4828     &hf_docsis_mdd_cm_status_event_enable_bitmask_qam_fec_lock_recovery,
4829     NULL
4830   };
4831   static const int * ofdm_plc_parameters[] = {
4832     &hf_docsis_mdd_ofdm_plc_parameters_tukey_raised_cosine_window,
4833     &hf_docsis_mdd_ofdm_plc_parameters_cyclic_prefix,
4834     &hf_docsis_mdd_ofdm_plc_parameters_sub_carrier_spacing,
4835     NULL
4836   };
4837
4838   pos = start;
4839   while ( pos < ( start + len) )
4840   {
4841     type = tvb_get_guint8 (tvb, pos);
4842     mdd_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
4843                                             ett_docsis_mdd_ds_active_channel_list, &mdd_item,
4844                                             val_to_str(type, mdd_ds_active_channel_list_vals,
4845                                                        "Unknown TLV (%u)"));
4846     proto_tree_add_uint (mdd_tree, hf_docsis_mdd_ds_active_channel_list_subtype, tvb, pos, 1, type);
4847     pos++;
4848     proto_tree_add_item_ret_uint (mdd_tree, hf_docsis_mdd_ds_active_channel_list_length, tvb, pos, 1, ENC_NA, &length);
4849     pos++;
4850     proto_item_set_len(mdd_item, length + 2);
4851
4852     switch(type)
4853     {
4854     case DOWNSTREAM_ACTIVE_CHANNEL_LIST_CHANNEL_ID:
4855       proto_tree_add_item (mdd_tree, hf_docsis_mdd_downstream_active_channel_list_channel_id, tvb, pos, 1, ENC_BIG_ENDIAN);
4856       break;
4857     case DOWNSTREAM_ACTIVE_CHANNEL_LIST_FREQUENCY:
4858       proto_tree_add_item (mdd_tree, hf_docsis_mdd_downstream_active_channel_list_frequency, tvb, pos, 4, ENC_BIG_ENDIAN);
4859       break;
4860     case DOWNSTREAM_ACTIVE_CHANNEL_LIST_MODULATION_ORDER_ANNEX:
4861       proto_tree_add_bitmask_list(mdd_tree, tvb, pos, 1, order_annex, ENC_BIG_ENDIAN);
4862       break;
4863     case DOWNSTREAM_ACTIVE_CHANNEL_LIST_PRIMARY_CAPABLE:
4864       proto_tree_add_item (mdd_tree, hf_docsis_mdd_downstream_active_channel_list_primary_capable, tvb, pos, 1, ENC_BIG_ENDIAN);
4865       break;
4866     case DOWNSTREAM_ACTIVE_CHANNEL_LIST_CM_STATUS_EVENT_ENABLE_BITMASK:
4867       proto_tree_add_bitmask(mdd_tree, tvb, pos, hf_docsis_mdd_cm_status_event_enable_bitmask, ett_sub_tlv, cm_status_event, ENC_BIG_ENDIAN);
4868       break;
4869     case DOWNSTREAM_ACTIVE_CHANNEL_LIST_MAP_UCD_TRANSPORT_INDICATOR:
4870       proto_tree_add_item (mdd_tree, hf_docsis_mdd_downstream_active_channel_list_map_ucd_transport_indicator, tvb, pos, 1, ENC_BIG_ENDIAN);
4871       break;
4872     case DOWNSTREAM_ACTIVE_CHANNEL_LIST_OFDM_PLC_PARAMETERS:
4873       proto_tree_add_bitmask(mdd_tree, tvb, pos, hf_docsis_mdd_ofdm_plc_parameters, ett_sub_tlv, ofdm_plc_parameters, ENC_BIG_ENDIAN);
4874       break;
4875     }
4876
4877     pos += length;
4878   }
4879 }
4880
4881 static void
4882 dissect_mdd_ds_service_group(tvbuff_t * tvb, packet_info* pinfo _U_, proto_tree * tree, int start, guint16 len)
4883 {
4884   guint8 type;
4885   guint32 i, length;
4886   proto_tree *mdd_tree;
4887   proto_item *mdd_item;
4888   int pos;
4889
4890   pos = start;
4891   while ( pos < ( start + len) )
4892   {
4893     type = tvb_get_guint8 (tvb, pos);
4894     mdd_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
4895                                             ett_docsis_mdd_ds_service_group, &mdd_item,
4896                                             val_to_str(type, mdd_ds_service_group_vals,
4897                                                        "Unknown TLV (%u)"));
4898     proto_tree_add_uint (mdd_tree, hf_docsis_mdd_ds_service_group_subtype, tvb, pos, 1, type);
4899     pos++;
4900     proto_tree_add_item_ret_uint (mdd_tree, hf_docsis_mdd_ds_service_group_length, tvb, pos, 1, ENC_NA, &length);
4901     pos++;
4902     proto_item_set_len(mdd_item, length + 2);
4903
4904     switch(type)
4905     {
4906     case MAC_DOMAIN_DOWNSTREAM_SERVICE_GROUP_MD_DS_SG_IDENTIFIER:
4907       proto_tree_add_item (mdd_tree, hf_docsis_mdd_mac_domain_downstream_service_group_md_ds_sg_identifier, tvb, pos, 1, ENC_BIG_ENDIAN);
4908      break;
4909     case MAC_DOMAIN_DOWNSTREAM_SERVICE_GROUP_CHANNEL_IDS:
4910       for (i = 0; i < length; i++) {
4911         proto_tree_add_item (mdd_tree, hf_docsis_mdd_mac_domain_downstream_service_group_channel_id, tvb, pos + i , 1, ENC_BIG_ENDIAN);
4912       }
4913       break;
4914     }
4915
4916     pos += length;
4917   }
4918 }
4919
4920 static void
4921 dissect_mdd_channel_profile_reporting_control(tvbuff_t * tvb, packet_info* pinfo _U_, proto_tree * tree, int start, guint16 len)
4922 {
4923   guint8 type;
4924   guint32 length;
4925   proto_tree *mdd_tree;
4926   proto_item *mdd_item;
4927   int pos;
4928
4929   pos = start;
4930   while ( pos < ( start + len) )
4931   {
4932     type = tvb_get_guint8 (tvb, pos);
4933     mdd_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
4934                                             ett_docsis_mdd_channel_profile_reporting_control, &mdd_item,
4935                                             val_to_str(type, mdd_channel_profile_reporting_control_vals,
4936                                                        "Unknown TLV (%u)"));
4937     proto_tree_add_uint (mdd_tree, hf_docsis_mdd_channel_profile_reporting_control_subtype, tvb, pos, 1, type);
4938     pos++;
4939     proto_tree_add_item_ret_uint (mdd_tree, hf_docsis_mdd_channel_profile_reporting_control_length, tvb, pos, 1, ENC_NA, &length);
4940     pos++;
4941     proto_item_set_len(mdd_item, length + 2);
4942
4943     switch(type)
4944     {
4945     case RCP_CENTER_FREQUENCY_SPACING:
4946       proto_tree_add_item (mdd_tree, hf_docsis_mdd_rpc_center_frequency_spacing, tvb, pos, 1, ENC_BIG_ENDIAN);
4947       break;
4948     case VERBOSE_RCP_REPORTING:
4949       proto_tree_add_item (mdd_tree, hf_docsis_mdd_verbose_rcp_reporting, tvb, pos, 1, ENC_BIG_ENDIAN);
4950       break;
4951     }
4952
4953     pos += length;
4954   }
4955 }
4956
4957 static void
4958 dissect_mdd_ip_init_param(tvbuff_t * tvb, packet_info* pinfo _U_, proto_tree * tree, int start, guint16 len)
4959 {
4960   guint8 type;
4961   guint32 length;
4962   proto_tree *mdd_tree;
4963   proto_item *mdd_item;
4964   int pos;
4965
4966   pos = start;
4967   while ( pos < ( start + len) )
4968   {
4969     type = tvb_get_guint8 (tvb, pos);
4970     mdd_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
4971                                             ett_docsis_mdd_ip_init_param, &mdd_item,
4972                                             val_to_str(type, mdd_ip_init_param_vals,
4973                                                        "Unknown TLV (%u)"));
4974     proto_tree_add_uint (mdd_tree, hf_docsis_mdd_ip_init_param_subtype, tvb, pos, 1, type);
4975     pos++;
4976     proto_tree_add_item_ret_uint (mdd_tree, hf_docsis_mdd_ip_init_param_length, tvb, pos, 1, ENC_NA, &length);
4977     pos++;
4978     proto_item_set_len(mdd_item, length + 2);
4979
4980     switch(type)
4981     {
4982     case IP_PROVISIONING_MODE:
4983       proto_tree_add_item (mdd_tree, hf_docsis_mdd_ip_provisioning_mode, tvb, pos, 1, ENC_BIG_ENDIAN);
4984       break;
4985     case PRE_REGISTRATION_DSID:
4986       proto_tree_add_item (mdd_tree, hf_docsis_mdd_pre_registration_dsid, tvb, pos, 3, ENC_BIG_ENDIAN);
4987       break;
4988     }
4989
4990     pos += length;
4991   }
4992 }
4993
4994 static void
4995 dissect_mdd_upstream_active_channel_list(tvbuff_t * tvb, packet_info* pinfo _U_, proto_tree * tree, int start, guint16 len)
4996 {
4997   guint8 type;
4998   guint32 length;
4999   proto_tree *mdd_tree;
5000   proto_item *mdd_item;
5001   int pos;
5002   static const int * cm_status_event[] = {
5003     &hf_docsis_mdd_cm_status_event_enable_bitmask_t4_timeout,
5004     &hf_docsis_mdd_cm_status_event_enable_bitmask_t3_retries_exceeded,
5005     &hf_docsis_mdd_cm_status_event_enable_bitmask_successful_ranging_after_t3_retries_exceeded,
5006     NULL
5007   };
5008
5009   pos = start;
5010   while ( pos < ( start + len) )
5011   {
5012     type = tvb_get_guint8 (tvb, pos);
5013     mdd_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
5014                                             ett_docsis_mdd_up_active_channel_list, &mdd_item,
5015                                             val_to_str(type, mdd_up_active_channel_list_vals,
5016                                                        "Unknown TLV (%u)"));
5017     proto_tree_add_uint (mdd_tree, hf_docsis_mdd_up_active_channel_list_subtype, tvb, pos, 1, type);
5018     pos++;
5019     proto_tree_add_item_ret_uint (mdd_tree, hf_docsis_mdd_up_active_channel_list_length, tvb, pos, 1, ENC_NA, &length);
5020     pos++;
5021     proto_item_set_len(mdd_item, length + 2);
5022
5023     switch(type)
5024     {
5025     case UPSTREAM_ACTIVE_CHANNEL_LIST_UPSTREAM_CHANNEL_ID:
5026       proto_tree_add_item (mdd_tree, hf_docsis_mdd_upstream_active_channel_list_upstream_channel_id, tvb, pos, 1, ENC_BIG_ENDIAN);
5027       break;
5028     case UPSTREAM_ACTIVE_CHANNEL_LIST_CM_STATUS_EVENT_ENABLE_BITMASK:
5029       proto_tree_add_bitmask(mdd_tree, tvb, pos, hf_docsis_mdd_cm_status_event_enable_bitmask, ett_sub_tlv, cm_status_event, ENC_BIG_ENDIAN);
5030       break;
5031     }
5032
5033     pos += length;
5034   }
5035 }
5036
5037 static void
5038 dissect_mdd_cm_status_event_control(tvbuff_t * tvb, packet_info* pinfo _U_, proto_tree * tree, int start, guint16 len)
5039 {
5040   guint8 type;
5041   guint32 length, timer;
5042   proto_tree *mdd_tree;
5043   proto_item *mdd_item, *text_item;
5044   int pos;
5045
5046   pos = start;
5047   while ( pos < ( start + len) )
5048   {
5049     type = tvb_get_guint8 (tvb, pos);
5050     mdd_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
5051                                             ett_docsis_mdd_cm_status_event_control, &mdd_item,
5052                                             val_to_str(type, mdd_cm_status_event_control_vals,
5053                                                        "Unknown TLV (%u)"));
5054     proto_tree_add_uint (mdd_tree, hf_docsis_mdd_cm_status_event_control_subtype, tvb, pos, 1, type);
5055     pos++;
5056     proto_tree_add_item_ret_uint (mdd_tree, hf_docsis_mdd_cm_status_event_control_length, tvb, pos, 1, ENC_NA, &length);
5057     pos++;
5058     proto_item_set_len(mdd_item, length + 2);
5059
5060     switch(type)
5061     {
5062     case EVENT_TYPE_CODE:
5063       proto_tree_add_item (mdd_tree, hf_docsis_mdd_event_type, tvb, pos, 1, ENC_BIG_ENDIAN);
5064       break;
5065     case MAXIMUM_EVENT_HOLDOFF_TIMER:
5066       text_item = proto_tree_add_item_ret_uint (mdd_tree, hf_docsis_mdd_maximum_event_holdoff_timer, tvb, pos, 2, ENC_BIG_ENDIAN, &timer);
5067       proto_item_append_text(text_item, " (%d ms)", timer * 20);
5068       break;
5069     case MAXIMUM_NUMBER_OF_REPORTS_PER_EVENT:
5070       proto_tree_add_item (mdd_tree, hf_docsis_mdd_maximum_number_of_reports_per_event, tvb, pos, 1, ENC_BIG_ENDIAN);
5071       break;
5072     }
5073
5074     pos += length;
5075   }
5076 }
5077
5078 static void
5079 dissect_mdd_dsg_da_to_dsid(tvbuff_t * tvb, packet_info* pinfo _U_, proto_tree * tree, int start, guint16 len)
5080 {
5081   guint8 type;
5082   guint32 length;
5083   proto_tree *mdd_tree;
5084   proto_item *mdd_item;
5085   int pos;
5086
5087   pos = start;
5088   while ( pos < ( start + len) )
5089   {
5090     type = tvb_get_guint8 (tvb, pos);
5091     mdd_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
5092                                             ett_docsis_mdd_dsg_da_to_dsid, &mdd_item,
5093                                             val_to_str(type, mdd_cm_dsg_da_to_dsid_vals,
5094                                                        "Unknown TLV (%u)"));
5095     proto_tree_add_uint (mdd_tree, hf_docsis_mdd_dsg_da_to_dsid_subtype, tvb, pos, 1, type);
5096     pos++;
5097     proto_tree_add_item_ret_uint (mdd_tree, hf_docsis_mdd_dsg_da_to_dsid_length, tvb, pos, 1, ENC_NA, &length);
5098     pos++;
5099     proto_item_set_len(mdd_item, length + 2);
5100
5101     switch(type)
5102     {
5103     case DSG_DA_TO_DSID_ASSOCIATION_DA:
5104       proto_tree_add_item (mdd_tree, hf_docsis_mdd_dsg_da_to_dsid_association_da, tvb, pos, 6, ENC_NA);
5105       break;
5106     case DSG_DA_TO_DSID_ASSOCIATION_DSID:
5107       proto_tree_add_item (mdd_tree, hf_docsis_mdd_dsg_da_to_dsid_association_dsid, tvb, pos, 3, ENC_BIG_ENDIAN);
5108       break;
5109     }
5110
5111     pos += length;
5112   }
5113 }
5114
5115 static void
5116 dissect_mdd_diplexer_band_edge(tvbuff_t * tvb, packet_info* pinfo _U_, proto_tree * tree, int start, guint16 len)
5117 {
5118   guint8 type;
5119   guint32 length;
5120   proto_tree *mdd_tree;
5121   proto_item *mdd_item;
5122   int pos;
5123
5124   pos = start;
5125   while ( pos < ( start + len) )
5126   {
5127     type = tvb_get_guint8 (tvb, pos);
5128     mdd_tree = proto_tree_add_subtree(tree, tvb, pos, 1,
5129                                             ett_docsis_mdd_diplexer_band_edge, &mdd_item,
5130                                             val_to_str(type, mdd_diplexer_band_edge_vals,
5131                                                        "Unknown TLV (%u)"));
5132     proto_tree_add_uint (mdd_tree, hf_docsis_mdd_diplexer_band_edge, tvb, pos, 1, type);
5133     pos++;
5134     proto_tree_add_item_ret_uint (mdd_tree, hf_docsis_mdd_diplexer_band_edge_length, tvb, pos, 1, ENC_BIG_ENDIAN, &length);
5135     pos++;
5136     proto_item_set_len(mdd_item, length + 2);
5137
5138     if (length == 1)
5139     {
5140       switch(type)
5141       {
5142       case DIPLEXER_US_UPPER_BAND_EDGE:
5143         proto_tree_add_item (mdd_tree, hf_docsis_mdd_diplexer_us_upper_band_edge, tvb, pos, length, ENC_BIG_ENDIAN);
5144         break;
5145       case DIPLEXER_DS_LOWER_BAND_EDGE:
5146         proto_tree_add_item (mdd_tree, hf_docsis_mdd_diplexer_ds_lower_band_edge, tvb, pos, length, ENC_BIG_ENDIAN);
5147         break;
5148       case DIPLEXER_DS_UPPER_BAND_EDGE:
5149         proto_tree_add_item (mdd_tree, hf_docsis_mdd_diplexer_ds_upper_band_edge, tvb, pos, length, ENC_BIG_ENDIAN);
5150         break;
5151       default:
5152         expert_add_info_format(pinfo, mdd_item, &ei_docsis_mgmt_tlvtype_unknown, "Unknown Diplexer Band Edge TLV type: %u", type);
5153         break;
5154       }
5155     } else
5156     {
5157       expert_add_info_format(pinfo, mdd_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5158       break;
5159     }
5160     pos += length;
5161   }
5162 }
5163
5164 static void
5165 dissect_mdd_full_duplex_descriptor(tvbuff_t * tvb, packet_info* pinfo _U_, proto_tree * tree, int start, guint16 len)
5166 {
5167   guint8 type;
5168   guint8 subtype;
5169   guint32 length;
5170   guint32 sublength;
5171   proto_tree *mdd_tree;
5172   proto_item *mdd_item;
5173   int pos;
5174   guint subpos;
5175   guint32 sub_band_offset;
5176
5177   pos = start;
5178   while ( pos < ( start + len) )
5179   {
5180     type = tvb_get_guint8 (tvb, pos);
5181     mdd_tree = proto_tree_add_subtree(tree, tvb, pos, 1,
5182                                             ett_docsis_mdd_full_duplex_descriptor, &mdd_item,
5183                                             val_to_str(type, mdd_full_duplex_descriptor_vals,
5184                                                        "Unknown TLV (%u)"));
5185     proto_tree_add_uint (mdd_tree, hf_docsis_mdd_full_duplex_descriptor, tvb, pos, 1, type);
5186     pos++;
5187     proto_tree_add_item_ret_uint (mdd_tree, hf_docsis_mdd_full_duplex_descriptor_length, tvb, pos, 1, ENC_BIG_ENDIAN, &length);
5188     pos++;
5189     proto_item_set_len(mdd_item, length + 2);
5190
5191     switch(type)
5192     {
5193     case FDX_ALLOCATED_SPECTRUM:
5194       if (length == 1)
5195       {
5196         proto_tree_add_item (mdd_tree, hf_docsis_mdd_full_duplex_allocated_spectrum, tvb, pos, length, ENC_BIG_ENDIAN);
5197       } else
5198       {
5199         expert_add_info_format(pinfo, mdd_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5200       }
5201       break;
5202     case FDX_TOTAL_NUMBER_OF_SUB_BANDS:
5203       if (length == 1)
5204       {
5205         proto_tree_add_item (mdd_tree, hf_docsis_mdd_full_duplex_total_number_of_sub_bands, tvb, pos, length, ENC_BIG_ENDIAN);
5206       } else
5207       {
5208         expert_add_info_format(pinfo, mdd_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5209       }
5210       break;
5211     case FDX_SUB_BAND_WIDTH:
5212       if (length == 1)
5213       {
5214         proto_tree_add_item (mdd_tree, hf_docsis_mdd_full_duplex_sub_band_width, tvb, pos, length, ENC_BIG_ENDIAN);
5215       } else
5216       {
5217         expert_add_info_format(pinfo, mdd_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5218       }
5219       break;
5220     case FDX_SUB_BAND_DESCRIPTOR:
5221       mdd_tree = proto_tree_add_subtree(mdd_tree, tvb, pos, 1,
5222                                             ett_docsis_mdd_full_duplex_sub_band_descriptor, &mdd_item,
5223                                             val_to_str(type, mdd_full_duplex_sub_band_vals,
5224                                                        "Unknown TLV (%u)"));
5225       proto_tree_add_item (mdd_tree, hf_docsis_mdd_full_duplex_sub_band_descriptor, tvb, pos, 1, ENC_BIG_ENDIAN);
5226       proto_tree_add_item_ret_uint (mdd_tree, hf_docsis_mdd_full_duplex_sub_band_descriptor_length, tvb, pos + 1, 1, ENC_BIG_ENDIAN, &sublength);
5227       proto_item_set_len(mdd_item, length + 2);
5228       subpos = pos + 2;
5229       while (subpos < pos + length + 2) {
5230         subtype = tvb_get_guint8 (tvb, subpos);
5231         sublength = tvb_get_guint8 (tvb, subpos + 1);
5232         switch(subtype) {
5233           case FDX_SUB_BAND_ID:
5234             if (length == 1)
5235             {
5236               proto_tree_add_item (mdd_tree, hf_docsis_mdd_full_duplex_sub_band_id, tvb, subpos + 2, sublength, ENC_BIG_ENDIAN);
5237             } else
5238             {
5239               expert_add_info_format(pinfo, mdd_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5240             }
5241             break;
5242           case FDX_SUB_BAND_OFFSET:
5243             if (length == 2)
5244             {
5245               mdd_item = proto_tree_add_item_ret_uint (mdd_tree, hf_docsis_mdd_full_duplex_sub_band_offset,
5246                                                        tvb, subpos + 2, sublength, ENC_BIG_ENDIAN, &sub_band_offset);
5247               proto_item_append_text(mdd_item, "%s", (sub_band_offset) ? " MHz" : " (108 MHz)");
5248             } else
5249             {
5250               expert_add_info_format(pinfo, mdd_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5251             }
5252             break;
5253           default:
5254             expert_add_info_format(pinfo, mdd_item, &ei_docsis_mgmt_tlvtype_unknown, "Unknown Full Duplex Sub-band TLV type: %u", subtype);
5255             break;
5256         }
5257         subpos += sublength + 2;
5258       }
5259       break;
5260     default:
5261       expert_add_info_format(pinfo, mdd_item, &ei_docsis_mgmt_tlvtype_unknown, "Unknown Diplexer Band Edge TLV type: %u", type);
5262       break;
5263     }
5264     pos += length;
5265   }
5266 }
5267
5268 static int
5269 dissect_mdd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
5270 {
5271   proto_item *it;
5272   proto_tree *mdd_tree;
5273
5274   int pos;
5275   guint subpos = 0;
5276   guint8 type;
5277   guint32 i, length;
5278   guint8 subtype;
5279   guint32 sublength;
5280
5281   proto_tree *tlv_tree;
5282   proto_item *tlv_item;
5283   static const int * non_channel_events[] = {
5284       &hf_docsis_mdd_cm_status_event_enable_non_channel_specific_events_sequence_out_of_range,
5285       &hf_docsis_mdd_cm_status_event_enable_non_channel_specific_events_cm_operating_on_battery_backup,
5286       &hf_docsis_mdd_cm_status_event_enable_non_channel_specific_events_cm_returned_to_ac_power,
5287       NULL
5288   };
5289
5290   col_set_str(pinfo->cinfo, COL_INFO, "MDD Message:");
5291
5292   it = proto_tree_add_item (tree, proto_docsis_mdd, tvb, 0, -1,ENC_NA);
5293   mdd_tree = proto_item_add_subtree (it, ett_docsis_mdd);
5294
5295   proto_tree_add_item (mdd_tree, hf_docsis_mdd_ccc, tvb, 0, 1, ENC_BIG_ENDIAN);
5296   proto_tree_add_item (mdd_tree, hf_docsis_mdd_number_of_fragments, tvb, 1, 1, ENC_BIG_ENDIAN);
5297   proto_tree_add_item (mdd_tree, hf_docsis_mdd_fragment_sequence_number, tvb, 2, 1, ENC_BIG_ENDIAN);
5298   proto_tree_add_item (mdd_tree, hf_docsis_mdd_current_channel_dcid, tvb, 3, 1, ENC_BIG_ENDIAN);
5299
5300   /*TLVs...*/
5301   pos = 4;
5302   while (tvb_reported_length_remaining(tvb, pos) > 0)
5303   {
5304     type = tvb_get_guint8 (tvb, pos);
5305     tlv_tree = proto_tree_add_subtree(mdd_tree, tvb, pos, -1,
5306                                             ett_tlv, &tlv_item,
5307                                             val_to_str(type, mdd_tlv_vals,
5308                                                        "Unknown TLV (%u)"));
5309     proto_tree_add_uint (tlv_tree, hf_docsis_mdd_type, tvb, pos, 1, type);
5310     pos++;
5311     proto_tree_add_item_ret_uint (tlv_tree, hf_docsis_mdd_length, tvb, pos, 1, ENC_NA, &length);
5312     pos++;
5313     proto_item_set_len(tlv_item, length + 2);
5314
5315     switch(type)
5316     {
5317     case DOWNSTREAM_ACTIVE_CHANNEL_LIST:
5318       dissect_mdd_ds_active_channel_list(tvb, pinfo, tlv_tree, pos, length );
5319       break;
5320     case MAC_DOMAIN_DOWNSTREAM_SERVICE_GROUP:
5321       dissect_mdd_ds_service_group(tvb, pinfo, tlv_tree, pos, length );
5322       break;
5323     case DOWNSTREAM_AMBIGUITY_RESOLUTION_FREQUENCY_LIST:
5324       for (i = 0; i < length; i+=4) {
5325         proto_tree_add_item (tlv_tree, hf_docsis_mdd_downstream_ambiguity_resolution_frequency, tvb, pos + i, 4, ENC_BIG_ENDIAN);
5326       }
5327       break;
5328     case RECEIVE_CHANNEL_PROFILE_REPORTING_CONTROL:
5329       dissect_mdd_channel_profile_reporting_control(tvb, pinfo, tlv_tree, pos, length );
5330       break;
5331     case IP_INITIALIZATION_PARAMETERS:
5332       dissect_mdd_ip_init_param(tvb, pinfo, tlv_tree, pos, length );
5333       break;
5334     case EARLY_AUTHENTICATION_AND_ENCRYPTION:
5335       proto_tree_add_item (tlv_tree, hf_docsis_mdd_early_authentication_and_encryption, tvb, pos, 1, ENC_BIG_ENDIAN);
5336       break;
5337     case UPSTREAM_ACTIVE_CHANNEL_LIST:
5338       dissect_mdd_upstream_active_channel_list(tvb, pinfo, tlv_tree, pos, length );
5339       break;
5340     case UPSTREAM_AMBIGUITY_RESOLUTION_CHANNEL_LIST:
5341       for (i = 0; i < length; i++) {
5342         proto_tree_add_item (tlv_tree, hf_docsis_mdd_upstream_ambiguity_resolution_channel_list_channel_id, tvb, pos + i , 1, ENC_BIG_ENDIAN);
5343       }
5344       break;
5345     case UPSTREAM_FREQUENCY_RANGE:
5346       proto_tree_add_item (tlv_tree, hf_docsis_mdd_upstream_frequency_range, tvb, pos, 1, ENC_BIG_ENDIAN);
5347       break;
5348     case SYMBOL_CLOCK_LOCKING_INDICATOR:
5349       proto_tree_add_item (tlv_tree, hf_docsis_mdd_symbol_clock_locking_indicator, tvb, pos, 1, ENC_BIG_ENDIAN);
5350       break;
5351     case CM_STATUS_EVENT_CONTROL:
5352       dissect_mdd_cm_status_event_control(tvb, pinfo, tlv_tree, pos, length );
5353       break;
5354     case UPSTREAM_TRANSMIT_POWER_REPORTING:
5355       proto_tree_add_item (tlv_tree, hf_docsis_mdd_upstream_transmit_power_reporting, tvb, pos, 1, ENC_BIG_ENDIAN);
5356       break;
5357     case DSG_DA_TO_DSID_ASSOCIATION_ENTRY:
5358       dissect_mdd_dsg_da_to_dsid(tvb, pinfo, tlv_tree, pos, length );
5359       break;
5360     case CM_STATUS_EVENT_ENABLE_NON_CHANNEL_SPECIFIC_EVENTS:
5361       proto_tree_add_bitmask(tlv_tree, tvb, pos, hf_docsis_mdd_cm_status_event_enable_non_channel_specific_events, ett_sub_tlv, non_channel_events, ENC_BIG_ENDIAN);
5362       break;
5363     case EXTENDED_UPSTREAM_TRANSMIT_POWER_SUPPORT:
5364       proto_tree_add_item (tlv_tree, hf_docsis_mdd_extended_upstream_transmit_power_support, tvb, pos, 1, ENC_BIG_ENDIAN);
5365       break;
5366     case CMTS_DOCSIS_VERSION:
5367       subpos = pos;
5368       while (subpos < pos + length + 2) {
5369         subtype = tvb_get_guint8 (tvb, subpos);
5370         sublength = tvb_get_guint8 (tvb, subpos + 1);
5371         switch(subtype) {
5372           case CMTS_MAJOR_DOCSIS_VERSION:
5373             proto_tree_add_item (tlv_tree, hf_docsis_mdd_cmts_major_docsis_version, tvb, subpos + 2, sublength, ENC_NA);
5374             break;
5375           case CMTS_MINOR_DOCSIS_VERSION:
5376             proto_tree_add_item (tlv_tree, hf_docsis_mdd_cmts_minor_docsis_version, tvb, subpos + 2, sublength, ENC_BIG_ENDIAN);
5377             break;
5378         }
5379         subpos += sublength + 2;
5380       }
5381       break;
5382     case CM_PERIODIC_MAINTENANCE_TIMEOUT_INDICATOR:
5383       proto_tree_add_item (tlv_tree, hf_docsis_mdd_cm_periodic_maintenance_timeout_indicator, tvb, pos, length, ENC_BIG_ENDIAN);
5384       break;
5385     case DLS_BROADCAST_AND_MULTICAST_DELIVERY_METHOD:
5386       proto_tree_add_item (tlv_tree, hf_docsis_mdd_dls_broadcast_and_multicast_delivery_method, tvb, pos, length, ENC_BIG_ENDIAN);
5387       break;
5388     case CM_STATUS_EVENT_ENABLE_FOR_DOCSIS_3_1_EVENTS:
5389       if (length == 4) {
5390         static const int * mdd_cm_status_event_d31[] = {
5391           &hf_docsis_mdd_cm_status_event_d31_ofdm_prof_fail,
5392           &hf_docsis_mdd_cm_status_event_d31_prim_down_chan_change,
5393           &hf_docsis_mdd_cm_status_event_d31_dpd_mismatch,
5394           &hf_docsis_mdd_cm_status_event_d31_deprecated,
5395           &hf_docsis_mdd_cm_status_event_d31_ncp_prof_fail,
5396           &hf_docsis_mdd_cm_status_event_d31_loss_fec_plc,
5397           &hf_docsis_mdd_cm_status_event_d31_ncp_prof_recover,
5398           &hf_docsis_mdd_cm_status_event_d31_fec_recover_on_plc,
5399           &hf_docsis_mdd_cm_status_event_d31_fec_recover_on_ofdm_prof,
5400           &hf_docsis_mdd_cm_status_event_d31_ofdma_prof_fail,
5401           &hf_docsis_mdd_cm_status_event_d31_map_stor_overflow_ind,
5402           &hf_docsis_mdd_cm_status_event_d31_ofdm_map_stor_almost_full_ind,
5403           &hf_docsis_mdd_cm_status_event_d31_reserved,
5404           NULL
5405         };
5406         proto_tree_add_bitmask_list(tlv_tree, tvb, pos, length, mdd_cm_status_event_d31, ENC_BIG_ENDIAN);
5407       }
5408       else
5409       {
5410         expert_add_info_format(pinfo, tlv_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5411       }
5412       break;
5413     case DIPLEXER_BAND_EDGE:
5414       dissect_mdd_diplexer_band_edge(tvb, pinfo, tlv_tree, pos, length );
5415       break;
5416     case FULL_DUPLEX_DESCRIPTOR:
5417       dissect_mdd_full_duplex_descriptor(tvb, pinfo, tlv_tree, pos, length );
5418       break;
5419     }
5420
5421     pos += length;
5422   }
5423
5424   return tvb_captured_length(tvb);
5425 }
5426
5427 static int
5428 dissect_bintrngreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
5429 {
5430   proto_item *bintrngreq_item;
5431   proto_tree *bintrngreq_tree;
5432   guint16 md_ds_sg_id;
5433   guint16 offset = 0;
5434
5435   md_ds_sg_id = tvb_get_ntohs (tvb, 0);
5436
5437   col_add_fstr (pinfo->cinfo, COL_INFO, "Bonded Ranging Request: MD-DS-SG-ID = %u (0x%X)",
5438                 md_ds_sg_id, md_ds_sg_id );
5439
5440   bintrngreq_item = proto_tree_add_item(tree, proto_docsis_bintrngreq, tvb, offset, -1, ENC_NA);
5441   bintrngreq_tree = proto_item_add_subtree (bintrngreq_item, ett_docsis_bintrngreq);
5442   proto_tree_add_item (bintrngreq_tree, hf_docsis_bintrngreq_capflags, tvb, offset, 1, ENC_BIG_ENDIAN);
5443   proto_tree_add_item( bintrngreq_tree, hf_docsis_bintrngreq_capflags_frag, tvb, offset, 1, ENC_BIG_ENDIAN );
5444   proto_tree_add_item( bintrngreq_tree, hf_docsis_bintrngreq_capflags_encrypt, tvb, offset, 1, ENC_BIG_ENDIAN );
5445   offset++;
5446   proto_tree_add_item (bintrngreq_tree, hf_docsis_bintrngreq_mddsgid, tvb, offset, 1, ENC_BIG_ENDIAN);
5447   offset++;
5448   proto_tree_add_item (bintrngreq_tree, hf_docsis_mgt_down_chid, tvb, offset, 1, ENC_BIG_ENDIAN);
5449   offset++;
5450   proto_tree_add_item (bintrngreq_tree, hf_docsis_mgt_upstream_chid, tvb, offset, 1, ENC_BIG_ENDIAN);
5451
5452   return tvb_captured_length(tvb);
5453 }
5454
5455 static int
5456 dissect_type35ucd(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
5457 {
5458   return dissect_any_ucd(tvb, pinfo, tree, proto_docsis_type35ucd, MGT_TYPE35UCD);
5459 }
5460
5461 static int
5462 dissect_dbcreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
5463 {
5464   proto_item *dbcreq_item, *reassembled_item;
5465   proto_tree *dbcreq_tree, *reassembled_tree;
5466   guint32 transid, number_of_fragments, fragment_sequence_number;
5467   tvbuff_t *next_tvb;
5468
5469   dbcreq_item = proto_tree_add_item(tree, proto_docsis_dbcreq, tvb, 0, -1, ENC_NA);
5470   dbcreq_tree = proto_item_add_subtree (dbcreq_item, ett_docsis_dbcreq);
5471   proto_tree_add_item_ret_uint(dbcreq_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
5472   proto_tree_add_item_ret_uint( dbcreq_tree, hf_docsis_dbcreq_number_of_fragments, tvb, 2, 1, ENC_BIG_ENDIAN, &number_of_fragments);
5473   proto_tree_add_item_ret_uint( dbcreq_tree, hf_docsis_dbcreq_fragment_sequence_number, tvb, 3, 1, ENC_BIG_ENDIAN, &fragment_sequence_number);
5474
5475   col_add_fstr (pinfo->cinfo, COL_INFO,
5476                 "Dynamic Bonding Change Request: Tran-Id = %u", transid);
5477   col_set_fence(pinfo->cinfo, COL_INFO);
5478
5479
5480   if(number_of_fragments > 1) {
5481      pinfo->fragmented = TRUE;
5482   }
5483
5484   /* Call Dissector for Appendix C TLV's */
5485   next_tvb = tvb_new_subset_remaining (tvb, 4);
5486   call_dissector (docsis_tlv_handle, next_tvb, pinfo, dbcreq_tree);
5487
5488
5489   if(number_of_fragments > 1) {
5490      pinfo->fragmented = TRUE;
5491
5492      fragment_head* reassembled_tlv = NULL;
5493      reassembled_tlv = fragment_add_seq_check(&docsis_tlv_reassembly_table,
5494                                   tvb, 4, pinfo,
5495                                   transid, NULL, /* ID for fragments belonging together */
5496                                   fragment_sequence_number -1, /*Sequence number starts at 0*/
5497                                   tvb_reported_length_remaining(tvb, 4), /* fragment length - to the end */
5498                                   (fragment_sequence_number != number_of_fragments)); /* More fragments? */
5499
5500      if (reassembled_tlv) {
5501        tvbuff_t *tlv_tvb = NULL;
5502
5503        reassembled_item = proto_tree_add_item(dbcreq_tree, hf_docsis_tlv_reassembled, tvb, 0, -1, ENC_NA);
5504        reassembled_tree = proto_item_add_subtree (reassembled_item, ett_docsis_tlv_reassembled );
5505
5506
5507        tlv_tvb = process_reassembled_data(tvb, 4, pinfo, "Reassembled TLV", reassembled_tlv, &docsis_tlv_frag_items,
5508                                                   NULL, reassembled_tree);
5509
5510        if (tlv_tvb && tvb_reported_length(tlv_tvb) > 0) {
5511          call_dissector (docsis_tlv_handle, tlv_tvb, pinfo, reassembled_tree);
5512        }
5513      }
5514
5515   }
5516
5517
5518   return tvb_captured_length(tvb);
5519 }
5520
5521 static int
5522 dissect_dbcrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
5523 {
5524   proto_item *dbcrsp_item;
5525   proto_tree *dbcrsp_tree;
5526   guint32 transid, confcode;
5527   tvbuff_t *next_tvb;
5528
5529   dbcrsp_item = proto_tree_add_item(tree, proto_docsis_dbcrsp, tvb, 0, -1, ENC_NA);
5530   dbcrsp_tree = proto_item_add_subtree (dbcrsp_item, ett_docsis_dbcrsp);
5531   proto_tree_add_item_ret_uint(dbcrsp_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
5532   proto_tree_add_item_ret_uint( dbcrsp_tree, hf_docsis_dbcrsp_conf_code, tvb, 2, 1, ENC_BIG_ENDIAN, &confcode);
5533
5534   col_add_fstr (pinfo->cinfo, COL_INFO,
5535                 "Dynamic Bonding Change Response: Tran-Id = %u (%s)", transid,
5536                 val_to_str_ext (confcode, &docsis_conf_code_ext, "%d"));
5537
5538   /* Call Dissector for Appendix C TLV's */
5539   next_tvb = tvb_new_subset_remaining (tvb, 3);
5540   call_dissector (docsis_tlv_handle, next_tvb, pinfo, dbcrsp_tree);
5541   return tvb_captured_length(tvb);
5542 }
5543
5544 static int
5545 dissect_dbcack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
5546 {
5547   proto_item *dbcack_item;
5548   proto_tree *dbcack_tree = NULL;
5549   guint16 transid;
5550   tvbuff_t *next_tvb;
5551
5552   transid = tvb_get_ntohs (tvb, 0);
5553
5554   col_add_fstr (pinfo->cinfo, COL_INFO,
5555                 "Dynamic Bonding Change Acknowledge: Tran-Id = %u", transid);
5556
5557   dbcack_item = proto_tree_add_item(tree, proto_docsis_dbcack, tvb, 0, -1, ENC_NA);
5558   dbcack_tree = proto_item_add_subtree (dbcack_item, ett_docsis_dbcack);
5559   proto_tree_add_item (dbcack_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN);
5560
5561   /* Call Dissector for Appendix C TLV's */
5562   next_tvb = tvb_new_subset_remaining (tvb, 2);
5563   call_dissector (docsis_tlv_handle, next_tvb, pinfo, dbcack_tree);
5564   return tvb_captured_length(tvb);
5565 }
5566
5567 static int
5568 dissect_dpvreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
5569 {
5570   proto_item *it;
5571   proto_tree *dpvreq_tree;
5572   guint32 transid, dschan;
5573
5574   it = proto_tree_add_item(tree, proto_docsis_dpvreq, tvb, 0, -1, ENC_NA);
5575   dpvreq_tree = proto_item_add_subtree (it, ett_docsis_dpvreq);
5576   proto_tree_add_item_ret_uint (dpvreq_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
5577   proto_tree_add_item_ret_uint (dpvreq_tree, hf_docsis_mgt_down_chid, tvb, 2, 1, ENC_BIG_ENDIAN, &dschan);
5578
5579   col_add_fstr (pinfo->cinfo, COL_INFO,
5580                 "DOCSIS Path Verify Request: Transaction-Id = %u DS-Ch %d",
5581                 transid, dschan);
5582
5583   proto_tree_add_item (dpvreq_tree, hf_docsis_dpv_flags, tvb, 3, 1, ENC_BIG_ENDIAN);
5584   proto_tree_add_item (dpvreq_tree, hf_docsis_dpv_us_sf, tvb, 4, 4, ENC_BIG_ENDIAN);
5585   proto_tree_add_item (dpvreq_tree, hf_docsis_dpv_n, tvb, 8, 2, ENC_BIG_ENDIAN);
5586   proto_tree_add_item (dpvreq_tree, hf_docsis_dpv_start, tvb, 10, 1, ENC_BIG_ENDIAN);
5587   proto_tree_add_item (dpvreq_tree, hf_docsis_dpv_end, tvb, 11, 1, ENC_BIG_ENDIAN);
5588   proto_tree_add_item (dpvreq_tree, hf_docsis_dpv_ts_start, tvb, 12, 4, ENC_BIG_ENDIAN);
5589   proto_tree_add_item (dpvreq_tree, hf_docsis_dpv_ts_end, tvb, 16, 4, ENC_BIG_ENDIAN);
5590
5591   return tvb_captured_length(tvb);
5592 }
5593
5594 static int
5595 dissect_dpvrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
5596 {
5597   proto_item *it;
5598   proto_tree *dpvrsp_tree = NULL;
5599   guint32 transid, dschan;
5600
5601   it = proto_tree_add_item (tree, proto_docsis_dpvrsp, tvb, 0, -1, ENC_NA);
5602   dpvrsp_tree = proto_item_add_subtree (it, ett_docsis_dpvrsp);
5603   proto_tree_add_item_ret_uint (dpvrsp_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
5604   proto_tree_add_item_ret_uint (dpvrsp_tree, hf_docsis_mgt_down_chid, tvb, 2, 1, ENC_BIG_ENDIAN, &dschan);
5605
5606   col_add_fstr (pinfo->cinfo, COL_INFO,
5607                 "DOCSIS Path Verify Response: Transaction-Id = %u DS-Ch %d",
5608                 transid, dschan);
5609
5610   proto_tree_add_item (dpvrsp_tree, hf_docsis_dpv_flags, tvb, 3, 1, ENC_BIG_ENDIAN);
5611   proto_tree_add_item (dpvrsp_tree, hf_docsis_dpv_us_sf, tvb, 4, 4, ENC_BIG_ENDIAN);
5612   proto_tree_add_item (dpvrsp_tree, hf_docsis_dpv_n, tvb, 8, 2, ENC_BIG_ENDIAN);
5613   proto_tree_add_item (dpvrsp_tree, hf_docsis_dpv_start, tvb, 10, 1, ENC_BIG_ENDIAN);
5614   proto_tree_add_item (dpvrsp_tree, hf_docsis_dpv_end, tvb, 11, 1, ENC_BIG_ENDIAN);
5615   proto_tree_add_item (dpvrsp_tree, hf_docsis_dpv_ts_start, tvb, 12, 4, ENC_BIG_ENDIAN);
5616   proto_tree_add_item (dpvrsp_tree, hf_docsis_dpv_ts_end, tvb, 16, 4, ENC_BIG_ENDIAN);
5617
5618   return tvb_captured_length(tvb);
5619 }
5620
5621 static void
5622 dissect_cmstatus_tlv (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree)
5623 {
5624   proto_item *it, *tlv_item, *tlv_len_item;
5625   proto_tree *tlv_tree;
5626   guint16 pos = 0;
5627   guint8 type;
5628   guint32 length;
5629
5630   it = proto_tree_add_item(tree, hf_docsis_cmstatus_tlv_data, tvb, 0, tvb_reported_length(tvb), ENC_NA);
5631   tlv_tree = proto_item_add_subtree (it, ett_docsis_cmstatus_tlv);
5632
5633   while (tvb_reported_length_remaining(tvb, pos) > 0)
5634   {
5635     type = tvb_get_guint8 (tvb, pos);
5636     tlv_tree = proto_tree_add_subtree(tlv_tree, tvb, pos, -1,
5637                                             ett_docsis_cmstatus_tlvtlv, &tlv_item,
5638                                             val_to_str(type, cmstatus_tlv_vals,
5639                                                        "Unknown TLV (%u)"));
5640     proto_tree_add_uint (tlv_tree, hf_docsis_cmstatus_type, tvb, pos, 1, type);
5641     pos++;
5642     tlv_len_item = proto_tree_add_item_ret_uint (tlv_tree, hf_docsis_cmstatus_length, tvb, pos, 1, ENC_NA, &length);
5643     pos++;
5644     proto_item_set_len(tlv_item, length + 2);
5645
5646     switch (type)
5647     {
5648     case EVENT_DS_CH_ID:
5649       if (length == 3)
5650       {
5651         proto_tree_add_item (tlv_tree, hf_docsis_cmstatus_ds_ch_id, tvb, pos + 1, 1, ENC_BIG_ENDIAN);
5652       }
5653       else
5654       {
5655         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5656       }
5657       break;
5658
5659     case EVENT_US_CH_ID:
5660       if (length == 3)
5661       {
5662         proto_tree_add_item (tlv_tree, hf_docsis_cmstatus_us_ch_id, tvb, pos + 1, 1, ENC_BIG_ENDIAN);
5663       }
5664       else
5665       {
5666         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5667       }
5668       break;
5669
5670     case EVENT_DSID:
5671       if (length == 5)
5672       {
5673         proto_tree_add_item (tlv_tree, hf_docsis_cmstatus_dsid, tvb, pos + 1, 3, ENC_BIG_ENDIAN);
5674       }
5675       else
5676       {
5677         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5678       }
5679       break;
5680
5681     case EVENT_DESCR:
5682       if (length >= 3 && length <= 82)
5683       {
5684         proto_tree_add_item (tlv_tree, hf_docsis_cmstatus_descr, tvb, pos + 1, length - 2, ENC_NA);
5685       }
5686       else
5687       {
5688         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5689       }
5690       break;
5691     } /* switch */
5692       pos += length;
5693   } /* while */
5694 }
5695
5696 static void
5697 dissect_cmstatus_common (tvbuff_t * tvb, proto_tree * tree)
5698 {
5699   guint8 event_type;
5700
5701   event_type = tvb_get_guint8 (tvb, 2);
5702   switch (event_type)
5703   {
5704   case SEC_CH_MDD_TIMEOUT:
5705     proto_tree_add_item (tree, hf_docsis_cmstatus_e_t_mdd_t, tvb, 2, 1, ENC_BIG_ENDIAN);
5706     break;
5707
5708   case QAM_FEC_LOCK_FAILURE:
5709     proto_tree_add_item (tree, hf_docsis_cmstatus_e_t_qfl_f, tvb, 2, 1, ENC_BIG_ENDIAN);
5710     break;
5711
5712   case SEQ_OUT_OF_RANGE:
5713     proto_tree_add_item (tree, hf_docsis_cmstatus_e_t_s_o, tvb, 2, 1, ENC_BIG_ENDIAN);
5714     break;
5715
5716   case SEC_CH_MDD_RECOVERY:
5717     proto_tree_add_item (tree, hf_docsis_cmstatus_e_t_mdd_r, tvb, 2, 1, ENC_BIG_ENDIAN);
5718     break;
5719
5720   case QAM_FEC_LOCK_RECOVERY:
5721     proto_tree_add_item (tree, hf_docsis_cmstatus_e_t_qfl_r, tvb, 2, 1, ENC_BIG_ENDIAN);
5722     break;
5723
5724   case T4_TIMEOUT:
5725     proto_tree_add_item (tree, hf_docsis_cmstatus_e_t_t4_t, tvb, 2, 1, ENC_BIG_ENDIAN);
5726     break;
5727
5728   case T3_RETRIES_EXCEEDED:
5729     proto_tree_add_item (tree, hf_docsis_cmstatus_e_t_t3_e, tvb, 2, 1, ENC_BIG_ENDIAN);
5730     break;
5731
5732    case SUCCESS_RANGING_AFTER_T3_RETRIES_EXCEEDED:
5733     proto_tree_add_item (tree, hf_docsis_cmstatus_e_t_rng_s, tvb, 2, 1, ENC_BIG_ENDIAN);
5734     break;
5735
5736   case CM_ON_BATTERY:
5737     proto_tree_add_item (tree, hf_docsis_cmstatus_e_t_cm_b, tvb, 2, 1, ENC_BIG_ENDIAN);
5738     break;
5739
5740   case CM_ON_AC_POWER:
5741     proto_tree_add_item (tree, hf_docsis_cmstatus_e_t_cm_a, tvb, 2, 1, ENC_BIG_ENDIAN);
5742     break;
5743   } /* switch */
5744   return;
5745 }
5746
5747 static int
5748 dissect_cmstatus (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
5749 {
5750   proto_item *it;
5751   proto_tree *cmstatus_tree;
5752   guint32 transid;
5753   tvbuff_t* next_tvb;
5754
5755   it = proto_tree_add_item(tree, proto_docsis_cmstatus, tvb, 0, -1, ENC_NA);
5756   cmstatus_tree = proto_item_add_subtree (it, ett_docsis_cmstatus);
5757   proto_tree_add_item_ret_uint (cmstatus_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
5758
5759   col_add_fstr (pinfo->cinfo, COL_INFO, "CM-STATUS Report: Transaction ID = %u", transid);
5760
5761   dissect_cmstatus_common (tvb, cmstatus_tree);
5762
5763   /* Call Dissector TLV's */
5764   next_tvb = tvb_new_subset_remaining(tvb, 3);
5765   dissect_cmstatus_tlv(next_tvb, pinfo, cmstatus_tree);
5766   return tvb_captured_length(tvb);
5767 }
5768
5769 static int
5770 dissect_cmstatusack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
5771 {
5772   proto_item *it;
5773   proto_tree *cmstatus_tree;
5774   guint32 transid;
5775
5776   it = proto_tree_add_item(tree, proto_docsis_cmstatusack, tvb, 0, -1, ENC_NA);
5777   cmstatus_tree = proto_item_add_subtree (it, ett_docsis_cmstatusack);
5778   proto_tree_add_item_ret_uint (cmstatus_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
5779
5780   col_add_fstr (pinfo->cinfo, COL_INFO, "CM-STATUS Report Acknowledge: Transaction ID = %u", transid);
5781
5782   dissect_cmstatus_common (tvb, cmstatus_tree);
5783
5784   return tvb_captured_length(tvb);
5785 }
5786
5787 static void
5788 dissect_ds_event(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int start, guint16 len)
5789 {
5790   guint8 type;
5791   guint32 length;
5792   proto_tree *event_tree;
5793   proto_item *event_item, *tlv_len_item;
5794   int pos = start;
5795
5796   while (pos < (start + len))
5797   {
5798     type = tvb_get_guint8 (tvb, pos);
5799     event_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
5800                                             ett_docsis_cmctrl_tlv_ds_event, &event_item,
5801                                             val_to_str(type, cmctrlreq_ds_tlv_vals,
5802                                                        "Unknown TLV (%u)"));
5803     proto_tree_add_uint (event_tree, hf_docsis_cmctrl_ds_type, tvb, pos, 1, type);
5804     pos++;
5805     tlv_len_item = proto_tree_add_item_ret_uint (event_tree, hf_docsis_cmctrl_ds_length, tvb, pos, 1, ENC_NA, &length);
5806     pos++;
5807     proto_item_set_len(event_item, length + 2);
5808
5809     switch (type)
5810     {
5811     case DS_EVENT_CH_ID:
5812       if (length == 1)
5813       {
5814         proto_tree_add_item (event_tree, hf_docsis_cmctrl_ds_event_ch_id, tvb, pos, length, ENC_BIG_ENDIAN);
5815       }
5816       else
5817       {
5818         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5819       }
5820       break;
5821     case DS_EVENT_MASK:
5822       if (length == 2)
5823       {
5824         proto_tree_add_item (event_tree, hf_docsis_cmctrl_ds_event_mask, tvb, pos, length, ENC_NA);
5825       }
5826       else
5827       {
5828         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5829       }
5830       break;
5831     }          /* switch */
5832
5833     pos += length;
5834   }            /* while */
5835 }
5836
5837 static void
5838 dissect_us_event(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int start, guint16 len)
5839 {
5840   guint8 type;
5841   guint32 length;
5842   proto_tree *event_tree;
5843   proto_item *event_item, *tlv_len_item;
5844   int pos = start;
5845
5846   while (pos < (start + len))
5847   {
5848     type = tvb_get_guint8 (tvb, pos);
5849     event_tree = proto_tree_add_subtree(tree, tvb, pos, -1,
5850                                             ett_docsis_cmctrl_tlv_us_event, &event_item,
5851                                             val_to_str(type, cmctrlreq_us_tlv_vals,
5852                                                        "Unknown TLV (%u)"));
5853     proto_tree_add_uint (event_tree, hf_docsis_cmctrlreq_us_type, tvb, pos, 1, type);
5854     pos++;
5855     tlv_len_item = proto_tree_add_item_ret_uint (event_tree, hf_docsis_cmctrlreq_us_length, tvb, pos, 1, ENC_NA, &length);
5856     pos++;
5857     proto_item_set_len(event_item, length + 2);
5858
5859     switch (type)
5860     {
5861     case US_EVENT_CH_ID:
5862       if (length == 1)
5863       {
5864         proto_tree_add_item (event_tree, hf_docsis_cmctrl_us_event_ch_id, tvb, pos, length, ENC_BIG_ENDIAN);
5865       }
5866       else
5867       {
5868         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5869       }
5870       break;
5871     case US_EVENT_MASK:
5872       if (length == 2)
5873       {
5874         proto_tree_add_item (event_tree, hf_docsis_cmctrl_us_event_mask, tvb, pos, length, ENC_NA);
5875       }
5876       else
5877       {
5878         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5879       }
5880       break;
5881     }                   /* switch */
5882       pos += length;
5883   }                     /* while */
5884 }
5885
5886 static void
5887 dissect_cmctrlreq_tlv(tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree)
5888 {
5889   proto_item *it, *tlv_item, *tlv_len_item;
5890   proto_tree *tlv_tree;
5891   guint16 pos = 0;
5892   guint8 type;
5893   guint32 length;
5894
5895   it = proto_tree_add_item(tree, hf_docsis_cmctrlreq_tlv_data, tvb, 0, tvb_reported_length(tvb), ENC_NA);
5896   tlv_tree = proto_item_add_subtree (it, ett_docsis_cmctrlreq_tlv);
5897
5898   while (tvb_reported_length_remaining(tvb, pos) > 0)
5899   {
5900     type = tvb_get_guint8 (tvb, pos);
5901     tlv_tree = proto_tree_add_subtree(tlv_tree, tvb, pos, -1,
5902                                             ett_docsis_cmctrlreq_tlvtlv, &tlv_item,
5903                                             val_to_str(type, cmctrlreq_tlv_vals,
5904                                                        "Unknown TLV (%u)"));
5905     proto_tree_add_uint (tlv_tree, hf_docsis_cmctrlreq_type, tvb, pos, 1, type);
5906     pos++;
5907     tlv_len_item = proto_tree_add_item_ret_uint (tlv_tree, hf_docsis_cmctrlreq_length, tvb, pos, 1, ENC_NA, &length);
5908     pos++;
5909     proto_item_set_len(tlv_item, length + 2);
5910
5911     switch (type)
5912     {
5913     case CM_CTRL_MUTE:
5914       if (length == 1)
5915       {
5916         proto_tree_add_item (tlv_tree, hf_docsis_cmctrl_tlv_mute, tvb, pos, length, ENC_BIG_ENDIAN);
5917       }
5918       else
5919       {
5920         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5921       }
5922       break;
5923     case CM_CTRL_MUTE_TIMEOUT:
5924       if (length == 4 || length == 1) /* response TLV always with len 1 */
5925       {
5926         proto_tree_add_item (tlv_tree, hf_docsis_cmctrl_tlv_mute_timeout, tvb, pos, length, ENC_BIG_ENDIAN);
5927       }
5928       else
5929       {
5930         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5931       }
5932       break;
5933     case CM_CTRL_REINIT:
5934       if (length == 1)
5935       {
5936         proto_tree_add_item (tlv_tree, hf_docsis_cmctrl_tlv_reinit, tvb, pos, length, ENC_BIG_ENDIAN);
5937       }
5938       else
5939       {
5940         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5941       }
5942       break;
5943     case CM_CTRL_DISABLE_FWD:
5944       if (length == 1)
5945       {
5946         proto_tree_add_item (tlv_tree, hf_docsis_cmctrl_tlv_disable_fwd, tvb, pos, length, ENC_BIG_ENDIAN);
5947       }
5948       else
5949       {
5950         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5951       }
5952       break;
5953     case CM_CTRL_DS_EVENT:
5954       if (length == 1)
5955       {
5956         proto_tree_add_item (tlv_tree, hf_docsis_cmctrl_tlv_ds_event, tvb, pos, length, ENC_NA);
5957       }
5958       else
5959       {
5960         dissect_ds_event(tvb, pinfo, tlv_tree, pos, length);
5961       }
5962       break;
5963     case CM_CTRL_US_EVENT:
5964       if (length == 1)
5965       {
5966         proto_tree_add_item (tlv_tree, hf_docsis_cmctrl_tlv_us_event, tvb, pos, length, ENC_NA);
5967       }
5968       else
5969       {
5970         dissect_us_event(tvb, pinfo, tlv_tree, pos, length);
5971       }
5972       break;
5973     case CM_CTRL_EVENT:
5974       if (length == 2 || length == 1) /* response TLV always with len 1 */
5975       {
5976         proto_tree_add_item (tlv_tree, hf_docsis_cmctrl_tlv_event, tvb, pos, length, ENC_NA);
5977       }
5978       else
5979       {
5980         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
5981       }
5982       break;
5983
5984     } /* switch */
5985
5986     pos += length;
5987   }
5988 }
5989
5990 static int
5991 dissect_cmctrlreq(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
5992 {
5993   proto_item *it;
5994   proto_tree *cmctrlreq_tree;
5995   guint32 transid;
5996   tvbuff_t *next_tvb;
5997
5998   it = proto_tree_add_item (tree, proto_docsis_cmctrlreq, tvb, 0, -1, ENC_NA);
5999   cmctrlreq_tree = proto_item_add_subtree (it, ett_docsis_cmctrlreq);
6000   proto_tree_add_item_ret_uint (cmctrlreq_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
6001
6002   col_add_fstr (pinfo->cinfo, COL_INFO,
6003                 "CM Control Request: Transaction-Id = %u", transid);
6004
6005   next_tvb = tvb_new_subset_remaining(tvb, 2);
6006   dissect_cmctrlreq_tlv(next_tvb, pinfo, cmctrlreq_tree);
6007   return tvb_captured_length(tvb);
6008 }
6009
6010 static int
6011 dissect_cmctrlrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
6012 {
6013   proto_item *it;
6014   proto_tree *cmctrlrsp_tree;
6015   guint32 transid;
6016   tvbuff_t *next_tvb;
6017
6018   it = proto_tree_add_item(tree, proto_docsis_cmctrlrsp, tvb, 0, -1, ENC_NA);
6019   cmctrlrsp_tree = proto_item_add_subtree (it, ett_docsis_cmctrlrsp);
6020   proto_tree_add_item_ret_uint (cmctrlrsp_tree, hf_docsis_mgt_tranid, tvb, 0, 2, ENC_BIG_ENDIAN, &transid);
6021
6022   col_add_fstr (pinfo->cinfo, COL_INFO,
6023                 "CM Control Response: Transaction-Id = %u", transid);
6024
6025   /* Call Dissector for Appendix C TLV's */
6026   next_tvb = tvb_new_subset_remaining (tvb, 2);
6027   dissect_cmctrlreq_tlv(next_tvb, pinfo, cmctrlrsp_tree);
6028   return tvb_captured_length(tvb);
6029 }
6030
6031 static int
6032 dissect_regreqmp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
6033 {
6034   proto_item *it;
6035   proto_tree *regreqmp_tree;
6036   tvbuff_t *next_tvb;
6037
6038   col_set_str(pinfo->cinfo, COL_INFO, "REG-REQ-MP Message:");
6039
6040   it = proto_tree_add_item(tree, proto_docsis_regreqmp, tvb, 0, -1, ENC_NA);
6041   regreqmp_tree = proto_item_add_subtree (it, ett_docsis_regreqmp);
6042
6043   proto_tree_add_item (regreqmp_tree, hf_docsis_regreqmp_sid, tvb, 0, 2, ENC_BIG_ENDIAN);
6044   proto_tree_add_item (regreqmp_tree, hf_docsis_regreqmp_number_of_fragments, tvb, 2, 1, ENC_BIG_ENDIAN);
6045   proto_tree_add_item (regreqmp_tree, hf_docsis_regreqmp_fragment_sequence_number, tvb, 3, 1, ENC_BIG_ENDIAN);
6046
6047   /* Call Dissector for Appendix C TLV's */
6048   next_tvb = tvb_new_subset_remaining (tvb, 4);
6049   call_dissector (docsis_tlv_handle, next_tvb, pinfo, regreqmp_tree);
6050   return tvb_captured_length(tvb);
6051 }
6052
6053 static int
6054 dissect_regrspmp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
6055 {
6056   proto_item *it, *reassembled_item;
6057   proto_tree *regrspmp_tree, *reassembled_tree;
6058   guint sid, number_of_fragments, fragment_sequence_number;
6059
6060   tvbuff_t *next_tvb;
6061
6062   col_set_str(pinfo->cinfo, COL_INFO, "REG-RSP-MP Message:");
6063   /*Make sure embedded UCD does not overwrite REGRSPMP info*/
6064   col_set_fence(pinfo->cinfo, COL_INFO);
6065
6066   it = proto_tree_add_item(tree, proto_docsis_regrspmp, tvb, 0, -1, ENC_NA);
6067   regrspmp_tree = proto_item_add_subtree (it, ett_docsis_regrspmp);
6068
6069   proto_tree_add_item_ret_uint (regrspmp_tree, hf_docsis_regrspmp_sid, tvb, 0, 2, ENC_BIG_ENDIAN, &sid);
6070   proto_tree_add_item (regrspmp_tree, hf_docsis_regrspmp_response, tvb, 2, 1, ENC_BIG_ENDIAN);
6071   proto_tree_add_item_ret_uint (regrspmp_tree, hf_docsis_regrspmp_number_of_fragments, tvb, 3, 1, ENC_BIG_ENDIAN, &number_of_fragments);
6072   proto_tree_add_item_ret_uint (regrspmp_tree, hf_docsis_regrspmp_fragment_sequence_number, tvb, 4, 1, ENC_BIG_ENDIAN, &fragment_sequence_number);
6073
6074   if(number_of_fragments > 1) {
6075      pinfo->fragmented = TRUE;
6076   }
6077
6078   /* Call Dissector for Appendix C TLV's */
6079   next_tvb = tvb_new_subset_remaining (tvb, 5);
6080   call_dissector (docsis_tlv_handle, next_tvb, pinfo, regrspmp_tree);
6081
6082   if(number_of_fragments > 1) {
6083      pinfo->fragmented = TRUE;
6084
6085      fragment_head* reassembled_tlv = NULL;
6086      reassembled_tlv = fragment_add_seq_check(&docsis_tlv_reassembly_table,
6087                                   tvb, 5, pinfo,
6088                                   sid, NULL, /* ID for fragments belonging together */
6089                                   fragment_sequence_number -1, /*Sequence number starts at 0*/
6090                                   tvb_reported_length_remaining(tvb, 5), /* fragment length - to the end */
6091                                   (fragment_sequence_number != number_of_fragments)); /* More fragments? */
6092
6093      if (reassembled_tlv) {
6094        tvbuff_t *tlv_tvb = NULL;
6095
6096        reassembled_item = proto_tree_add_item(regrspmp_tree, hf_docsis_tlv_reassembled, tvb, 0, -1, ENC_NA);
6097        reassembled_tree = proto_item_add_subtree (reassembled_item, ett_docsis_tlv_reassembled );
6098
6099
6100        tlv_tvb = process_reassembled_data(tvb, 5, pinfo, "Reassembled TLV", reassembled_tlv, &docsis_tlv_frag_items,
6101                                                   NULL, reassembled_tree);
6102
6103        if (tlv_tvb && tvb_reported_length(tlv_tvb) > 0) {
6104          call_dissector (docsis_tlv_handle, tlv_tvb, pinfo, reassembled_tree);
6105        }
6106      }
6107
6108   }
6109
6110
6111
6112   return tvb_captured_length(tvb);
6113 }
6114
6115 static void
6116 dissect_subcarrier_assignment_range_list(tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, guint16 pos, guint32 len)
6117 {
6118   proto_item* type_item;
6119   guint32 i, subcarrier_assignment_type;
6120
6121   type_item = proto_tree_add_item_ret_uint (tree, hf_docsis_ocd_tlv_subc_assign_type, tvb, pos, 1, ENC_BIG_ENDIAN, &subcarrier_assignment_type);
6122   proto_tree_add_item (tree, hf_docsis_ocd_tlv_subc_assign_value, tvb, pos, 1, ENC_BIG_ENDIAN);
6123   proto_tree_add_item (tree, hf_docsis_ocd_subc_assign_subc_type, tvb, pos, 1, ENC_BIG_ENDIAN);
6124   pos++;
6125
6126   switch (subcarrier_assignment_type) {
6127     case SUBCARRIER_ASSIGNMENT_RANGE_CONT:
6128     case SUBCARRIER_ASSIGNMENT_RANGE_SKIPBY1:
6129       proto_tree_add_item (tree, hf_docsis_ocd_subc_assign_range, tvb, pos, 4, ENC_BIG_ENDIAN);
6130       break;
6131     case SUBCARRIER_ASSIGNMENT_LIST:
6132       for (i = 0; i < len/2; ++i) {
6133         proto_tree_add_item (tree, hf_docsis_ocd_subc_assign_index, tvb, pos, 2, ENC_BIG_ENDIAN);
6134         pos += 2;
6135       }
6136       break;
6137     default:
6138       expert_add_info_format(pinfo, type_item, &ei_docsis_mgmt_tlvtype_unknown, "Unknown subcarrier assignment type %d", subcarrier_assignment_type);
6139       break;
6140   }
6141 }
6142
6143 static void
6144 dissect_ocd_tlv (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree)
6145 {
6146   proto_item *it, *tlv_item, *tlv_len_item;
6147   proto_tree *tlv_tree, *tlvtlv_tree;
6148   guint16 pos = 0;
6149   guint8 type;
6150   guint32 length;
6151
6152   it = proto_tree_add_item(tree, hf_docsis_ocd_tlv_data, tvb, 0, tvb_reported_length(tvb), ENC_NA);
6153   tlv_tree = proto_item_add_subtree (it, ett_docsis_ocd_tlv);
6154
6155   while (tvb_reported_length_remaining(tvb, pos) > 0)
6156   {
6157     type = tvb_get_guint8 (tvb, pos);
6158     tlvtlv_tree = proto_tree_add_subtree(tlv_tree, tvb, pos, -1,
6159                                             ett_docsis_ocd_tlvtlv, &tlv_item,
6160                                             val_to_str(type, ocd_tlv_vals,
6161                                                        "Unknown TLV (%u)"));
6162     proto_tree_add_uint (tlvtlv_tree, hf_docsis_ocd_type, tvb, pos, 1, type);
6163     pos++;
6164     tlv_len_item = proto_tree_add_item_ret_uint (tlvtlv_tree, hf_docsis_ocd_length, tvb, pos, 1, ENC_NA, &length);
6165     pos++;
6166     proto_item_set_len(tlv_item, length + 2);
6167
6168     switch (type)
6169     {
6170     case DISCRETE_FOURIER_TRANSFORM_SIZE:
6171       if (length == 1)
6172       {
6173         proto_tree_add_item (tlvtlv_tree, hf_docsis_ocd_tlv_four_trans_size, tvb, pos, 1, ENC_BIG_ENDIAN);
6174       }
6175       else
6176       {
6177         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
6178       }
6179       break;
6180     case CYCLIC_PREFIX:
6181       if (length == 1)
6182       {
6183         proto_tree_add_item (tlvtlv_tree, hf_docsis_ocd_tlv_cycl_pref, tvb, pos, 1, ENC_BIG_ENDIAN);
6184       }
6185       else
6186       {
6187         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
6188       }
6189       break;
6190     case ROLL_OFF:
6191       if (length == 1)
6192       {
6193         proto_tree_add_item (tlvtlv_tree, hf_docsis_ocd_tlv_roll_off, tvb, pos, 1, ENC_BIG_ENDIAN);
6194       }
6195       else
6196       {
6197         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
6198       }
6199       break;
6200     case OFDM_SPECTRUM_LOCATION:
6201       if (length == 4)
6202       {
6203         proto_tree_add_item (tlvtlv_tree, hf_docsis_ocd_tlv_ofdm_spec_loc, tvb, pos, 4, ENC_BIG_ENDIAN);
6204       }
6205       else
6206       {
6207         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
6208       }
6209       break;
6210     case TIME_INTERLEAVING_DEPTH:
6211       if (length == 1)
6212       {
6213         proto_tree_add_item (tlvtlv_tree, hf_docsis_ocd_tlv_time_int_depth, tvb, pos, 1, ENC_BIG_ENDIAN);
6214       }
6215       else
6216       {
6217         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
6218       }
6219       break;
6220     case SUBCARRIER_ASSIGNMENT_RANGE_LIST:
6221       if (length >= 5)
6222       {
6223         dissect_subcarrier_assignment_range_list(tvb, pinfo, tlvtlv_tree, pos, length);
6224       }
6225       else
6226       {
6227         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
6228       }
6229       break;
6230     case PRIMARY_CAPABILITY_INDICATOR:
6231       if (length == 1)
6232       {
6233         proto_tree_add_item (tlvtlv_tree, hf_docsis_ocd_tlv_prim_cap_ind, tvb, pos, 1, ENC_BIG_ENDIAN);
6234       }
6235       else
6236       {
6237         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
6238       }
6239       break;
6240     default:
6241       proto_tree_add_item (tlvtlv_tree, hf_docsis_ocd_tlv_unknown, tvb, pos - 2, length+2, ENC_NA);
6242       break;
6243     } /* switch */
6244     pos += length;
6245   } /* while */
6246 }
6247
6248 static int
6249 dissect_ocd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
6250 {
6251   proto_item *it;
6252   proto_tree *ocd_tree;
6253   tvbuff_t *next_tvb;
6254   guint32 downstream_channel_id, configuration_change_count;
6255
6256   it = proto_tree_add_item(tree, proto_docsis_ocd, tvb, 0, -1, ENC_NA);
6257   ocd_tree = proto_item_add_subtree (it, ett_docsis_ocd);
6258
6259   proto_tree_add_item_ret_uint (ocd_tree, hf_docsis_mgt_down_chid, tvb, 0, 1, ENC_BIG_ENDIAN, &downstream_channel_id);
6260   proto_tree_add_item_ret_uint (ocd_tree, hf_docsis_ocd_ccc, tvb, 1, 1, ENC_BIG_ENDIAN, &configuration_change_count);
6261
6262   col_add_fstr (pinfo->cinfo, COL_INFO, "OCD: DS CH ID: %u, CCC: %u", downstream_channel_id, configuration_change_count);
6263
6264   /* Call Dissector TLV's */
6265   next_tvb = tvb_new_subset_remaining(tvb, 2);
6266   dissect_ocd_tlv(next_tvb, pinfo, ocd_tree);
6267
6268   return tvb_captured_length(tvb);
6269 }
6270
6271 static void
6272 dissect_dpd_subcarrier_assignment_range_list(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint pos, guint len)
6273 {
6274   guint32 i, subcarrier_assignment_type;
6275   proto_item* type_item;
6276   guint modulation;
6277
6278   type_item = proto_tree_add_item_ret_uint (tree, hf_docsis_dpd_tlv_subc_assign_type, tvb, pos, 1, ENC_BIG_ENDIAN, &subcarrier_assignment_type);
6279   proto_tree_add_item (tree, hf_docsis_dpd_tlv_subc_assign_value, tvb, pos, 1, ENC_BIG_ENDIAN);
6280   proto_tree_add_item (tree, hf_docsis_dpd_tlv_subc_assign_reserved, tvb, pos, 1, ENC_BIG_ENDIAN);
6281   proto_tree_add_item_ret_uint (tree, hf_docsis_dpd_tlv_subc_assign_modulation, tvb, pos, 1, ENC_BIG_ENDIAN, &modulation);
6282   col_append_str(pinfo->cinfo, COL_INFO, val_to_str(modulation, docsis_dpd_subc_assign_modulation_str, "%s"));
6283   pos++;
6284
6285   switch (subcarrier_assignment_type)
6286   {
6287     case SUBCARRIER_ASSIGNMENT_RANGE_CONT:
6288     case SUBCARRIER_ASSIGNMENT_RANGE_SKIPBY1:
6289       proto_tree_add_item (tree, hf_docsis_dpd_subc_assign_range, tvb, pos, 4, ENC_BIG_ENDIAN);
6290       break;
6291     case SUBCARRIER_ASSIGNMENT_LIST:
6292       for (i = 0; i < len/2; ++i) {
6293         proto_tree_add_item (tree, hf_docsis_dpd_subc_assign_index, tvb, pos, 2, ENC_BIG_ENDIAN);
6294         pos += 2;
6295       }
6296       break;
6297     default:
6298       expert_add_info_format(pinfo, type_item, &ei_docsis_mgmt_tlvtype_unknown, "Unknown subcarrier assignment type: %u", subcarrier_assignment_type);
6299       break;
6300   }
6301 }
6302
6303 static void
6304 dissect_dpd_subcarrier_assignment_vector(tvbuff_t * tvb, proto_tree * tree, guint start, guint len)
6305 {
6306   guint32 subcarrier_assignment_vector_oddness;
6307   guint vector_index;
6308
6309   proto_tree_add_item_ret_uint (tree, hf_docsis_dpd_tlv_subc_assign_vector_oddness, tvb, start, 1, ENC_BIG_ENDIAN, &subcarrier_assignment_vector_oddness);
6310   proto_tree_add_item (tree, hf_docsis_dpd_tlv_subc_assign_vector_reserved, tvb, start, 1, ENC_BIG_ENDIAN);
6311   proto_tree_add_item (tree, hf_docsis_dpd_tlv_subc_assign_vector_subc_start, tvb, start, 2, ENC_BIG_ENDIAN);
6312
6313   for(vector_index = 0; vector_index < len; ++vector_index)
6314   {
6315     proto_tree_add_item (tree, hf_docsis_dpd_tlv_subc_assign_vector_modulation_odd, tvb, start + 2 + vector_index, 1, ENC_BIG_ENDIAN);
6316     if (!((vector_index == len -1) && subcarrier_assignment_vector_oddness))
6317     {
6318       proto_tree_add_item (tree, hf_docsis_dpd_tlv_subc_assign_vector_modulation_even, tvb, start + 2 + vector_index, 1, ENC_BIG_ENDIAN);
6319     }
6320   }
6321 }
6322
6323
6324 static void
6325 dissect_dpd_tlv (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6326 {
6327   proto_item *it, *tlv_item, *tlv_len_item;
6328   proto_tree *tlv_tree;
6329   guint pos = 0;
6330   guint length;
6331   guint8 type;
6332   guint first_subc_assign_list = 1;
6333
6334   it = proto_tree_add_item(tree, hf_docsis_dpd_tlv_data, tvb, 0, tvb_reported_length(tvb), ENC_NA);
6335   tlv_tree = proto_item_add_subtree (it, ett_docsis_dpd_tlv);
6336
6337   while (tvb_reported_length_remaining(tvb, pos) > 0)
6338   {
6339     type = tvb_get_guint8 (tvb, pos);
6340     tlv_tree = proto_tree_add_subtree(tlv_tree, tvb, pos, -1,
6341                                             ett_docsis_dpd_tlvtlv, &tlv_item,
6342                                             val_to_str(type, dpd_tlv_vals,
6343                                                        "Unknown TLV (%u)"));
6344     proto_tree_add_uint (tlv_tree, hf_docsis_dpd_type, tvb, pos, 1, type);
6345     pos++;
6346     if (type != SUBCARRIER_ASSIGNMENT_VECTOR)
6347     {
6348       tlv_len_item = proto_tree_add_item_ret_uint (tlv_tree, hf_docsis_dpd_length, tvb, pos, 1, ENC_NA, &length);
6349       pos++;
6350       proto_item_set_len(tlv_item, length + 2);
6351     }
6352
6353     switch (type)
6354     {
6355     case SUBCARRIER_ASSIGNMENT_RANGE_LIST:
6356       if (length >= 5)
6357       {
6358         if(first_subc_assign_list) {
6359           col_append_str(pinfo->cinfo, COL_INFO, ", Modulation: ");
6360           first_subc_assign_list = 0;
6361         } else {
6362           col_append_str(pinfo->cinfo, COL_INFO, " | ");
6363         }
6364         dissect_dpd_subcarrier_assignment_range_list(tvb, pinfo, tlv_tree, pos, length);
6365       }
6366       else
6367       {
6368         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
6369       }
6370       break;
6371     case SUBCARRIER_ASSIGNMENT_VECTOR:
6372       /*FOR THIS TYPE, LENGTH IS 2 BYTES INSTEAD OF 1 */
6373       tlv_len_item = proto_tree_add_item_ret_uint (tlv_tree, hf_docsis_dpd_length, tvb, pos, 2, ENC_BIG_ENDIAN, &length);
6374       pos += 2;
6375       proto_item_set_len(tlv_item, length + 2);
6376       if (length >=2)
6377       {
6378         dissect_dpd_subcarrier_assignment_vector(tvb, tlv_tree, pos, length);
6379       }
6380       else
6381       {
6382         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
6383       }
6384       break;
6385     default:
6386       proto_tree_add_item (tlv_tree, hf_docsis_dpd_tlv_unknown, tvb, pos - 2, length+2, ENC_NA);
6387       expert_add_info_format(pinfo, tlv_item, &ei_docsis_mgmt_tlvtype_unknown, "Unknown TLV: %u", type);
6388       break;
6389     } /* switch */
6390     pos += length;
6391   } /* while */
6392 }
6393
6394 static int
6395 dissect_dpd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data  _U_)
6396 {
6397   proto_item *it;
6398   proto_tree *dpd_tree;
6399   tvbuff_t *next_tvb;
6400
6401   guint32 downstream_channel_id, profile_identifier, configuration_change_count;
6402
6403   it = proto_tree_add_item(tree, proto_docsis_dpd, tvb, 0, -1, ENC_NA);
6404   dpd_tree = proto_item_add_subtree (it, ett_docsis_dpd);
6405   proto_tree_add_item_ret_uint (dpd_tree, hf_docsis_mgt_down_chid, tvb, 0, 1, ENC_BIG_ENDIAN, &downstream_channel_id);
6406   proto_tree_add_item_ret_uint (dpd_tree, hf_docsis_dpd_prof_id, tvb, 1, 1, ENC_BIG_ENDIAN, &profile_identifier);
6407   proto_tree_add_item_ret_uint (dpd_tree, hf_docsis_dpd_ccc, tvb, 2, 1, ENC_BIG_ENDIAN, &configuration_change_count);
6408
6409   col_add_fstr (pinfo->cinfo, COL_INFO, "DPD: DS CH ID: %u, Profile ID: %u, CCC: %u", downstream_channel_id, profile_identifier, configuration_change_count);
6410
6411   /* Call Dissector TLV's */
6412   next_tvb = tvb_new_subset_remaining(tvb, 3);
6413   dissect_dpd_tlv(next_tvb, pinfo, dpd_tree);
6414
6415   return tvb_captured_length(tvb);
6416 }
6417
6418 static int
6419 dissect_type51ucd(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
6420 {
6421   return dissect_any_ucd(tvb, pinfo, tree, proto_docsis_type51ucd, MGT_TYPE51UCD);
6422 }
6423
6424 static void
6425 dissect_optreq_tlv_rxmer_thresholding_parameters (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6426 {
6427   proto_item *it, *tlv_item, *tlv_len_item;
6428   proto_tree *tlv_tree;
6429   guint pos = 0;
6430   guint length;
6431   guint8 type;
6432
6433   it = proto_tree_add_item(tree, hf_docsis_optreq_tlv_xrmer_thresh_data, tvb, 0, tvb_reported_length(tvb), ENC_NA);
6434   tlv_tree = proto_item_add_subtree (it, ett_docsis_optreq_tlv_rxmer_thresh_params);
6435
6436   while (tvb_reported_length_remaining(tvb, pos) > 0)
6437   {
6438     type = tvb_get_guint8 (tvb, pos);
6439     tlv_tree = proto_tree_add_subtree(tlv_tree, tvb, pos, -1,
6440                                             ett_docsis_optreq_tlv_rxmer_thresh_params_tlv, &tlv_item,
6441                                             val_to_str(type, optreq_tlv_rxmer_thresh_params_vals,
6442                                                        "Unknown TLV (%u)"));
6443     proto_tree_add_uint (tlv_tree, hf_docsis_optreq_xmer_thresh_params_type, tvb, pos, 1, type);
6444     pos++;
6445     tlv_len_item = proto_tree_add_item_ret_uint (tlv_tree, hf_docsis_optreq_xmer_thresh_params_length, tvb, pos, 1, ENC_NA, &length);
6446     pos++;
6447
6448
6449     switch (type)
6450     {
6451     case OPT_REQ_RXMER_THRESH_PARAMS_MODULATION_ORDER:
6452       if (length == 1)
6453       {
6454         proto_tree_add_item(tree, hf_docsis_optreq_tlv_xrmer_thresh_data_mod_order, tvb, pos, length, ENC_NA);
6455       }
6456       else
6457       {
6458         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
6459       }
6460       break;
6461     default:
6462       proto_tree_add_item (tlv_tree, hf_docsis_optreq_tlv_unknown, tvb, pos - 2, length+2, ENC_NA);
6463       expert_add_info_format(pinfo, tlv_item, &ei_docsis_mgmt_tlvtype_unknown, "Unknown TLV: %u", type);
6464       break;
6465     } /* switch */
6466     pos += length;
6467   } /* while */
6468 }
6469
6470 static void
6471 dissect_optreq_tlv (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6472 {
6473   proto_item *it, *tlv_item, *tlv_len_item;
6474   proto_tree *tlv_tree;
6475   guint pos = 0;
6476   guint length;
6477   guint8 type;
6478   tvbuff_t *next_tvb;
6479
6480   it = proto_tree_add_item(tree, hf_docsis_optreq_tlv_data, tvb, 0, tvb_reported_length(tvb), ENC_NA);
6481   tlv_tree = proto_item_add_subtree (it, ett_docsis_optreq_tlv);
6482
6483   while (tvb_reported_length_remaining(tvb, pos) > 0)
6484   {
6485     type = tvb_get_guint8 (tvb, pos);
6486     tlv_tree = proto_tree_add_subtree(tlv_tree, tvb, pos, -1,
6487                                             ett_docsis_optreq_tlvtlv, &tlv_item,
6488                                             val_to_str(type, optreq_tlv_vals,
6489                                                        "Unknown TLV (%u)"));
6490     proto_tree_add_uint (tlv_tree, hf_docsis_optreq_type, tvb, pos, 1, type);
6491     pos++;
6492     tlv_len_item = proto_tree_add_item_ret_uint (tlv_tree, hf_docsis_optreq_length, tvb, pos, 1, ENC_NA, &length);
6493     pos++;
6494
6495
6496     switch (type)
6497     {
6498     case OPT_REQ_REQ_STAT:
6499       if (length == 1)
6500       {
6501
6502          static const int * req_stat[] = {
6503            &hf_docsis_optreq_reqstat_rxmer_stat_subc,
6504            &hf_docsis_optreq_reqstat_rxmer_subc_threshold_comp,
6505            &hf_docsis_optreq_reqstat_snr_marg_cand_prof,
6506            &hf_docsis_optreq_reqstat_codew_stat_cand_prof,
6507            &hf_docsis_optreq_reqstat_codew_thresh_comp_cand_prof,
6508            &hf_docsis_optreq_reqstat_ncp_field_stat,
6509            &hf_docsis_optreq_reqstat_ncp_crc_thresh_comp,
6510            &hf_docsis_optreq_reqstat_reserved,
6511            NULL
6512          };
6513
6514          proto_tree_add_bitmask_list(tlv_tree, tvb, pos, length, req_stat, ENC_BIG_ENDIAN);
6515       }
6516       else
6517       {
6518         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
6519       }
6520       break;
6521     case OPT_REQ_RXMER_THRESH_PARAMS:
6522       next_tvb = tvb_new_subset_length(tvb, pos, length);
6523       dissect_optreq_tlv_rxmer_thresholding_parameters(next_tvb, pinfo, tlv_tree);
6524       break;
6525     default:
6526       proto_tree_add_item (tlv_tree, hf_docsis_optreq_tlv_unknown, tvb, pos - 2, length+2, ENC_NA);
6527       expert_add_info_format(pinfo, tlv_item, &ei_docsis_mgmt_tlvtype_unknown, "Unknown TLV: %u", type);
6528       break;
6529     } /* switch */
6530     pos += length;
6531   } /* while */
6532 }
6533
6534 static int
6535 dissect_optreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data  _U_)
6536 {
6537   proto_item *it;
6538   proto_tree *opt_tree;
6539   tvbuff_t *next_tvb;
6540
6541   guint32 downstream_channel_id, profile_identifier, opcode;
6542
6543   it = proto_tree_add_item(tree, proto_docsis_optreq, tvb, 0, -1, ENC_NA);
6544   opt_tree = proto_item_add_subtree (it, ett_docsis_optreq);
6545   proto_tree_add_item (opt_tree, hf_docsis_optreq_reserved, tvb, 0, 2, ENC_BIG_ENDIAN);
6546   proto_tree_add_item_ret_uint (opt_tree, hf_docsis_mgt_down_chid, tvb, 2, 1, ENC_BIG_ENDIAN, &downstream_channel_id);
6547   proto_tree_add_item_ret_uint (opt_tree, hf_docsis_optreq_prof_id, tvb, 3, 1, ENC_BIG_ENDIAN, &profile_identifier);
6548   proto_tree_add_item_ret_uint (opt_tree, hf_docsis_optreq_opcode, tvb, 4, 1, ENC_BIG_ENDIAN, &opcode);
6549
6550   col_add_fstr (pinfo->cinfo, COL_INFO, "OPT-REQ: DS CH ID: %u, Profile ID: %s (%u), Opcode: %s (%u)", downstream_channel_id,
6551                               val_to_str(profile_identifier, profile_id_vals, "Unknown Profile ID (%u)"), profile_identifier,
6552                               val_to_str(opcode, opt_opcode_vals, "Unknown Opcode (%u)"), opcode);
6553
6554   /* Call Dissector TLV's */
6555   if(tvb_reported_length_remaining(tvb, 5) > 0 )
6556   {
6557     next_tvb = tvb_new_subset_remaining(tvb, 5);
6558     dissect_optreq_tlv(next_tvb, pinfo, opt_tree);
6559   }
6560
6561   return tvb_reported_length(tvb);
6562 }
6563
6564 static void
6565 dissect_optrsp_tlv_rxmer_and_snr_margin_data (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6566 {
6567   proto_item *it, *tlv_item, *tlv_len_item;
6568   proto_tree *tlv_tree;
6569   guint pos = 0;
6570   guint length;
6571   guint8 type;
6572   guint number_of_subcarriers = 0;
6573   guint i;
6574
6575   it = proto_tree_add_item(tree, hf_docsis_optrsp_tlv_xrmer_snr_margin_data, tvb, 0, tvb_reported_length(tvb), ENC_NA);
6576   tlv_tree = proto_item_add_subtree (it, ett_docsis_optrsp_tlv_rxmer_snr_margin_data);
6577
6578   while (tvb_reported_length_remaining(tvb, pos) > 0)
6579   {
6580     type = tvb_get_guint8 (tvb, pos);
6581     tlv_tree = proto_tree_add_subtree(tlv_tree, tvb, pos, -1,
6582                                             ett_docsis_optrsp_tlv_rxmer_snr_margin_tlv, &tlv_item,
6583                                             val_to_str(type, optrsp_tlv_rxmer_snr_margin_vals,
6584                                                        "Unknown TLV (%u)"));
6585     proto_tree_add_uint (tlv_tree, hf_docsis_optrsp_xmer_snr_margin_type, tvb, pos, 1, type);
6586     pos++;
6587     tlv_len_item = proto_tree_add_item_ret_uint (tlv_tree, hf_docsis_optrsp_xmer_snr_margin_length, tvb, pos, 2, ENC_NA, &length);
6588     pos+=2;
6589
6590
6591     switch (type)
6592     {
6593     case OPT_RSP_RXMER_PER_SUBCARRIER:
6594       if ((guint) tvb_reported_length_remaining(tvb, pos) < length)
6595       {
6596         number_of_subcarriers = tvb_reported_length_remaining(tvb,pos);
6597       } else {
6598         number_of_subcarriers = length;
6599       }
6600       for(i=0; i < number_of_subcarriers;++i)
6601       {
6602         proto_tree_add_item(tlv_tree, hf_docsis_optrsp_tlv_xrmer_snr_margin_data_rxmer_subc, tvb, pos+i, 1, ENC_NA);
6603       }
6604       break;
6605     case OPT_RSP_SNR_MARGIN:
6606       if (length == 1)
6607       {
6608         proto_tree_add_item(tree, hf_docsis_optrsp_tlv_rxmer_snr_margin_data_snr_margin, tvb, pos, length, ENC_NA);
6609       }
6610       else
6611       {
6612         expert_add_info_format(pinfo, tlv_len_item, &ei_docsis_mgmt_tlvlen_bad, "Wrong TLV length: %u", length);
6613       }
6614       break;
6615     default:
6616       proto_tree_add_item (tlv_tree, hf_docsis_optrsp_tlv_unknown, tvb, pos - 2, length+2, ENC_NA);
6617       expert_add_info_format(pinfo, tlv_item, &ei_docsis_mgmt_tlvtype_unknown, "Unknown TLV: %u", type);
6618       break;
6619     } /* switch */
6620     pos += length;
6621   } /* while */
6622 }
6623
6624 static void
6625 dissect_optrsp_tlv (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6626 {
6627   proto_item *it, *tlv_item;
6628   proto_tree *tlv_tree;
6629   guint pos = 0;
6630   guint length;
6631   guint8 type;
6632   tvbuff_t *next_tvb;
6633
6634
6635   it = proto_tree_add_item(tree, hf_docsis_optrsp_tlv_data, tvb, 0, tvb_reported_length(tvb), ENC_NA);
6636   tlv_tree = proto_item_add_subtree (it, ett_docsis_optrsp_tlv);
6637
6638   while (tvb_reported_length_remaining(tvb, pos) > 0)
6639   {
6640     type = tvb_get_guint8 (tvb, pos);
6641     tlv_tree = proto_tree_add_subtree(tlv_tree, tvb, pos, -1,
6642                                             ett_docsis_optrsp_tlvtlv, &tlv_item,
6643                                             val_to_str(type, optrsp_tlv_vals,
6644                                                        "Unknown TLV (%u)"));
6645     proto_tree_add_uint (tlv_tree, hf_docsis_optrsp_type, tvb, pos, 1, type);
6646     pos++;
6647     proto_tree_add_item_ret_uint (tlv_tree, hf_docsis_optrsp_length, tvb, pos, 2, ENC_NA, &length);
6648     pos+=2;
6649
6650     switch (type)
6651     {
6652     case OPT_RSP_RXMER_AND_SNR_MARGIN_DATA:
6653       if ((guint) tvb_reported_length_remaining(tvb, pos) < length) {
6654         next_tvb = tvb_new_subset_remaining(tvb, pos);
6655       } else {
6656         next_tvb = tvb_new_subset_length(tvb, pos, length);
6657       }
6658       dissect_optrsp_tlv_rxmer_and_snr_margin_data(next_tvb, pinfo, tlv_tree);
6659       break;
6660     default:
6661       proto_tree_add_item (tlv_tree, hf_docsis_dpd_tlv_unknown, tvb, pos - 2, length+2, ENC_NA);
6662       expert_add_info_format(pinfo, tlv_item, &ei_docsis_mgmt_tlvtype_unknown, "Unknown TLV: %u", type);
6663       break;
6664     } /* switch */
6665     pos += length;
6666   } /* while */
6667 }
6668
6669 static int
6670 dissect_optrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data  _U_)
6671 {
6672   proto_item *it;
6673   proto_tree *opt_tree;
6674   address save_src, save_dst;
6675
6676   guint32 downstream_channel_id, profile_identifier, status;
6677
6678   it = proto_tree_add_item(tree, proto_docsis_optrsp, tvb, 0, -1, ENC_NA);
6679   opt_tree = proto_item_add_subtree (it, ett_docsis_optrsp);
6680   proto_tree_add_item (opt_tree, hf_docsis_optrsp_reserved, tvb, 0, 2, ENC_BIG_ENDIAN);
6681   proto_tree_add_item_ret_uint (opt_tree, hf_docsis_mgt_down_chid, tvb, 2, 1, ENC_BIG_ENDIAN, &downstream_channel_id);
6682   proto_tree_add_item_ret_uint (opt_tree, hf_docsis_optrsp_prof_id, tvb, 3, 1, ENC_BIG_ENDIAN, &profile_identifier);
6683   proto_tree_add_item_ret_uint (opt_tree, hf_docsis_optrsp_status, tvb, 4, 1, ENC_BIG_ENDIAN, &status);
6684
6685   col_add_fstr (pinfo->cinfo, COL_INFO, "OPT-RSP: DS CH ID: %u, Profile ID: %s (%u), Status: %s (%u)", downstream_channel_id,
6686                               val_to_str(profile_identifier, profile_id_vals, "Unknown Profile ID (%u)"), profile_identifier,
6687                               val_to_str(status, opt_status_vals, "Unknown status (%u)"), status);
6688
6689
6690   /* Reassemble TLV's */
6691   if (tvb_reported_length_remaining(tvb, 5) > 0) {
6692     /*DOCSIS mac management messages do not have network (ip)  address. Use link (mac)  address instead. Same workflow as in wimax.*/
6693     /* Save address pointers. */
6694     copy_address_shallow(&save_src, &pinfo->src);
6695     copy_address_shallow(&save_dst, &pinfo->dst);
6696     /* Use dl_src and dl_dst in defragmentation. */
6697     copy_address_shallow(&pinfo->src, &pinfo->dl_src);
6698     copy_address_shallow(&pinfo->dst, &pinfo->dl_dst);
6699
6700     fragment_head* fh = fragment_add_seq_next(&docsis_opt_tlv_reassembly_table, tvb, 5, pinfo, downstream_channel_id, NULL, tvb_reported_length_remaining(tvb, 5) , TRUE);
6701
6702     /* Restore address pointers. */
6703     copy_address_shallow(&pinfo->src, &save_src);
6704     copy_address_shallow(&pinfo->dst, &save_dst);
6705
6706
6707     /*Check if complete: if top level tlvs are completely within packet, we assume the packet is complete*/
6708     fragment_head *tmp_fh = fragment_get(&docsis_opt_tlv_reassembly_table, pinfo, downstream_channel_id, NULL);
6709
6710     /*Calculating offset*/
6711     guint offset = 0;
6712     guint tlvs_length = 0;
6713     while (tmp_fh) {
6714       offset += tmp_fh->len;
6715       while (tlvs_length < offset) {
6716         /* Assumes that the Type and Lengths fields are always present in a
6717          * single buffer (the value can still be fragmented). */
6718         tlvs_length += 3 + tvb_get_ntohs(tmp_fh->tvb_data, tlvs_length + 1);
6719       }
6720       tmp_fh = tmp_fh->next;
6721     }
6722
6723     if (offset == tlvs_length) {
6724       /* Save address pointers. */
6725       copy_address_shallow(&save_src, &pinfo->src);
6726       copy_address_shallow(&save_dst, &pinfo->dst);
6727       /* Use dl_src and dl_dst in defragmentation. */
6728       copy_address_shallow(&pinfo->src, &pinfo->dl_src);
6729       copy_address_shallow(&pinfo->dst, &pinfo->dl_dst);
6730
6731       fh = fragment_end_seq_next(&docsis_opt_tlv_reassembly_table, pinfo, downstream_channel_id, NULL);
6732
6733       /* Restore address pointers. */
6734       copy_address_shallow(&pinfo->src, &save_src);
6735       copy_address_shallow(&pinfo->dst, &save_dst);
6736
6737     }
6738
6739     if (fh) {
6740       tvbuff_t *tlv_tvb = NULL;
6741
6742       tlv_tvb = process_reassembled_data(tvb, 5, pinfo, "Reassembled OPT TLV", fh, &docsis_tlv_frag_items,
6743                                                   NULL, opt_tree);
6744
6745       if (tlv_tvb && tvb_reported_length(tlv_tvb) > 0) {
6746         dissect_optrsp_tlv(tlv_tvb, pinfo, opt_tree);
6747       }
6748     }
6749   }
6750
6751   return tvb_reported_length(tvb);
6752 }
6753
6754 static int
6755 dissect_optack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data  _U_)
6756 {
6757   proto_item *it;
6758   proto_tree *opt_tree;
6759
6760   guint32 downstream_channel_id, profile_identifier;
6761
6762   it = proto_tree_add_item(tree, proto_docsis_optack, tvb, 0, -1, ENC_NA);
6763   opt_tree = proto_item_add_subtree (it, ett_docsis_optack);
6764   proto_tree_add_item (opt_tree, hf_docsis_optack_reserved, tvb, 0, 2, ENC_BIG_ENDIAN);
6765   proto_tree_add_item_ret_uint (opt_tree, hf_docsis_mgt_down_chid, tvb, 2, 1, ENC_BIG_ENDIAN, &downstream_channel_id);
6766   proto_tree_add_item_ret_uint (opt_tree, hf_docsis_optack_prof_id, tvb, 3, 1, ENC_BIG_ENDIAN, &profile_identifier);
6767
6768   col_add_fstr (pinfo->cinfo, COL_INFO, "OPT-ACK: DS CH ID: %u, Profile ID: %s (%u)", downstream_channel_id,
6769                               val_to_str(profile_identifier, profile_id_vals, "Unknown Profile ID (%u)"), profile_identifier);
6770
6771   return tvb_captured_length(tvb);
6772 }
6773
6774 static int
6775 dissect_macmgmt (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
6776 {
6777   guint32 type, version, msg_len;
6778   proto_item *mgt_hdr_it;
6779   proto_tree *mgt_hdr_tree;
6780   tvbuff_t *payload_tvb;
6781
6782   col_set_str (pinfo->cinfo, COL_PROTOCOL, "DOCSIS MGMT");
6783
6784   col_clear(pinfo->cinfo, COL_INFO);
6785
6786   set_address_tvb (&pinfo->dl_src, AT_ETHER, 6, tvb, 6);
6787   copy_address_shallow(&pinfo->src, &pinfo->dl_src);
6788   set_address_tvb (&pinfo->dl_dst, AT_ETHER, 6, tvb, 0);
6789   copy_address_shallow(&pinfo->dst, &pinfo->dl_dst);
6790
6791   mgt_hdr_it = proto_tree_add_item (tree, proto_docsis_mgmt, tvb, 0, 20, ENC_NA);
6792   mgt_hdr_tree = proto_item_add_subtree (mgt_hdr_it, ett_docsis_mgmt);
6793   proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_dst_addr, tvb, 0, 6, ENC_NA);
6794   proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_src_addr, tvb, 6, 6, ENC_NA);
6795   proto_tree_add_item_ret_uint (mgt_hdr_tree, hf_docsis_mgt_msg_len, tvb, 12, 2, ENC_BIG_ENDIAN, &msg_len);
6796   proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_dsap, tvb, 14, 1, ENC_BIG_ENDIAN);
6797   proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_ssap, tvb, 15, 1, ENC_BIG_ENDIAN);
6798   proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_control, tvb, 16, 1, ENC_BIG_ENDIAN);
6799   proto_tree_add_item_ret_uint (mgt_hdr_tree, hf_docsis_mgt_version, tvb, 17, 1, ENC_BIG_ENDIAN, &version);
6800   proto_tree_add_item_ret_uint (mgt_hdr_tree, hf_docsis_mgt_type, tvb, 18, 1, ENC_BIG_ENDIAN, &type);
6801   proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_rsvd, tvb, 19, 1, ENC_BIG_ENDIAN);
6802
6803   /* Code to Call subdissector */
6804   /* sub-dissectors are based on the type field */
6805   payload_tvb = tvb_new_subset_length (tvb, 20, msg_len - 6);
6806
6807   /* Special case: map needs version. Two types of MAPs exist, with some difference in encoding: MAPv1 and MAPv5. See also DOCSIS3.1 MULPI spec */
6808   if (type == MGT_MAP) {
6809     if (!dissector_try_uint(docsis_mgmt_dissector_table, 256*version + type, payload_tvb, pinfo, tree)) {
6810       call_data_dissector(payload_tvb, pinfo, tree);
6811     }
6812   } else {
6813     if (!dissector_try_uint(docsis_mgmt_dissector_table, type, payload_tvb, pinfo, tree)) {
6814       call_data_dissector(payload_tvb, pinfo, tree);
6815     }
6816   }
6817
6818   return tvb_captured_length(tvb);
6819 }
6820
6821 /* Register the protocol with Wireshark */
6822 void
6823 proto_register_docsis_mgmt (void)
6824 {
6825   static hf_register_info hf[] = {
6826       /* Sync Message */
6827     {&hf_docsis_sync_cmts_timestamp,
6828      {"CMTS Timestamp", "docsis_sync.cmts_timestamp",
6829       FT_UINT32, BASE_DEC, NULL, 0x0,
6830       "Sync CMTS Timestamp", HFILL}
6831     },
6832     /* UCD */
6833     {&hf_docsis_ucd_config_ch_cnt,
6834      {"Config Change Count", "docsis_ucd.confcngcnt",
6835       FT_UINT8, BASE_DEC, NULL, 0x0,
6836       "Configuration Change Count", HFILL}
6837     },
6838     {&hf_docsis_ucd_mini_slot_size,
6839      {"Mini Slot Size (6.25us TimeTicks)", "docsis_ucd.mslotsize",
6840       FT_UINT8, BASE_DEC, NULL, 0x0,
6841       NULL, HFILL}
6842     },
6843     {&hf_docsis_ucd_type,
6844      {"Type", "docsis_ucd.type",
6845       FT_UINT8, BASE_DEC, VALS(channel_tlv_vals), 0x0,
6846       "Channel TLV type", HFILL}
6847     },
6848     {&hf_docsis_ucd_length,
6849      {"Length", "docsis_ucd.length",
6850       FT_UINT8, BASE_DEC, NULL, 0x0,
6851       "Channel TLV length", HFILL}
6852     },
6853     {&hf_docsis_ucd_burst_type,
6854      {"Type", "docsis_ucd.burst.tlvtype",
6855       FT_UINT8, BASE_DEC, VALS(burst_tlv_vals), 0x0,
6856       "Burst TLV type", HFILL}
6857     },
6858     {&hf_docsis_ucd_burst_length,
6859      {"Length", "docsis_ucd.burst.tlvlen",
6860       FT_UINT8, BASE_DEC, NULL, 0x0,
6861       "Burst TLV length", HFILL}
6862     },
6863     {&hf_docsis_ucd_symbol_rate,
6864      {"Symbol Rate (ksym/sec)", "docsis_ucd.symrate",
6865       FT_UINT8, BASE_DEC, NULL, 0x0,
6866       "Symbol Rate", HFILL}
6867     },
6868     {&hf_docsis_ucd_frequency,
6869      {"Frequency (Hz)", "docsis_ucd.freq",
6870       FT_UINT32, BASE_DEC, NULL, 0x0,
6871       "Upstream Center Frequency", HFILL}
6872     },
6873     {&hf_docsis_ucd_preamble_pat,
6874      {"Preamble Pattern", "docsis_ucd.preamble",
6875       FT_BYTES, BASE_NONE, NULL, 0x0,
6876       "Preamble Superstring", HFILL}
6877     },
6878     {&hf_docsis_ucd_ext_preamble_pat,
6879      {"Extended Preamble Pattern", "docsis_ucd.extpreamble",
6880       FT_BYTES, BASE_NONE, NULL, 0x0,
6881       "Extended Preamble Superstring", HFILL}
6882     },
6883     {&hf_docsis_ucd_scdma_mode_enabled,
6884      {"S-CDMA Mode Enabled", "docsis_ucd.scdma",
6885       FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
6886       NULL, HFILL}
6887     },
6888     {&hf_docsis_ucd_scdma_spreading_interval,
6889      {"SCDMA Spreading Interval", "docsis_ucd.scdmaspreadinginterval",
6890       FT_BYTES, BASE_NONE, NULL, 0x0,
6891       NULL, HFILL}
6892     },
6893     {&hf_docsis_ucd_scdma_codes_per_mini_slot,
6894      {"SCDMA Codes per mini slot", "docsis_ucd.scdmacodesperminislot",
6895       FT_BYTES, BASE_NONE, NULL, 0x0,
6896       NULL, HFILL}
6897     },
6898     {&hf_docsis_ucd_scdma_active_codes,
6899      {"SCDMA Active Codes", "docsis_ucd.scdmaactivecodes",
6900       FT_BYTES, BASE_NONE, NULL, 0x0,
6901       NULL, HFILL}
6902     },
6903     {&hf_docsis_ucd_scdma_code_hopping_seed,
6904      {"SCDMA Code Hopping Seed", "docsis_ucd.scdmacodehoppingseed",
6905       FT_BYTES, BASE_NONE, NULL, 0x0,
6906       NULL, HFILL}
6907     },
6908     {&hf_docsis_ucd_scdma_us_ratio_num,
6909      {"SCDMA US Ratio Numerator", "docsis_ucd.scdmausrationum",
6910       FT_BYTES, BASE_NONE, NULL, 0x0,
6911       NULL, HFILL}
6912     },
6913     {&hf_docsis_ucd_scdma_us_ratio_denom,
6914      {"SCDMA US Ratio Denominator", "docsis_ucd.scdmausratiodenom",
6915       FT_BYTES, BASE_NONE, NULL, 0x0,
6916       NULL, HFILL}
6917     },
6918     {&hf_docsis_ucd_scdma_timestamp_snapshot,
6919      {"SCDMA Timestamp Snapshot", "docsis_ucd.scdmatimestamp",
6920       FT_BYTES, BASE_NONE, NULL, 0x0,
6921       NULL, HFILL}
6922     },
6923     {&hf_docsis_ucd_maintain_power_spectral_density,
6924      {"Maintain Power Spectral Density", "docsis_ucd.maintpower",
6925       FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
6926       NULL, HFILL}
6927     },
6928     {&hf_docsis_ucd_ranging_required,
6929      {"Ranging Required", "docsis_ucd.rangingreq",
6930       FT_UINT8, BASE_DEC, VALS (ranging_req_vals), 0x0,
6931       NULL, HFILL}
6932     },
6933     {&hf_docsis_ucd_max_scheduled_codes,
6934      {"S-CDMA Max Scheduled Codes", "docsis_ucd.scdmamaxcodes",
6935       FT_UINT8, BASE_DEC, VALS (max_scheduled_codes_vals), 0x0,
6936       NULL, HFILL}
6937     },
6938     {&hf_docsis_ucd_rnghoff_cm,
6939      {"Ranging Hold-Off (CM)","docsis_ucd.rnghoffcm",
6940       FT_BOOLEAN, 32, TFS(&tfs_allow_inhibit), 0x1,
6941       NULL, HFILL}
6942     },
6943     {&hf_docsis_ucd_rnghoff_erouter,
6944      {"Ranging Hold-Off (eRouter)",
6945       "docsis_ucd.rnghofferouter",
6946       FT_BOOLEAN, 32, TFS(&tfs_allow_inhibit), 0x2,
6947       NULL, HFILL}
6948     },
6949     {&hf_docsis_ucd_rnghoff_emta,
6950      {"Ranging Hold-Off (eMTA or EDVA)",
6951       "docsis_ucd.rnghoffemta",
6952       FT_BOOLEAN, 32, TFS(&tfs_allow_inhibit), 0x4,
6953       NULL, HFILL}
6954     },
6955     {&hf_docsis_ucd_rnghoff_estb,
6956      {"Ranging Hold-Off (DSG/eSTB)",
6957       "docsis_ucd.rnghoffestb",
6958       FT_BOOLEAN, 32, TFS(&tfs_allow_inhibit), 0x8,
6959       NULL, HFILL}
6960     },
6961     {&hf_docsis_ucd_rnghoff_rsvd,
6962      {"Reserved",
6963       "docsis_ucd.rnghoffrsvd",
6964       FT_UINT32, BASE_HEX, NULL, 0xFFF0,
6965       NULL, HFILL}
6966     },
6967     {&hf_docsis_ucd_rnghoff_id_ext,
6968      {"CM Ranging Class ID Extension",
6969       "docsis_ucd.rngidext",
6970       FT_UINT32, BASE_HEX, NULL, 0xFFFF0000,
6971       NULL, HFILL}
6972     },
6973     {&hf_docsis_ucd_chan_class_id_cm,
6974      {"Channel Class ID (CM)","docsis_ucd.classidcm",
6975       FT_UINT32, BASE_DEC, VALS (inhibit_allow_vals), 0x1,
6976       NULL, HFILL}
6977     },
6978     {&hf_docsis_ucd_chan_class_id_erouter,
6979      {"Channel Class ID (eRouter)",
6980       "docsis_ucd.classiderouter",
6981       FT_UINT32, BASE_DEC, VALS (inhibit_allow_vals), 0x2,
6982       NULL, HFILL}
6983     },
6984     {&hf_docsis_ucd_chan_class_id_emta,
6985      {"Channel Class ID (eMTA or EDVA)",
6986       "docsis_ucd.classidemta",
6987       FT_UINT32, BASE_DEC, VALS (inhibit_allow_vals), 0x4,
6988       NULL, HFILL}
6989     },
6990     {&hf_docsis_ucd_chan_class_id_estb,
6991      {"Channel Class ID (DSG/eSTB)",
6992       "docsis_ucd.classidestb",
6993       FT_UINT32, BASE_DEC, VALS (inhibit_allow_vals), 0x8,
6994       NULL, HFILL}
6995     },
6996     {&hf_docsis_ucd_chan_class_id_rsvd,
6997      {"Reserved",
6998       "docsis_ucd.classidrsvd",
6999       FT_UINT32, BASE_HEX, NULL, 0xFFF0,
7000       NULL, HFILL}
7001     },
7002     {&hf_docsis_ucd_chan_class_id_id_ext,
7003      {"CM Ranging Class ID Extension",
7004       "docsis_ucd.classidext",
7005       FT_UINT32, BASE_HEX, NULL, 0xFFFF0000,
7006       NULL, HFILL}
7007     },
7008     {&hf_docsis_ucd_change_ind_bitmask_subc_excl_band,
7009      {"UCD Change Indicator Bitmask: Subcarrier Exclusion Band TLV", "docsis_ucd.burst.ucd_change_ind_bitmask_subc_excl_band",
7010       FT_BOOLEAN, 8, TFS(&tfs_ucd_change_ind_vals), 0x01,
7011       NULL, HFILL}
7012     },
7013     {&hf_docsis_ucd_change_ind_bitmask_unused_subc,
7014      {"UCD Change Indicator Bitmask: Unused Subcarrier Specification TLV", "docsis_ucd.burst.ucd_change_ind_bitmask_unused_subc",
7015       FT_BOOLEAN, 8, TFS(&tfs_ucd_change_ind_vals), 0x02,
7016       NULL, HFILL}
7017     },
7018     {&hf_docsis_ucd_change_ind_bitmask_other_subc,
7019      {"UCD Change Indicator Bitmask: Other than Subcarrier Exclusion Band and Unused Subcarrier Specification TLV", "docsis_ucd.burst.ucd_change_ind_bitmask_other_subc",
7020       FT_BOOLEAN, 8, TFS(&tfs_ucd_change_ind_vals), 0x04,
7021       NULL, HFILL}
7022     },
7023     {&hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc5,
7024      {"UCD Change Indicator Bitmask: Burst Attributes associated with IUC5", "docsis_ucd.burst.ucd_change_ind_bitmask_burst_attr_iuc5",
7025       FT_BOOLEAN, 8, TFS(&tfs_ucd_change_ind_vals), 0x08,
7026       NULL, HFILL}
7027     },
7028     {&hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc6,
7029      {"UCD Change Indicator Bitmask: Burst Attributes associated with IUC6", "docsis_ucd.burst.ucd_change_ind_bitmask_burst_attr_iuc6",
7030       FT_BOOLEAN, 8, TFS(&tfs_ucd_change_ind_vals), 0x10,
7031       NULL, HFILL}
7032     },
7033     {&hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc9,
7034      {"UCD Change Indicator Bitmask: Burst Attributes associated with IUC9", "docsis_ucd.burst.ucd_change_ind_bitmask_burst_attr_iuc9",
7035       FT_BOOLEAN, 8, TFS(&tfs_ucd_change_ind_vals), 0x20,
7036       NULL, HFILL}
7037     },
7038     {&hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc10,
7039      {"UCD Change Indicator Bitmask: Burst Attributes associated with IUC10", "docsis_ucd.burst.ucd_change_ind_bitmask_burst_attr_iuc10",
7040       FT_BOOLEAN, 8, TFS(&tfs_ucd_change_ind_vals), 0x40,
7041       NULL, HFILL}
7042     },
7043     {&hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc11,
7044      {"UCD Change Indicator Bitmask: Burst Attributes associated with IUC11", "docsis_ucd.burst.ucd_change_ind_bitmask_burst_attr_iuc11",
7045       FT_BOOLEAN, 8, TFS(&tfs_ucd_change_ind_vals), 0x80,
7046       NULL, HFILL}
7047     },
7048     {&hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc12,
7049      {"UCD Change Indicator Bitmask: Burst Attributes associated with IUC12", "docsis_ucd.burst.ucd_change_ind_bitmask_burst_attr_iuc12",
7050       FT_BOOLEAN, 8, TFS(&tfs_ucd_change_ind_vals), 0x01,
7051       NULL, HFILL}
7052     },
7053     {&hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc13,
7054      {"UCD Change Indicator Bitmask: Burst Attributes associated with IUC13", "docsis_ucd.burst.ucd_change_ind_bitmask_burst_attr_iuc13",
7055       FT_BOOLEAN, 8, TFS(&tfs_ucd_change_ind_vals), 0x02,
7056       NULL, HFILL}
7057     },
7058     {&hf_docsis_ucd_change_ind_bitmask_burst_attr_iuc3_or_4,
7059      {"UCD Change Indicator Bitmask: Burst Attributes associated with IUC3 or IUC4", "docsis_ucd.burst.ucd_change_ind_bitmask_burst_attr_iuc3_or_4",
7060       FT_BOOLEAN, 8, TFS(&tfs_ucd_change_ind_vals), 0x04,
7061       NULL, HFILL}
7062     },
7063     {&hf_docsis_ucd_change_ind_bitmask_reserved,
7064      {"UCD Change Indicator Bitmask: Reserved", "docsis_ucd.burst.ucd_change_ind_bitmask_reserved",
7065       FT_UINT8, BASE_HEX, NULL, 0xF8,
7066       NULL, HFILL}
7067     },
7068     {&hf_docsis_ucd_ofdma_timestamp_snapshot,
7069      {"OFDMA Timestamp Snapshot", "docsis_ucd.ofdma_timestamp_snapshot",
7070       FT_BYTES, BASE_NONE, NULL, 0x00,
7071       NULL, HFILL}
7072     },
7073     {&hf_docsis_ucd_ofdma_cyclic_prefix_size,
7074      {"OFDMA Cyclic Prefix Size", "docsis_ucd.ofdma_cyclic_prefix_size",
7075       FT_UINT8, BASE_DEC, VALS(ofdma_cyclic_prefix_size_vals), 0x00,
7076       NULL, HFILL}
7077     },
7078     {&hf_docsis_ucd_ofdma_rolloff_period_size,
7079      {"OFDMA Rolloff Period Size", "docsis_ucd.ofdma_rolloff_period_size",
7080       FT_UINT8, BASE_DEC, VALS(ofdma_rolloff_period_size_vals), 0x00,
7081       NULL, HFILL}
7082     },
7083     {&hf_docsis_ucd_subc_spacing,
7084      {"Subcarrier Spacing", "docsis_ucd.subc_spacing",
7085       FT_UINT8, BASE_DEC, VALS(subc_spacing_vals), 0x00,
7086       NULL, HFILL}
7087     },
7088     {&hf_docsis_ucd_cent_freq_subc0,
7089      {"Center Frequency of Subcarrier 0", "docsis_ucd.cent_freq_subc0",
7090       FT_UINT8, BASE_DEC, NULL, 0x00,
7091       NULL, HFILL}
7092     },
7093     {&hf_docsis_ucd_subcarrier_range,
7094      {"Subcarrier range", "docsis_ucd.subc_range",
7095       FT_UINT32, BASE_CUSTOM, CF_FUNC(subc_assign_range), 0x00,
7096       NULL, HFILL}
7097     },
7098     {&hf_docsis_ucd_symb_ofdma_frame,
7099      {"Symbols in OFDMA frame", "docsis_ucd.symb_ofdma_frame",
7100       FT_UINT8, BASE_DEC, NULL, 0x00,
7101       NULL, HFILL}
7102     },
7103     {&hf_docsis_ucd_rand_seed,
7104      {"Randomization Seed", "docsis_ucd.rand_seed",
7105       FT_BYTES, BASE_NONE, NULL, 0x00,
7106       NULL, HFILL}
7107     },
7108     {&hf_docsis_ucd_iuc,
7109      {"Interval Usage Code", "docsis_ucd.iuc",
7110       FT_UINT8, BASE_DEC, VALS (iuc_vals), 0x0,
7111       NULL, HFILL}
7112     },
7113     {&hf_docsis_burst_mod_type,
7114      {"Modulation Type", "docsis_ucd.burst.modtype",
7115       FT_UINT8, BASE_DEC, VALS (mod_vals), 0x0,
7116       NULL, HFILL}
7117     },
7118     {&hf_docsis_burst_diff_encoding,
7119      {"Differential Encoding", "docsis_ucd.burst.diffenc",
7120       FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
7121       NULL, HFILL}
7122     },
7123     {&hf_docsis_burst_preamble_len,
7124      {"Preamble Length (Bits)", "docsis_ucd.burst.preamble_len",
7125       FT_UINT16, BASE_DEC, NULL, 0x0,
7126       NULL, HFILL}
7127     },
7128     {&hf_docsis_burst_preamble_val_off,
7129      {"Preamble Offset (Bits)", "docsis_ucd.burst.preamble_off",
7130       FT_UINT16, BASE_DEC, NULL, 0x0,
7131       NULL, HFILL}
7132     },
7133     {&hf_docsis_burst_fec,
7134      {"FEC (T)", "docsis_ucd.burst.fec",
7135       FT_UINT8, BASE_DEC, NULL, 0x0,
7136       "FEC (T) Codeword Parity Bits = 2^T", HFILL}
7137     },
7138     {&hf_docsis_burst_fec_codeword,
7139      {"FEC Codeword Info bytes (k)", "docsis_ucd.burst.fec_codeword",
7140       FT_UINT8, BASE_DEC, NULL, 0x0,
7141       NULL, HFILL}
7142     },
7143     {&hf_docsis_burst_scrambler_seed,
7144      {"Scrambler Seed", "docsis_ucd.burst.scrambler_seed",
7145       FT_UINT16, BASE_HEX, NULL, 0x0,
7146       "Burst Descriptor", HFILL}
7147     },
7148     {&hf_docsis_burst_max_burst,
7149      {"Max Burst Size (Minislots)", "docsis_ucd.burst.maxburst",
7150       FT_UINT8, BASE_DEC, NULL, 0x0,
7151       NULL, HFILL}
7152     },
7153     {&hf_docsis_burst_guard_time,
7154      {"Guard Time Size (Symbol Times)", "docsis_ucd.burst.guardtime",
7155       FT_UINT8, BASE_DEC, NULL, 0x0,
7156       "Guard Time Size", HFILL}
7157     },
7158     {&hf_docsis_burst_last_cw_len,
7159      {"Last Codeword Length", "docsis_ucd.burst.last_cw_len",
7160       FT_UINT8, BASE_DEC, VALS (last_cw_len_vals), 0x0,
7161       NULL, HFILL}
7162     },
7163     {&hf_docsis_burst_scrambler_onoff,
7164      {"Scrambler On/Off", "docsis_ucd.burst.scrambleronoff",
7165       FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
7166       NULL, HFILL}
7167     },
7168     {&hf_docsis_rs_int_depth,
7169      {"RS Interleaver Depth", "docsis_ucd.burst.rsintdepth",
7170       FT_UINT8, BASE_DEC, NULL, 0x0,
7171       "R-S Interleaver Depth", HFILL}
7172     },
7173     {&hf_docsis_rs_int_block,
7174      {"RS Interleaver Block Size", "docsis_ucd.burst.rsintblock",
7175       FT_UINT8, BASE_DEC, NULL, 0x0,
7176       "R-S Interleaver Block", HFILL}
7177     },
7178     {&hf_docsis_preamble_type,
7179      {"Preamble Type", "docsis_ucd.burst.preambletype",
7180       FT_UINT8, BASE_DEC, NULL, 0x0,
7181       NULL, HFILL}
7182     },
7183     {&hf_docsis_ucd_scdma_scrambler_onoff,
7184      {"Scrambler On/Off", "docsis_ucd.burst.scdmascrambleronoff",
7185       FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
7186       "SCDMA Scrambler On/Off", HFILL}
7187     },
7188     {&hf_docsis_ucd_scdma_codes_per_subframe,
7189      {"SCDMA Codes per Subframe", "docsis_ucd.burst.scdmacodespersubframe",
7190       FT_UINT8, BASE_DEC, NULL, 0x0,
7191       NULL, HFILL}
7192     },
7193     {&hf_docsis_ucd_scdma_framer_int_step_size,
7194      {"SCDMA Framer Interleaving Step Size", "docsis_ucd.burst.scdmaframerintstepsize",
7195       FT_UINT8, BASE_DEC, NULL, 0x0,
7196       NULL, HFILL}
7197     },
7198     {&hf_docsis_ucd_tcm_enabled,
7199      {"TCM Enabled", "docsis_ucd.burst.tcmenabled",
7200       FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
7201       NULL, HFILL}
7202     },
7203     {&hf_docsis_ucd_active_code_hopping,
7204      {"S-CDMA Selection Mode for Active Codes and Code Hopping", "docsis_ucd.selectcodehop",
7205       FT_UINT8, BASE_DEC, VALS (tlv20_vals), 0x0,
7206       NULL, HFILL}
7207     },
7208     {&hf_docsis_ucd_scdma_selection_active_codes,
7209      {"S-CDMA Selection String for Active Codes", "docsis_ucd.selectcode",
7210       FT_BYTES, BASE_NONE, NULL, 0x0,
7211       NULL, HFILL}
7212     },
7213     {&hf_docsis_ucd_higher_ucd_for_same_ucid,
7214      {"Higher UCD for the same UCID", "docsis_ucd.highucdpresent",
7215       FT_BOOLEAN, 8, TFS(&type35ucd_tfs_present_not_present), 0x1,
7216       NULL, HFILL}
7217     },
7218     {&hf_docsis_ucd_higher_ucd_for_same_ucid_resv,
7219      {"Reserved", "docsis_ucd.highucdresv",
7220       FT_UINT8, BASE_HEX, NULL, 0xFE,
7221       NULL, HFILL}
7222     },
7223     {&hf_docsis_subc_init_rang,
7224      {"Subcarriers (Nir) Initial Ranging", "docsis_ucd.burst.subc_init_rang",
7225       FT_UINT16, BASE_DEC, NULL, 0x0,
7226       NULL, HFILL}
7227     },
7228     {&hf_docsis_subc_fine_rang,
7229      {"Subcarriers (Nfr) Fine Ranging", "docsis_ucd.burst.subc_fine_rang",
7230       FT_UINT16, BASE_DEC, NULL, 0x0,
7231       NULL, HFILL}
7232     },
7233     {&hf_docsis_ofdma_prof_mod_order,
7234      {"OFDMA Profile: modulation", "docsis_ucd.burst.ofma_prof_mod_order",
7235       FT_UINT8, BASE_DEC, VALS(ofdma_prof_mod_order), 0xF0,
7236       NULL, HFILL}
7237     },
7238     {&hf_docsis_ofdma_prof_pilot_pattern,
7239      {"OFDMA Profile: pilot pattern", "docsis_ucd.burst.ofma_prof_pilot_pattern",
7240       FT_UINT8, BASE_DEC, NULL, 0x0F,
7241       NULL, HFILL}
7242     },
7243     {&hf_docsis_ofdma_prof_num_add_minislots,
7244      {"OFDMA Profile: Additional Minislots that have identical bit-loading and pilot pattern index", "docsis_ucd.burst.ofma_prof_add_minislots",
7245       FT_UINT8, BASE_DEC, NULL, 0x00,
7246       NULL, HFILL}
7247     },
7248     {&hf_docsis_ofdma_ir_pow_ctrl_start_pow,
7249      {"OFDMA IR Power Control Starting Power Level", "docsis_ucd.burst.ofma_ir_pow_ctrl_start_pow",
7250       FT_UINT8, BASE_CUSTOM, CF_FUNC(ofdma_ir_pow_ctrl_start_pow), 0x00,
7251       NULL, HFILL}
7252     },
7253     {&hf_docsis_ofdma_ir_pow_ctrl_step_size,
7254      {"OFDMA IR Power Control Step Size", "docsis_ucd.burst.ofma_ir_pow_ctrl_step_size",
7255       FT_UINT8, BASE_CUSTOM, CF_FUNC(ofdma_ir_pow_ctrl_step_size), 0x00,
7256       NULL, HFILL}
7257     },
7258     /* MAP */
7259     {&hf_docsis_map_ucd_count,
7260      {"UCD Count", "docsis_map.ucdcount",
7261       FT_UINT8, BASE_DEC, NULL, 0x0,
7262       "Map UCD Count", HFILL}
7263     },
7264     {&hf_docsis_map_numie,
7265      {"Number of IE's", "docsis_map.numie",
7266       FT_UINT8, BASE_DEC, NULL, 0x0,
7267       "Number of Information Elements", HFILL}
7268     },
7269     {&hf_docsis_map_numie_v5,
7270      {"Number of IE's", "docsis_map.numie",
7271       FT_UINT16, BASE_DEC, NULL, 0xFF80,
7272       "Number of Information Elements", HFILL}
7273     },
7274     {&hf_docsis_map_rsvd_v5,
7275      {"Reserved [0x00]", "docsis_map.rsvd",
7276       FT_UINT8, BASE_HEX, NULL, 0x70,
7277       "Reserved Byte", HFILL}
7278     },
7279     {&hf_docsis_map_cat,
7280      {"CAT", "docsis_map.cat",
7281       FT_UINT8, BASE_HEX, NULL, 0x0F,
7282       NULL, HFILL}
7283     },
7284
7285     {&hf_docsis_map_alloc_start,
7286      {"Alloc Start Time (minislots)", "docsis_map.allocstart",
7287       FT_UINT32, BASE_DEC, NULL, 0x0,
7288       NULL, HFILL}
7289     },
7290     {&hf_docsis_map_ack_time,
7291      {"ACK Time (minislots)", "docsis_map.acktime",
7292       FT_UINT32, BASE_DEC, NULL, 0x0,
7293       NULL, HFILL}
7294     },
7295     {&hf_docsis_map_rng_start,
7296      {"Ranging Backoff Start", "docsis_map.rng_start",
7297       FT_UINT8, BASE_DEC, NULL, 0x0,
7298       NULL, HFILL}
7299     },
7300     {&hf_docsis_map_rng_end,
7301      {"Ranging Backoff End", "docsis_map.rng_end",
7302       FT_UINT8, BASE_DEC, NULL, 0x0,
7303       NULL, HFILL}
7304     },
7305     {&hf_docsis_map_data_start,
7306      {"Data Backoff Start", "docsis_map.data_start",
7307       FT_UINT8, BASE_DEC, NULL, 0x0,
7308       NULL, HFILL}
7309     },
7310     {&hf_docsis_map_data_end,
7311      {"Data Backoff End", "docsis_map.data_end",
7312       FT_UINT8, BASE_DEC, NULL, 0x0,
7313       NULL, HFILL}
7314     },
7315     {&hf_docsis_map_ie,
7316      {"Information Element", "docsis_map.ie",
7317       FT_UINT32, BASE_HEX, NULL, 0x0,
7318       NULL, HFILL}
7319     },
7320     {&hf_docsis_map_probe_ie,
7321      {"Probe Information Element", "docsis_map.probe_ie",
7322       FT_UINT32, BASE_HEX, NULL, 0x0,
7323       NULL, HFILL}
7324     },
7325     {&hf_docsis_map_rsvd,
7326      {"Reserved", "docsis_map.rsvd",
7327       FT_UINT8, BASE_HEX, NULL, 0x0,
7328       "Reserved Byte", HFILL}
7329     },
7330     {&hf_docsis_map_sid,
7331      {"Service Identifier", "docsis_map.sid",
7332       FT_UINT32, BASE_DEC, NULL, 0xFFFC0000,
7333       NULL, HFILL}
7334     },
7335     {&hf_docsis_map_iuc,
7336      {"Interval Usage Code", "docsis_map.iuc",
7337       FT_UINT32, BASE_DEC, VALS(iuc_vals), 0x0003c000,
7338       NULL, HFILL}
7339     },
7340     {&hf_docsis_map_offset,
7341      {"Offset", "docsis_map.offset",
7342       FT_UINT32, BASE_DEC, NULL, 0x00003fff,
7343       NULL, HFILL}
7344     },
7345     {&hf_docsis_map_mer,
7346      {"MER", "docsis_map.mer",
7347       FT_BOOLEAN, 32, TFS(&mer_vals), 0x00020000,
7348       NULL, HFILL}
7349     },
7350     {&hf_docsis_map_pw,
7351      {"PW (Power)", "docsis_map.pw",
7352       FT_BOOLEAN, 32, TFS(&pw_vals), 0x00010000,
7353       NULL, HFILL}
7354     },
7355     {&hf_docsis_map_eq,
7356      {"EQ (TX Equalization)", "docsis_map.eq",
7357       FT_BOOLEAN, 32, TFS(&eq_vals), 0x00008000,
7358       NULL, HFILL}
7359     },
7360     {&hf_docsis_map_st,
7361      {"St (Stagger)", "docsis_map.st",
7362       FT_BOOLEAN, 32, TFS(&st_vals), 0x00004000,
7363       NULL, HFILL}
7364     },
7365     {&hf_docsis_map_probe_frame,
7366      {"Probe Frame", "docsis_map.probe_frame",
7367       FT_UINT32, BASE_DEC, NULL, 0x00003000,
7368       NULL, HFILL}
7369     },
7370     {&hf_docsis_map_symbol_in_frame,
7371      {"Symbol in Frame", "docsis_map.symbol_in_frame",
7372       FT_UINT32, BASE_DEC, NULL, 0x00000fc0,
7373       NULL, HFILL}
7374     },
7375     {&hf_docsis_map_start_subc,
7376      {"Start Subc", "docsis_map.start_subc",
7377       FT_UINT32, BASE_DEC, NULL, 0x00000038,
7378       NULL, HFILL}
7379     },
7380     {&hf_docsis_map_subc_skip,
7381      {"Subc Skip", "docsis_map.subc_skip",
7382       FT_UINT32, BASE_DEC, NULL, 0x00000007,
7383       NULL, HFILL}
7384     },
7385
7386     /* RNG-REQ */
7387     {&hf_docsis_rngreq_sid,
7388      {"Service Identifier", "docsis_rngreq.sid",
7389       FT_UINT16, BASE_DEC, NULL, 0x0,
7390       NULL, HFILL}
7391     },
7392     {&hf_docsis_rngreq_pend_compl,
7393      {"Pending Till Complete", "docsis_rngreq.pendcomp",
7394       FT_UINT8, BASE_DEC, NULL, 0x0,
7395       "Upstream Channel ID", HFILL}
7396     },
7397     /* RNG-RSP */
7398     {&hf_docsis_rngrsp_type,
7399      {"Type", "docsis_rngrsp.type",
7400       FT_UINT8, BASE_DEC, VALS(rngrsp_tlv_vals), 0x0,
7401       "TLV Type", HFILL}
7402      },
7403     {&hf_docsis_rngrsp_length,
7404      {"Length", "docsis_rngrsp.length",
7405       FT_UINT8, BASE_DEC, NULL, 0x0,
7406       "TLV Length", HFILL}
7407      },
7408     {&hf_docsis_rngrsp_sid,
7409      {"Service Identifier", "docsis_rngrsp.sid",
7410       FT_UINT16, BASE_DEC, NULL, 0x0,
7411       NULL, HFILL}
7412      },
7413     {&hf_docsis_rngrsp_timing_adj,
7414      {"Timing Adjust (6.25us/64)", "docsis_rngrsp.timingadj",
7415       FT_INT32, BASE_DEC, NULL, 0x0,
7416       "Timing Adjust", HFILL}
7417      },
7418     {&hf_docsis_rngrsp_power_adj,
7419      {"Power Level Adjust (0.25dB units)", "docsis_rngrsp.poweradj",
7420       FT_INT8, BASE_DEC, NULL, 0x0,
7421       "Power Level Adjust", HFILL}
7422      },
7423     {&hf_docsis_rngrsp_freq_adj,
7424      {"Offset Freq Adjust (Hz)", "docsis_rngrsp.freqadj",
7425       FT_INT16, BASE_DEC, NULL, 0x0,
7426       "Frequency Adjust", HFILL}
7427      },
7428     {&hf_docsis_rngrsp_xmit_eq_adj,
7429      {"Transmit Equalisation Adjust", "docsis_rngrsp.xmit_eq_adj",
7430       FT_BYTES, BASE_NONE, NULL, 0x0,
7431       "Timing Equalisation Adjust", HFILL}
7432      },
7433     {&hf_docsis_rngrsp_ranging_status,
7434      {"Ranging Status", "docsis_rngrsp.rng_stat",
7435       FT_UINT8, BASE_DEC, VALS (rng_stat_vals), 0x0,
7436       NULL, HFILL}
7437      },
7438     {&hf_docsis_rngrsp_down_freq_over,
7439      {"Downstream Frequency Override (Hz)", "docsis_rngrsp.freq_over",
7440       FT_UINT32, BASE_DEC, NULL, 0x0,
7441       "Downstream Frequency Override", HFILL}
7442      },
7443     {&hf_docsis_rngrsp_upstream_ch_over,
7444      {"Upstream Channel ID Override", "docsis_rngrsp.chid_override",
7445       FT_UINT8, BASE_DEC, NULL, 0x0,
7446       NULL, HFILL}
7447      },
7448     {&hf_docsis_rngrsp_rngrsp_t4_timeout_multiplier,
7449      {"Multiplier of the default T4 Timeout (the valid range is 1-10)", "docsis_rngrsp.t4_timeout_multiplier",
7450       FT_UINT8, BASE_DEC, NULL, 0x0,
7451       "T4 Timeout Multiplier", HFILL}
7452      },
7453     {&hf_docsis_rngrsp_dynamic_range_window_upper_edge,
7454      {"Dynamic Range Window Upper Edge (in units of 0.25 db below the max allowable setting)", "docsis_rngrsp.dynamic_range_window_upper_edge",
7455       FT_UINT8, BASE_DEC, NULL, 0x0,
7456       "Dynamic Range Window Upper EDGE", HFILL}
7457      },
7458     {&hf_docsis_rngrsp_tlv_unknown,
7459      {"Unknown TLV", "docsis_rngrsp.tlv.unknown",
7460       FT_BYTES, BASE_NONE, NULL, 0x0,
7461       NULL, HFILL}
7462     },
7463     {&hf_docsis_rngrsp_trans_eq_data,
7464      {"Transmit equalization data", "docsis_rngrsp.tlv.trans_eq_data",
7465       FT_BYTES, BASE_NONE, NULL, 0x0,
7466       NULL, HFILL}
7467     },
7468     {&hf_docsis_rngrsp_trans_eq_enc_lowest_subc,
7469      {"Lowest Subcarrier for this TLV", "docsis_rngrsp.tlv.trans_eq_enc_lowest_subc",
7470       FT_UINT24, BASE_DEC, NULL, 0xFFF000,
7471       NULL, HFILL}
7472     },
7473     {&hf_docsis_rngrsp_trans_eq_enc_highest_subc,
7474      {"Highest Subcarrier for this TLV", "docsis_rngrsp.tlv.trans_eq_enc_highest_subc",
7475       FT_UINT24, BASE_DEC, NULL, 0x0FFF,
7476       NULL, HFILL}
7477     },
7478     {&hf_docsis_rngrsp_trans_eq_enc_coef_real,
7479      {"Coefficient (real)", "docsis_rngrsp.tlv.trans_eq_enc_coef_real",
7480       FT_INT16, BASE_CUSTOM, CF_FUNC(two_compl_frac), 0x000,
7481       NULL, HFILL}
7482     },
7483     {&hf_docsis_rngrsp_trans_eq_enc_coef_imag,
7484      {"Coefficient (imag)", "docsis_rngrsp.tlv.trans_eq_enc_coef_imag",
7485       FT_INT16, BASE_CUSTOM, CF_FUNC(two_compl_frac), 0x000,
7486       NULL, HFILL}
7487     },
7488     {&hf_docsis_rngrsp_commanded_power_data,
7489      {"Commanded Power Data", "docsis_rngrsp.tlv.comm_pwr_data",
7490       FT_BYTES, BASE_NONE, NULL, 0x00,
7491       NULL, HFILL}
7492     },
7493     {&hf_docsis_rngrsp_commanded_power_dynamic_range_window,
7494      {"Dynamic Range Window", "docsis_rngrsp.tlv.comm_pwr_dyn_range_window",
7495       FT_INT8, BASE_DEC, NULL, 0x00,
7496       NULL, HFILL}
7497     },
7498     {&hf_docsis_rngrsp_commanded_power_ucid,
7499      {"UCID", "docsis_rngrsp.tlv.comm_pwr_ucid",
7500       FT_INT8, BASE_DEC, NULL, 0x00,
7501       NULL, HFILL}
7502     },
7503     {&hf_docsis_rngrsp_commanded_power_trans_pow_lvl,
7504      {"Transmit Power Level (quarter dBmV)", "docsis_rngrsp.tlv.comm_pwr_trans_pow_lvl",
7505       FT_INT16, BASE_DEC, NULL, 0x00,
7506       NULL, HFILL}
7507     },
7508
7509      /* REG_REQ */
7510     {&hf_docsis_regreq_sid,
7511      {"Service Identifier", "docsis_regreq.sid",
7512       FT_UINT16, BASE_DEC, NULL, 0x0,
7513       NULL, HFILL}
7514     },
7515      /* REG_RSP */
7516     {&hf_docsis_regrsp_sid,
7517      {"Service Identifier", "docsis_regrsp.sid",
7518       FT_UINT16, BASE_DEC, NULL, 0x0,
7519       NULL, HFILL}
7520     },
7521     {&hf_docsis_regrsp_response,
7522      {"Response Code", "docsis_regrsp.respnse",
7523       FT_UINT8, BASE_DEC|BASE_EXT_STRING, &docsis_conf_code_ext, 0x0,
7524       NULL, HFILL}
7525     },
7526     /* BPKM */
7527     {&hf_docsis_bpkm_code,
7528      {"BPKM Code", "docsis_bpkm.code",
7529       FT_UINT8, BASE_DEC, VALS (code_field_vals), 0x0,
7530       "BPKM Request Message", HFILL}
7531     },
7532     {&hf_docsis_bpkm_ident,
7533      {"BPKM Identifier", "docsis_bpkm.ident",
7534       FT_UINT8, BASE_DEC, NULL, 0x0,
7535       NULL, HFILL}
7536     },
7537     {&hf_docsis_bpkmattr,
7538      {"BPKM Attributes", "docsis_bpkm.attr",
7539       FT_BYTES, BASE_NONE|BASE_NO_DISPLAY_VALUE, NULL, 0x0,
7540       NULL, HFILL}
7541     },
7542     {&hf_docsis_bpkm_length,
7543      {"BPKM Length", "docsis_bpkm.length",
7544       FT_UINT16, BASE_DEC, NULL, 0x0,
7545       NULL, HFILL}
7546     },
7547     {&hf_docsis_bpkmattr_serial_num,
7548      {"Serial Number", "docsis_bpkm.attr.serialnum",
7549       FT_STRING, BASE_NONE, NULL, 0x0,
7550       NULL, HFILL}
7551     },
7552     {&hf_docsis_bpkmattr_manf_id,
7553      {"Manufacturer Id", "docsis_bpkm.attr.manfid",
7554       FT_BYTES, BASE_NONE, NULL, 0x0,
7555       NULL, HFILL}
7556     },
7557     {&hf_docsis_bpkmattr_mac_addr,
7558      {"Mac Address", "docsis_bpkm.attr.macaddr",
7559       FT_ETHER, BASE_NONE, NULL, 0x0,
7560       NULL, HFILL}
7561     },
7562     {&hf_docsis_bpkmattr_rsa_pub_key,
7563      {"RSA Public Key", "docsis_bpkm.attr.rsa_pub_key",
7564       FT_BYTES, BASE_NONE, NULL, 0x0,
7565       NULL, HFILL}
7566     },
7567     {&hf_docsis_bpkmattr_cm_id,
7568      {"CM Identification", "docsis_bpkm.attr.cmid",
7569       FT_BYTES, BASE_NO_DISPLAY_VALUE, NULL, 0x0,
7570       NULL, HFILL}
7571     },
7572     {&hf_docsis_bpkmattr_display_str,
7573      {"Display String", "docsis_bpkm.attr.dispstr",
7574       FT_STRING, BASE_NONE, NULL, 0x0,
7575       NULL, HFILL}
7576     },
7577     {&hf_docsis_bpkmattr_auth_key,
7578      {"Auth Key", "docsis_bpkm.attr.auth_key",
7579       FT_BYTES, BASE_NONE, NULL, 0x0,
7580       NULL, HFILL}
7581     },
7582     {&hf_docsis_bpkmattr_tek,
7583      {"Traffic Encryption Key", "docsis_bpkm.attr.tek",
7584       FT_BYTES, BASE_NONE, NULL, 0x0,
7585       NULL, HFILL}
7586     },
7587     {&hf_docsis_bpkmattr_key_life,
7588      {"Key Lifetime(s)", "docsis_bpkm.attr.keylife",
7589       FT_UINT32, BASE_DEC, NULL, 0x0,
7590       NULL, HFILL}
7591     },
7592     {&hf_docsis_bpkmattr_key_seq,
7593      {"Key Sequence Number", "docsis_bpkm.attr.keyseq",
7594       FT_UINT8, BASE_DEC, NULL, 0x0,
7595       NULL, HFILL}
7596     },
7597     {&hf_docsis_bpkmattr_hmac_digest,
7598      {"HMAC Digest", "docsis_bpkm.attr.hmacdigest",
7599       FT_BYTES, BASE_NONE, NULL, 0x0,
7600       NULL, HFILL}
7601     },
7602     {&hf_docsis_bpkmattr_said,
7603      {"SAID", "docsis_bpkm.attr.said",
7604       FT_UINT16, BASE_DEC, NULL, 0x0,
7605       "Security Association ID", HFILL}
7606     },
7607     {&hf_docsis_bpkmattr_tek_params,
7608      {"TEK Parameters", "docsis_bpkm.attr.tekparams",
7609       FT_BYTES, BASE_NO_DISPLAY_VALUE, NULL, 0x0,
7610       NULL, HFILL}
7611     },
7612     {&hf_docsis_bpkmattr_cbc_iv,
7613      {"CBC IV", "docsis_bpkm.attr.cbciv",
7614       FT_BYTES, BASE_NONE, NULL, 0x0,
7615       "Cypher Block Chaining", HFILL}
7616     },
7617     {&hf_docsis_bpkmattr_error_code,
7618      {"Error Code", "docsis_bpkm.attr.errcode",
7619       FT_UINT8, BASE_DEC, VALS (error_code_vals), 0x0,
7620       NULL, HFILL}
7621     },
7622     {&hf_docsis_bpkmattr_vendor_def,
7623      {"Vendor Defined", "docsis_bpkm.attr.vendordef",
7624       FT_BYTES, BASE_NONE, NULL, 0x0,
7625       NULL, HFILL}
7626     },
7627     {&hf_docsis_bpkmattr_ca_cert,
7628      {"CA Certificate", "docsis_bpkm.attr.cacert",
7629       FT_BYTES, BASE_NONE, NULL, 0x0,
7630       NULL, HFILL}
7631     },
7632     {&hf_docsis_bpkmattr_cm_cert,
7633      {"CM Certificate", "docsis_bpkm.attr.cmcert",
7634       FT_BYTES, BASE_NONE, NULL, 0x0,
7635       NULL, HFILL}
7636     },
7637     {&hf_docsis_bpkmattr_security_cap,
7638      {"Security Capabilities", "docsis_bpkm.attr.seccap",
7639       FT_BYTES, BASE_NO_DISPLAY_VALUE, NULL, 0x0,
7640       NULL, HFILL}
7641     },
7642     {&hf_docsis_bpkmattr_crypto_suite,
7643      {"Cryptographic Suite", "docsis_bpkm.attr.cryptosuite",
7644       FT_UINT16, BASE_HEX, VALS(crypto_suite_attr_vals), 0x0,
7645       NULL, HFILL}
7646     },
7647     {&hf_docsis_bpkmattr_crypto_suite_list,
7648      {"Cryptographic Suite List", "docsis_bpkm.attr.crypto_suite_lst",
7649       FT_BYTES, BASE_NONE, NULL, 0x0,
7650       NULL, HFILL}
7651     },
7652     {&hf_docsis_bpkmattr_bpi_version,
7653      {"BPI Version", "docsis_bpkm.attr.bpiver",
7654       FT_UINT8, BASE_DEC, VALS (bpi_ver_vals), 0x0,
7655       NULL, HFILL}
7656     },
7657     {&hf_docsis_bpkmattr_sa_descr,
7658      {"SA Descriptor", "docsis_bpkm.attr.sadescr",
7659       FT_BYTES, BASE_NO_DISPLAY_VALUE, NULL, 0x0,
7660       NULL, HFILL}
7661     },
7662     {&hf_docsis_bpkmattr_sa_type,
7663      {"SA Type", "docsis_bpkm.attr.satype",
7664       FT_UINT8, BASE_DEC, NULL, 0x0,
7665       NULL, HFILL}
7666     },
7667     {&hf_docsis_bpkmattr_sa_query,
7668      {"SA Query", "docsis_bpkm.attr.saquery",
7669       FT_BYTES, BASE_NO_DISPLAY_VALUE, NULL, 0x0,
7670       NULL, HFILL}
7671     },
7672     {&hf_docsis_bpkmattr_sa_query_type,
7673      {"SA Query Type", "docsis_bpkm.attr.saquery_type",
7674       FT_UINT8, BASE_HEX, NULL, 0x0,
7675       NULL, HFILL}
7676     },
7677     {&hf_docsis_bpkmattr_ip_address,
7678      {"IP Address", "docsis_bpkm.attr.ipaddr",
7679       FT_IPv4, BASE_NONE, NULL, 0x0,
7680       NULL, HFILL}
7681     },
7682     {&hf_docsis_bpkmattr_download_param,
7683      {"Download Parameters", "docsis_bpkm.attr.dnld_params",
7684       FT_BYTES, BASE_NO_DISPLAY_VALUE, NULL, 0x0,
7685       NULL, HFILL}
7686     },
7687     {&hf_docsis_bpkmattr_type,
7688      {"Type", "docsis_bpkm.attr.type",
7689       FT_UINT8, BASE_DEC, VALS(bpkmattr_tlv_vals), 0x0,
7690       "TLV Type", HFILL}
7691      },
7692     {&hf_docsis_bpkmattr_length,
7693      {"Length", "docsis_bpkm.attr.length",
7694       FT_UINT16, BASE_DEC, NULL, 0x0,
7695       "TLV Length", HFILL}
7696      },
7697     /* REG-ACK */
7698     {&hf_docsis_regack_sid,
7699      {"Service Identifier", "docsis_regack.sid",
7700       FT_UINT16, BASE_DEC, NULL, 0x0,
7701       NULL, HFILL}
7702     },
7703     {&hf_docsis_regack_response,
7704      {"Response Code", "docsis_regack.respnse",
7705       FT_UINT8, BASE_DEC|BASE_EXT_STRING, &docsis_conf_code_ext, 0x0,
7706       NULL, HFILL}
7707     },
7708     /* DAS-RSP */
7709     {&hf_docsis_dsarsp_response,
7710      {"Confirmation Code", "docsis_dsarsp.confcode",
7711       FT_UINT8, BASE_DEC|BASE_EXT_STRING, &docsis_conf_code_ext, 0x0,
7712       NULL, HFILL}
7713     },
7714     {&hf_docsis_dsaack_response,
7715      {"Confirmation Code", "docsis_dsaack.confcode",
7716       FT_UINT8, BASE_DEC|BASE_EXT_STRING, &docsis_conf_code_ext, 0x0,
7717       NULL, HFILL}
7718     },
7719     /* DSC-RSP */
7720     {&hf_docsis_dscrsp_response,
7721      {"Confirmation Code", "docsis_dscrsp.confcode",
7722       FT_UINT8, BASE_DEC|BASE_EXT_STRING, &docsis_conf_code_ext, 0x0,
7723       NULL, HFILL}
7724     },
7725     {&hf_docsis_dscack_response,
7726      {"Confirmation Code", "docsis_dscack.confcode",
7727       FT_UINT8, BASE_DEC|BASE_EXT_STRING, &docsis_conf_code_ext, 0x0,
7728       NULL, HFILL}
7729     },
7730     /* DSD-REQ */
7731     {&hf_docsis_dsdreq_rsvd,
7732      {"Reserved", "docsis_dsdreq.rsvd",
7733       FT_UINT16, BASE_HEX, NULL, 0x0,
7734       NULL, HFILL}
7735     },
7736     {&hf_docsis_dsdreq_sfid,
7737      {"Service Flow ID", "docsis_dsdreq.sfid",
7738       FT_UINT32, BASE_DEC, NULL, 0x0,
7739       NULL, HFILL}
7740     },
7741     /* DSD-RSP */
7742     {&hf_docsis_dsdrsp_confcode,
7743      {"Confirmation Code", "docsis_dsdrsp.confcode",
7744       FT_UINT8, BASE_DEC|BASE_EXT_STRING, &docsis_conf_code_ext, 0x0,
7745       NULL, HFILL}
7746     },
7747     {&hf_docsis_dsdrsp_rsvd,
7748      {"Reserved", "docsis_dsdrsp.rsvd",
7749       FT_UINT8, BASE_DEC, NULL, 0x0,
7750       NULL, HFILL}
7751     },
7752     /* DCC-REQ */
7753     {&hf_docsis_dccreq_type,
7754      {
7755       "Type",
7756       "docsis_dccreq.tlvtype",
7757       FT_UINT8, BASE_DEC, VALS(dcc_tlv_vals), 0x0,
7758       NULL,
7759       HFILL
7760      }
7761     },
7762     {&hf_docsis_dccreq_length,
7763      {
7764       "Length",
7765       "docsis_dccreq.tlvlen",
7766       FT_UINT8, BASE_DEC, NULL, 0x0,
7767       NULL,
7768       HFILL
7769      }
7770     },
7771     {&hf_docsis_dccreq_tran_id ,
7772      {
7773        "Transaction ID",
7774        "docsis_dccreq.tran_id",
7775        FT_UINT16, BASE_DEC, NULL, 0x0,
7776        NULL,
7777        HFILL
7778      }
7779     },
7780     {&hf_docsis_dccreq_up_chan_id ,
7781      {
7782        "Up Channel ID",
7783        "docsis_dccreq.up_chan_id",
7784        FT_UINT8, BASE_DEC, NULL, 0x0,
7785        NULL,
7786        HFILL
7787      }
7788     },
7789     {&hf_docsis_dcc_ds_params_subtype,
7790      {
7791       "Type",
7792       "docsis_dccreq.ds_tlvtype",
7793       FT_UINT8, BASE_DEC, VALS(ds_param_subtlv_vals), 0x0,
7794       NULL,
7795       HFILL
7796      }
7797     },
7798     {&hf_docsis_dcc_ds_params_length,
7799      {
7800       "Length",
7801       "docsis_dccreq.ds_tlvlen",
7802       FT_UINT8, BASE_DEC, NULL, 0x0,
7803       NULL,
7804       HFILL
7805      }
7806     },
7807     {&hf_docsis_dccreq_ds_freq ,
7808      {
7809        "Frequency",
7810        "docsis_dccreq.ds_freq",
7811        FT_UINT32, BASE_DEC, NULL, 0x0,
7812        NULL,
7813        HFILL
7814      }
7815     },
7816     {&hf_docsis_dccreq_ds_mod_type ,
7817      {
7818        "Modulation Type",
7819        "docsis_dccreq.ds_mod_type",
7820        FT_UINT8, BASE_DEC, VALS (ds_mod_type_vals), 0x0,
7821        NULL,
7822        HFILL
7823      }
7824     },
7825     {&hf_docsis_dccreq_ds_sym_rate ,
7826      {
7827        "Symbol Rate",
7828        "docsis_dccreq.ds_sym_rate",
7829        FT_UINT8, BASE_DEC, VALS (ds_sym_rate_vals), 0x0,
7830        NULL,
7831        HFILL
7832      }
7833     },
7834     {&hf_docsis_dccreq_ds_intlv_depth_i ,
7835      {
7836        "Interleaver Depth I Value",
7837        "docsis_dccreq.ds_intlv_depth_i",
7838        FT_UINT8, BASE_DEC, NULL, 0x0,
7839        NULL,
7840        HFILL
7841      }
7842     },
7843     {&hf_docsis_dccreq_ds_intlv_depth_j ,
7844      {
7845        "Interleaver Depth J Value",
7846        "docsis_dccreq.ds_intlv_depth_j",
7847        FT_UINT8, BASE_DEC, NULL, 0x0,
7848        NULL,
7849        HFILL
7850      }
7851     },
7852     {&hf_docsis_dccreq_ds_chan_id ,
7853      {
7854        "Downstream Channel ID",
7855        "docsis_dccreq.ds_chan_id",
7856        FT_UINT8, BASE_DEC, NULL, 0x0,
7857        NULL,
7858        HFILL
7859      }
7860     },
7861     {&hf_docsis_dccreq_ds_sync_sub ,
7862      {
7863        "SYNC Substitution",
7864        "docsis_dccreq.ds_sync_sub",
7865        FT_UINT8, BASE_DEC, NULL, 0x0,
7866        NULL,
7867        HFILL
7868      }
7869     },
7870     {&hf_docsis_dccreq_ds_ofdm_block_freq ,
7871      {
7872        "OFDM Block Frequency",
7873        "docsis_dccreq.ds_ofdm_block_freq",
7874        FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &local_units_hz, 0x0,
7875        NULL,
7876        HFILL
7877      }
7878     },
7879     {&hf_docsis_dccreq_init_tech ,
7880      {
7881        "Initialization Technique",
7882        "docsis_dccreq.init_tech",
7883        FT_UINT8, BASE_DEC, VALS (init_tech_vals), 0x0,
7884        NULL,
7885        HFILL
7886      }
7887     },
7888     {&hf_docsis_dccreq_ucd_sub ,
7889      {
7890        "UCD Substitution",
7891        "docsis_dccreq.ucd_sub",
7892        FT_BYTES, BASE_NONE, NULL, 0x0,
7893        NULL,
7894        HFILL
7895      }
7896     },
7897     {&hf_docsis_dccreq_said_sub_cur ,
7898      {
7899        "SAID Sub - Current Value",
7900        "docsis_dccreq.said_sub_cur",
7901        FT_UINT16, BASE_DEC, NULL, 0x0,
7902        NULL,
7903        HFILL
7904      }
7905     },
7906     {&hf_docsis_dccreq_said_sub_new ,
7907      {
7908        "SAID Sub - New Value",
7909        "docsis_dccreq.said_sub_new",
7910        FT_UINT16, BASE_DEC, NULL, 0x0,
7911        NULL,
7912        HFILL
7913      }
7914     },
7915     {&hf_docsis_dcc_sf_sub_subtype,
7916      {
7917       "Type",
7918       "docsis_dccreq.sf_tlvtype",
7919       FT_UINT8, BASE_DEC, VALS(sf_sub_subtlv_vals), 0x0,
7920       NULL,
7921       HFILL
7922      }
7923     },
7924     {&hf_docsis_dcc_sf_sub_length,
7925      {
7926       "Length",
7927       "docsis_dccreq.sf_tlvlen",
7928       FT_UINT8, BASE_DEC, NULL, 0x0,
7929       NULL,
7930       HFILL
7931      }
7932     },
7933     {&hf_docsis_dccreq_sf_sfid_cur ,
7934      {
7935        "SF Sub - SFID Current Value",
7936        "docsis_dccreq.sf_sfid_cur",
7937        FT_UINT32, BASE_DEC, NULL, 0x0,
7938        NULL,
7939        HFILL
7940      }
7941     },
7942     {&hf_docsis_dccreq_sf_sfid_new ,
7943      {
7944        "SF Sub - SFID New Value",
7945        "docsis_dccreq.sf_sfid_new",
7946        FT_UINT32, BASE_DEC, NULL, 0x0,
7947        NULL,
7948        HFILL
7949      }
7950     },
7951     {&hf_docsis_dccreq_sf_sid_cur ,
7952      {
7953        "SF Sub - SID Current Value",
7954        "docsis_dccreq.sf_sid_cur",
7955        FT_UINT16, BASE_DEC, NULL, 0x0,
7956        NULL,
7957        HFILL
7958      }
7959     },
7960     {&hf_docsis_dccreq_sf_sid_new ,
7961      {
7962        "SF Sub - SID New Value",
7963        "docsis_dccreq.sf_sid_new",
7964        FT_UINT16, BASE_DEC, NULL, 0x0,
7965        NULL,
7966        HFILL
7967      }
7968     },
7969     {&hf_docsis_dccreq_sf_unsol_grant_tref ,
7970      {
7971        "SF Sub - Unsolicited Grant Time Reference",
7972        "docsis_dccreq.sf_unsol_grant_tref",
7973        FT_UINT32, BASE_DEC, NULL, 0x0,
7974        NULL,
7975        HFILL
7976      }
7977     },
7978     {&hf_docsis_dccreq_cmts_mac_addr ,
7979      {
7980        "CMTS Mac Address",
7981        "docsis_dccreq.cmts_mac_addr",
7982        FT_ETHER, BASE_NONE, NULL, 0x0,
7983        NULL,
7984        HFILL
7985      }
7986     },
7987     {&hf_docsis_dccreq_key_seq_num ,
7988      {
7989        "Auth Key Sequence Number",
7990        "docsis_dccreq.key_seq_num",
7991        FT_UINT8, BASE_DEC, NULL, 0x0,
7992        NULL,
7993        HFILL
7994      }
7995     },
7996     {&hf_docsis_dccreq_hmac_digest ,
7997      {
7998        "HMAC-DigestNumber",
7999        "docsis_dccreq.hmac_digest",
8000        FT_BYTES, BASE_NONE, NULL, 0x0,
8001        NULL,
8002        HFILL
8003      }
8004     },
8005     /* DCC-RSP */
8006     {&hf_docsis_dccrsp_conf_code ,
8007      {
8008        "Confirmation Code",
8009        "docsis_dccrsp.conf_code",
8010        FT_UINT8, BASE_DEC|BASE_EXT_STRING, &docsis_conf_code_ext, 0x0,
8011        NULL,
8012        HFILL
8013      }
8014     },
8015     {&hf_docsis_dccrsp_type,
8016      {
8017       "Type",
8018       "docsis_dccrsp.tlvtype",
8019       FT_UINT8, BASE_DEC, VALS(dccrsp_tlv_vals), 0x0,
8020       NULL,
8021       HFILL
8022      }
8023     },
8024     {&hf_docsis_dccrsp_length,
8025      {
8026       "Length",
8027       "docsis_dccrsp.tlvlen",
8028       FT_UINT8, BASE_DEC, NULL, 0x0,
8029       NULL,
8030       HFILL
8031      }
8032     },
8033     {&hf_docsis_dcc_cm_jump_subtype,
8034      {
8035       "Type",
8036       "docsis_dccrsp.cm_jump_tlvtype",
8037       FT_UINT8, BASE_DEC, VALS(cm_jump_subtlv_vals), 0x0,
8038       NULL,
8039       HFILL
8040      }
8041     },
8042     {&hf_docsis_dcc_cm_jump_length,
8043      {
8044       "Length",
8045       "docsis_dccrsp.cm_jump_tlvlen",
8046       FT_UINT8, BASE_DEC, NULL, 0x0,
8047       NULL,
8048       HFILL
8049      }
8050     },
8051     {&hf_docsis_dccrsp_cm_jump_time_length ,
8052      {
8053        "Length of Jump",
8054        "docsis_dccrsp.cm_jump_time_length",
8055        FT_UINT32, BASE_DEC, NULL, 0x0,
8056        NULL,
8057        HFILL
8058      }
8059     },
8060     {&hf_docsis_dccrsp_cm_jump_time_start ,
8061      {
8062        "Start Time of Jump",
8063        "docsis_dccrsp.cm_jump_time_start",
8064        FT_UINT64, BASE_DEC, NULL, 0x0,
8065        NULL,
8066        HFILL
8067      }
8068     },
8069     {&hf_docsis_dccrsp_key_seq_num ,
8070      {
8071        "Auth Key Sequence Number",
8072        "docsis_dccrsp.key_seq_num",
8073        FT_UINT8, BASE_DEC, NULL, 0x0,
8074        NULL,
8075        HFILL
8076      }
8077     },
8078     {&hf_docsis_dccrsp_hmac_digest ,
8079      {
8080        "HMAC-Digest Number",
8081        "docsis_dccrsp.hmac_digest",
8082        FT_BYTES, BASE_NONE, NULL, 0x0,
8083        NULL,
8084        HFILL
8085      }
8086     },
8087     /* DCC-ACK */
8088     {&hf_docsis_dccack_type,
8089      {
8090       "Type",
8091       "docsis_dccack.tlvtype",
8092       FT_UINT8, BASE_DEC, VALS(dccack_tlv_vals), 0x0,
8093       NULL,
8094       HFILL
8095      }
8096     },
8097     {&hf_docsis_dccack_length,
8098      {
8099       "Length",
8100       "docsis_dccack.tlvlen",
8101       FT_UINT8, BASE_DEC, NULL, 0x0,
8102       NULL,
8103       HFILL
8104      }
8105     },
8106     {&hf_docsis_dccack_key_seq_num ,
8107      {
8108        "Auth Key Sequence Number",
8109        "docsis_dccack.key_seq_num",
8110        FT_UINT8, BASE_DEC, NULL, 0x0,
8111        NULL,
8112        HFILL
8113      }
8114     },
8115     {&hf_docsis_dccack_hmac_digest ,
8116      {
8117        "HMAC-DigestNumber",
8118        "docsis_dccack.hmac_digest",
8119        FT_BYTES, BASE_NONE, NULL, 0x0,
8120        NULL,
8121        HFILL
8122      }
8123     },
8124     /* INIT_RNG_REQ */
8125     {&hf_docsis_intrngreq_sid,
8126      {"Service Identifier", "docsis_intrngreq.sid",
8127       FT_UINT16, BASE_DEC, NULL, 0x0,
8128       NULL, HFILL}
8129     },
8130     /* DCD */
8131     {&hf_docsis_dcd_config_ch_cnt,
8132      {
8133        "Configuration Change Count",
8134        "docsis_dcd.config_ch_cnt",
8135        FT_UINT8, BASE_DEC, NULL, 0x0,
8136        NULL,
8137        HFILL
8138      }
8139     },
8140     {&hf_docsis_dcd_num_of_frag,
8141      {
8142        "Number of Fragments",
8143        "docsis_dcd.num_of_frag",
8144        FT_UINT8, BASE_DEC, NULL, 0x0,
8145        NULL,
8146        HFILL
8147      }
8148     },
8149     {&hf_docsis_dcd_frag_sequence_num,
8150      {
8151        "Fragment Sequence Number",
8152        "docsis_dcd.frag_sequence_num",
8153        FT_UINT8, BASE_DEC, NULL, 0x0,
8154        NULL,
8155        HFILL
8156      }
8157     },
8158     {&hf_docsis_dcd_type,
8159      {
8160       "Type",
8161       "docsis_dcd.tlvtype",
8162       FT_UINT8, BASE_DEC, VALS(dcd_tlv_vals), 0x0,
8163       NULL,
8164       HFILL
8165      }
8166     },
8167     {&hf_docsis_dcd_length,
8168      {
8169       "Length",
8170       "docsis_dcd.tlvlen",
8171       FT_UINT8, BASE_DEC, NULL, 0x0,
8172       NULL,
8173       HFILL
8174      }
8175     },
8176     {&hf_docsis_dcd_down_classifier_subtype,
8177      {
8178       "Type",
8179       "docsis_dcd.down_classifier_tlvtype",
8180       FT_UINT8, BASE_DEC, VALS(dcd_down_classifier_vals), 0x0,
8181       NULL,
8182       HFILL
8183      }
8184     },
8185     {&hf_docsis_dcd_down_classifier_length,
8186      {
8187       "Length",
8188       "docsis_dcd.down_classifier_tlvlen",
8189       FT_UINT8, BASE_DEC, NULL, 0x0,
8190       NULL,
8191       HFILL
8192      }
8193     },
8194     {&hf_docsis_dcd_cfr_id,
8195      {
8196        "Downstream Classifier Id",
8197        "docsis_dcd.cfr_id",
8198        FT_UINT16, BASE_DEC, NULL, 0x0,
8199        NULL,
8200        HFILL
8201      }
8202     },
8203     {&hf_docsis_dcd_cfr_rule_pri,
8204      {
8205        "Downstream Classifier Rule Priority",
8206        "docsis_dcd.cfr_rule_pri",
8207        FT_UINT8, BASE_DEC, NULL, 0x0,
8208        NULL,
8209        HFILL
8210      }
8211     },
8212     {&hf_docsis_dcd_cfr_ip_subtype,
8213      {
8214       "Type",
8215       "docsis_dcd.cfr_ip_tlvtype",
8216       FT_UINT8, BASE_DEC, VALS(dcd_cfr_ip_vals), 0x0,
8217       NULL,
8218       HFILL
8219      }
8220     },
8221     {&hf_docsis_dcd_cfr_ip_length,
8222      {
8223       "Length",
8224       "docsis_dcd.cfr_ip_tlvlen",
8225       FT_UINT8, BASE_DEC, NULL, 0x0,
8226       NULL,
8227       HFILL
8228      }
8229     },
8230     {&hf_docsis_dcd_cfr_ip_source_addr,
8231      {
8232        "Downstream Classifier IP Source Address",
8233        "docsis_dcd.cfr_ip_source_addr",
8234        FT_IPv4, BASE_NONE, NULL, 0x0,
8235        NULL,
8236        HFILL
8237      }
8238     },
8239     {&hf_docsis_dcd_cfr_ip_source_mask,
8240      {
8241        "Downstream Classifier IP Source Mask",
8242        "docsis_dcd.cfr_ip_source_mask",
8243        FT_IPv4, BASE_NETMASK, NULL, 0x0,
8244        NULL,
8245        HFILL
8246      }
8247     },
8248     {&hf_docsis_dcd_cfr_ip_dest_addr,
8249      {
8250        "Downstream Classifier IP Destination Address",
8251        "docsis_dcd.cfr_ip_dest_addr",
8252        FT_IPv4, BASE_NONE, NULL, 0x0,
8253        NULL,
8254        HFILL
8255      }
8256     },
8257     {&hf_docsis_dcd_cfr_ip_dest_mask,
8258      {
8259        "Downstream Classifier IP Destination Mask",
8260        "docsis_dcd.cfr_ip_dest_mask",
8261        FT_IPv4, BASE_NETMASK, NULL, 0x0,
8262        "Downstream Classifier IP Destination Address",
8263        HFILL
8264      }
8265     },
8266     {&hf_docsis_dcd_cfr_tcpudp_srcport_start,
8267      {
8268        "Downstream Classifier IP TCP/UDP Source Port Start",
8269        "docsis_dcd.cfr_ip_tcpudp_srcport_start",
8270        FT_UINT16, BASE_DEC, NULL, 0x0,
8271        NULL,
8272        HFILL
8273      }
8274     },
8275     {&hf_docsis_dcd_cfr_tcpudp_srcport_end,
8276      {
8277        "Downstream Classifier IP TCP/UDP Source Port End",
8278        "docsis_dcd.cfr_ip_tcpudp_srcport_end",
8279        FT_UINT16, BASE_DEC, NULL, 0x0,
8280        NULL,
8281        HFILL
8282      }
8283     },
8284     {&hf_docsis_dcd_cfr_tcpudp_dstport_start,
8285      {
8286        "Downstream Classifier IP TCP/UDP Destination Port Start",
8287        "docsis_dcd.cfr_ip_tcpudp_dstport_start",
8288        FT_UINT16, BASE_DEC, NULL, 0x0,
8289        NULL,
8290        HFILL
8291      }
8292     },
8293     {&hf_docsis_dcd_cfr_tcpudp_dstport_end,
8294      {
8295        "Downstream Classifier IP TCP/UDP Destination Port End",
8296        "docsis_dcd.cfr_ip_tcpudp_dstport_end",
8297        FT_UINT16, BASE_DEC, NULL, 0x0,
8298        NULL,
8299        HFILL
8300      }
8301     },
8302     {&hf_docsis_dcd_rule_id,
8303      {
8304        "DSG Rule Id",
8305        "docsis_dcd.rule_id",
8306        FT_UINT8, BASE_DEC, NULL, 0x0,
8307        NULL,
8308        HFILL
8309      }
8310     },
8311     {&hf_docsis_dcd_rule_pri,
8312      {
8313        "DSG Rule Priority",
8314        "docsis_dcd.rule_pri",
8315        FT_UINT8, BASE_DEC, NULL, 0x0,
8316        NULL,
8317        HFILL
8318      }
8319     },
8320     {&hf_docsis_dcd_rule_ucid_list,
8321      {
8322        "DSG Rule UCID Range",
8323        "docsis_dcd.rule_ucid_list",
8324        FT_BYTES, BASE_NONE, NULL, 0x0,
8325        NULL,
8326        HFILL
8327      }
8328     },
8329     {&hf_docsis_dcd_clid_subtype,
8330      {
8331       "Type",
8332       "docsis_dcd.clid_tlvtype",
8333       FT_UINT8, BASE_DEC, VALS(dcd_clid_vals), 0x0,
8334       NULL,
8335       HFILL
8336      }
8337     },
8338     {&hf_docsis_dcd_clid_length,
8339      {
8340       "Length",
8341       "docsis_dcd.clid_tlvlen",
8342       FT_UINT8, BASE_DEC, NULL, 0x0,
8343       NULL,
8344       HFILL
8345      }
8346     },
8347     {&hf_docsis_dcd_clid_bcast_id,
8348      {
8349        "DSG Rule Client ID Broadcast ID",
8350        "docsis_dcd.clid_bcast_id",
8351        FT_UINT16, BASE_DEC, NULL, 0x0,
8352        NULL,
8353        HFILL
8354      }
8355     },
8356     {&hf_docsis_dcd_clid_known_mac_addr,
8357      {
8358        "DSG Rule Client ID Known MAC Address",
8359        "docsis_dcd.clid_known_mac_addr",
8360        FT_ETHER, BASE_NONE, NULL, 0x0,
8361        NULL,
8362        HFILL
8363      }
8364     },
8365     {&hf_docsis_dcd_clid_ca_sys_id,
8366      {
8367        "DSG Rule Client ID CA System ID",
8368        "docsis_dcd.clid_ca_sys_id",
8369        FT_UINT16, BASE_DEC, NULL, 0x0,
8370        NULL,
8371        HFILL
8372      }
8373     },
8374     {&hf_docsis_dcd_clid_app_id,
8375      {
8376        "DSG Rule Client ID Application ID",
8377        "docsis_dcd.clid_app_id",
8378        FT_UINT16, BASE_DEC, NULL, 0x0,
8379        NULL,
8380        HFILL
8381      }
8382     },
8383     {&hf_docsis_dcd_dsg_rule_subtype,
8384      {
8385       "Type",
8386       "docsis_dcd.rule_tlvtype",
8387       FT_UINT8, BASE_DEC, VALS(dcd_dsg_rule_vals), 0x0,
8388       NULL,
8389       HFILL
8390      }
8391     },
8392     {&hf_docsis_dcd_dsg_rule_length,
8393      {
8394       "Length",
8395       "docsis_dcd.rule_tlvlen",
8396       FT_UINT8, BASE_DEC, NULL, 0x0,
8397       NULL,
8398       HFILL
8399      }
8400     },
8401     {&hf_docsis_dcd_rule_tunl_addr,
8402      {
8403        "DSG Rule Tunnel MAC Address",
8404        "docsis_dcd.rule_tunl_addr",
8405        FT_ETHER, BASE_NONE, NULL, 0x0,
8406        NULL,
8407        HFILL
8408      }
8409     },
8410     {&hf_docsis_dcd_rule_cfr_id,
8411      {
8412        "DSG Rule Classifier ID",
8413        "docsis_dcd.rule_cfr_id",
8414        FT_UINT16, BASE_DEC, NULL, 0x0,
8415        NULL,
8416        HFILL
8417      }
8418     },
8419     {&hf_docsis_dcd_rule_vendor_spec,
8420      {
8421        "DSG Rule Vendor Specific Parameters",
8422        "docsis_dcd.rule_vendor_spec",
8423        FT_BYTES, BASE_NONE, NULL, 0x0,
8424        NULL,
8425        HFILL
8426      }
8427     },
8428     {&hf_docsis_dcd_cfg_subtype,
8429      {
8430       "Type",
8431       "docsis_dcd.cfg_tlvtype",
8432       FT_UINT8, BASE_DEC, VALS(dcd_cfg_vals), 0x0,
8433       NULL,
8434       HFILL
8435      }
8436     },
8437     {&hf_docsis_dcd_cfg_length,
8438      {
8439       "Length",
8440       "docsis_dcd.cfg_tlvlen",
8441       FT_UINT8, BASE_DEC, NULL, 0x0,
8442       NULL,
8443       HFILL
8444      }
8445     },
8446     {&hf_docsis_dcd_cfg_chan,
8447      {
8448        "DSG Configuration Channel",
8449        "docsis_dcd.cfg_chan",
8450        FT_UINT32, BASE_DEC, NULL, 0x0,
8451        NULL,
8452        HFILL
8453      }
8454     },
8455     {&hf_docsis_dcd_cfg_tdsg1,
8456      {
8457        "DSG Initialization Timeout (Tdsg1)",
8458        "docsis_dcd.cfg_tdsg1",
8459        FT_UINT16, BASE_DEC, NULL, 0x0,
8460        NULL,
8461        HFILL
8462      }
8463     },
8464     {&hf_docsis_dcd_cfg_tdsg2,
8465      {
8466        "DSG Operational Timeout (Tdsg2)",
8467        "docsis_dcd.cfg_tdsg2",
8468        FT_UINT16, BASE_DEC, NULL, 0x0,
8469        NULL,
8470        HFILL
8471      }
8472     },
8473     {&hf_docsis_dcd_cfg_tdsg3,
8474      {
8475        "DSG Two-Way Retry Timer (Tdsg3)",
8476        "docsis_dcd.cfg_tdsg3",
8477        FT_UINT16, BASE_DEC, NULL, 0x0,
8478        NULL,
8479        HFILL
8480      }
8481     },
8482     {&hf_docsis_dcd_cfg_tdsg4,
8483      {
8484        "DSG One-Way Retry Timer (Tdsg4)",
8485        "docsis_dcd.cfg_tdsg4",
8486        FT_UINT16, BASE_DEC, NULL, 0x0,
8487        NULL,
8488        HFILL
8489      }
8490     },
8491     {&hf_docsis_dcd_cfg_vendor_spec,
8492      {
8493        "DSG Configuration Vendor Specific Parameters",
8494        "docsis_dcd.cfg_vendor_spec",
8495        FT_BYTES, BASE_NONE, NULL, 0x0,
8496        NULL,
8497        HFILL
8498      }
8499     },
8500     /* MDD */
8501     {&hf_docsis_mdd_ccc,
8502      {"Configuration Change Count", "docsis_mdd.ccc",
8503       FT_UINT8, BASE_DEC, NULL, 0x0,
8504       "Mdd Configuration Change Count", HFILL}
8505     },
8506     {&hf_docsis_mdd_number_of_fragments,
8507      {"Number of Fragments", "docsis_mdd.number_of_fragments",
8508       FT_UINT8, BASE_DEC, NULL, 0x0,
8509       "Mdd Number of Fragments", HFILL}
8510     },
8511     {&hf_docsis_mdd_fragment_sequence_number,
8512      {"Fragment Sequence Number", "docsis_mdd.fragment_sequence_number",
8513       FT_UINT8, BASE_DEC, NULL, 0x0,
8514       "Mdd Fragment Sequence Number", HFILL}
8515     },
8516     {&hf_docsis_mdd_current_channel_dcid,
8517      {"Current Channel DCID", "docsis_mdd.current_channel_dcid",
8518       FT_UINT8, BASE_DEC, NULL, 0x0,
8519       "Mdd Current Channel DCID", HFILL}
8520     },
8521     {&hf_docsis_mdd_ds_active_channel_list_subtype,
8522      {"Type", "docsis_mdd.downstream_active_channel_list_tlvtype",
8523       FT_UINT8, BASE_DEC, VALS(mdd_ds_active_channel_list_vals), 0x0,
8524       NULL, HFILL}
8525     },
8526     {&hf_docsis_mdd_ds_active_channel_list_length,
8527      {"Length", "docsis_mdd.downstream_active_channel_list_tlvlen",
8528       FT_UINT8, BASE_DEC, NULL, 0x0,
8529       NULL, HFILL}
8530     },
8531     {&hf_docsis_mdd_downstream_active_channel_list_channel_id,
8532      {"Channel ID", "docsis_mdd.downstream_active_channel_list_channel_id",
8533       FT_UINT8, BASE_DEC, NULL, 0x0,
8534       "Mdd Downstream Active Channel List Channel ID", HFILL}
8535     },
8536     {&hf_docsis_mdd_downstream_active_channel_list_frequency,
8537      {"Frequency", "docsis_mdd.downstream_active_channel_list_frequency",
8538       FT_UINT32, BASE_DEC, NULL, 0x0,
8539       "Mdd Downstream Active Channel List Frequency", HFILL}
8540     },
8541     {&hf_docsis_mdd_downstream_active_channel_list_annex,
8542      {"Annex", "docsis_mdd.downstream_active_channel_list_annex",
8543       FT_UINT8, BASE_DEC, VALS(J83_annex_vals), 0xF0,
8544       "Mdd Downstream Active Channel List Annex", HFILL}
8545     },
8546     {&hf_docsis_mdd_downstream_active_channel_list_modulation_order,
8547      {"Modulation Order", "docsis_mdd.downstream_active_channel_list_modulation_order",
8548       FT_UINT8, BASE_DEC, VALS(modulation_order_vals), 0x0F,
8549       "Mdd Downstream Active Channel List Modulation Order", HFILL}
8550     },
8551     {&hf_docsis_mdd_downstream_active_channel_list_primary_capable,
8552      {"Primary Capable", "docsis_mdd.downstream_active_channel_list_primary_capable",
8553       FT_UINT8, BASE_DEC, VALS(primary_capable_vals), 0x0,
8554       "Mdd Downstream Active Channel List Primary Capable", HFILL}
8555     },
8556     {&hf_docsis_mdd_cm_status_event_enable_bitmask,
8557      {"CM-STATUS Event Enable Bitmask", "docsis_mdd.cm_status_event_enable_bitmask",
8558       FT_UINT16, BASE_HEX, NULL, 0x0,
8559       NULL, HFILL}
8560     },
8561     {&hf_docsis_mdd_cm_status_event_enable_bitmask_mdd_timeout,
8562      {"MDD Timeout", "docsis_mdd.downstream_active_channel_list_mdd_timeout",
8563       FT_UINT16, BASE_DEC, NULL, 0x0002,
8564       "Mdd Downstream Active Channel List MDD Timeout", HFILL}
8565     },
8566     {&hf_docsis_mdd_cm_status_event_enable_bitmask_qam_fec_lock_failure,
8567      {"QAM/FEC Lock Failure", "docsis_mdd.cm_status_event_enable_bitmask_qam_fec_lock_failure",
8568       FT_UINT16, BASE_DEC, NULL, 0x0004,
8569       "Mdd Downstream Active Channel List QAM/FEC Lock Failure", HFILL}
8570     },
8571     {&hf_docsis_mdd_cm_status_event_enable_bitmask_mdd_recovery,
8572      {"MDD Recovery", "docsis_mdd.cm_status_event_enable_bitmask_mdd_recovery",
8573       FT_UINT16, BASE_DEC, NULL, 0x0010,
8574       "CM-STATUS event MDD Recovery", HFILL}
8575     },
8576     {&hf_docsis_mdd_cm_status_event_enable_bitmask_qam_fec_lock_recovery,
8577      {"QAM/FEC Lock Recovery", "docsis_mdd.cm_status_event_enable_bitmask_qam_fec_lock_recovery",
8578       FT_UINT16, BASE_DEC, NULL, 0x0020,
8579       "CM-STATUS event QAM/FEC Lock Recovery", HFILL}
8580     },
8581     {&hf_docsis_mdd_downstream_active_channel_list_map_ucd_transport_indicator,
8582      {"MAP and UCD transport indicator", "docsis_mdd.downstream_active_channel_list_map_ucd_transport_indicator",
8583       FT_UINT8, BASE_DEC, VALS(map_ucd_transport_indicator_vals), 0x0,
8584       "Mdd Downstream Active Channel List MAP and UCD Transport Indicator", HFILL}
8585     },
8586     {&hf_docsis_mdd_ofdm_plc_parameters,
8587      {"OFDM PLC Parameters", "docsis_mdd.ofdm_plc_parameters",
8588       FT_UINT8, BASE_HEX, NULL, 0x0,
8589       NULL, HFILL}
8590     },
8591     {&hf_docsis_mdd_ofdm_plc_parameters_tukey_raised_cosine_window,
8592      {"Tukey raised cosine window", "docsis_mdd.ofdm_plc_parameters_tukey_raised_cosine_window",
8593       FT_UINT8, BASE_DEC, VALS(tukey_raised_cosine_vals), 0x07,
8594       "OFDM PLC Parameters Tukey raised cosine window", HFILL}
8595     },
8596     {&hf_docsis_mdd_ofdm_plc_parameters_cyclic_prefix,
8597      {"Cyclic prefix", "docsis_mdd.ofdm_plc_parameters_cyclic_prefix",
8598       FT_UINT8, BASE_DEC, VALS(cyclic_prefix_vals), 0x38,
8599       "OFDM PLC parameters Cyclic prefix", HFILL}
8600     },
8601     {&hf_docsis_mdd_ofdm_plc_parameters_sub_carrier_spacing,
8602      {"Sub carrier spacing", "docsis_mdd.ofdm_plc_parameters_sub_carrier_spacing",
8603       FT_UINT8, BASE_DEC, VALS(spacing_vals), 0x40,
8604       "OFDM PLC parameters Sub carrier spacing", HFILL}
8605     },
8606     {&hf_docsis_mdd_up_active_channel_list_subtype,
8607      {"Type", "docsis_mdd.up_active_channel_list_tlvtype",
8608       FT_UINT8, BASE_DEC, VALS(mdd_up_active_channel_list_vals), 0x0,
8609       NULL, HFILL}
8610     },
8611     {&hf_docsis_mdd_up_active_channel_list_length,
8612      {"Length", "docsis_mdd.up_active_channel_list_tlvlen",
8613       FT_UINT8, BASE_DEC, NULL, 0x0,
8614       NULL, HFILL}
8615     },
8616     {&hf_docsis_mdd_cm_status_event_enable_bitmask_t4_timeout,
8617      {"T4 timeout", "docsis_mdd.cm_status_event_enable_bitmask_t4_timeout",
8618       FT_UINT16, BASE_DEC, NULL, 0x0040,
8619       "CM-STATUS event T4 timeout", HFILL}
8620     },
8621     {&hf_docsis_mdd_cm_status_event_enable_bitmask_t3_retries_exceeded,
8622      {"T3 Retries Exceeded", "docsis_mdd.cm_status_event_enable_bitmask_t3_retries_exceeded",
8623       FT_UINT16, BASE_DEC, NULL, 0x0080,
8624       "CM-STATUS event T3 Retries Exceeded", HFILL}
8625     },
8626     {&hf_docsis_mdd_cm_status_event_enable_bitmask_successful_ranging_after_t3_retries_exceeded,
8627      {"Successful Ranging after T3 Retries Exceeded", "docsis_mdd.cm_status_event_enable_bitmask_successful_ranging_after_t3_retries_exceeded",
8628       FT_UINT16, BASE_DEC, NULL, 0x0100,
8629       "CM-STATUS event Successful Ranging after T3 Retries Exceeded", HFILL}
8630     },
8631     {&hf_docsis_mdd_mac_domain_downstream_service_group_channel_id,
8632      {"Channel Id", "docsis_mdd.mac_domain_downstream_service_group_channel_id",
8633       FT_UINT8, BASE_DEC, NULL, 0x0,
8634       "Mdd Mac Domain Downstream Service Group Channel Id", HFILL}
8635     },
8636     {&hf_docsis_mdd_ds_service_group_subtype,
8637      {"Type", "docsis_mdd.ds_service_group_type",
8638       FT_UINT8, BASE_DEC, VALS(mdd_ds_service_group_vals), 0x0,
8639       NULL, HFILL}
8640     },
8641     {&hf_docsis_mdd_ds_service_group_length,
8642      {"Length", "docsis_mdd.ds_service_group_length",
8643       FT_UINT8, BASE_DEC, NULL, 0x0,
8644       NULL, HFILL}
8645     },
8646     {&hf_docsis_mdd_mac_domain_downstream_service_group_md_ds_sg_identifier,
8647      {"MD-DS-SG Identifier", "docsis_mdd.mac_domain_downstream_service_group_md_ds_sg_identifier",
8648       FT_UINT8, BASE_DEC, NULL, 0x0,
8649       "Mdd Mac Domain Downstream Service Group MD-DS-SG Identifier", HFILL}
8650     },
8651     {&hf_docsis_mdd_type,
8652      {"Type", "docsis_mdd.type",
8653       FT_UINT8, BASE_DEC, VALS(mdd_tlv_vals), 0x0,
8654       NULL, HFILL}
8655     },
8656     {&hf_docsis_mdd_length,
8657      {"Length", "docsis_mdd.length",
8658       FT_UINT8, BASE_DEC, NULL, 0x0,
8659       NULL, HFILL}
8660     },
8661     {&hf_docsis_mdd_downstream_ambiguity_resolution_frequency,
8662      {"Frequency", "docsis_mdd.downstream_ambiguity_resolution_frequency",
8663       FT_UINT32, BASE_DEC, NULL, 0x0,
8664       "Mdd Downstream Ambiguity Resolution frequency", HFILL}
8665     },
8666     {&hf_docsis_mdd_channel_profile_reporting_control_subtype,
8667      {"Type", "docsis_mdd.channel_profile_reporting_control_type",
8668       FT_UINT8, BASE_DEC, VALS(mdd_channel_profile_reporting_control_vals), 0x0,
8669       NULL, HFILL}
8670     },
8671     {&hf_docsis_mdd_channel_profile_reporting_control_length,
8672      {"Length", "docsis_mdd.channel_profile_reporting_control_length",
8673       FT_UINT8, BASE_DEC, NULL, 0x0,
8674       NULL, HFILL}
8675     },
8676     {&hf_docsis_mdd_rpc_center_frequency_spacing,
8677      {"RPC Center Frequency Spacing", "docsis_mdd.rpc_center_frequency_spacing",
8678       FT_UINT8, BASE_DEC, VALS(rpc_center_frequency_spacing_vals), 0x0,
8679       "Mdd RPC Center Frequency Spacing", HFILL}
8680     },
8681     {&hf_docsis_mdd_verbose_rcp_reporting,
8682      {"Verbose RCP reporting", "docsis_mdd.verbose_rpc_reporting",
8683       FT_UINT8, BASE_DEC, VALS(verbose_rpc_reporting_vals), 0x0,
8684       "Mdd Verbose RPC Reporting", HFILL}
8685     },
8686     {&hf_docsis_mdd_ip_init_param_subtype,
8687      {"Type", "docsis_mdd.ip_init_param_type",
8688       FT_UINT8, BASE_DEC, VALS(mdd_ip_init_param_vals), 0x0,
8689       NULL, HFILL}
8690     },
8691     {&hf_docsis_mdd_ip_init_param_length,
8692      {"Length", "docsis_mdd.ip_init_param_length",
8693       FT_UINT8, BASE_DEC, NULL, 0x0,
8694       NULL, HFILL}
8695     },
8696     {&hf_docsis_mdd_ip_provisioning_mode,
8697      {"IP Provisioning Mode", "docsis_mdd.ip_provisioning_mode",
8698       FT_UINT8, BASE_DEC, VALS(ip_provisioning_mode_vals), 0x0,
8699       "Mdd IP Provisioning Mode", HFILL}
8700     },
8701     {&hf_docsis_mdd_pre_registration_dsid,
8702      {"Pre-registration DSID", "docsis_mdd.pre_registration_dsid",
8703       FT_UINT24, BASE_DEC, NULL, 0x0FFFFF,
8704       "Mdd Pre-registration DSID", HFILL}
8705     },
8706     {&hf_docsis_mdd_early_authentication_and_encryption,
8707      {"Early Authentication and Encryption", "docsis_mdd.early_authentication_and_encryption",
8708       FT_UINT8, BASE_DEC, VALS(eae_vals), 0x0,
8709       "Mdd Early Authentication and Encryption", HFILL}
8710     },
8711     {&hf_docsis_mdd_upstream_active_channel_list_upstream_channel_id,
8712      {"Upstream Channel Id", "docsis_mdd.upstream_active_channel_list_upstream_channel_id",
8713       FT_UINT8, BASE_DEC, NULL, 0x0,
8714       "Mdd Upstream Active Channel List Upstream Channel Id", HFILL}
8715     },
8716     {&hf_docsis_mdd_upstream_ambiguity_resolution_channel_list_channel_id,
8717      {"Channel Id", "docsis_mdd.upstream_ambiguity_resolution_channel_list_channel_id",
8718       FT_UINT8, BASE_DEC, NULL, 0x0,
8719       "Mdd Mac Domain Upstream Ambiguity Resolution Channel List Channel Id", HFILL}
8720     },
8721     {&hf_docsis_mdd_upstream_frequency_range,
8722      {"Upstream Frequency Range", "docsis_mdd.upstream_frequency_range",
8723       FT_UINT8, BASE_DEC, VALS(upstream_frequency_range_vals), 0x0,
8724       "Mdd Upstream Frequency Range", HFILL}
8725     },
8726     {&hf_docsis_mdd_symbol_clock_locking_indicator,
8727      {"Symbol Clock Locking Indicator", "docsis_mdd.symbol_clock_locking_indicator",
8728       FT_UINT8, BASE_DEC, VALS(symbol_clock_locking_indicator_vals), 0x0,
8729       "Mdd Symbol Clock Locking Indicator", HFILL}
8730     },
8731     {&hf_docsis_mdd_cm_status_event_control_subtype,
8732      {"Type", "docsis_mdd.cm_status_event_control_type",
8733       FT_UINT8, BASE_DEC, VALS(mdd_cm_status_event_control_vals), 0x0,
8734       NULL, HFILL}
8735     },
8736     {&hf_docsis_mdd_cm_status_event_control_length,
8737      {"Length", "docsis_mdd.cm_status_event_control_length",
8738       FT_UINT8, BASE_DEC, NULL, 0x0,
8739       NULL, HFILL}
8740     },
8741     {&hf_docsis_mdd_event_type,
8742      {"Event Type", "docsis_mdd.event_type",
8743       FT_UINT8, BASE_DEC, VALS(symbol_cm_status_event_vals), 0x0,
8744       "Mdd CM-STATUS Event Type", HFILL}
8745     },
8746     {&hf_docsis_mdd_maximum_event_holdoff_timer,
8747      {"Maximum Event Holdoff Timer (units of 20 ms)", "docsis_mdd.maximum_event_holdoff_timer",
8748       FT_UINT16, BASE_DEC, NULL, 0x0,
8749       "Mdd Maximum Event Holdoff Timer", HFILL}
8750     },
8751     {&hf_docsis_mdd_maximum_number_of_reports_per_event,
8752      {"Maximum Number of Reports per Event", "docsis_mdd.maximum_number_of_reports_per_event",
8753       FT_UINT8, BASE_DEC|BASE_SPECIAL_VALS, VALS(unique_unlimited), 0x0,
8754       "Mdd Maximum Number of Reports per Event", HFILL}
8755     },
8756     {&hf_docsis_mdd_upstream_transmit_power_reporting,
8757      {"Upstream Transmit Power Reporting", "docsis_mdd.upstream_transmit_power_reporting",
8758       FT_UINT8, BASE_DEC, VALS(upstream_transmit_power_reporting_vals), 0x0,
8759       "Mdd Upstream Transmit Power Reporting", HFILL}
8760     },
8761     {&hf_docsis_mdd_dsg_da_to_dsid_subtype,
8762      {"Type", "docsis_mdd.dsg_da_to_dsid_type",
8763       FT_UINT8, BASE_DEC, VALS(mdd_cm_dsg_da_to_dsid_vals), 0x0,
8764       NULL, HFILL}
8765     },
8766     {&hf_docsis_mdd_dsg_da_to_dsid_length,
8767      {"Length", "docsis_mdd.dsg_da_to_dsid_length",
8768       FT_UINT8, BASE_DEC, NULL, 0x0,
8769       NULL, HFILL}
8770     },
8771     {&hf_docsis_mdd_dsg_da_to_dsid_association_da,
8772      {"Destination Address", "docsis_mdd.dsg_da_to_dsid_association_da",
8773       FT_ETHER, BASE_NONE, NULL, 0x0,
8774       "Mdd DSG DA to DSID association Destination Address", HFILL}
8775     },
8776     {&hf_docsis_mdd_dsg_da_to_dsid_association_dsid,
8777      {"DSID", "docsis_mdd.dsg_da_to_dsid_association_dsid",
8778       FT_UINT24, BASE_DEC, NULL, 0x0FFFFF,
8779       "Mdd Mdd DSG DA to DSID association DSID", HFILL}
8780     },
8781     {&hf_docsis_mdd_cm_status_event_enable_non_channel_specific_events,
8782      {"CM-STATUS Event Enable Bitmask for Non-Channel-Specific Events", "docsis_mdd.cm_status_event_enable_non_channel_specific_events",
8783       FT_UINT16, BASE_HEX, NULL, 0x0,
8784       NULL, HFILL}
8785     },
8786     {&hf_docsis_mdd_cm_status_event_enable_non_channel_specific_events_sequence_out_of_range,
8787      {"Sequence out of range", "docsis_mdd.cm_status_event_enable_non_channel_specific_events_sequence_out_of_range",
8788       FT_UINT16, BASE_DEC, NULL, 0x0008,
8789       "CM-STATUS event non-channel-event Sequence out of range", HFILL}
8790     },
8791     {&hf_docsis_mdd_cm_status_event_enable_non_channel_specific_events_cm_operating_on_battery_backup,
8792      {"CM operating on battery backup", "docsis_mdd.cm_status_event_enable_non_channel_specific_events_cm_operating_on_battery_backup",
8793       FT_UINT16, BASE_DEC, NULL, 0x0200,
8794       "CM-STATUS event non-channel-event Cm operating on battery backup", HFILL}
8795     },
8796     {&hf_docsis_mdd_cm_status_event_enable_non_channel_specific_events_cm_returned_to_ac_power,
8797      {"Returned to AC power", "docsis_mdd.cm_status_event_enable_non_channel_specific_events_cm_returned_to_ac_power",
8798       FT_UINT16, BASE_DEC, NULL, 0x0400,
8799       "CM-STATUS event non-channel-event Cm returned to AC power", HFILL}
8800     },
8801     {&hf_docsis_mdd_extended_upstream_transmit_power_support,
8802      { "Extended Upstream Transmit Power Support", "docsis_mdd.extended_upstream_transmit_power_support",
8803        FT_BOOLEAN, BASE_NONE, TFS(&mdd_tfs_on_off), 0x0,
8804        "Mdd Extended Upstream Transmit Power Support", HFILL}
8805     },
8806     {&hf_docsis_mdd_cmts_major_docsis_version,
8807      { "CMTS Major DOCSIS Version", "docsis_mdd.cmts_major_docsis_version",
8808        FT_UINT8, BASE_DEC, NULL, 0x0,
8809        NULL, HFILL}
8810     },
8811     {&hf_docsis_mdd_cmts_minor_docsis_version,
8812      { "CMTS Minor DOCSIS Version", "docsis_mdd.cmts_minor_docsis_version",
8813        FT_UINT8, BASE_DEC, NULL, 0x0,
8814        NULL, HFILL}
8815     },
8816     {&hf_docsis_mdd_cm_periodic_maintenance_timeout_indicator,
8817      { "CM periodic maintenance timeout indicator", "docsis_mdd.cm_periodic_maintenance_timeout_indicator",
8818        FT_UINT8, BASE_DEC, VALS(cm_periodic_maintenance_timeout_indicator_vals), 0x0,
8819        NULL, HFILL}
8820     },
8821     {&hf_docsis_mdd_dls_broadcast_and_multicast_delivery_method,
8822      { "DLS Broadcast and Multicast Delivery Method", "docsis_mdd.dls_broadcast_and_multicast_delivery_method",
8823        FT_UINT8, BASE_DEC, VALS(dls_broadcast_and_multicast_delivery_method_vals), 0x0,
8824        NULL, HFILL}
8825     },
8826     {&hf_docsis_mdd_cm_status_event_d31_ofdm_prof_fail,
8827      { "Downstream OFDM Profile Failure", "docsis_mdd.cm_status_event_d31_ofdm_prof_fail",
8828        FT_BOOLEAN, 32, TFS(&mdd_tfs_en_dis), 0x01,
8829        NULL, HFILL}
8830     },
8831     {&hf_docsis_mdd_cm_status_event_d31_prim_down_chan_change,
8832      { "Primary Downstream Channel Change", "docsis_mdd.cm_status_event_d31_prim_down_chan_change",
8833        FT_BOOLEAN, 32, TFS(&mdd_tfs_en_dis), 0x02,
8834        NULL, HFILL}
8835     },
8836     {&hf_docsis_mdd_cm_status_event_d31_dpd_mismatch,
8837      { "DPD Mismatch", "docsis_mdd.cm_status_event_d31_dpd_mismatch",
8838        FT_BOOLEAN, 32, TFS(&mdd_tfs_en_dis), 0x04,
8839        NULL, HFILL}
8840     },
8841     {&hf_docsis_mdd_cm_status_event_d31_deprecated,
8842      { "Deprecated", "docsis_mdd.cm_status_event_d31_deprecated",
8843        FT_BOOLEAN, 32, TFS(&mdd_tfs_en_dis), 0x08,
8844        NULL, HFILL}
8845     },
8846     {&hf_docsis_mdd_cm_status_event_d31_ncp_prof_fail,
8847      { "NCP Profile Failure", "docsis_mdd.cm_status_event_d31_ncp_prof_fail",
8848        FT_BOOLEAN, 32, TFS(&mdd_tfs_en_dis), 0x10,
8849        NULL, HFILL}
8850     },
8851     {&hf_docsis_mdd_cm_status_event_d31_loss_fec_plc,
8852      { "Loss of FEC lock on PLC", "docsis_mdd.cm_status_event_d31_loss_fec_plc",
8853        FT_BOOLEAN, 32, TFS(&mdd_tfs_en_dis), 0x20,
8854        NULL, HFILL}
8855     },
8856     {&hf_docsis_mdd_cm_status_event_d31_ncp_prof_recover,
8857      { "NCP Profile Recovery", "docsis_mdd.cm_status_event_d31_ncp_prof_recover",
8858        FT_BOOLEAN, 32, TFS(&mdd_tfs_en_dis), 0x40,
8859        NULL, HFILL}
8860     },
8861     {&hf_docsis_mdd_cm_status_event_d31_fec_recover_on_plc,
8862      { "FEC Recovery on PLC", "docsis_mdd.cm_status_event_d31_fec_recover_on_plc",
8863        FT_BOOLEAN, 32, TFS(&mdd_tfs_en_dis), 0x80,
8864        NULL, HFILL}
8865     },
8866     {&hf_docsis_mdd_cm_status_event_d31_fec_recover_on_ofdm_prof,
8867      { "FEC Recovery on OFDM Profile", "docsis_mdd.cm_status_event_d31_fec_recover_on_ofdm_prof",
8868        FT_BOOLEAN, 32, TFS(&mdd_tfs_en_dis), 0x0100,
8869        NULL, HFILL}
8870     },
8871     {&hf_docsis_mdd_cm_status_event_d31_ofdma_prof_fail,
8872      { "OFDMA Profile Failure", "docsis_mdd.cm_status_event_d31_ofdma_prof_fail",
8873        FT_BOOLEAN, 32, TFS(&mdd_tfs_en_dis), 0x0200,
8874        NULL, HFILL}
8875     },
8876     {&hf_docsis_mdd_cm_status_event_d31_map_stor_overflow_ind,
8877      { "MAP Storage Overflow Indicator", "docsis_mdd.cm_status_event_d31_map_stor_overflow_ind",
8878        FT_BOOLEAN, 32, TFS(&mdd_tfs_en_dis), 0x0400,
8879        NULL, HFILL}
8880     },
8881     {&hf_docsis_mdd_cm_status_event_d31_ofdm_map_stor_almost_full_ind,
8882      { "MAP Storage Almost Full Indicator", "docsis_mdd.cm_status_event_d31_ofdm_map_stor_almost_full_ind",
8883        FT_BOOLEAN, 32, TFS(&mdd_tfs_en_dis), 0x0800,
8884        NULL, HFILL}
8885     },
8886     {&hf_docsis_mdd_cm_status_event_d31_reserved,
8887      { "Reserved for future use", "docsis_mdd.cm_status_event_d31_reserved",
8888        FT_UINT32, BASE_HEX, NULL, 0xFFFFF000,
8889        NULL, HFILL}
8890     },
8891     {&hf_docsis_mdd_diplexer_band_edge,
8892      { "Diplexer Band Edge", "docsis_mdd.diplexer_band_edge",
8893        FT_UINT8, BASE_DEC, VALS(mdd_diplexer_band_edge_vals), 0x0,
8894        NULL, HFILL}
8895     },
8896     {&hf_docsis_mdd_diplexer_band_edge_length,
8897      {"Length", "docsis_mdd.diplexer_band_edge_length",
8898       FT_UINT8, BASE_DEC, NULL, 0x0,
8899       NULL, HFILL}
8900     },
8901     {&hf_docsis_mdd_diplexer_us_upper_band_edge,
8902      {"Diplexer Upstream Upper Band Edge", "docsis_mdd.diplexer_us_upper_band_edge",
8903       FT_UINT8, BASE_DEC, VALS(mdd_diplexer_us_upper_band_edge_vals), 0x0,
8904       NULL, HFILL}
8905     },
8906     {&hf_docsis_mdd_diplexer_ds_lower_band_edge,
8907      {"Diplexer Downstream Lower Band Edge", "docsis_mdd.diplexer_ds_lower_band_edge",
8908       FT_UINT8, BASE_DEC, VALS(mdd_diplexer_ds_lower_band_edge_vals), 0x0,
8909       NULL, HFILL}
8910     },
8911     {&hf_docsis_mdd_diplexer_ds_upper_band_edge,
8912      {"Diplexer Downstream Upper Band Edge", "docsis_mdd.diplexer_ds_upper_band_edge",
8913       FT_UINT8, BASE_DEC, VALS(mdd_diplexer_ds_upper_band_edge_vals), 0x0,
8914       NULL, HFILL}
8915     },
8916     {&hf_docsis_mdd_full_duplex_descriptor,
8917      {"Full Duplex Descriptor", "docsis_mdd.full_duplex_descriptor",
8918       FT_UINT8, BASE_DEC, VALS(mdd_full_duplex_descriptor_vals), 0x0,
8919       NULL, HFILL}
8920     },
8921     {&hf_docsis_mdd_full_duplex_descriptor_length,
8922      {"Length", "docsis_mdd.full_duplex_descriptor_length",
8923       FT_UINT8, BASE_DEC, NULL, 0x0,
8924       NULL, HFILL}
8925     },
8926     {&hf_docsis_mdd_full_duplex_allocated_spectrum,
8927      {"Full Duplex Allocated Spectrum", "docsis_mdd.full_duplex_full_allocated_spectrum",
8928       FT_UINT8, BASE_DEC, VALS(mdd_full_duplex_allocated_spectrum_vals), 0x0,
8929       NULL, HFILL}
8930     },
8931     {&hf_docsis_mdd_full_duplex_total_number_of_sub_bands,
8932      {"Total number of sub-bands", "docsis_mdd.full_duplex_total_number_of_sub_bands",
8933       FT_UINT8, BASE_DEC, NULL, 0x0,
8934       NULL, HFILL}
8935     },
8936     {&hf_docsis_mdd_full_duplex_sub_band_width,
8937      {"Full Duplex Sub-band Width", "docsis_mdd.full_duplex_sub_band_width",
8938       FT_UINT8, BASE_DEC, VALS(mdd_full_duplex_sub_band_width_vals), 0x0,
8939       NULL, HFILL}
8940     },
8941     {&hf_docsis_mdd_full_duplex_sub_band_descriptor,
8942      {"Full Duplex Sub-band Descriptor", "docsis_mdd.full_duplex_sub_band_descriptor",
8943       FT_UINT8, BASE_DEC, VALS(mdd_full_duplex_sub_band_vals), 0x0,
8944       NULL, HFILL}
8945     },
8946     {&hf_docsis_mdd_full_duplex_sub_band_descriptor_length,
8947      {"Length", "docsis_mdd.full_duplex_sub_band_descriptor_length",
8948       FT_UINT8, BASE_DEC, NULL, 0x0,
8949       NULL, HFILL}
8950     },
8951     {&hf_docsis_mdd_full_duplex_sub_band_id,
8952      {"Full Duplex Sub-band ID", "docsis_mdd.full_duplex_sub_band_id",
8953       FT_UINT8, BASE_DEC, NULL, 0x0,
8954       NULL, HFILL}
8955     },
8956     {&hf_docsis_mdd_full_duplex_sub_band_offset,
8957      {"Full Duplex Sub-band ID", "docsis_mdd.full_duplex_sub_band_offset",
8958       FT_UINT16, BASE_DEC, NULL, 0x0,
8959       NULL, HFILL}
8960     },
8961
8962     /* B_INIT_RNG_REQ */
8963     {&hf_docsis_bintrngreq_capflags,
8964      {"Capability Flags", "docsis_bintrngreq.capflags",
8965       FT_UINT8, BASE_HEX, NULL, 0x0,
8966       NULL, HFILL}
8967     },
8968     {&hf_docsis_bintrngreq_capflags_frag,
8969      {"Pre-3.0 Fragmentation", "docsis_bintrngreq.capflags.frag",
8970       FT_BOOLEAN, 8, NULL, (1<<7),
8971       "Pre-3.0 DOCSIS fragmentation is supported prior to registration", HFILL }
8972     },
8973     {&hf_docsis_bintrngreq_capflags_encrypt,
8974      {"Early Auth. & Encrypt", "docsis_bintrngreq.capflags.encrypt",
8975       FT_BOOLEAN, 8, NULL, (1<<6),
8976       "Early Authentication and Encryption supported", HFILL }
8977     },
8978     {&hf_docsis_bintrngreq_mddsgid,
8979      {"MD-DS-SG-ID", "docsis_bintrngreq.mddsgid",
8980       FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8981       "MAC Domain Downstream Service Group Identifier", HFILL}
8982     },
8983     /* DBC_REQ */
8984     {&hf_docsis_dbcreq_number_of_fragments,
8985      {"Number of Fragments", "docsis_dbcreq.number_of_fragments",
8986       FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8987       NULL, HFILL}
8988     },
8989     {&hf_docsis_dbcreq_fragment_sequence_number,
8990      {"Fragment Seq No", "docsis_dbcreq.fragment_sequence_number",
8991       FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8992       NULL, HFILL}
8993     },
8994     /* DBC_RSP */
8995     {&hf_docsis_dbcrsp_conf_code,
8996      {"Confirmation Code", "docsis_dbcrsp.conf_code",
8997       FT_UINT8, BASE_DEC|BASE_EXT_STRING, &docsis_conf_code_ext, 0x0,
8998       NULL, HFILL}
8999     },
9000     /* DPV_REQ/RSP */
9001     {&hf_docsis_dpv_flags,
9002      {"Flags", "docsis_dpv.flags",
9003       FT_UINT8, BASE_DEC, NULL, 0x0,
9004       NULL, HFILL}
9005     },
9006     {&hf_docsis_dpv_us_sf,
9007      {"Upstream Service Flow ID", "docsis_dpv.us_sf",
9008       FT_UINT32, BASE_DEC, NULL, 0x0,
9009       NULL, HFILL}
9010     },
9011     {&hf_docsis_dpv_n,
9012      {"N (Measurement avaraging factor)", "docsis_dpv.n",
9013       FT_UINT16, BASE_DEC, NULL, 0x0,
9014       NULL, HFILL}
9015     },
9016     {&hf_docsis_dpv_start,
9017      {"Start Reference Point", "docsis_dpv.start",
9018       FT_UINT8, BASE_DEC, NULL, 0x0,
9019       NULL, HFILL}
9020     },
9021     {&hf_docsis_dpv_end,
9022      {"End Reference Point", "docsis_dpv.end",
9023       FT_UINT8, BASE_DEC, NULL, 0x0,
9024       NULL, HFILL}
9025     },
9026     {&hf_docsis_dpv_ts_start,
9027      {"Timestamp Start", "docsis_dpv.ts_start",
9028       FT_UINT32, BASE_DEC, NULL, 0x0,
9029       NULL, HFILL}
9030     },
9031     {&hf_docsis_dpv_ts_end,
9032      {"Timestamp End", "docsis_dpv.ts_end",
9033       FT_UINT32, BASE_DEC, NULL, 0x0,
9034       NULL, HFILL}
9035     },
9036     /* CM Status */
9037     {&hf_docsis_cmstatus_e_t_mdd_t,
9038      {"Secondary Channel MDD timeout", "docsis_cmstatus.mdd_timeout", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9039     },
9040     {&hf_docsis_cmstatus_e_t_qfl_f,
9041      {"QAM/FEC lock failure", "docsis_cmstatus.qam_fec_lock_failure", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9042     },
9043     {&hf_docsis_cmstatus_e_t_s_o,
9044      {"Sequence out-of-range", "docsis_cmstatus.sequence_out_of_range", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9045     },
9046     {&hf_docsis_cmstatus_e_t_mdd_r,
9047      {"Secondary Channel MDD Recovery", "docsis_cmstatus.mdd_recovery", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9048     },
9049     {&hf_docsis_cmstatus_e_t_qfl_r,
9050      {"QAM/FEC Lock Recovery", "docsis_cmstatus.qam_fec_lock_recovery", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9051     },
9052     {&hf_docsis_cmstatus_e_t_t4_t,
9053      {"T4 timeout", "docsis_cmstatus.t4_timeout", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9054     },
9055     {&hf_docsis_cmstatus_e_t_t3_e,
9056      {"T3 retries exceeded", "docsis_cmstatus.t3_retries_exceeded", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9057     },
9058     {&hf_docsis_cmstatus_e_t_rng_s,
9059      {"Successful ranging after T3 retries exceeded", "docsis_cmstatus.successful_ranging_after_t3_retries_exceeded", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9060     },
9061     {&hf_docsis_cmstatus_e_t_cm_b,
9062      {"CM operating on battery backup", "docsis_cmstatus.cm_on_battery", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9063     },
9064     {&hf_docsis_cmstatus_e_t_cm_a,
9065      {"CM returned to A/C power", "docsis_cmstatus.cm_on_ac_power", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9066     },
9067     {&hf_docsis_cmstatus_descr,
9068      {"Description", "docsis_cmstatus.description",FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
9069     },
9070     {&hf_docsis_cmstatus_ds_ch_id,
9071      {"Downstream Channel ID", "docsis_cmstatus.ds_chid",FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9072     },
9073     {&hf_docsis_cmstatus_us_ch_id,
9074      {"Upstream Channel ID", "docsis_cmstatus.us_chid",FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9075     },
9076     {&hf_docsis_cmstatus_dsid,
9077      {"DSID", "docsis_cmstatus.dsid", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL}
9078     },
9079     {&hf_docsis_cmstatus_tlv_data,
9080      {"TLV Data", "docsis_cmstatus.tlv_data", FT_BYTES, BASE_NO_DISPLAY_VALUE, NULL, 0x0, NULL, HFILL}
9081     },
9082     {&hf_docsis_cmstatus_type,
9083      {"Type", "docsis_cmstatus.type",FT_UINT8, BASE_DEC, VALS(cmstatus_tlv_vals), 0x0, NULL, HFILL}
9084     },
9085     {&hf_docsis_cmstatus_length,
9086      {"Length", "docsis_cmstatus.length",FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9087     },
9088     /* CM_CTRL_REQ */
9089     {&hf_docsis_cmctrl_tlv_mute,
9090      {"Upstream Channel RF Mute", "docsis_cmctrl.mute",
9091       FT_UINT8, BASE_DEC, NULL, 0x0,
9092       NULL, HFILL}
9093     },
9094     {&hf_docsis_cmctrl_tlv_mute_timeout,
9095      {"RF Mute Timeout Interval", "docsis_cmctrl.mute_timeout",
9096       FT_UINT32, BASE_DEC, NULL, 0x0,
9097       NULL, HFILL}
9098     },
9099     {&hf_docsis_cmctrl_tlv_reinit,
9100      {"CM Reinitialize", "docsis_cmctrl.reinit",
9101       FT_UINT8, BASE_DEC, NULL, 0x0,
9102       NULL, HFILL}
9103     },
9104     {&hf_docsis_cmctrl_tlv_disable_fwd,
9105      {"Disable Forwarding", "docsis_cmctrl.disable_fwd",
9106       FT_UINT8, BASE_DEC, NULL, 0x0,
9107       NULL, HFILL}
9108     },
9109     {&hf_docsis_cmctrl_tlv_ds_event,
9110      {"Override Downstream Events", "docsis_cmctrl.ds_event",
9111       FT_BYTES, BASE_NONE, NULL, 0x0,
9112       NULL, HFILL}
9113     },
9114     {&hf_docsis_cmctrl_tlv_us_event,
9115      {"Override Upstream Events", "docsis_cmctrl.us_event",
9116       FT_BYTES, BASE_NONE, NULL, 0x0,
9117       NULL, HFILL}
9118     },
9119     {&hf_docsis_cmctrl_tlv_event,
9120      {"Override Non-Channel-Specific Events", "docsis_cmctrl.event",
9121       FT_BYTES, BASE_NONE, NULL, 0x0,
9122       NULL, HFILL}
9123     },
9124     {&hf_docsis_cmctrlreq_tlv_data,
9125      {"TLV Data", "docsis_cmctrl.tlv_data",
9126       FT_BYTES, BASE_NO_DISPLAY_VALUE, NULL, 0x0,
9127       NULL, HFILL}
9128     },
9129     {&hf_docsis_cmctrlreq_type,
9130      {"Type", "docsis_cmctrl.tlv_type",
9131       FT_UINT8, BASE_DEC, VALS(cmctrlreq_tlv_vals), 0x0,
9132       NULL, HFILL}
9133     },
9134     {&hf_docsis_cmctrlreq_length,
9135      {"Length", "docsis_cmctrl.tlv_length",
9136       FT_UINT8, BASE_DEC, NULL, 0x0,
9137       NULL, HFILL}
9138     },
9139     {&hf_docsis_cmctrlreq_us_type,
9140      {"Type", "docsis_cmctrl.us_event_type",
9141       FT_UINT8, BASE_DEC, VALS(cmctrlreq_us_tlv_vals), 0x0,
9142       NULL, HFILL}
9143     },
9144     {&hf_docsis_cmctrlreq_us_length,
9145      {"Length", "docsis_cmctrl.us_event_length",
9146       FT_UINT8, BASE_DEC, NULL, 0x0,
9147       NULL, HFILL}
9148     },
9149     {&hf_docsis_cmctrl_us_event_ch_id,
9150      {"Upstream Channel ID", "docsis_cmctrl.us_event.chid",
9151       FT_UINT8, BASE_DEC, NULL, 0x0,
9152       NULL, HFILL}
9153     },
9154     {&hf_docsis_cmctrl_us_event_mask,
9155      {"Upstream Status Event Enable Bitmask", "docsis_cmctrl.us_event.mask",
9156       FT_BYTES, BASE_NONE, NULL, 0x0,
9157       NULL, HFILL}
9158     },
9159     {&hf_docsis_cmctrl_ds_type,
9160      {"Type", "docsis_cmctrl.ds_event_type",
9161       FT_UINT8, BASE_DEC, VALS(cmctrlreq_ds_tlv_vals), 0x0,
9162       NULL, HFILL}
9163     },
9164     {&hf_docsis_cmctrl_ds_length,
9165      {"Length", "docsis_cmctrl.ds_event_length",
9166       FT_UINT8, BASE_DEC, NULL, 0x0,
9167       NULL, HFILL}
9168     },
9169     {&hf_docsis_cmctrl_ds_event_ch_id,
9170      {"Downstream Channel ID", "docsis_cmctrl.ds_event.chid",
9171       FT_UINT8, BASE_DEC, NULL, 0x0,
9172       NULL, HFILL}
9173     },
9174     {&hf_docsis_cmctrl_ds_event_mask,
9175      {"Downstream Status Event Enable Bitmask", "docsis_cmctrl.ds_event.mask",
9176       FT_BYTES, BASE_NONE, NULL, 0x0,
9177       NULL, HFILL}
9178     },
9179     /* REG_REQ_MP */
9180     {&hf_docsis_regreqmp_sid,
9181      {"Sid", "docsis_regreqmp.sid",
9182       FT_UINT16, BASE_DEC, NULL, 0x0,
9183       "Reg-Req-Mp Sid", HFILL}
9184     },
9185     {&hf_docsis_regreqmp_number_of_fragments,
9186      {"Number of Fragments", "docsis_regreqmp.number_of_fragments",
9187       FT_UINT8, BASE_DEC, NULL, 0x0,
9188       "Reg-Req-Mp Number of Fragments", HFILL}
9189     },
9190     {&hf_docsis_regreqmp_fragment_sequence_number,
9191      {"Fragment Sequence Number", "docsis_regreqmp.fragment_sequence_number",
9192       FT_UINT8, BASE_DEC, NULL, 0x0,
9193       "Reg-Req-Mp Fragment Sequence Number", HFILL}
9194     },
9195     /* REG_RSP_MP */
9196     {&hf_docsis_regrspmp_sid,
9197      {"Sid", "docsis_regrspmp.sid",
9198       FT_UINT16, BASE_DEC, NULL, 0x0,
9199       "Reg-Rsp-Mp Sid", HFILL}
9200     },
9201     {&hf_docsis_regrspmp_response,
9202      {"Response", "docsis_regrspmp.response",
9203       FT_UINT8, BASE_DEC, NULL, 0x0,
9204       "Reg-Rsp-Mp Response", HFILL}
9205     },
9206     {&hf_docsis_regrspmp_number_of_fragments,
9207      {"Number of Fragments", "docsis_regrspmp.number_of_fragments",
9208       FT_UINT8, BASE_DEC, NULL, 0x0,
9209       "Reg-Rsp-Mp Number of Fragments", HFILL}
9210     },
9211     {&hf_docsis_regrspmp_fragment_sequence_number,
9212      {"Fragment Sequence Number", "docsis_regrspmp.fragment_sequence_number",
9213       FT_UINT8, BASE_DEC, NULL, 0x0,
9214       "Reg-Rsp-Mp Fragment Sequence Number", HFILL}
9215     },
9216     /* OCD */
9217     {&hf_docsis_ocd_tlv_unknown,
9218       {"Unknown TLV", "docsis_ocd.unknown_tlv", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
9219     },
9220     {&hf_docsis_ocd_ccc,
9221       {"Configuration Change Count", "docsis_ocd.ccc", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9222     },
9223     {&hf_docsis_ocd_tlv_four_trans_size,
9224       {"Discrete Fourier Transform Size", "docsis_ocd.tlv.four_trans_size", FT_UINT8, BASE_DEC, VALS (docsis_ocd_four_trans_size), 0x0, NULL, HFILL}
9225     },
9226     {&hf_docsis_ocd_tlv_cycl_pref,
9227       {"Cylic Prefix", "docsis_ocd.tlv.cyc_pref", FT_UINT8, BASE_DEC, VALS (docsis_ocd_cyc_prefix), 0x0, NULL, HFILL}
9228     },
9229     {&hf_docsis_ocd_tlv_roll_off,
9230       {"Roll Off", "docsis_ocd.tlv.roll_off", FT_UINT8, BASE_DEC, VALS (docsis_ocd_roll_off), 0x0, NULL, HFILL}
9231     },
9232     {&hf_docsis_ocd_tlv_ofdm_spec_loc,
9233       {"OFDM Spectrum Location", "docsis_ocd.tlv.ofdm_spec_loc", FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &local_units_hz, 0x0, NULL, HFILL}
9234     },
9235     {&hf_docsis_ocd_tlv_time_int_depth,
9236       {"Time Interleaving Depth", "docsis_ocd.tlv.time_int_depth", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9237     },
9238     {&hf_docsis_ocd_tlv_prim_cap_ind,
9239       {"Primary Capable Indicator", "docsis_ocd.tlv.prim_cap_ind", FT_UINT8, BASE_DEC, VALS(docsis_ocd_prim_cap_ind_str), 0x0, NULL, HFILL}
9240     },
9241     {&hf_docsis_ocd_tlv_subc_assign_type,
9242       {"Assignment type", "docsis_ocd.tlv.subc_assign.type", FT_UINT8, BASE_DEC, VALS(docsis_ocd_subc_assign_type_str), 0xC0, NULL, HFILL}
9243     },
9244     {&hf_docsis_ocd_tlv_subc_assign_value,
9245       {"Assignment value", "docsis_ocd.tlv.subc_assign.value", FT_UINT8, BASE_DEC, VALS(docsis_ocd_subc_assign_value_str), 0x20, NULL, HFILL}
9246     },
9247     {&hf_docsis_ocd_subc_assign_subc_type,
9248       {"Subcarrier Type", "docsis_ocd.tlv.subc_assign.subc_type", FT_UINT8, BASE_DEC, VALS(docsis_ocd_subc_assign_subc_type_str), 0x1F, NULL, HFILL}
9249     },
9250     {&hf_docsis_ocd_subc_assign_range,
9251       {"Subcarrier index range", "docsis_ocd.tlv.subc_assign.range", FT_UINT32, BASE_CUSTOM, CF_FUNC(subc_assign_range), 0x00, NULL, HFILL}
9252     },
9253     {&hf_docsis_ocd_subc_assign_index,
9254       {"Subcarrier index", "docsis_ocd.tlv.subc_assign.index", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL}
9255     },
9256     {&hf_docsis_ocd_tlv_data,
9257      {"TLV Data", "docsis_ocd.tlv_data", FT_BYTES, BASE_NO_DISPLAY_VALUE, NULL, 0x0, NULL, HFILL}
9258     },
9259     {&hf_docsis_ocd_type,
9260      {"Type", "docsis_ocd.type",FT_UINT8, BASE_DEC, VALS(ocd_tlv_vals), 0x0, NULL, HFILL}
9261     },
9262     {&hf_docsis_ocd_length,
9263      {"Length", "docsis_ocd.length",FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9264     },
9265     /* DPD */
9266     {&hf_docsis_dpd_tlv_unknown,
9267      {"Unknown TLV", "docsis_dpd.unknown_tlv",
9268       FT_BYTES, BASE_NONE, NULL, 0x0,
9269       NULL, HFILL}
9270     },
9271     {&hf_docsis_dpd_prof_id,
9272      {"Profile Identifier", "docsis_dpd.prof_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9273     },
9274     {&hf_docsis_dpd_ccc,
9275      {"Configuration Change Count", "docsis_dpd.ccc", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9276     },
9277     {&hf_docsis_dpd_tlv_subc_assign_type,
9278       {"Subcarrier Assignment Type", "docsis_dpd.tlv.subc_assign.type", FT_UINT8, BASE_DEC, VALS(docsis_dpd_subc_assign_type_str), 0xC0, NULL, HFILL}
9279     },
9280     {&hf_docsis_dpd_tlv_subc_assign_value,
9281       {"Subcarrier Assignment Value", "docsis_dpd.tlv.subc_assign.value", FT_UINT8, BASE_DEC, VALS(docsis_dpd_subc_assign_value_str), 0x20, NULL, HFILL}
9282     },
9283     {&hf_docsis_dpd_tlv_subc_assign_reserved,
9284       {"reserved", "docsis_dpd.tlv.subc_assign.reserved", FT_UINT8, BASE_DEC, NULL, 0x10, NULL, HFILL}
9285     },
9286     {&hf_docsis_dpd_tlv_subc_assign_modulation,
9287      {"Subcarrier Assignment Modulation", "docsis_dpd.tlv.subc_assign.modulation", FT_UINT8, BASE_DEC, VALS(docsis_dpd_subc_assign_modulation_str), 0x0F, NULL, HFILL}
9288     },
9289     {&hf_docsis_dpd_subc_assign_range,
9290      {"Subcarrier index range", "docsis_dpd.tlv.subc_assign.range", FT_UINT32, BASE_CUSTOM, CF_FUNC(subc_assign_range), 0x00, NULL, HFILL}
9291     },
9292     {&hf_docsis_dpd_subc_assign_index,
9293      {"Subcarrier index", "docsis_dpd.tlv.subc_assign.index", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL}
9294     },
9295     {&hf_docsis_dpd_tlv_subc_assign_vector_oddness,
9296      {"Odd or even", "docsis_dpd.tlv.subc_assign_vect.oddness", FT_UINT8, BASE_DEC, VALS(docsis_dpd_tlv_subc_assign_vector_oddness_str), 0x80, NULL, HFILL}
9297     },
9298     {&hf_docsis_dpd_tlv_subc_assign_vector_reserved,
9299      {"Reserved", "docsis_dpd.tlv.subc_assign_vect.reserved", FT_UINT8, BASE_DEC, NULL, 0x60, NULL, HFILL}
9300     },
9301     {&hf_docsis_dpd_tlv_subc_assign_vector_subc_start,
9302      {"Subcarrier start", "docsis_dpd.tlv.subc_assign_vect.subc_start", FT_UINT16, BASE_DEC, NULL, 0x1FFF, NULL, HFILL}
9303     },
9304     {&hf_docsis_dpd_tlv_subc_assign_vector_modulation_odd,
9305      {"Modulation", "docsis_dpd.tlv.subc_assign_vect.modulation", FT_UINT8, BASE_DEC, VALS(docsis_dpd_tlv_subc_assign_vector_modulation_str), 0xF0, NULL, HFILL}
9306     },
9307     {&hf_docsis_dpd_tlv_subc_assign_vector_modulation_even,
9308      {"Modulation", "docsis_dpd.tlv.subc_assign_vect.modulation", FT_UINT8, BASE_DEC, VALS(docsis_dpd_tlv_subc_assign_vector_modulation_str), 0x0F, NULL, HFILL}
9309     },
9310     {&hf_docsis_dpd_tlv_data,
9311      {"TLV Data", "docsis_dpd.tlv_data", FT_BYTES, BASE_NO_DISPLAY_VALUE, NULL, 0x0, NULL, HFILL}
9312     },
9313     {&hf_docsis_dpd_type,
9314      {"Type", "docsis_dpd.type",FT_UINT8, BASE_DEC, VALS(dpd_tlv_vals), 0x0, NULL, HFILL}
9315     },
9316     {&hf_docsis_dpd_length,
9317      {"Length", "docsis_dpd.length",FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
9318     },
9319     /* OPT-REQ */
9320     {&hf_docsis_optreq_tlv_unknown,
9321      {"Unknown TLV", "docsis_optreq.unknown_tlv", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
9322     },
9323     {&hf_docsis_optreq_reserved,
9324      {"Reserved", "docsis_optreq.reserved", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
9325     },
9326     {&hf_docsis_optreq_prof_id,
9327      {"Profile Identifier", "docsis_optreq.prof_id", FT_UINT8, BASE_DEC, VALS(profile_id_vals), 0x0, NULL, HFILL}
9328     },
9329     {&hf_docsis_optreq_opcode,
9330      {"Opcode", "docsis_optreq.opcode", FT_UINT8, BASE_DEC, VALS(opt_opcode_vals), 0x0, NULL, HFILL}
9331     },
9332     {&hf_docsis_optreq_tlv_data,
9333      {"TLV Data", "docsis_optreq.tlv_data", FT_BYTES, BASE_NO_DISPLAY_VALUE, NULL, 0x0, NULL, HFILL}
9334     },
9335     {&hf_docsis_optreq_type,
9336      {"Type", "docsis_optreq.type",FT_UINT8, BASE_DEC, VALS(optreq_tlv_vals), 0x0, NULL, HFILL}
9337     },
9338     {&hf_docsis_optreq_length,
9339      {"Length", "docsis_optreq.length",FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9340     },
9341     {&hf_docsis_optreq_reqstat_rxmer_stat_subc,
9342      {"RxMER Statistics per subcarrier", "docsis_optreq.reqstat.rxmer_stat_per_subcarrier", FT_BOOLEAN, 32, TFS(&req_not_req_tfs), 0x1, NULL, HFILL}
9343     },
9344     {&hf_docsis_optreq_reqstat_rxmer_subc_threshold_comp,
9345      {"RxMER per Subcarrier Threshold Comparison for Candidate Profile", "docsis_optreq.reqstat.rxmer_per_subcarrrier_thresh_comp", FT_BOOLEAN, 32, TFS(&req_not_req_tfs), 0x2, NULL, HFILL}
9346     },
9347     {&hf_docsis_optreq_reqstat_snr_marg_cand_prof,
9348      {"SNR Margin for Candidate Profile", "docsis_optreq.reqstat.snr_marg_cand_prof", FT_BOOLEAN, 32, TFS(&req_not_req_tfs), 0x4, NULL, HFILL}
9349     },
9350     {&hf_docsis_optreq_reqstat_codew_stat_cand_prof,
9351      {"Codeword Statistics for Candidate Profile", "docsis_optreq.reqstat.codew_stat_cand_prof", FT_BOOLEAN, 32, TFS(&req_not_req_tfs), 0x8, NULL, HFILL}
9352     },
9353     {&hf_docsis_optreq_reqstat_codew_thresh_comp_cand_prof,
9354      {"Codeword Threshold Comparison for Candidate Profile", "docsis_optreq.reqstat.codew_thresh_comp_cand_prof", FT_BOOLEAN, 32, TFS(&req_not_req_tfs), 0x10, NULL, HFILL}
9355     },
9356     {&hf_docsis_optreq_reqstat_ncp_field_stat,
9357      {"NCP Field Statistics", "docsis_optreq.reqstat.ncp_field_stats", FT_BOOLEAN, 32, TFS(&req_not_req_tfs), 0x20, NULL, HFILL}
9358     },
9359     {&hf_docsis_optreq_reqstat_ncp_crc_thresh_comp,
9360      {"NCP CRC Threshold Comparison", "docsis_optreq.reqstat.ncp_crc_thresh_comp", FT_BOOLEAN, 32, TFS(&req_not_req_tfs), 0x40, NULL, HFILL}
9361     },
9362     {&hf_docsis_optreq_reqstat_reserved,
9363      {"Reserved", "docsis_optreq.reqstat.reserved", FT_BOOLEAN, 32, TFS(&req_not_req_tfs), 0x80, NULL, HFILL}
9364     },
9365     {&hf_docsis_optreq_tlv_xrmer_thresh_data,
9366      {"TLV Data", "docsis_optreq.rxmer_thresh_params.tlv_data", FT_BYTES, BASE_NO_DISPLAY_VALUE, NULL, 0x0, NULL, HFILL}
9367     },
9368     {&hf_docsis_optreq_xmer_thresh_params_type,
9369      {"Type", "docsis_optreq.rxmer_thres_params.type",FT_UINT8, BASE_DEC, VALS(optreq_tlv_rxmer_thresh_params_vals), 0x0, NULL, HFILL}
9370     },
9371     {&hf_docsis_optreq_xmer_thresh_params_length,
9372      {"Length", "docsis_optreq.rxmer_thres_params.length",FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9373     },
9374     {&hf_docsis_optreq_tlv_xrmer_thresh_data_mod_order,
9375      {"Modulation Order", "docsis_optreq.rxmer_thres_params.mod_order", FT_UINT8, BASE_DEC, VALS(opreq_tlv_rxmer_thresh_params_mod_order), 0x0, NULL, HFILL}
9376     },
9377     /* OPT-RSP */
9378     {&hf_docsis_optrsp_tlv_unknown,
9379      {"Unknown TLV", "docsis_optrsp.unknown_tlv", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
9380     },
9381     {&hf_docsis_optrsp_reserved,
9382      {"Reserved", "docsis_optrsp.reserved", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
9383     },
9384     {&hf_docsis_optrsp_prof_id,
9385      {"Profile Identifier", "docsis_optrsp.prof_id", FT_UINT8, BASE_DEC, VALS(profile_id_vals), 0x0, NULL, HFILL}
9386     },
9387     {&hf_docsis_optrsp_status,
9388      {"Status", "docsis_optrsp.status", FT_UINT8, BASE_DEC, VALS(opt_status_vals), 0x0, NULL, HFILL}
9389     },
9390     {&hf_docsis_optrsp_tlv_data,
9391      {"TLV Data", "docsis_optrsp.tlv_data", FT_BYTES, BASE_NO_DISPLAY_VALUE, NULL, 0x0, NULL, HFILL}
9392     },
9393     {&hf_docsis_optrsp_type,
9394      {"Type", "docsis_optrsp.type",FT_UINT8, BASE_DEC, VALS(optreq_tlv_vals), 0x0, NULL, HFILL}
9395     },
9396     {&hf_docsis_optrsp_length,
9397      {"Length", "docsis_optrsp.length",FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
9398     },
9399     {&hf_docsis_optrsp_tlv_xrmer_snr_margin_data,
9400      {"TLV Data", "docsis_optrsp.rxmer_snr_margin.tlv_data", FT_BYTES, BASE_NO_DISPLAY_VALUE, NULL, 0x0, NULL, HFILL}
9401     },
9402     {&hf_docsis_optrsp_xmer_snr_margin_type,
9403      {"Type", "docsis_optrsp.xmer_snr_margin.type",FT_UINT8, BASE_DEC, VALS(optrsp_tlv_rxmer_snr_margin_vals), 0x0, NULL, HFILL}
9404     },
9405     {&hf_docsis_optrsp_xmer_snr_margin_length,
9406      {"Length", "docsis_optrsp.rxmer_snr_margin.length",FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
9407     },
9408     {&hf_docsis_optrsp_tlv_xrmer_snr_margin_data_rxmer_subc,
9409      {"RxMER", "docsis_optrsp.rxmer_snr_margin.rxmer_per_subc", FT_UINT8, BASE_CUSTOM, CF_FUNC(mer_fourth_db), 0x0, NULL, HFILL}
9410     },
9411     {&hf_docsis_optrsp_tlv_rxmer_snr_margin_data_snr_margin,
9412      {"SNR Margin", "docsis_optrsp.rxmer_snr_margin.snr_margin", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
9413     },
9414     /* OPT-ACK */
9415     {&hf_docsis_optack_prof_id,
9416      {"Profile Identifier", "docsis_optack.prof_id", FT_UINT8, BASE_DEC, VALS(profile_id_vals), 0x0, NULL, HFILL}
9417     },
9418     {&hf_docsis_optack_reserved,
9419      {"Reserved", "docsis_optack.reserved", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}
9420     },
9421
9422
9423     /* MAC Management */
9424     {&hf_docsis_mgt_upstream_chid,
9425      {"Upstream Channel ID", "docsis_mgmt.upchid",
9426       FT_UINT8, BASE_DEC, NULL, 0x0,
9427       NULL, HFILL}
9428     },
9429     {&hf_docsis_mgt_down_chid,
9430      {"Downstream Channel ID", "docsis_ucd.downchid",
9431       FT_UINT8, BASE_DEC, NULL, 0x0,
9432       "Management Message", HFILL}
9433     },
9434     {&hf_docsis_mgt_tranid,
9435      {"Transaction Id", "docsis_mgmt.tranid",
9436       FT_UINT16, BASE_DEC, NULL, 0x0,
9437       NULL, HFILL}
9438     },
9439     {&hf_docsis_mgt_dst_addr,
9440      {"Destination Address", "docsis_mgmt.dst",
9441       FT_ETHER, BASE_NONE, NULL, 0x0,
9442       NULL, HFILL}
9443     },
9444     {&hf_docsis_mgt_src_addr,
9445      {"Source Address", "docsis_mgmt.src",
9446       FT_ETHER, BASE_NONE, NULL, 0x0,
9447       NULL, HFILL}
9448     },
9449     {&hf_docsis_mgt_msg_len,
9450      {"Message Length - DSAP to End (Bytes)", "docsis_mgmt.msglen",
9451       FT_UINT16, BASE_DEC, NULL, 0x0,
9452       NULL, HFILL}
9453     },
9454     {&hf_docsis_mgt_dsap,
9455      {"DSAP", "docsis_mgmt.dsap",
9456       FT_UINT8, BASE_HEX, NULL, 0x0,
9457       "Destination SAP", HFILL}
9458     },
9459     {&hf_docsis_mgt_ssap,
9460      {"SSAP", "docsis_mgmt.ssap",
9461       FT_UINT8, BASE_HEX, NULL, 0x0,
9462       "Source SAP", HFILL}
9463     },
9464     {&hf_docsis_mgt_control,
9465      {"Control", "docsis_mgmt.control",
9466       FT_UINT8, BASE_HEX, NULL, 0x0,
9467       NULL, HFILL}
9468     },
9469     {&hf_docsis_mgt_version,
9470      {"Version", "docsis_mgmt.version",
9471       FT_UINT8, BASE_DEC, NULL, 0x0,
9472       NULL, HFILL}
9473     },
9474     {&hf_docsis_mgt_type,
9475      {"Type", "docsis_mgmt.type",
9476       FT_UINT8, BASE_DEC, VALS (mgmt_type_vals), 0x0,
9477       NULL, HFILL}
9478     },
9479     {&hf_docsis_mgt_rsvd,
9480      {"Reserved", "docsis_mgmt.rsvd",
9481       FT_UINT8, BASE_DEC, NULL, 0x0,
9482       NULL, HFILL}
9483     },
9484     { &hf_docsis_tlv_fragment_overlap,
9485      { "Fragment overlap", "docsis_mgmt.tlv.fragment.overlap",
9486        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
9487        "Fragment overlaps with other fragments", HFILL}
9488     },
9489     { &hf_docsis_tlv_fragment_overlap_conflict,
9490      { "Conflicting data in fragment overlap", "docsis_mgmt.tlv.fragment.overlap.conflict",
9491        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
9492        "Overlapping fragments contained conflicting data", HFILL}
9493     },
9494     { &hf_docsis_tlv_fragment_multiple_tails,
9495      { "Multiple tail fragments found", "docsis_mgmt.tlv.fragment.multipletails",
9496        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
9497        "Several tails were found when defragmenting the packet", HFILL}
9498     },
9499     { &hf_docsis_tlv_fragment_too_long_fragment,
9500      { "Fragment too long", "docsis_mgmt.tlv.fragment.toolongfragment",
9501        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
9502        "Fragment contained data past end of packet", HFILL}
9503     },
9504     { &hf_docsis_tlv_fragment_error,
9505      { "Defragmentation error", "docsis_mgmt.tlv.fragment.error",
9506        FT_FRAMENUM, BASE_NONE, NULL, 0x0,
9507        "Defragmentation error due to illegal fragments", HFILL}
9508     },
9509     { &hf_docsis_tlv_fragment_count,
9510      { "Fragment count", "docsis_mgmt.tlv.fragment.count",
9511        FT_UINT32, BASE_DEC, NULL, 0x0,
9512        NULL, HFILL}
9513     },
9514     { &hf_docsis_tlv_fragment,
9515      { "TLV Fragment", "docsis_mgmt.tlv.fragment",
9516        FT_FRAMENUM, BASE_NONE, NULL, 0x0,
9517        NULL, HFILL}
9518     },
9519     { &hf_docsis_tlv_fragments,
9520      { "TLV Fragments", "docsis_mgmt.tlv.fragments",
9521        FT_BYTES, BASE_NONE, NULL, 0x0,
9522        NULL, HFILL}
9523     },
9524     { &hf_docsis_tlv_reassembled_in,
9525      { "Reassembled TLV in frame", "docsis_mgmt.tlv.reassembled_in",
9526        FT_FRAMENUM, BASE_NONE, NULL, 0x0,
9527        "This TLV packet is reassembled in this frame", HFILL}
9528     },
9529     { &hf_docsis_tlv_reassembled_length,
9530      { "Reassembled TLV length", "docsis_mgmt.tlv.reassembled.length",
9531        FT_UINT32, BASE_DEC, NULL, 0x0,
9532        "The total length of the reassembled payload", HFILL}
9533     },
9534     { &hf_docsis_tlv_reassembled_data,
9535      { "Reassembled TLV data", "docsis_mgmt.tlv.reassembled.data",
9536        FT_BYTES, BASE_NONE, NULL, 0x0,
9537        "The reassembled payload", HFILL}
9538     },
9539     { &hf_docsis_tlv_reassembled,
9540      { "Reassembled TLV", "docsis_mgmt.tlv.reassembled",
9541        FT_BYTES, BASE_NONE, NULL, 0x0,
9542        NULL, HFILL}
9543     },
9544   };
9545
9546   static gint *ett[] = {
9547     &ett_docsis_sync,
9548     &ett_docsis_ucd,
9549     &ett_docsis_tlv,
9550     &ett_docsis_burst_tlv,
9551     &ett_docsis_map,
9552     &ett_docsis_map_ie,
9553     &ett_docsis_map_probe_ie,
9554     &ett_docsis_rngreq,
9555     &ett_docsis_rngrsp,
9556     &ett_docsis_rngrsptlv,
9557     &ett_docsis_rngrsp_tlv_transmit_equalization_encodings,
9558     &ett_docsis_rngrsp_tlv_transmit_equalization_encodings_coef,
9559     &ett_docsis_rngrsp_tlv_commanded_power,
9560     &ett_docsis_rngrsp_tlv_commanded_power_subtlv,
9561     &ett_docsis_regreq,
9562     &ett_docsis_regrsp,
9563     &ett_docsis_uccreq,
9564     &ett_docsis_uccrsp,
9565     &ett_docsis_bpkmreq,
9566     &ett_docsis_bpkmrsp,
9567     &ett_docsis_bpkmattr,
9568     &ett_docsis_bpkmattr_cmid,
9569     &ett_docsis_bpkmattr_scap,
9570     &ett_docsis_bpkmattr_tekp,
9571     &ett_docsis_bpkmattr_sadsc,
9572     &ett_docsis_bpkmattr_saqry,
9573     &ett_docsis_bpkmattr_dnld,
9574     &ett_docsis_bpkmattrtlv,
9575     &ett_docsis_regack,
9576     &ett_docsis_dsareq,
9577     &ett_docsis_dsarsp,
9578     &ett_docsis_dsaack,
9579     &ett_docsis_dscreq,
9580     &ett_docsis_dscrsp,
9581     &ett_docsis_dscack,
9582     &ett_docsis_dsdreq,
9583     &ett_docsis_dsdrsp,
9584     &ett_docsis_dccreq,
9585     &ett_docsis_dccreq_sf_sub,
9586     &ett_docsis_dccreq_ds_params,
9587     &ett_docsis_dccreq_tlv,
9588     &ett_docsis_dccrsp,
9589     &ett_docsis_dccrsp_cm_jump_time,
9590     &ett_docsis_dccrsp_tlv,
9591     &ett_docsis_dccack,
9592     &ett_docsis_dccack_tlv,
9593     &ett_docsis_intrngreq,
9594     &ett_docsis_dcd,
9595     &ett_docsis_dcd_cfr,
9596     &ett_docsis_dcd_cfr_ip,
9597     &ett_docsis_dcd_rule,
9598     &ett_docsis_dcd_clid,
9599     &ett_docsis_dcd_cfg,
9600     &ett_docsis_dcd_tlv,
9601     &ett_docsis_mdd,
9602     &ett_tlv,
9603     &ett_sub_tlv,
9604     &ett_docsis_mdd_cm_status_ev_en_for_docsis31,
9605     &ett_docsis_mdd_ds_active_channel_list,
9606     &ett_docsis_mdd_ds_service_group,
9607     &ett_docsis_mdd_channel_profile_reporting_control,
9608     &ett_docsis_mdd_ip_init_param,
9609     &ett_docsis_mdd_up_active_channel_list,
9610     &ett_docsis_mdd_cm_status_event_control,
9611     &ett_docsis_mdd_dsg_da_to_dsid,
9612     &ett_docsis_mdd_diplexer_band_edge,
9613     &ett_docsis_mdd_full_duplex_descriptor,
9614     &ett_docsis_mdd_full_duplex_sub_band_descriptor,
9615     &ett_docsis_bintrngreq,
9616     &ett_docsis_dbcreq,
9617     &ett_docsis_dbcrsp,
9618     &ett_docsis_dbcack,
9619     &ett_docsis_dpvreq,
9620     &ett_docsis_dpvrsp,
9621     &ett_docsis_cmstatus,
9622     &ett_docsis_cmstatus_tlv,
9623     &ett_docsis_cmstatus_tlvtlv,
9624     &ett_docsis_cmstatusack,
9625     &ett_docsis_cmctrlreq,
9626     &ett_docsis_cmctrlreq_tlv,
9627     &ett_docsis_cmctrlreq_tlvtlv,
9628     &ett_docsis_cmctrl_tlv_us_event,
9629     &ett_docsis_cmctrl_tlv_ds_event,
9630     &ett_docsis_cmctrlrsp,
9631     &ett_docsis_regreqmp,
9632     &ett_docsis_regrspmp,
9633     &ett_docsis_ocd,
9634     &ett_docsis_ocd_tlv,
9635     &ett_docsis_ocd_tlvtlv,
9636     &ett_docsis_dpd,
9637     &ett_docsis_dpd_tlv,
9638     &ett_docsis_dpd_tlvtlv,
9639     &ett_docsis_dpd_tlv_subcarrier_assignment,
9640     &ett_docsis_dpd_tlv_subcarrier_assignment_vector,
9641     &ett_docsis_optreq,
9642     &ett_docsis_optreq_tlv,
9643     &ett_docsis_optreq_tlvtlv,
9644     &ett_docsis_optreq_tlv_rxmer_thresh_params,
9645     &ett_docsis_optreq_tlv_rxmer_thresh_params_tlv,
9646     &ett_docsis_optrsp,
9647     &ett_docsis_optrsp_tlv,
9648     &ett_docsis_optrsp_tlvtlv,
9649     &ett_docsis_optrsp_tlv_rxmer_snr_margin_data,
9650     &ett_docsis_optrsp_tlv_rxmer_snr_margin_tlv,
9651     &ett_docsis_optack,
9652     &ett_docsis_mgmt,
9653     &ett_mgmt_pay,
9654     &ett_docsis_tlv_fragment,
9655     &ett_docsis_tlv_fragments,
9656     &ett_docsis_tlv_reassembled
9657   };
9658
9659   static ei_register_info ei[] = {
9660     {&ei_docsis_mgmt_tlvlen_bad, {"docsis_mgmt.tlvlenbad", PI_MALFORMED, PI_ERROR, "Bad TLV length", EXPFILL}},
9661     {&ei_docsis_mgmt_tlvtype_unknown, { "docsis_mgmt.tlvtypeunknown", PI_PROTOCOL, PI_WARN, "Unknown TLV type", EXPFILL}},
9662     {&ei_docsis_mgmt_version_unknown, { "docsis_mgmt.versionunknown", PI_PROTOCOL, PI_WARN, "Unknown mac management version", EXPFILL}},
9663    };
9664
9665   expert_module_t* expert_docsis_mgmt;
9666
9667   proto_docsis_mgmt = proto_register_protocol ("DOCSIS Mac Management", "DOCSIS MAC MGMT", "docsis_mgmt");
9668
9669   proto_register_field_array (proto_docsis_mgmt, hf, array_length (hf));
9670   proto_register_subtree_array (ett, array_length (ett));
9671   expert_docsis_mgmt = expert_register_protocol(proto_docsis_mgmt);
9672   expert_register_field_array(expert_docsis_mgmt, ei, array_length(ei));
9673
9674   docsis_mgmt_dissector_table = register_dissector_table ("docsis_mgmt",
9675                                                           "DOCSIS Mac Management", proto_docsis_mgmt,
9676                                                           FT_UINT8, BASE_DEC);
9677
9678   /* Register Mac Management commands as their own protocols so we can get the name of the option */
9679   proto_docsis_sync = proto_register_protocol_in_name_only("DOCSIS Synchronisation Message", "SYNC Message", "docsis_sync", proto_docsis_mgmt, FT_BYTES);
9680   proto_docsis_ucd = proto_register_protocol_in_name_only("DOCSIS Upstream Channel Descriptor", "DOCSIS UCD", "docsis_ucd", proto_docsis_mgmt, FT_BYTES);
9681   proto_docsis_map_v1 = proto_register_protocol_in_name_only("DOCSIS Upstream Bandwidth Allocation - version 1", "DOCSIS MAP", "docsis_map", proto_docsis_mgmt, FT_BYTES);
9682   proto_docsis_map_v5 = proto_register_protocol_in_name_only("DOCSIS Upstream Bandwidth Allocation - version 5", "DOCSIS MAP", "docsis_map", proto_docsis_mgmt, FT_BYTES);
9683   proto_docsis_rngreq = proto_register_protocol_in_name_only("DOCSIS Range Request Message", "DOCSIS RNG-REQ", "docsis_rngreq", proto_docsis_mgmt, FT_BYTES);
9684   proto_docsis_rngrsp = proto_register_protocol_in_name_only("DOCSIS Ranging Response", "DOCSIS RNG-RSP", "docsis_rngrsp", proto_docsis_mgmt, FT_BYTES);
9685   proto_docsis_regreq = proto_register_protocol_in_name_only("DOCSIS Registration Requests", "DOCSIS REG-REQ", "docsis_regreq", proto_docsis_mgmt, FT_BYTES);
9686   proto_docsis_regrsp = proto_register_protocol_in_name_only("DOCSIS Registration Responses", "DOCSIS REG-RSP", "docsis_regrsp", proto_docsis_mgmt, FT_BYTES);
9687   proto_docsis_uccreq = proto_register_protocol_in_name_only("DOCSIS Upstream Channel Change Request", "DOCSIS UCC-REQ", "docsis_uccreq", proto_docsis_mgmt, FT_BYTES);
9688   proto_docsis_uccrsp = proto_register_protocol_in_name_only("DOCSIS Upstream Channel Change Response", "DOCSIS UCC-RSP", "docsis_uccrsp", proto_docsis_mgmt, FT_BYTES);
9689   proto_docsis_bpkmreq = proto_register_protocol_in_name_only("DOCSIS Baseline Privacy Key Management Request", "DOCSIS BPKM-REQ", "docsis_bpkm.req", proto_docsis_mgmt, FT_BYTES);
9690   proto_docsis_bpkmrsp = proto_register_protocol_in_name_only("DOCSIS Baseline Privacy Key Management Response", "DOCSIS BPKM-RSP", "docsis_bpkm.rsp", proto_docsis_mgmt, FT_BYTES);
9691   proto_docsis_regack = proto_register_protocol_in_name_only("DOCSIS Registration Acknowledge", "DOCSIS REG-ACK", "docsis_regack", proto_docsis_mgmt, FT_BYTES);
9692   proto_docsis_dsareq = proto_register_protocol_in_name_only("DOCSIS Dynamic Service Addition Request", "DOCSIS DSA-REQ", "docsis_dsareq", proto_docsis_mgmt, FT_BYTES);
9693   proto_docsis_dsarsp = proto_register_protocol_in_name_only("DOCSIS Dynamic Service Addition Response", "DOCSIS DSA-RSP", "docsis_dsarsp", proto_docsis_mgmt, FT_BYTES);
9694   proto_docsis_dsaack = proto_register_protocol_in_name_only("DOCSIS Dynamic Service Addition Acknowledge", "DOCSIS DSA-ACK", "docsis_dsaack", proto_docsis_mgmt, FT_BYTES);
9695   proto_docsis_dscreq = proto_register_protocol_in_name_only("DOCSIS Dynamic Service Change Request", "DOCSIS DSC-REQ", "docsis_dscreq", proto_docsis_mgmt, FT_BYTES);
9696   proto_docsis_dscrsp = proto_register_protocol_in_name_only("DOCSIS Dynamic Service Change Response", "DOCSIS DSC-RSP", "docsis_dscrsp", proto_docsis_mgmt, FT_BYTES);
9697   proto_docsis_dscack = proto_register_protocol_in_name_only("DOCSIS Dynamic Service Change Acknowledgement", "DOCSIS DSC-ACK", "docsis_dscack", proto_docsis_mgmt, FT_BYTES);
9698   proto_docsis_dsdreq = proto_register_protocol_in_name_only("DOCSIS Dynamic Service Delete Request", "DOCSIS DSD-REQ", "docsis_dsdreq", proto_docsis_mgmt, FT_BYTES);
9699   proto_docsis_dsdrsp = proto_register_protocol_in_name_only("DOCSIS Dynamic Service Delete Response", "DOCSIS DSD-RSP", "docsis_dsdrsp", proto_docsis_mgmt, FT_BYTES);
9700   proto_docsis_dccreq = proto_register_protocol_in_name_only("DOCSIS Downstream Channel Change Request", "DOCSIS DCC-REQ", "docsis_dccreq", proto_docsis_mgmt, FT_BYTES);
9701   proto_docsis_dccrsp = proto_register_protocol_in_name_only("DOCSIS Downstream Channel Change Response", "DOCSIS DCC-RSP", "docsis_dccrsp", proto_docsis_mgmt, FT_BYTES);
9702   proto_docsis_dccack = proto_register_protocol_in_name_only("DOCSIS Downstream Channel Change Acknowledge", "DOCSIS DCC-ACK", "docsis_dccack", proto_docsis_mgmt, FT_BYTES);
9703   proto_docsis_type29ucd = proto_register_protocol_in_name_only("DOCSIS Upstream Channel Descriptor Type 29", "DOCSIS type29ucd", "docsis_type29ucd", proto_docsis_mgmt, FT_BYTES);
9704   proto_docsis_intrngreq = proto_register_protocol_in_name_only("DOCSIS Initial Ranging Message", "DOCSIS INT-RNG-REQ", "docsis_intrngreq", proto_docsis_mgmt, FT_BYTES);
9705   proto_docsis_dcd = proto_register_protocol_in_name_only("DOCSIS Downstream Channel Descriptor", "DOCSIS DCD", "docsis_dcd", proto_docsis_mgmt, FT_BYTES);
9706   proto_docsis_mdd = proto_register_protocol_in_name_only("DOCSIS Mac Domain Description", "DOCSIS Mdd", "docsis_mdd", proto_docsis_mgmt, FT_BYTES);
9707   proto_docsis_bintrngreq = proto_register_protocol_in_name_only("DOCSIS Bonded Initial Ranging Message", "DOCSIS B-INT-RNG-REQ", "docsis_bintrngreq", proto_docsis_mgmt, FT_BYTES);
9708   proto_docsis_type35ucd = proto_register_protocol_in_name_only("DOCSIS Upstream Channel Descriptor Type 35", "DOCSIS type35ucd", "docsis_type35ucd", proto_docsis_mgmt, FT_BYTES);
9709   proto_docsis_dbcreq = proto_register_protocol_in_name_only("DOCSIS Dynamic Bonding Change Request", "DOCSIS DBC-REQ", "docsis_dbcreq", proto_docsis_mgmt, FT_BYTES);
9710   proto_docsis_dbcrsp = proto_register_protocol_in_name_only("DOCSIS Dynamic Bonding Change Response", "DOCSIS DBC-RSP", "docsis_dbcrsp", proto_docsis_mgmt, FT_BYTES);
9711   proto_docsis_dbcack = proto_register_protocol_in_name_only("DOCSIS Dynamic Bonding Change Acknowledge", "DOCSIS DBC-ACK", "docsis_dbcack", proto_docsis_mgmt, FT_BYTES);
9712   proto_docsis_dpvreq = proto_register_protocol_in_name_only("DOCSIS Path Verify Request", "DOCSIS DPV-REQ", "docsis_dpv.req", proto_docsis_mgmt, FT_BYTES);
9713   proto_docsis_dpvrsp = proto_register_protocol_in_name_only("DOCSIS Path Verify Response", "DOCSIS DPV-RSP", "docsis_dpv.rsp", proto_docsis_mgmt, FT_BYTES);
9714   proto_docsis_cmstatus = proto_register_protocol_in_name_only("DOCSIS CM-STATUS Report", "DOCSIS CM-STATUS", "docsis_cmstatus", proto_docsis_mgmt, FT_BYTES);
9715   proto_docsis_cmstatusack = proto_register_protocol_in_name_only("DOCSIS Status Report Acknowledge", "DOCSIS CM-STATUS-ACK", "docsis_cmstatusack", proto_docsis_mgmt, FT_BYTES);
9716   proto_docsis_cmctrlreq = proto_register_protocol_in_name_only("DOCSIS CM Control Request", "DOCSIS CM-CTRL-REQ", "docsis_cmctrl.req", proto_docsis_mgmt, FT_BYTES);
9717   proto_docsis_cmctrlrsp = proto_register_protocol_in_name_only("DOCSIS CM Control Response", "DOCSIS CM-CTRL-RSP", "docsis_cmctrlrsp", proto_docsis_mgmt, FT_BYTES);
9718   proto_docsis_regreqmp = proto_register_protocol_in_name_only("DOCSIS Registration Request Multipart", "DOCSIS Reg-Req-Mp", "docsis_regreqmp", proto_docsis_mgmt, FT_BYTES);
9719   proto_docsis_regrspmp = proto_register_protocol_in_name_only("DOCSIS Registration Response Multipart", "DOCSIS Reg-Rsp-Mp", "docsis_regrspmp", proto_docsis_mgmt, FT_BYTES);
9720   proto_docsis_ocd = proto_register_protocol_in_name_only("DOCSIS OFDM Channel Descriptor", "DOCSIS OCD", "docsis_ocd", proto_docsis_mgmt, FT_BYTES);
9721   proto_docsis_dpd = proto_register_protocol_in_name_only("DOCSIS Downstream Profile Descriptor", "DOCSIS DPD", "docsis_dpd", proto_docsis_mgmt, FT_BYTES);
9722   proto_docsis_type51ucd = proto_register_protocol_in_name_only("DOCSIS Upstream Channel Descriptor Type 51", "DOCSIS type51ucd", "docsis_type51ucd", proto_docsis_mgmt, FT_BYTES);
9723   proto_docsis_optreq = proto_register_protocol_in_name_only("OFDM Downstream Profile Test Request", "DOCSIS OPT-REQ", "docsis_optreq", proto_docsis_mgmt, FT_BYTES);
9724   proto_docsis_optrsp = proto_register_protocol_in_name_only("OFDM Downstream Profile Test Response", "DOCSIS OPT-RSP", "docsis_optrsp", proto_docsis_mgmt, FT_BYTES);
9725   proto_docsis_optack = proto_register_protocol_in_name_only("OFDM Downstream Profile Test Acknowledge", "DOCSIS OPT-ACK", "docsis_optack", proto_docsis_mgmt, FT_BYTES);
9726
9727   register_dissector ("docsis_mgmt", dissect_macmgmt, proto_docsis_mgmt);
9728   docsis_ucd_handle = register_dissector ("docsis_ucd", dissect_ucd, proto_docsis_ucd);
9729 }
9730
9731 void
9732 proto_reg_handoff_docsis_mgmt (void)
9733 {
9734   /* Create dissection function handles for all Mac Management commands */
9735   dissector_add_uint ("docsis_mgmt", MGT_SYNC, create_dissector_handle( dissect_sync, proto_docsis_sync ));
9736   dissector_add_uint ("docsis_mgmt", MGT_UCD, docsis_ucd_handle);
9737   dissector_add_uint ("docsis_mgmt", 256*MAP_v1 + MGT_MAP, create_dissector_handle( dissect_map_v1, proto_docsis_map_v1 ));
9738   dissector_add_uint ("docsis_mgmt", 256*MAP_v5 + MGT_MAP, create_dissector_handle( dissect_map_v5, proto_docsis_map_v5 ));
9739   dissector_add_uint ("docsis_mgmt", MGT_RNG_REQ, create_dissector_handle( dissect_rngreq, proto_docsis_rngreq ));
9740   dissector_add_uint ("docsis_mgmt", MGT_RNG_RSP, create_dissector_handle( dissect_rngrsp, proto_docsis_rngrsp ));
9741   dissector_add_uint ("docsis_mgmt", MGT_REG_REQ, create_dissector_handle( dissect_regreq, proto_docsis_regreq ));
9742   dissector_add_uint ("docsis_mgmt", MGT_REG_RSP, create_dissector_handle( dissect_regrsp, proto_docsis_regrsp ));
9743   dissector_add_uint ("docsis_mgmt", MGT_UCC_REQ, create_dissector_handle( dissect_uccreq, proto_docsis_uccreq ));
9744   dissector_add_uint ("docsis_mgmt", MGT_UCC_RSP, create_dissector_handle( dissect_uccrsp, proto_docsis_uccrsp ));
9745   dissector_add_uint ("docsis_mgmt", MGT_BPKM_REQ, create_dissector_handle( dissect_bpkmreq, proto_docsis_bpkmreq ));
9746   dissector_add_uint ("docsis_mgmt", MGT_BPKM_RSP, create_dissector_handle( dissect_bpkmrsp, proto_docsis_bpkmrsp ));
9747   dissector_add_uint ("docsis_mgmt", MGT_REG_ACK, create_dissector_handle( dissect_regack, proto_docsis_regack ));
9748   dissector_add_uint ("docsis_mgmt", MGT_DSA_REQ, create_dissector_handle( dissect_dsareq, proto_docsis_dsareq ));
9749   dissector_add_uint ("docsis_mgmt", MGT_DSA_RSP, create_dissector_handle( dissect_dsarsp, proto_docsis_dsarsp ));
9750   dissector_add_uint ("docsis_mgmt", MGT_DSA_ACK, create_dissector_handle( dissect_dsaack, proto_docsis_dsaack ));
9751   dissector_add_uint ("docsis_mgmt", MGT_DSC_REQ, create_dissector_handle( dissect_dscreq, proto_docsis_dscreq ));
9752   dissector_add_uint ("docsis_mgmt", MGT_DSC_RSP, create_dissector_handle( dissect_dscrsp, proto_docsis_dscrsp ));
9753   dissector_add_uint ("docsis_mgmt", MGT_DSC_ACK, create_dissector_handle( dissect_dscack, proto_docsis_dscack ));
9754   dissector_add_uint ("docsis_mgmt", MGT_DSD_REQ, create_dissector_handle( dissect_dsdreq, proto_docsis_dsdreq ));
9755   dissector_add_uint ("docsis_mgmt", MGT_DSD_RSP, create_dissector_handle( dissect_dsdrsp, proto_docsis_dsdrsp ));
9756   dissector_add_uint ("docsis_mgmt", MGT_DCC_REQ, create_dissector_handle( dissect_dccreq, proto_docsis_dccreq ));
9757   dissector_add_uint ("docsis_mgmt", MGT_DCC_RSP, create_dissector_handle( dissect_dccrsp, proto_docsis_dccrsp ));
9758   dissector_add_uint ("docsis_mgmt", MGT_DCC_ACK, create_dissector_handle( dissect_dccack, proto_docsis_dccack ));
9759   dissector_add_uint ("docsis_mgmt", MGT_TYPE29UCD, create_dissector_handle( dissect_type29ucd, proto_docsis_type29ucd ));
9760   dissector_add_uint ("docsis_mgmt", MGT_INIT_RNG_REQ, create_dissector_handle( dissect_intrngreq, proto_docsis_intrngreq ));
9761   dissector_add_uint ("docsis_mgmt", MGT_DS_CH_DESC, create_dissector_handle( dissect_dcd, proto_docsis_dcd ));
9762   dissector_add_uint ("docsis_mgmt", MGT_MDD, create_dissector_handle( dissect_mdd, proto_docsis_mdd ));
9763   dissector_add_uint ("docsis_mgmt", MGT_B_INIT_RNG_REQ, create_dissector_handle( dissect_bintrngreq, proto_docsis_bintrngreq ));
9764   dissector_add_uint ("docsis_mgmt", MGT_TYPE35UCD, create_dissector_handle( dissect_type35ucd, proto_docsis_type35ucd ));
9765   dissector_add_uint ("docsis_mgmt", MGT_DBC_REQ, create_dissector_handle( dissect_dbcreq, proto_docsis_dbcreq ));
9766   dissector_add_uint ("docsis_mgmt", MGT_DBC_RSP, create_dissector_handle( dissect_dbcrsp, proto_docsis_dbcrsp ));
9767   dissector_add_uint ("docsis_mgmt", MGT_DBC_ACK, create_dissector_handle( dissect_dbcack, proto_docsis_dbcack ));
9768   dissector_add_uint ("docsis_mgmt", MGT_DPV_REQ, create_dissector_handle( dissect_dpvreq, proto_docsis_dpvreq ));
9769   dissector_add_uint ("docsis_mgmt", MGT_DPV_RSP, create_dissector_handle( dissect_dpvrsp, proto_docsis_dpvrsp ));
9770   dissector_add_uint ("docsis_mgmt", MGT_CM_STATUS, create_dissector_handle( dissect_cmstatus, proto_docsis_cmstatus ));
9771   dissector_add_uint ("docsis_mgmt", MGT_CM_STATUS_ACK, create_dissector_handle( dissect_cmstatusack, proto_docsis_cmstatusack ));
9772   dissector_add_uint ("docsis_mgmt", MGT_CM_CTRL_REQ, create_dissector_handle( dissect_cmctrlreq, proto_docsis_cmctrlreq ));
9773   dissector_add_uint ("docsis_mgmt", MGT_CM_CTRL_RSP, create_dissector_handle( dissect_cmctrlrsp, proto_docsis_cmctrlrsp ));
9774   dissector_add_uint ("docsis_mgmt", MGT_REG_REQ_MP, create_dissector_handle( dissect_regreqmp, proto_docsis_regreqmp ));
9775   dissector_add_uint ("docsis_mgmt", MGT_REG_RSP_MP, create_dissector_handle( dissect_regrspmp, proto_docsis_regrspmp ));
9776   dissector_add_uint ("docsis_mgmt", MGT_OCD, create_dissector_handle( dissect_ocd, proto_docsis_ocd ));
9777   dissector_add_uint ("docsis_mgmt", MGT_DPD, create_dissector_handle( dissect_dpd, proto_docsis_dpd ));
9778   dissector_add_uint ("docsis_mgmt", MGT_TYPE51UCD, create_dissector_handle( dissect_type51ucd, proto_docsis_type51ucd ));
9779   dissector_add_uint ("docsis_mgmt", MGT_OPT_REQ, create_dissector_handle( dissect_optreq, proto_docsis_optreq ));
9780   dissector_add_uint ("docsis_mgmt", MGT_OPT_RSP, create_dissector_handle( dissect_optrsp, proto_docsis_optrsp ));
9781   dissector_add_uint ("docsis_mgmt", MGT_OPT_ACK, create_dissector_handle( dissect_optack, proto_docsis_optack ));
9782
9783   docsis_tlv_handle = find_dissector ("docsis_tlv");
9784
9785   reassembly_table_register(&docsis_tlv_reassembly_table, &addresses_reassembly_table_functions);
9786   reassembly_table_register(&docsis_opt_tlv_reassembly_table, &addresses_reassembly_table_functions);
9787
9788 }
9789
9790 /*
9791  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
9792  *
9793  * Local Variables:
9794  * c-basic-offset: 2
9795  * tab-width: 8
9796  * indent-tabs-mode: nil
9797  * End:
9798  *
9799  * ex: set shiftwidth=2 tabstop=8 expandtab:
9800  * :indentSize=2:tabSize=8:noTabs=true:
9801  */