MSWSP: fix dissect_mswsp_smb()
[wireshark-wip.git] / plugins / docsis / packet-ucd.c
blob3622123c31db46432a904845496a2f76f07f0347
1 /* packet-ucd.c
2 * Routines for UCD Message dissection
3 * Copyright 2002, Anand V. Narwani <anand[AT]narwani.org>
5 * $Id$
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include "config.h"
28 #include <epan/packet.h>
29 #include <epan/exceptions.h>
31 #define UCD_SYMBOL_RATE 1
32 #define UCD_FREQUENCY 2
33 #define UCD_PREAMBLE 3
34 #define UCD_BURST_DESCR 4
35 #define UCD_BURST_DESCR5 5
37 #define UCD_MODULATION 1
38 #define UCD_DIFF_ENCODING 2
39 #define UCD_PREAMBLE_LEN 3
40 #define UCD_PREAMBLE_VAL_OFF 4
41 #define UCD_FEC 5
42 #define UCD_FEC_CODEWORD 6
43 #define UCD_SCRAMBLER_SEED 7
44 #define UCD_MAX_BURST 8
45 #define UCD_GUARD_TIME 9
46 #define UCD_LAST_CW_LEN 10
47 #define UCD_SCRAMBLER_ONOFF 11
48 #define UCD_RS_INT_DEPTH 12
49 #define UCD_RS_INT_BLOCK 13
50 #define UCD_PREAMBLE_TYPE 14
51 #define UCD_SCMDA_SCRAMBLER_ONOFF 15
52 #define UCD_SCDMA_CODES_PER_SUBFRAME 16
53 #define UCD_SCDMA_FRAMER_INT_STEP_SIZE 17
54 #define UCD_TCM_ENABLED 18
56 #define IUC_REQUEST 1
57 #define IUC_REQ_DATA 2
58 #define IUC_INIT_MAINT 3
59 #define IUC_STATION_MAINT 4
60 #define IUC_SHORT_DATA_GRANT 5
61 #define IUC_LONG_DATA_GRANT 6
62 #define IUC_NULL_IE 7
63 #define IUC_DATA_ACK 8
64 #define IUC_ADV_PHY_SHORT_DATA_GRANT 9
65 #define IUC_ADV_PHY_LONG_DATA_GRANT 10
66 #define IUC_ADV_PHY_UGS 11
67 #define IUC_RESERVED12 12
68 #define IUC_RESERVED13 13
69 #define IUC_RESERVED14 14
70 #define IUC_EXPANSION 15
72 /* Initialize the protocol and registered fields */
73 static int proto_docsis_ucd = -1;
75 static int hf_docsis_ucd_upstream_chid = -1;
76 static int hf_docsis_ucd_config_ch_cnt = -1;
77 static int hf_docsis_ucd_mini_slot_size = -1;
78 static int hf_docsis_ucd_down_chid = -1;
79 static int hf_docsis_ucd_type = -1;
80 static int hf_docsis_ucd_length = -1;
81 static int hf_docsis_ucd_symbol_rate = -1;
82 static int hf_docsis_ucd_frequency = -1;
83 static int hf_docsis_ucd_preamble_pat = -1;
84 static int hf_docsis_ucd_iuc = -1;
86 static int hf_docsis_burst_mod_type = -1;
87 static int hf_docsis_burst_diff_encoding = -1;
88 static int hf_docsis_burst_preamble_len = -1;
89 static int hf_docsis_burst_preamble_val_off = -1;
90 static int hf_docsis_burst_fec = -1;
91 static int hf_docsis_burst_fec_codeword = -1;
92 static int hf_docsis_burst_scrambler_seed = -1;
93 static int hf_docsis_burst_max_burst = -1;
94 static int hf_docsis_burst_guard_time = -1;
95 static int hf_docsis_burst_last_cw_len = -1;
96 static int hf_docsis_burst_scrambler_onoff = -1;
97 static int hf_docsis_rs_int_depth = -1;
98 static int hf_docsis_rs_int_block = -1;
99 static int hf_docsis_preamble_type = -1;
100 static int hf_docsis_scdma_scrambler_onoff = -1;
101 static int hf_docsis_scdma_codes_per_subframe = -1;
102 static int hf_docsis_scdma_framer_int_step_size = -1;
103 static int hf_docsis_tcm_enabled = -1;
105 /* Initialize the subtree pointers */
106 static gint ett_docsis_ucd = -1;
107 static gint ett_tlv = -1;
109 static const value_string channel_tlv_vals[] = {
110 {UCD_SYMBOL_RATE, "Symbol Rate"},
111 {UCD_FREQUENCY, "Frequency"},
112 {UCD_PREAMBLE, "Preamble Pattern"},
113 {UCD_BURST_DESCR, "Burst Descriptor"},
114 {UCD_BURST_DESCR5, "Burst Descriptor DOCSIS 2.0"},
115 {0, NULL}
118 static const value_string on_off_vals[] = {
119 {1, "On"},
120 {2, "Off"},
121 {0, NULL}
124 static const value_string mod_vals[] = {
125 {1, "QPSK"},
126 {2, "QAM16"},
127 {0, NULL}
130 value_string iuc_vals[] = {
131 {IUC_REQUEST, "Request"},
132 {IUC_REQ_DATA, "REQ/Data"},
133 {IUC_INIT_MAINT, "Initial Maintenance"},
134 {IUC_STATION_MAINT, "Station Maintenance"},
135 {IUC_SHORT_DATA_GRANT, "Short Data Grant"},
136 {IUC_LONG_DATA_GRANT, "Long Data Grant"},
137 {IUC_NULL_IE, "NULL IE"},
138 {IUC_DATA_ACK, "Data Ack"},
139 {IUC_ADV_PHY_SHORT_DATA_GRANT, "Advanced Phy Short Data Grant"},
140 {IUC_ADV_PHY_LONG_DATA_GRANT, "Advanced Phy Long Data Grant"},
141 {IUC_ADV_PHY_UGS, "Advanced Phy UGS"},
142 {IUC_RESERVED12, "Reserved"},
143 {IUC_RESERVED13, "Reserved"},
144 {IUC_RESERVED14, "Reserved"},
145 {IUC_EXPANSION, "Expanded IUC"},
146 {0, NULL}
150 static const value_string last_cw_len_vals[] = {
151 {1, "Fixed"},
152 {2, "Shortened"},
153 {0, NULL}
155 /* Code to actually dissect the packets */
156 static void
157 dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
159 int pos, endtlvpos;
160 guint8 type, length;
161 guint8 tlvlen, tlvtype;
162 proto_tree *ucd_tree;
163 proto_item *ucd_item;
164 proto_tree *tlv_tree;
165 proto_item *tlv_item;
166 gint len;
167 guint8 upchid, symrate;
169 len = tvb_reported_length_remaining (tvb, 0);
170 upchid = tvb_get_guint8 (tvb, 0);
172 /* if the upstream Channel ID is 0 then this is for Telephony Return) */
173 if (upchid > 0)
174 col_add_fstr (pinfo->cinfo, COL_INFO,
175 "UCD Message: Channel ID = %u (U%u)", upchid,
176 upchid - 1);
177 else
178 col_add_fstr (pinfo->cinfo, COL_INFO,
179 "UCD Message: Channel ID = %u (Telephony Return)",
180 upchid);
182 if (tree)
184 ucd_item =
185 proto_tree_add_protocol_format (tree, proto_docsis_ucd, tvb, 0, -1,
186 "UCD Message");
187 ucd_tree = proto_item_add_subtree (ucd_item, ett_docsis_ucd);
188 proto_tree_add_item (ucd_tree, hf_docsis_ucd_upstream_chid, tvb, 0, 1,
189 ENC_BIG_ENDIAN);
190 proto_tree_add_item (ucd_tree, hf_docsis_ucd_config_ch_cnt, tvb, 1, 1,
191 ENC_BIG_ENDIAN);
192 proto_tree_add_item (ucd_tree, hf_docsis_ucd_mini_slot_size, tvb, 2, 1,
193 ENC_BIG_ENDIAN);
194 proto_tree_add_item (ucd_tree, hf_docsis_ucd_down_chid, tvb, 3, 1,
195 ENC_BIG_ENDIAN);
197 pos = 4;
198 while (pos < len)
200 type = tvb_get_guint8 (tvb, pos);
201 tlv_item = proto_tree_add_text (ucd_tree, tvb, pos, -1,
202 "%s",
203 val_to_str(type, channel_tlv_vals,
204 "Unknown TLV (%u)"));
205 tlv_tree = proto_item_add_subtree (tlv_item, ett_tlv);
206 proto_tree_add_uint (tlv_tree, hf_docsis_ucd_type,
207 tvb, pos, 1, type);
208 pos++;
209 length = tvb_get_guint8 (tvb, pos);
210 proto_tree_add_uint (tlv_tree, hf_docsis_ucd_length,
211 tvb, pos, 1, length);
212 pos++;
213 proto_item_set_len(tlv_item, length + 2);
214 switch (type)
216 case UCD_SYMBOL_RATE:
217 if (length == 1)
219 symrate = tvb_get_guint8 (tvb, pos);
220 proto_tree_add_uint (tlv_tree, hf_docsis_ucd_symbol_rate,
221 tvb, pos, length, symrate * 160);
223 else
225 THROW (ReportedBoundsError);
227 pos = pos + length;
228 break;
229 case UCD_FREQUENCY:
230 if (length == 4)
232 proto_tree_add_item (tlv_tree, hf_docsis_ucd_frequency, tvb,
233 pos, length, ENC_BIG_ENDIAN);
234 pos = pos + length;
236 else
238 THROW (ReportedBoundsError);
240 break;
241 case UCD_PREAMBLE:
242 proto_tree_add_item (tlv_tree, hf_docsis_ucd_preamble_pat, tvb,
243 pos, length, ENC_NA);
244 pos = pos + length;
245 break;
246 case UCD_BURST_DESCR:
247 proto_tree_add_item (tlv_tree, hf_docsis_ucd_iuc, tvb,
248 pos++, 1, ENC_BIG_ENDIAN);
249 endtlvpos = pos + length - 1;
250 while (pos < endtlvpos)
252 tlvtype = tvb_get_guint8 (tvb, pos++);
253 tlvlen = tvb_get_guint8 (tvb, pos++);
254 switch (tlvtype)
256 case UCD_MODULATION:
257 if (tlvlen == 1)
259 proto_tree_add_item (tlv_tree,
260 hf_docsis_burst_mod_type, tvb,
261 pos, tlvlen, ENC_BIG_ENDIAN);
263 else
265 THROW (ReportedBoundsError);
267 break;
268 case UCD_DIFF_ENCODING:
269 if (tlvlen == 1)
271 proto_tree_add_item (tlv_tree,
272 hf_docsis_burst_diff_encoding,
273 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
275 else
277 THROW (ReportedBoundsError);
279 break;
280 case UCD_PREAMBLE_LEN:
281 if (tlvlen == 2)
283 proto_tree_add_item (tlv_tree,
284 hf_docsis_burst_preamble_len,
285 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
287 else
289 THROW (ReportedBoundsError);
291 break;
292 case UCD_PREAMBLE_VAL_OFF:
293 if (tlvlen == 2)
295 proto_tree_add_item (tlv_tree,
296 hf_docsis_burst_preamble_val_off,
297 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
299 else
301 THROW (ReportedBoundsError);
303 break;
304 case UCD_FEC:
305 if (tlvlen == 1)
307 proto_tree_add_item (tlv_tree,
308 hf_docsis_burst_fec, tvb, pos,
309 tlvlen, ENC_BIG_ENDIAN);
311 else
313 THROW (ReportedBoundsError);
315 break;
316 case UCD_FEC_CODEWORD:
317 if (tlvlen == 1)
319 proto_tree_add_item (tlv_tree,
320 hf_docsis_burst_fec_codeword,
321 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
323 else
325 THROW (ReportedBoundsError);
327 break;
328 case UCD_SCRAMBLER_SEED:
329 if (tlvlen == 2)
331 proto_tree_add_item (tlv_tree,
332 hf_docsis_burst_scrambler_seed,
333 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
335 else
337 THROW (ReportedBoundsError);
339 break;
340 case UCD_MAX_BURST:
341 if (tlvlen == 1)
343 proto_tree_add_item (tlv_tree,
344 hf_docsis_burst_max_burst, tvb,
345 pos, tlvlen, ENC_BIG_ENDIAN);
347 else
349 THROW (ReportedBoundsError);
351 break;
352 case UCD_GUARD_TIME:
353 if (tlvlen == 1)
355 proto_tree_add_item (tlv_tree,
356 hf_docsis_burst_guard_time,
357 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
359 else
361 THROW (ReportedBoundsError);
363 break;
364 case UCD_LAST_CW_LEN:
365 if (tlvlen == 1)
367 proto_tree_add_item (tlv_tree,
368 hf_docsis_burst_last_cw_len,
369 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
371 else
373 THROW (ReportedBoundsError);
375 break;
376 case UCD_SCRAMBLER_ONOFF:
377 if (tlvlen == 1)
379 proto_tree_add_item (tlv_tree,
380 hf_docsis_burst_scrambler_onoff,
381 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
383 else
385 THROW (ReportedBoundsError);
387 break;
388 } /* switch(tlvtype) */
389 pos = pos + tlvlen;
390 } /* while (pos < endtlvpos) */
391 break;
392 case UCD_BURST_DESCR5:
393 /* DOCSIS 2.0 Upstream Channel Descriptor */
394 proto_tree_add_item (tlv_tree, hf_docsis_ucd_iuc, tvb,
395 pos++, 1, ENC_BIG_ENDIAN);
396 endtlvpos = pos + length - 1;
397 while (pos < endtlvpos)
399 tlvtype = tvb_get_guint8 (tvb, pos++);
400 tlvlen = tvb_get_guint8 (tvb, pos++);
401 switch (tlvtype)
403 case UCD_MODULATION:
404 if (tlvlen == 1)
406 proto_tree_add_item (tlv_tree,
407 hf_docsis_burst_mod_type, tvb,
408 pos, tlvlen, ENC_BIG_ENDIAN);
410 else
412 THROW (ReportedBoundsError);
414 break;
415 case UCD_DIFF_ENCODING:
416 if (tlvlen == 1)
418 proto_tree_add_item (tlv_tree,
419 hf_docsis_burst_diff_encoding,
420 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
422 else
424 THROW (ReportedBoundsError);
426 break;
427 case UCD_PREAMBLE_LEN:
428 if (tlvlen == 2)
430 proto_tree_add_item (tlv_tree,
431 hf_docsis_burst_preamble_len,
432 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
434 else
436 THROW (ReportedBoundsError);
438 break;
439 case UCD_PREAMBLE_VAL_OFF:
440 if (tlvlen == 2)
442 proto_tree_add_item (tlv_tree,
443 hf_docsis_burst_preamble_val_off,
444 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
446 else
448 THROW (ReportedBoundsError);
450 break;
451 case UCD_FEC:
452 if (tlvlen == 1)
454 proto_tree_add_item (tlv_tree,
455 hf_docsis_burst_fec, tvb, pos,
456 tlvlen, ENC_BIG_ENDIAN);
458 else
460 THROW (ReportedBoundsError);
462 break;
463 case UCD_FEC_CODEWORD:
464 if (tlvlen == 1)
466 proto_tree_add_item (tlv_tree,
467 hf_docsis_burst_fec_codeword,
468 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
470 else
472 THROW (ReportedBoundsError);
474 break;
475 case UCD_SCRAMBLER_SEED:
476 if (tlvlen == 2)
478 proto_tree_add_item (tlv_tree,
479 hf_docsis_burst_scrambler_seed,
480 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
482 else
484 THROW (ReportedBoundsError);
486 break;
487 case UCD_MAX_BURST:
488 if (tlvlen == 1)
490 proto_tree_add_item (tlv_tree,
491 hf_docsis_burst_max_burst, tvb,
492 pos, tlvlen, ENC_BIG_ENDIAN);
494 else
496 THROW (ReportedBoundsError);
498 break;
499 case UCD_GUARD_TIME:
500 if (tlvlen == 1)
502 proto_tree_add_item (tlv_tree,
503 hf_docsis_burst_guard_time,
504 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
506 else
508 THROW (ReportedBoundsError);
510 break;
511 case UCD_LAST_CW_LEN:
512 if (tlvlen == 1)
514 proto_tree_add_item (tlv_tree,
515 hf_docsis_burst_last_cw_len,
516 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
518 else
520 THROW (ReportedBoundsError);
522 break;
523 case UCD_SCRAMBLER_ONOFF:
524 if (tlvlen == 1)
526 proto_tree_add_item (tlv_tree,
527 hf_docsis_burst_scrambler_onoff,
528 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
530 else
532 THROW (ReportedBoundsError);
534 break;
535 /* New cases added for DOCSIS 2.0 US Physical Burst Descriptor TLV */
536 /* #define UCD_RS_INT_DEPTH 12
537 * * #define UCD_RS_INT_BLOCK 13
538 * * #define UCD_PREAMBLE_TYPE 14
539 * * #define UCD_SCMDA_SCRAMBLER_ONOFF 15
540 * * #define UCD_SCDMA_CODES_PER_SUBFRAME 16
541 * * #define UCD_SCDMA_FRAMER_INT_STEP_SIZE 17
542 * * #define UCD_TCM_ENABLED 18
543 * */
544 case UCD_RS_INT_DEPTH:
545 if (tlvlen == 1)
547 proto_tree_add_item (tlv_tree,
548 hf_docsis_rs_int_depth,
549 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
551 else
553 THROW (ReportedBoundsError);
555 break;
556 case UCD_RS_INT_BLOCK:
557 if (tlvlen == 2)
559 proto_tree_add_item (tlv_tree,
560 hf_docsis_rs_int_block,
561 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
563 else
565 THROW (ReportedBoundsError);
567 break;
568 case UCD_PREAMBLE_TYPE:
569 if (tlvlen == 1)
571 proto_tree_add_item (tlv_tree,
572 hf_docsis_preamble_type,
573 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
575 else
577 THROW (ReportedBoundsError);
579 break;
580 case UCD_SCMDA_SCRAMBLER_ONOFF:
581 if (tlvlen == 1)
583 proto_tree_add_item (tlv_tree,
584 hf_docsis_scdma_scrambler_onoff,
585 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
587 else
589 THROW (ReportedBoundsError);
591 break;
592 case UCD_SCDMA_CODES_PER_SUBFRAME:
593 if (tlvlen == 1)
595 proto_tree_add_item (tlv_tree,
596 hf_docsis_scdma_codes_per_subframe,
597 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
599 else
601 THROW (ReportedBoundsError);
603 break;
604 case UCD_SCDMA_FRAMER_INT_STEP_SIZE:
605 if (tlvlen == 1)
607 proto_tree_add_item (tlv_tree,
608 hf_docsis_scdma_framer_int_step_size,
609 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
611 else
613 THROW (ReportedBoundsError);
615 break;
616 case UCD_TCM_ENABLED:
617 if (tlvlen == 1)
619 proto_tree_add_item (tlv_tree,
620 hf_docsis_tcm_enabled,
621 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
623 else
625 THROW (ReportedBoundsError);
627 break;
628 } /* switch(tlvtype) */
629 pos = pos + tlvlen;
630 } /* while (pos < endtlvpos) */
631 break;
632 } /* switch(type) */
633 } /* while (pos < len) */
634 } /* if (tree) */
638 /* Register the protocol with Wireshark */
640 /* this format is require because a script is used to build the C function
641 that calls all the protocol registration.
645 void
646 proto_register_docsis_ucd (void)
649 /* Setup list of header fields See Section 1.6.1 for details*/
650 static hf_register_info hf[] = {
651 {&hf_docsis_ucd_upstream_chid,
652 {"Upstream Channel ID", "docsis_ucd.upchid",
653 FT_UINT8, BASE_DEC, NULL, 0x0,
654 NULL, HFILL}
656 {&hf_docsis_ucd_config_ch_cnt,
657 {"Config Change Count", "docsis_ucd.confcngcnt",
658 FT_UINT8, BASE_DEC, NULL, 0x0,
659 "Configuration Change Count", HFILL}
661 {&hf_docsis_ucd_mini_slot_size,
662 {"Mini Slot Size (6.25us TimeTicks)", "docsis_ucd.mslotsize",
663 FT_UINT8, BASE_DEC, NULL, 0x0,
664 NULL, HFILL}
666 {&hf_docsis_ucd_down_chid,
667 {"Downstream Channel ID", "docsis_ucd.downchid",
668 FT_UINT8, BASE_DEC, NULL, 0x0,
669 "Management Message", HFILL}
671 {&hf_docsis_ucd_type,
672 {"TLV Type", "docsis_ucd.type",
673 FT_UINT8, BASE_DEC, VALS(channel_tlv_vals), 0x0,
674 "Channel TLV type", HFILL}
676 {&hf_docsis_ucd_length,
677 {"TLV Length", "docsis_ucd.length",
678 FT_UINT8, BASE_DEC, NULL, 0x0,
679 "Channel TLV length", HFILL}
681 {&hf_docsis_ucd_symbol_rate,
682 {"Symbol Rate (ksym/sec)", "docsis_ucd.symrate",
683 FT_UINT8, BASE_DEC, NULL, 0x0,
684 "Symbol Rate", HFILL}
686 {&hf_docsis_ucd_frequency,
687 {"Frequency (Hz)", "docsis_ucd.freq",
688 FT_UINT32, BASE_DEC, NULL, 0x0,
689 "Upstream Center Frequency", HFILL}
691 {&hf_docsis_ucd_preamble_pat,
692 {"Preamble Pattern", "docsis_ucd.preamble",
693 FT_BYTES, BASE_NONE, NULL, 0x0,
694 "Preamble Superstring", HFILL}
696 {&hf_docsis_ucd_iuc,
697 {"Interval Usage Code", "docsis_ucd.iuc",
698 FT_UINT8, BASE_DEC, VALS (iuc_vals), 0x0,
699 NULL, HFILL}
701 {&hf_docsis_burst_mod_type,
702 {"1 Modulation Type", "docsis_ucd.burst.modtype",
703 FT_UINT8, BASE_DEC, VALS (mod_vals), 0x0,
704 "Modulation Type", HFILL}
706 {&hf_docsis_burst_diff_encoding,
707 {"2 Differential Encoding", "docsis_ucd.burst.diffenc",
708 FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
709 "Differential Encoding", HFILL}
711 {&hf_docsis_burst_preamble_len,
712 {"3 Preamble Length (Bits)", "docsis_ucd.burst.preamble_len",
713 FT_UINT16, BASE_DEC, NULL, 0x0,
714 "Preamble Length (Bits)", HFILL}
716 {&hf_docsis_burst_preamble_val_off,
717 {"4 Preamble Offset (Bits)", "docsis_ucd.burst.preamble_off",
718 FT_UINT16, BASE_DEC, NULL, 0x0,
719 "Preamble Offset (Bits)", HFILL}
721 {&hf_docsis_burst_fec,
722 {"5 FEC (T)", "docsis_ucd.burst.fec",
723 FT_UINT8, BASE_DEC, NULL, 0x0,
724 "FEC (T) Codeword Parity Bits = 2^T", HFILL}
726 {&hf_docsis_burst_fec_codeword,
727 {"6 FEC Codeword Info bytes (k)", "docsis_ucd.burst.fec_codeword",
728 FT_UINT8, BASE_DEC, NULL, 0x0,
729 "FEC Codeword Info Bytes (k)", HFILL}
731 {&hf_docsis_burst_scrambler_seed,
732 {"7 Scrambler Seed", "docsis_ucd.burst.scrambler_seed",
733 FT_UINT16, BASE_HEX, NULL, 0x0,
734 "Burst Descriptor", HFILL}
736 {&hf_docsis_burst_max_burst,
737 {"8 Max Burst Size (Minislots)", "docsis_ucd.burst.maxburst",
738 FT_UINT8, BASE_DEC, NULL, 0x0,
739 "Max Burst Size (Minislots)", HFILL}
741 {&hf_docsis_burst_guard_time,
742 {"9 Guard Time Size (Symbol Times)", "docsis_ucd.burst.guardtime",
743 FT_UINT8, BASE_DEC, NULL, 0x0,
744 "Guard Time Size", HFILL}
746 {&hf_docsis_burst_last_cw_len,
747 {"10 Last Codeword Length", "docsis_ucd.burst.last_cw_len",
748 FT_UINT8, BASE_DEC, VALS (last_cw_len_vals), 0x0,
749 "Last Codeword Length", HFILL}
751 {&hf_docsis_burst_scrambler_onoff,
752 {"11 Scrambler On/Off", "docsis_ucd.burst.scrambleronoff",
753 FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
754 "Scrambler On/Off", HFILL}
756 {&hf_docsis_rs_int_depth,
757 {"12 RS Interleaver Depth", "docsis_ucd.burst.rsintdepth",
758 FT_UINT8, BASE_DEC, NULL, 0x0,
759 "R-S Interleaver Depth", HFILL}
761 {&hf_docsis_rs_int_block,
762 {"13 RS Interleaver Block Size", "docsis_ucd.burst.rsintblock",
763 FT_UINT8, BASE_DEC, NULL, 0x0,
764 "R-S Interleaver Block", HFILL}
766 {&hf_docsis_preamble_type,
767 {"14 Preamble Type", "docsis_ucd.burst.preambletype",
768 FT_UINT8, BASE_DEC, NULL, 0x0,
769 "Preamble Type", HFILL}
771 {&hf_docsis_scdma_scrambler_onoff,
772 {"15 SCDMA Scrambler On/Off", "docsis_ucd.burst.scdmascrambleronoff",
773 FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
774 "SCDMA Scrambler On/Off", HFILL}
776 {&hf_docsis_scdma_codes_per_subframe,
777 {"16 SCDMA Codes per Subframe", "docsis_ucd.burst.scdmacodespersubframe",
778 FT_UINT8, BASE_DEC, NULL, 0x0,
779 "SCDMA Codes per Subframe", HFILL}
781 {&hf_docsis_scdma_framer_int_step_size,
782 {"17 SDMA Framer Int Step Size", "docsis_ucd.burst.scdmaframerintstepsize",
783 FT_UINT8, BASE_DEC, NULL, 0x0,
784 "SCDMA Framer Interleaving Step Size", HFILL}
786 {&hf_docsis_tcm_enabled,
787 {"18 TCM Enable", "docsis_ucd.burst.tcmenabled",
788 FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
789 "TCM Enabled", HFILL}
793 /* Setup protocol subtree array */
794 static gint *ett[] = {
795 &ett_docsis_ucd,
796 &ett_tlv,
799 /* Register the protocol name and description */
800 proto_docsis_ucd =
801 proto_register_protocol ("DOCSIS Upstream Channel Descriptor",
802 "DOCSIS UCD", "docsis_ucd");
804 /* Required function calls to register the header fields and subtrees used */
805 proto_register_field_array (proto_docsis_ucd, hf, array_length (hf));
806 proto_register_subtree_array (ett, array_length (ett));
808 register_dissector ("docsis_ucd", dissect_ucd, proto_docsis_ucd);
812 /* If this dissector uses sub-dissector registration add a registration routine.
813 This format is required because a script is used to find these routines and
814 create the code that calls these routines.
816 void
817 proto_reg_handoff_docsis_ucd (void)
819 dissector_handle_t docsis_ucd_handle;
821 docsis_ucd_handle = find_dissector ("docsis_ucd");
822 dissector_add_uint ("docsis_mgmt", 0x02, docsis_ucd_handle);