MSWSP: fix dissect_mswsp_smb()
[wireshark-wip.git] / plugins / docsis / packet-type29ucd.c
blobe26abdff869829529a35b061375cf71daa75043a
1 /* packet-type29ucd.c
2 * Routines for Type 29 UCD - DOCSIS 2.0 only - Message dissection
3 * Copyright 2003, Brian Wheeler <brian.wheeler[AT]arrisi.com>
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 type29ucd_SYMBOL_RATE 1
32 #define type29ucd_FREQUENCY 2
33 #define type29ucd_PREAMBLE 3
34 #define type29ucd_BURST_DESCR 4
35 #define type29ucd_BURST_DESCR5 5
36 #define type29ucd_EXT_PREAMBLE 6
37 #define type29ucd_SCDMA_MODE_ENABLE 7
38 #define type29ucd_SCDMA_SPREADING_INTERVAL 8
39 #define type29ucd_SCDMA_CODES_PER_MINI_SLOT 9
40 #define type29ucd_SCDMA_ACTIVE_CODES 10
41 #define type29ucd_SCDMA_CODE_HOPPING_SEED 11
42 #define type29ucd_SCDMA_US_RATIO_NUM 12
43 #define type29ucd_SCDMA_US_RATIO_DENOM 13
44 #define type29ucd_SCDMA_TIMESTAMP_SNAPSHOT 14
45 #define type29ucd_MAINTAIN_POWER_SPECTRAL_DENSITY 15
46 #define type29ucd_RANGING_REQUIRED 16
48 #define type29ucd_MODULATION 1
49 #define type29ucd_DIFF_ENCODING 2
50 #define type29ucd_PREAMBLE_LEN 3
51 #define type29ucd_PREAMBLE_VAL_OFF 4
52 #define type29ucd_FEC 5
53 #define type29ucd_FEC_CODEWORD 6
54 #define type29ucd_SCRAMBLER_SEED 7
55 #define type29ucd_MAX_BURST 8
56 #define type29ucd_GUARD_TIME 9
57 #define type29ucd_LAST_CW_LEN 10
58 #define type29ucd_SCRAMBLER_ONOFF 11
59 #define type29ucd_RS_INT_DEPTH 12
60 #define type29ucd_RS_INT_BLOCK 13
61 #define type29ucd_PREAMBLE_TYPE 14
62 #define type29ucd_SCMDA_SCRAMBLER_ONOFF 15
63 #define type29ucd_SCDMA_CODES_PER_SUBFRAME 16
64 #define type29ucd_SCDMA_FRAMER_INT_STEP_SIZE 17
65 #define type29ucd_TCM_ENABLED 18
67 #define IUC_REQUEST 1
68 #define IUC_REQ_DATA 2
69 #define IUC_INIT_MAINT 3
70 #define IUC_STATION_MAINT 4
71 #define IUC_SHORT_DATA_GRANT 5
72 #define IUC_LONG_DATA_GRANT 6
73 #define IUC_NULL_IE 7
74 #define IUC_DATA_ACK 8
75 #define IUC_ADV_PHY_SHORT_DATA_GRANT 9
76 #define IUC_ADV_PHY_LONG_DATA_GRANT 10
77 #define IUC_ADV_PHY_UGS 11
78 #define IUC_RESERVED12 12
79 #define IUC_RESERVED13 13
80 #define IUC_RESERVED14 14
81 #define IUC_EXPANSION 15
83 /* Initialize the protocol and registered fields */
84 static int proto_docsis_type29ucd = -1;
86 static int hf_docsis_type29ucd_upstream_chid = -1;
87 static int hf_docsis_type29ucd_config_ch_cnt = -1;
88 static int hf_docsis_type29ucd_mini_slot_size = -1;
89 static int hf_docsis_type29ucd_down_chid = -1;
90 static int hf_docsis_type29ucd_symbol_rate = -1;
91 static int hf_docsis_type29ucd_frequency = -1;
92 static int hf_docsis_type29ucd_preamble_pat = -1;
93 static int hf_docsis_type29ucd_iuc = -1;
94 static int hf_docsis_type29ucd_ext_preamble = -1;
95 static int hf_docsis_type29ucd_scdma_mode_enable = -1;
96 static int hf_docsis_type29ucd_scdma_spreading_interval = -1;
97 static int hf_docsis_type29ucd_scdma_codes_per_mini_slot = -1;
98 static int hf_docsis_type29ucd_scdma_active_codes = -1;
99 static int hf_docsis_type29ucd_scdma_code_hopping_seed = -1;
100 static int hf_docsis_type29ucd_scdma_us_ratio_num = -1;
101 static int hf_docsis_type29ucd_scdma_us_ratio_denom = -1;
102 static int hf_docsis_type29ucd_scdma_timestamp_snapshot = -1;
103 static int hf_docsis_type29ucd_maintain_power_spectral_density = -1;
104 static int hf_docsis_type29ucd_ranging_required = -1;
106 static int hf_docsis_burst_mod_type = -1;
107 static int hf_docsis_burst_diff_encoding = -1;
108 static int hf_docsis_burst_preamble_len = -1;
109 static int hf_docsis_burst_preamble_val_off = -1;
110 static int hf_docsis_burst_fec = -1;
111 static int hf_docsis_burst_fec_codeword = -1;
112 static int hf_docsis_burst_scrambler_seed = -1;
113 static int hf_docsis_burst_max_burst = -1;
114 static int hf_docsis_burst_guard_time = -1;
115 static int hf_docsis_burst_last_cw_len = -1;
116 static int hf_docsis_burst_scrambler_onoff = -1;
117 static int hf_docsis_rs_int_depth = -1;
118 static int hf_docsis_rs_int_block = -1;
119 static int hf_docsis_preamble_type = -1;
120 static int hf_docsis_scdma_scrambler_onoff = -1;
121 static int hf_docsis_scdma_codes_per_subframe = -1;
122 static int hf_docsis_scdma_framer_int_step_size = -1;
123 static int hf_docsis_tcm_enabled = -1;
126 /* Initialize the subtree pointers */
127 static gint ett_docsis_type29ucd = -1;
128 static gint ett_burst_descr = -1;
130 static const value_string channel_tlv_vals[] _U_ = {
131 {type29ucd_SYMBOL_RATE, "Symbol Rate"},
132 {type29ucd_FREQUENCY, "Frequency"},
133 {type29ucd_PREAMBLE, "Preamble Pattern"},
134 {type29ucd_BURST_DESCR, "Burst Descriptor"},
135 {type29ucd_BURST_DESCR5, "Burst Descriptor DOCSIS 2.0"},
136 {type29ucd_EXT_PREAMBLE, "Extended Preamble Pattern"},
137 {type29ucd_SCDMA_MODE_ENABLE, "SCDMA Mode Enabled"},
138 {type29ucd_SCDMA_SPREADING_INTERVAL, "SCDMA Spreading Intervals per Frame"},
139 {type29ucd_SCDMA_CODES_PER_MINI_SLOT, "SCDMA Codes per Mini-slot"},
140 {type29ucd_SCDMA_ACTIVE_CODES, "SCDMA Number of Active Codes"},
141 {type29ucd_SCDMA_CODE_HOPPING_SEED, "SCDMA Code Hopping Seed"},
142 {type29ucd_SCDMA_US_RATIO_NUM, "SCDMA US ratio numerator M"},
143 {type29ucd_SCDMA_US_RATIO_DENOM, "SCDMA US ratio denominator N"},
144 {type29ucd_SCDMA_TIMESTAMP_SNAPSHOT, "SCDMA Timestamp Snapshot"},
145 {type29ucd_MAINTAIN_POWER_SPECTRAL_DENSITY, "Maintain Power Spectral Density"},
146 {type29ucd_RANGING_REQUIRED, "Ranging Required"},
147 {0, NULL}
150 static const value_string on_off_vals[] = {
151 {1, "On"},
152 {2, "Off"},
153 {0, NULL}
156 static const value_string mod_vals2[] = {
157 {1, "QPSK"},
158 {2, "QAM16"},
159 {3, "QAM8"},
160 {4, "QAM32"},
161 {5, "QAM64"},
162 {6, "QAM128 (S-CDMA)"},
163 {0, NULL}
166 value_string iuc_vals2[] = {
167 {IUC_REQUEST, "Request"},
168 {IUC_REQ_DATA, "REQ/Data"},
169 {IUC_INIT_MAINT, "Initial Maintenance"},
170 {IUC_STATION_MAINT, "Station Maintenance"},
171 {IUC_SHORT_DATA_GRANT, "Short Data Grant"},
172 {IUC_LONG_DATA_GRANT, "Long Data Grant"},
173 {IUC_NULL_IE, "NULL IE"},
174 {IUC_DATA_ACK, "Data Ack"},
175 {IUC_ADV_PHY_SHORT_DATA_GRANT, "Advanced Phy Short Data Grant"},
176 {IUC_ADV_PHY_LONG_DATA_GRANT, "Advanced Phy Long Data Grant"},
177 {IUC_ADV_PHY_UGS, "Advanced Phy UGS"},
178 {IUC_RESERVED12, "Reserved 12"},
179 {IUC_RESERVED13, "Reserved 13"},
180 {IUC_RESERVED14, "Reserved 14"},
181 {IUC_EXPANSION, "IUC Expansion"},
182 {0, NULL}
185 static const value_string last_cw_len_vals[] = {
186 {1, "Fixed"},
187 {2, "Shortened"},
188 {0, NULL}
190 /* Code to actually dissect the packets */
191 static void
192 dissect_type29ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
194 guint16 pos, endtlvpos;
195 guint8 type, length;
196 guint8 tlvlen, tlvtype;
197 proto_tree *burst_descr_tree;
198 proto_item *it;
199 proto_tree *type29ucd_tree;
200 proto_item *type29ucd_item;
201 guint16 len;
202 guint8 upchid, symrate;
204 len = tvb_length_remaining (tvb, 0);
205 upchid = tvb_get_guint8 (tvb, 0);
207 /* if the upstream Channel ID is 0 then this is for Telephony Return) */
208 if (upchid > 0)
209 col_add_fstr (pinfo->cinfo, COL_INFO,
210 "type29ucd Message: Channel ID = %u (U%u)", upchid,
211 upchid - 1);
212 else
213 col_add_fstr (pinfo->cinfo, COL_INFO,
214 "type29ucd Message: Channel ID = %u (Telephony Return)",
215 upchid);
217 if (tree)
219 type29ucd_item =
220 proto_tree_add_protocol_format (tree, proto_docsis_type29ucd, tvb, 0,
221 tvb_length_remaining (tvb, 0),
222 "type29ucd Message");
223 type29ucd_tree = proto_item_add_subtree (type29ucd_item, ett_docsis_type29ucd);
224 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_upstream_chid, tvb, 0, 1,
225 ENC_BIG_ENDIAN);
226 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_config_ch_cnt, tvb, 1, 1,
227 ENC_BIG_ENDIAN);
228 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_mini_slot_size, tvb, 2, 1,
229 ENC_BIG_ENDIAN);
230 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_down_chid, tvb, 3, 1,
231 ENC_BIG_ENDIAN);
233 pos = 4;
234 while (pos < len)
236 type = tvb_get_guint8 (tvb, pos++);
237 length = tvb_get_guint8 (tvb, pos++);
238 switch (type)
240 case type29ucd_SYMBOL_RATE:
241 if (length == 1)
243 symrate = tvb_get_guint8 (tvb, pos);
244 proto_tree_add_uint (type29ucd_tree, hf_docsis_type29ucd_symbol_rate,
245 tvb, pos, length, symrate * 160);
247 else
249 THROW (ReportedBoundsError);
251 pos = pos + length;
252 break;
253 case type29ucd_FREQUENCY:
254 if (length == 4)
256 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_frequency, tvb,
257 pos, length, ENC_BIG_ENDIAN);
258 pos = pos + length;
260 else
262 THROW (ReportedBoundsError);
264 break;
265 case type29ucd_PREAMBLE:
266 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_preamble_pat, tvb,
267 pos, length, ENC_NA);
268 pos = pos + length;
269 break;
270 /* DOCSIS 2.0 UCD TLV definitions
271 * #define type29ucd_EXT_PREAMBLE 6
272 * #define type29ucd_SCDMA_MODE_ENABLE 7
273 * #define type29ucd_SCDMA_SPREADING_INTERVAL 8
274 * #define type29ucd_SCDMA_CODES_PER_MINI_SLOT 9
275 * #define type29ucd_SCDMA_ACTIVE_CODES 10
276 * #define type29ucd_SCDMA_CODE_HOPPING_SEED 11
277 * #define type29ucd_SCDMA_US_RATIO_NUM 12
278 * #define type29ucd_SCDMA_US_RATIO_DENOM 13
279 * #define type29ucd_SCDMA_TIMESTAMP_SNAPSHOT 14
280 * #define type29ucd_MAINTAIN_POWER_SPECTRAL_DENSITY 15
281 * #define type29ucd_RANGING_REQUIRED 16
283 case type29ucd_EXT_PREAMBLE:
284 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_ext_preamble, tvb,
285 pos, length, ENC_NA);
286 pos = pos + length;
287 break;
288 case type29ucd_SCDMA_MODE_ENABLE:
289 if (length == 1)
291 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_scdma_mode_enable,
292 tvb, pos, length, ENC_NA);
294 else
296 THROW (ReportedBoundsError);
298 pos = pos + length;
299 break;
300 case type29ucd_SCDMA_SPREADING_INTERVAL:
301 if (length == 1)
303 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_scdma_spreading_interval,
304 tvb, pos, length, ENC_NA);
306 else
308 THROW (ReportedBoundsError);
310 pos = pos + length;
311 break;
312 case type29ucd_SCDMA_CODES_PER_MINI_SLOT:
313 if (length == 1)
315 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_scdma_codes_per_mini_slot,
316 tvb, pos, length, ENC_NA);
318 else
320 THROW (ReportedBoundsError);
322 pos = pos + length;
323 break;
324 case type29ucd_SCDMA_ACTIVE_CODES:
325 if (length == 1)
327 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_scdma_active_codes,
328 tvb, pos, length, ENC_NA);
330 else
332 THROW (ReportedBoundsError);
334 pos = pos + length;
335 break;
336 case type29ucd_SCDMA_CODE_HOPPING_SEED:
337 if (length == 2)
339 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_scdma_code_hopping_seed,
340 tvb, pos, length, ENC_NA);
342 else
344 THROW (ReportedBoundsError);
346 pos = pos + length;
347 break;
348 case type29ucd_SCDMA_US_RATIO_NUM:
349 if (length == 2)
351 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_scdma_us_ratio_num,
352 tvb, pos, length, ENC_NA);
354 else
356 THROW (ReportedBoundsError);
358 pos = pos + length;
359 break;
360 case type29ucd_SCDMA_US_RATIO_DENOM:
361 if (length == 2)
363 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_scdma_us_ratio_denom,
364 tvb, pos, length, ENC_NA);
366 else
368 THROW (ReportedBoundsError);
370 pos = pos + length;
371 break;
372 case type29ucd_SCDMA_TIMESTAMP_SNAPSHOT:
373 if (length == 9)
375 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_scdma_timestamp_snapshot,
376 tvb, pos, length, ENC_NA);
378 else
380 THROW (ReportedBoundsError);
382 pos = pos + length;
383 break;
384 case type29ucd_MAINTAIN_POWER_SPECTRAL_DENSITY:
385 if (length == 1)
387 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_maintain_power_spectral_density,
388 tvb, pos, length, ENC_NA);
390 else
392 THROW (ReportedBoundsError);
394 pos = pos + length;
395 break;
396 case type29ucd_RANGING_REQUIRED:
397 if (length == 1)
399 proto_tree_add_item (type29ucd_tree, hf_docsis_type29ucd_ranging_required,
400 tvb, pos, length, ENC_NA);
402 else
404 THROW (ReportedBoundsError);
406 pos = pos + length;
407 break;
408 /* DOCSIS 1.1 BURST DESCRIPTOR */
409 case type29ucd_BURST_DESCR:
410 it =
411 proto_tree_add_text (type29ucd_tree, tvb, pos, length,
412 "4 Burst Descriptor (Length = %u)",
413 length);
414 burst_descr_tree = proto_item_add_subtree (it, ett_burst_descr);
415 proto_tree_add_item (burst_descr_tree, hf_docsis_type29ucd_iuc, tvb,
416 pos++, 1, ENC_BIG_ENDIAN);
417 endtlvpos = pos + length - 1;
418 while (pos < endtlvpos)
420 tlvtype = tvb_get_guint8 (tvb, pos++);
421 tlvlen = tvb_get_guint8 (tvb, pos++);
422 switch (tlvtype)
424 case type29ucd_MODULATION:
425 if (tlvlen == 1)
427 proto_tree_add_item (burst_descr_tree,
428 hf_docsis_burst_mod_type, tvb,
429 pos, tlvlen, ENC_BIG_ENDIAN);
431 else
433 THROW (ReportedBoundsError);
435 break;
436 case type29ucd_DIFF_ENCODING:
437 if (tlvlen == 1)
439 proto_tree_add_item (burst_descr_tree,
440 hf_docsis_burst_diff_encoding,
441 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
443 else
445 THROW (ReportedBoundsError);
447 break;
448 case type29ucd_PREAMBLE_LEN:
449 if (tlvlen == 2)
451 proto_tree_add_item (burst_descr_tree,
452 hf_docsis_burst_preamble_len,
453 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
455 else
457 THROW (ReportedBoundsError);
459 break;
460 case type29ucd_PREAMBLE_VAL_OFF:
461 if (tlvlen == 2)
463 proto_tree_add_item (burst_descr_tree,
464 hf_docsis_burst_preamble_val_off,
465 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
467 else
469 THROW (ReportedBoundsError);
471 break;
472 case type29ucd_FEC:
473 if (tlvlen == 1)
475 proto_tree_add_item (burst_descr_tree,
476 hf_docsis_burst_fec, tvb, pos,
477 tlvlen, ENC_BIG_ENDIAN);
479 else
481 THROW (ReportedBoundsError);
483 break;
484 case type29ucd_FEC_CODEWORD:
485 if (tlvlen == 1)
487 proto_tree_add_item (burst_descr_tree,
488 hf_docsis_burst_fec_codeword,
489 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
491 else
493 THROW (ReportedBoundsError);
495 break;
496 case type29ucd_SCRAMBLER_SEED:
497 if (tlvlen == 2)
499 proto_tree_add_item (burst_descr_tree,
500 hf_docsis_burst_scrambler_seed,
501 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
503 else
505 THROW (ReportedBoundsError);
507 break;
508 case type29ucd_MAX_BURST:
509 if (tlvlen == 1)
511 proto_tree_add_item (burst_descr_tree,
512 hf_docsis_burst_max_burst, tvb,
513 pos, tlvlen, ENC_BIG_ENDIAN);
515 else
517 THROW (ReportedBoundsError);
519 break;
520 case type29ucd_GUARD_TIME:
521 if (tlvlen == 1)
523 proto_tree_add_item (burst_descr_tree,
524 hf_docsis_burst_guard_time,
525 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
527 else
529 THROW (ReportedBoundsError);
531 break;
532 case type29ucd_LAST_CW_LEN:
533 if (tlvlen == 1)
535 proto_tree_add_item (burst_descr_tree,
536 hf_docsis_burst_last_cw_len,
537 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
539 else
541 THROW (ReportedBoundsError);
543 break;
544 case type29ucd_SCRAMBLER_ONOFF:
545 if (tlvlen == 1)
547 proto_tree_add_item (burst_descr_tree,
548 hf_docsis_burst_scrambler_onoff,
549 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
551 else
553 THROW (ReportedBoundsError);
555 break;
556 } /* switch(tlvtype) */
557 pos = pos + tlvlen;
558 } /* while (pos < endtlvpos) */
559 break;
560 /* DOCSIS 2.0 Upstream Channel Descriptor */
561 case type29ucd_BURST_DESCR5:
562 it =
563 proto_tree_add_text (type29ucd_tree, tvb, pos, length,
564 "5 Burst Descriptor (Length = %u)",
565 length);
566 burst_descr_tree = proto_item_add_subtree (it, ett_burst_descr);
567 proto_tree_add_item (burst_descr_tree, hf_docsis_type29ucd_iuc, tvb,
568 pos++, 1, ENC_BIG_ENDIAN);
569 endtlvpos = pos + length - 1;
570 while (pos < endtlvpos)
572 tlvtype = tvb_get_guint8 (tvb, pos++);
573 tlvlen = tvb_get_guint8 (tvb, pos++);
574 switch (tlvtype)
576 case type29ucd_MODULATION:
577 if (tlvlen == 1)
579 proto_tree_add_item (burst_descr_tree,
580 hf_docsis_burst_mod_type, tvb,
581 pos, tlvlen, ENC_BIG_ENDIAN);
583 else
585 THROW (ReportedBoundsError);
587 break;
588 case type29ucd_DIFF_ENCODING:
589 if (tlvlen == 1)
591 proto_tree_add_item (burst_descr_tree,
592 hf_docsis_burst_diff_encoding,
593 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
595 else
597 THROW (ReportedBoundsError);
599 break;
600 case type29ucd_PREAMBLE_LEN:
601 if (tlvlen == 2)
603 proto_tree_add_item (burst_descr_tree,
604 hf_docsis_burst_preamble_len,
605 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
607 else
609 THROW (ReportedBoundsError);
611 break;
612 case type29ucd_PREAMBLE_VAL_OFF:
613 if (tlvlen == 2)
615 proto_tree_add_item (burst_descr_tree,
616 hf_docsis_burst_preamble_val_off,
617 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
619 else
621 THROW (ReportedBoundsError);
623 break;
624 case type29ucd_FEC:
625 if (tlvlen == 1)
627 proto_tree_add_item (burst_descr_tree,
628 hf_docsis_burst_fec, tvb, pos,
629 tlvlen, ENC_BIG_ENDIAN);
631 else
633 THROW (ReportedBoundsError);
635 break;
636 case type29ucd_FEC_CODEWORD:
637 if (tlvlen == 1)
639 proto_tree_add_item (burst_descr_tree,
640 hf_docsis_burst_fec_codeword,
641 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
643 else
645 THROW (ReportedBoundsError);
647 break;
648 case type29ucd_SCRAMBLER_SEED:
649 if (tlvlen == 2)
651 proto_tree_add_item (burst_descr_tree,
652 hf_docsis_burst_scrambler_seed,
653 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
655 else
657 THROW (ReportedBoundsError);
659 break;
660 case type29ucd_MAX_BURST:
661 if (tlvlen == 1)
663 proto_tree_add_item (burst_descr_tree,
664 hf_docsis_burst_max_burst, tvb,
665 pos, tlvlen, ENC_BIG_ENDIAN);
667 else
669 THROW (ReportedBoundsError);
671 break;
672 case type29ucd_GUARD_TIME:
673 if (tlvlen == 1)
675 proto_tree_add_item (burst_descr_tree,
676 hf_docsis_burst_guard_time,
677 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
679 else
681 THROW (ReportedBoundsError);
683 break;
684 case type29ucd_LAST_CW_LEN:
685 if (tlvlen == 1)
687 proto_tree_add_item (burst_descr_tree,
688 hf_docsis_burst_last_cw_len,
689 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
691 else
693 THROW (ReportedBoundsError);
695 break;
696 case type29ucd_SCRAMBLER_ONOFF:
697 if (tlvlen == 1)
699 proto_tree_add_item (burst_descr_tree,
700 hf_docsis_burst_scrambler_onoff,
701 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
703 else
705 THROW (ReportedBoundsError);
707 break;
708 /* New cases added for DOCSIS 2.0 US Physical Burst Descriptor TLV */
709 /* #define type29ucd_RS_INT_DEPTH 12
710 * #define type29ucd_RS_INT_BLOCK 13
711 * #define type29ucd_PREAMBLE_TYPE 14
712 * #define type29ucd_SCMDA_SCRAMBLER_ONOFF 15
713 * #define type29ucd_SCDMA_CODES_PER_SUBFRAME 16
714 * #define type29ucd_SCDMA_FRAMER_INT_STEP_SIZE 17
715 * #define type29ucd_TCM_ENABLED 18
717 case type29ucd_RS_INT_DEPTH:
718 if (tlvlen == 1)
720 proto_tree_add_item (burst_descr_tree,
721 hf_docsis_rs_int_depth,
722 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
724 else
726 THROW (ReportedBoundsError);
728 break;
729 case type29ucd_RS_INT_BLOCK:
730 if (tlvlen == 2)
732 proto_tree_add_item (burst_descr_tree,
733 hf_docsis_rs_int_block,
734 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
736 else
738 THROW (ReportedBoundsError);
740 break;
741 case type29ucd_PREAMBLE_TYPE:
742 if (tlvlen == 1)
744 proto_tree_add_item (burst_descr_tree,
745 hf_docsis_preamble_type,
746 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
748 else
750 THROW (ReportedBoundsError);
752 break;
753 case type29ucd_SCMDA_SCRAMBLER_ONOFF:
754 if (tlvlen == 1)
756 proto_tree_add_item (burst_descr_tree,
757 hf_docsis_scdma_scrambler_onoff,
758 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
760 else
762 THROW (ReportedBoundsError);
764 break;
765 case type29ucd_SCDMA_CODES_PER_SUBFRAME:
766 if (tlvlen == 1)
768 proto_tree_add_item (burst_descr_tree,
769 hf_docsis_scdma_codes_per_subframe,
770 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
772 else
774 THROW (ReportedBoundsError);
776 break;
777 case type29ucd_SCDMA_FRAMER_INT_STEP_SIZE:
778 if (tlvlen == 1)
780 proto_tree_add_item (burst_descr_tree,
781 hf_docsis_scdma_framer_int_step_size,
782 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
784 else
786 THROW (ReportedBoundsError);
788 break;
789 case type29ucd_TCM_ENABLED:
790 if (tlvlen == 1)
792 proto_tree_add_item (burst_descr_tree,
793 hf_docsis_tcm_enabled,
794 tvb, pos, tlvlen, ENC_BIG_ENDIAN);
796 else
798 THROW (ReportedBoundsError);
800 break;
801 /* End of DOCSIS 2.0 US burst Descriptor Changes */
802 } /* switch(tlvtype) */
803 pos = pos + tlvlen;
804 } /* while (pos < endtlvpos) */
805 break;
806 } /* switch(type) */
807 } /* while (pos < len) */
808 } /* if (tree) */
812 /* Register the protocol with Wireshark */
814 /* this format is require because a script is used to build the C function
815 that calls all the protocol registration.
819 void
820 proto_register_docsis_type29ucd (void)
823 /* Setup list of header fields See Section 1.6.1 for details*/
824 static hf_register_info hf[] = {
825 {&hf_docsis_type29ucd_upstream_chid,
826 {"Upstream Channel ID", "docsis_type29ucd.upchid",
827 FT_UINT8, BASE_DEC, NULL, 0x0,
828 NULL, HFILL}
830 {&hf_docsis_type29ucd_config_ch_cnt,
831 {"Config Change Count", "docsis_type29ucd.confcngcnt",
832 FT_UINT8, BASE_DEC, NULL, 0x0,
833 "Configuration Change Count", HFILL}
835 {&hf_docsis_type29ucd_mini_slot_size,
836 {"Mini Slot Size (6.25us TimeTicks)", "docsis_type29ucd.mslotsize",
837 FT_UINT8, BASE_DEC, NULL, 0x0,
838 NULL, HFILL}
840 {&hf_docsis_type29ucd_down_chid,
841 {"Downstream Channel ID", "docsis_type29ucd.downchid",
842 FT_UINT8, BASE_DEC, NULL, 0x0,
843 "Management Message", HFILL}
845 {&hf_docsis_type29ucd_symbol_rate,
846 {"1 Symbol Rate (ksym/sec)", "docsis_type29ucd.symrate",
847 FT_UINT8, BASE_DEC, NULL, 0x0,
848 "Symbol Rate", HFILL}
850 {&hf_docsis_type29ucd_frequency,
851 {"2 Frequency (Hz)", "docsis_type29ucd.freq",
852 FT_UINT32, BASE_DEC, NULL, 0x0,
853 "Upstream Center Frequency", HFILL}
855 {&hf_docsis_type29ucd_preamble_pat,
856 {"3 Preamble Pattern", "docsis_type29ucd.preamble",
857 FT_BYTES, BASE_NONE, NULL, 0x0,
858 "Preamble Superstring", HFILL}
860 {&hf_docsis_type29ucd_iuc,
861 {"Interval Usage Code", "docsis_type29ucd.iuc",
862 FT_UINT8, BASE_DEC, VALS (iuc_vals2), 0x0,
863 NULL, HFILL}
865 {&hf_docsis_burst_mod_type,
866 {"1 Modulation Type", "docsis_type29ucd.burst.modtype",
867 FT_UINT8, BASE_DEC, VALS (mod_vals2), 0x0,
868 "Modulation Type", HFILL}
870 {&hf_docsis_burst_diff_encoding,
871 {"2 Differential Encoding", "docsis_type29ucd.burst.diffenc",
872 FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
873 "Differential Encoding", HFILL}
875 {&hf_docsis_burst_preamble_len,
876 {"3 Preamble Length (Bits)", "docsis_type29ucd.burst.preamble_len",
877 FT_UINT16, BASE_DEC, NULL, 0x0,
878 "Preamble Length (Bits)", HFILL}
880 {&hf_docsis_burst_preamble_val_off,
881 {"4 Preamble Offset (Bits)", "docsis_type29ucd.burst.preamble_off",
882 FT_UINT16, BASE_DEC, NULL, 0x0,
883 "Preamble Offset (Bits)", HFILL}
885 {&hf_docsis_burst_fec,
886 {"5 FEC (T)", "docsis_type29ucd.burst.fec",
887 FT_UINT8, BASE_DEC, NULL, 0x0,
888 "FEC (T) Codeword Parity Bits = 2^T", HFILL}
890 {&hf_docsis_burst_fec_codeword,
891 {"6 FEC Codeword Info bytes (k)", "docsis_type29ucd.burst.fec_codeword",
892 FT_UINT8, BASE_DEC, NULL, 0x0,
893 "FEC Codeword Info Bytes (k)", HFILL}
895 {&hf_docsis_burst_scrambler_seed,
896 {"7 Scrambler Seed", "docsis_type29ucd.burst.scrambler_seed",
897 FT_UINT16, BASE_HEX, NULL, 0x0,
898 "Burst Descriptor", HFILL}
900 {&hf_docsis_burst_max_burst,
901 {"8 Max Burst Size (Minislots)", "docsis_type29ucd.burst.maxburst",
902 FT_UINT8, BASE_DEC, NULL, 0x0,
903 "Max Burst Size (Minislots)", HFILL}
905 {&hf_docsis_burst_guard_time,
906 {"9 Guard Time Size (Symbol Times)", "docsis_type29ucd.burst.guardtime",
907 FT_UINT8, BASE_DEC, NULL, 0x0,
908 "Guard Time Size", HFILL}
910 {&hf_docsis_burst_last_cw_len,
911 {"10 Last Codeword Length", "docsis_type29ucd.burst.last_cw_len",
912 FT_UINT8, BASE_DEC, VALS (last_cw_len_vals), 0x0,
913 "Last Codeword Length", HFILL}
915 {&hf_docsis_burst_scrambler_onoff,
916 {"11 Scrambler On/Off", "docsis_type29ucd.burst.scrambleronoff",
917 FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
918 "Scrambler On/Off", HFILL}
920 /* DOCSIS 2.0 UCD TLV definitions
921 * * #define type29ucd_EXT_PREAMBLE 6
922 * * #define type29ucd_SCDMA_MODE_ENABLE 7
923 * * #define type29ucd_SCDMA_SPREADING_INTERVAL 8
924 * * #define type29ucd_SCDMA_CODES_PER_MINI_SLOT 9
925 * * #define type29ucd_SCDMA_ACTIVE_CODES 10
926 * * #define type29ucd_SCDMA_CODE_HOPPING_SEED 11
927 * * #define type29ucd_SCDMA_US_RATIO_NUM 12
928 * * #define type29ucd_SCDMA_US_RATIO_DENOM 13
929 * * #define type29ucd_SCDMA_TIMESTAMP_SNAPSHOT 14
930 * * #define type29ucd_MAINTAIN_POWER_SPECTRAL_DENSITY 15
931 * * #define type29ucd_RANGING_REQUIRED 16
932 * */
933 {&hf_docsis_type29ucd_ext_preamble,
934 {"6 Extended Preamble Pattern", "docsis_type29ucd.extpreamble",
935 FT_BYTES, BASE_NONE, NULL, 0x0,
936 "Extended Preamble Pattern", HFILL}
938 {&hf_docsis_type29ucd_scdma_mode_enable,
939 {"7 SCDMA Mode Enable", "docsis_type29ucd.scdmaenable",
940 FT_BYTES, BASE_NONE, NULL, 0x0,
941 "SCDMA Mode Enable", HFILL}
943 {&hf_docsis_type29ucd_scdma_spreading_interval,
944 {"8 SCDMA Spreading Interval", "docsis_type29ucd.scdmaspreadinginterval",
945 FT_BYTES, BASE_NONE, NULL, 0x0,
946 "SCDMA Spreading Interval", HFILL}
948 {&hf_docsis_type29ucd_scdma_codes_per_mini_slot,
949 {"9 SCDMA Codes per mini slot", "docsis_type29ucd.scdmacodesperminislot",
950 FT_BYTES, BASE_NONE, NULL, 0x0,
951 "SCDMA Codes per mini slot", HFILL}
953 {&hf_docsis_type29ucd_scdma_active_codes,
954 {"10 SCDMA Active Codes", "docsis_type29ucd.scdmaactivecodes",
955 FT_BYTES, BASE_NONE, NULL, 0x0,
956 "SCDMA Active Codes", HFILL}
958 {&hf_docsis_type29ucd_scdma_code_hopping_seed,
959 {"11 SCDMA Code Hopping Seed", "docsis_type29ucd.scdmacodehoppingseed",
960 FT_BYTES, BASE_NONE, NULL, 0x0,
961 "SCDMA Code Hopping Seed", HFILL}
963 {&hf_docsis_type29ucd_scdma_us_ratio_num,
964 {"12 SCDMA US Ratio Numerator", "docsis_type29ucd.scdmausrationum",
965 FT_BYTES, BASE_NONE, NULL, 0x0,
966 "SCDMA US Ratio Numerator", HFILL}
968 {&hf_docsis_type29ucd_scdma_us_ratio_denom,
969 {"13 SCDMA US Ratio Denominator", "docsis_type29ucd.scdmausratiodenom",
970 FT_BYTES, BASE_NONE, NULL, 0x0,
971 "SCDMA US Ratio Denominator", HFILL}
973 {&hf_docsis_type29ucd_scdma_timestamp_snapshot,
974 {"14 SCDMA Timestamp Snapshot", "docsis_type29ucd.scdmatimestamp",
975 FT_BYTES, BASE_NONE, NULL, 0x0,
976 "SCDMA Timestamp Snapshot", HFILL}
978 {&hf_docsis_type29ucd_maintain_power_spectral_density,
979 {"15 Maintain power spectral density", "docsis_type29ucd.maintainpowerspectraldensity",
980 FT_BYTES, BASE_NONE, NULL, 0x0,
981 "Maintain power spectral density", HFILL}
983 {&hf_docsis_type29ucd_ranging_required,
984 {"16 Ranging Required", "docsis_type29ucd.rangingrequired",
985 FT_BYTES, BASE_NONE, NULL, 0x0,
986 "Ranging Required", HFILL}
988 /* #define type29ucd_RS_INT_DEPTH 12
989 * #define type29ucd_RS_INT_BLOCK 13
990 * #define type29ucd_PREAMBLE_TYPE 14
991 * #define type29ucd_SCMDA_SCRAMBLER_ONOFF 15
992 * #define type29ucd_SCDMA_CODES_PER_SUBFRAME 16
993 * #define type29ucd_SCDMA_FRAMER_INT_STEP_SIZE 17
994 * #define type29ucd_TCM_ENABLED 18
996 {&hf_docsis_rs_int_depth,
997 {"12 Scrambler On/Off", "docsis_type29ucd.burst.rsintdepth",
998 FT_UINT8, BASE_DEC, NULL, 0x0,
999 "R-S Interleaver Depth", HFILL}
1001 {&hf_docsis_rs_int_block,
1002 {"13 Scrambler On/Off", "docsis_type29ucd.burst.rsintblock",
1003 FT_UINT8, BASE_DEC, NULL, 0x0,
1004 "R-S Interleaver Block", HFILL}
1006 {&hf_docsis_preamble_type,
1007 {"14 Scrambler On/Off", "docsis_type29ucd.burst.preambletype",
1008 FT_UINT8, BASE_DEC, NULL, 0x0,
1009 "Preamble Type", HFILL}
1011 {&hf_docsis_scdma_scrambler_onoff,
1012 {"15 Scrambler On/Off", "docsis_type29ucd.burst.scdmascrambleronoff",
1013 FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
1014 "SCDMA Scrambler On/Off", HFILL}
1016 {&hf_docsis_scdma_codes_per_subframe,
1017 {"16 Scrambler On/Off", "docsis_type29ucd.burst.scdmacodespersubframe",
1018 FT_UINT8, BASE_DEC, NULL, 0x0,
1019 "SCDMA Codes per Subframe", HFILL}
1021 {&hf_docsis_scdma_framer_int_step_size,
1022 {"17 Scrambler On/Off", "docsis_type29ucd.burst.scdmaframerintstepsize",
1023 FT_UINT8, BASE_DEC, NULL, 0x0,
1024 "SCDMA Framer Interleaving Step Size", HFILL}
1026 {&hf_docsis_tcm_enabled,
1027 {"18 Scrambler On/Off", "docsis_type29ucd.burst.tcmenabled",
1028 FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
1029 "TCM Enabled", HFILL}
1033 /* Setup protocol subtree array */
1034 static gint *ett[] = {
1035 &ett_docsis_type29ucd,
1036 &ett_burst_descr,
1039 /* Register the protocol name and description */
1040 proto_docsis_type29ucd =
1041 proto_register_protocol ("DOCSIS Upstream Channel Descriptor Type 29",
1042 "DOCSIS type29ucd", "docsis_type29ucd");
1044 /* Required function calls to register the header fields and subtrees used */
1045 proto_register_field_array (proto_docsis_type29ucd, hf, array_length (hf));
1046 proto_register_subtree_array (ett, array_length (ett));
1048 register_dissector ("docsis_type29ucd", dissect_type29ucd, proto_docsis_type29ucd);
1052 /* If this dissector uses sub-dissector registration add a registration routine.
1053 This format is required because a script is used to find these routines and
1054 create the code that calls these routines.
1056 void
1057 proto_reg_handoff_docsis_type29ucd (void)
1059 dissector_handle_t docsis_type29ucd_handle;
1061 docsis_type29ucd_handle = find_dissector ("docsis_type29ucd");
1062 dissector_add_uint ("docsis_mgmt", 0x1D, docsis_type29ucd_handle);