2 * Routines for DCC Request Message dissection
3 * Copyright 2004, Darryl Hymel <darryl.hymel[AT]arrisi.com>
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #include "moduleinfo.h"
39 #include <epan/packet.h>
41 #define DCCREQ_UP_CHAN_ID 1
42 #define DCCREQ_DS_PARAMS 2
43 #define DCCREQ_INIT_TECH 3
44 #define DCCREQ_UCD_SUB 4
45 #define DCCREQ_SAID_SUB 6
46 #define DCCREQ_SF_SUB 7
47 #define DCCREQ_CMTS_MAC_ADDR 8
48 #define DCCREQ_KEY_SEQ_NUM 31
49 #define DCCREQ_HMAC_DIGEST 27
51 /* Define Downstrean Parameters subtypes
52 * These are subtype of DCCREQ_DS_PARAMS (2)
55 #define DCCREQ_DS_FREQ 1
56 #define DCCREQ_DS_MOD_TYPE 2
57 #define DCCREQ_DS_SYM_RATE 3
58 #define DCCREQ_DS_INTLV_DEPTH 4
59 #define DCCREQ_DS_CHAN_ID 5
60 #define DCCREQ_DS_SYNC_SUB 6
62 /* Define Service Flow Substitution subtypes
63 * These are subtypes of DCCREQ_SF_SUB (7)
65 #define DCCREQ_SF_SFID 1
66 #define DCCREQ_SF_SID 2
67 #define DCCREQ_SF_UNSOL_GRANT_TREF 5
69 /* Initialize the protocol and registered fields */
70 static int proto_docsis_dccreq = -1;
72 static int hf_docsis_dccreq_tran_id = -1;
73 static int hf_docsis_dccreq_up_chan_id = -1;
74 static int hf_docsis_dccreq_ds_freq = -1;
75 static int hf_docsis_dccreq_ds_mod_type = -1;
76 static int hf_docsis_dccreq_ds_sym_rate = -1;
77 static int hf_docsis_dccreq_ds_intlv_depth_i = -1;
78 static int hf_docsis_dccreq_ds_intlv_depth_j = -1;
79 static int hf_docsis_dccreq_ds_chan_id = -1;
80 static int hf_docsis_dccreq_ds_sync_sub = -1;
81 static int hf_docsis_dccreq_init_tech = -1;
82 static int hf_docsis_dccreq_ucd_sub = -1;
83 static int hf_docsis_dccreq_said_sub_cur = -1;
84 static int hf_docsis_dccreq_said_sub_new = -1;
85 static int hf_docsis_dccreq_sf_sfid_cur = -1;
86 static int hf_docsis_dccreq_sf_sfid_new = -1;
87 static int hf_docsis_dccreq_sf_sid_cur = -1;
88 static int hf_docsis_dccreq_sf_sid_new = -1;
89 static int hf_docsis_dccreq_sf_unsol_grant_tref = -1;
90 static int hf_docsis_dccreq_cmts_mac_addr = -1;
91 static int hf_docsis_dccreq_key_seq_num = -1;
92 static int hf_docsis_dccreq_hmac_digest = -1;
94 /* Initialize the subtree pointers */
95 static gint ett_docsis_dccreq = -1;
96 static gint ett_docsis_dccreq_ds_params = -1;
97 static gint ett_docsis_dccreq_sf_sub = -1;
100 value_string ds_mod_type_vals[] = {
106 value_string ds_sym_rate_vals[] = {
107 {0 , "5.056941 Msym/sec"},
108 {1 , "5.360537 Msym/sec"},
109 {2 , "6.952 Msym/sec"},
112 value_string init_tech_vals[] = {
113 {0 , "Reinitialize MAC"},
114 {1 , "Broadcast Init RNG on new chanbefore normal op"},
115 {2 , "Unicast RNG on new chan before normal op"},
116 {3 , "Either Unicast or broadcast RNG on new chan before normal op"},
117 {4 , "Use new chan directly without re-init or RNG"},
120 /* Code to actually dissect the packets */
122 dissect_dccreq_ds_params (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
125 proto_item *dcc_item;
126 proto_tree *dcc_tree;
130 dcc_item = proto_tree_add_text ( tree, tvb, start, len, "2 DCC-REQ Downstream Params Encodings (Length = %u)", len);
131 dcc_tree = proto_item_add_subtree ( dcc_item , ett_docsis_dccreq_ds_params);
133 while ( pos < ( start + len) )
135 type = tvb_get_guint8 (tvb, pos++);
136 length = tvb_get_guint8 (tvb, pos++);
143 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_freq, tvb,
148 THROW (ReportedBoundsError);
151 case DCCREQ_DS_MOD_TYPE:
154 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_mod_type, tvb,
159 THROW (ReportedBoundsError);
162 case DCCREQ_DS_SYM_RATE:
165 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_sym_rate, tvb,
170 THROW (ReportedBoundsError);
173 case DCCREQ_DS_INTLV_DEPTH:
176 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_intlv_depth_i, tvb,
178 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_intlv_depth_j, tvb,
183 THROW (ReportedBoundsError);
186 case DCCREQ_DS_CHAN_ID:
189 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_chan_id, tvb,
194 THROW (ReportedBoundsError);
197 case DCCREQ_DS_SYNC_SUB:
198 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ds_sync_sub, tvb,
207 dissect_dccreq_sf_sub (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
210 proto_item *dcc_item;
211 proto_tree *dcc_tree;
215 dcc_item = proto_tree_add_text ( tree, tvb, start, len, "7 DCC-REQ Service Flow Substitution Encodings (Length = %u)", len);
216 dcc_tree = proto_item_add_subtree ( dcc_item , ett_docsis_dccreq_sf_sub);
218 while ( pos < ( start + len) )
220 type = tvb_get_guint8 (tvb, pos++);
221 length = tvb_get_guint8 (tvb, pos++);
228 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_sfid_cur, tvb,
230 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_sfid_new, tvb,
235 THROW (ReportedBoundsError);
241 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_sid_cur, tvb,
243 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_sid_new, tvb,
248 THROW (ReportedBoundsError);
251 case DCCREQ_SF_UNSOL_GRANT_TREF:
254 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_sf_unsol_grant_tref, tvb,
259 THROW (ReportedBoundsError);
267 dissect_dccreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
271 proto_tree *dcc_tree;
272 proto_item *dcc_item;
275 len = tvb_length_remaining (tvb, 0);
277 if (check_col (pinfo->cinfo, COL_INFO))
279 col_clear (pinfo->cinfo, COL_INFO);
280 col_add_fstr (pinfo->cinfo, COL_INFO,"DCC-REQ Message: ");
286 proto_tree_add_protocol_format (tree, proto_docsis_dccreq, tvb, 0,
287 tvb_length_remaining (tvb, 0),
289 dcc_tree = proto_item_add_subtree (dcc_item, ett_docsis_dccreq);
290 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_tran_id, tvb, 0, 2, FALSE);
295 type = tvb_get_guint8 (tvb, pos++);
296 length = tvb_get_guint8 (tvb, pos++);
300 case DCCREQ_UP_CHAN_ID:
303 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_up_chan_id, tvb,
308 THROW (ReportedBoundsError);
311 case DCCREQ_DS_PARAMS:
312 dissect_dccreq_ds_params (tvb , dcc_tree , pos , length );
314 case DCCREQ_INIT_TECH:
317 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_init_tech, tvb,
322 THROW (ReportedBoundsError);
326 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ucd_sub, tvb,
329 case DCCREQ_SAID_SUB:
332 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_said_sub_cur, tvb,
334 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_said_sub_new, tvb,
339 THROW (ReportedBoundsError);
343 dissect_dccreq_sf_sub (tvb , dcc_tree , pos , length );
345 case DCCREQ_CMTS_MAC_ADDR:
348 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_cmts_mac_addr, tvb,
353 THROW (ReportedBoundsError);
356 case DCCREQ_KEY_SEQ_NUM:
359 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_key_seq_num, tvb,
364 THROW (ReportedBoundsError);
367 case DCCREQ_HMAC_DIGEST:
370 proto_tree_add_item (dcc_tree, hf_docsis_dccreq_hmac_digest, tvb,
375 THROW (ReportedBoundsError);
380 } /* while (pos < len) */
384 /* Register the protocol with Wireshark */
386 /* this format is require because a script is used to build the C function
387 that calls all the protocol registration.
392 proto_register_docsis_dccreq (void)
394 /* Setup list of header fields See Section 1.6.1 for details*/
395 static hf_register_info hf[] = {
396 {&hf_docsis_dccreq_tran_id ,
399 "docsis_dccreq.tran_id",
400 FT_UINT16, BASE_DEC, NULL, 0x0,
405 {&hf_docsis_dccreq_up_chan_id ,
408 "docsis_dccreq.up_chan_id",
409 FT_UINT8, BASE_DEC, NULL, 0x0,
414 {&hf_docsis_dccreq_ds_freq ,
417 "docsis_dccreq.ds_freq",
418 FT_UINT32, BASE_DEC, NULL, 0x0,
423 {&hf_docsis_dccreq_ds_mod_type ,
426 "docsis_dccreq.ds_mod_type",
427 FT_UINT8, BASE_DEC, VALS (ds_mod_type_vals), 0x0,
432 {&hf_docsis_dccreq_ds_sym_rate ,
435 "docsis_dccreq.ds_sym_rate",
436 FT_UINT8, BASE_DEC, VALS (ds_sym_rate_vals), 0x0,
441 {&hf_docsis_dccreq_ds_intlv_depth_i ,
443 "Interleaver Depth I Value",
444 "docsis_dccreq.ds_intlv_depth_i",
445 FT_UINT8, BASE_DEC, NULL, 0x0,
450 {&hf_docsis_dccreq_ds_intlv_depth_j ,
452 "Interleaver Depth J Value",
453 "docsis_dccreq.ds_intlv_depth_j",
454 FT_UINT8, BASE_DEC, NULL, 0x0,
459 {&hf_docsis_dccreq_ds_chan_id ,
461 "Downstream Channel ID",
462 "docsis_dccreq.ds_chan_id",
463 FT_UINT8, BASE_DEC, NULL, 0x0,
468 {&hf_docsis_dccreq_ds_sync_sub ,
471 "docsis_dccreq.ds_sync_sub",
472 FT_UINT8, BASE_DEC, NULL, 0x0,
477 {&hf_docsis_dccreq_init_tech ,
479 "Initialization Technique",
480 "docsis_dccreq.init_tech",
481 FT_UINT8, BASE_DEC, VALS (init_tech_vals), 0x0,
486 {&hf_docsis_dccreq_ucd_sub ,
489 "docsis_dccreq.ucd_sub",
490 FT_BYTES, BASE_NONE, NULL, 0x0,
495 {&hf_docsis_dccreq_said_sub_cur ,
497 "SAID Sub - Current Value",
498 "docsis_dccreq.said_sub_cur",
499 FT_UINT16, BASE_DEC, NULL, 0x0,
504 {&hf_docsis_dccreq_said_sub_new ,
506 "SAID Sub - New Value",
507 "docsis_dccreq.said_sub_new",
508 FT_UINT16, BASE_DEC, NULL, 0x0,
513 {&hf_docsis_dccreq_sf_sfid_cur ,
515 "SF Sub - SFID Current Value",
516 "docsis_dccreq.sf_sfid_cur",
517 FT_UINT32, BASE_DEC, NULL, 0x0,
522 {&hf_docsis_dccreq_sf_sfid_new ,
524 "SF Sub - SFID New Value",
525 "docsis_dccreq.sf_sfid_new",
526 FT_UINT32, BASE_DEC, NULL, 0x0,
531 {&hf_docsis_dccreq_sf_sid_cur ,
533 "SF Sub - SID Current Value",
534 "docsis_dccreq.sf_sid_cur",
535 FT_UINT16, BASE_DEC, NULL, 0x0,
540 {&hf_docsis_dccreq_sf_sid_new ,
542 "SF Sub - SID New Value",
543 "docsis_dccreq.sf_sid_new",
544 FT_UINT16, BASE_DEC, NULL, 0x0,
549 {&hf_docsis_dccreq_sf_unsol_grant_tref ,
551 "SF Sub - Unsolicited Grant Time Reference",
552 "docsis_dccreq.sf_unsol_grant_tref",
553 FT_UINT32, BASE_DEC, NULL, 0x0,
558 {&hf_docsis_dccreq_cmts_mac_addr ,
561 "docsis_dccreq.cmts_mac_addr",
562 FT_ETHER, BASE_NONE, NULL, 0x0,
567 {&hf_docsis_dccreq_key_seq_num ,
569 "Auth Key Sequence Number",
570 "docsis_dccreq.key_seq_num",
571 FT_UINT8, BASE_DEC, NULL, 0x0,
576 {&hf_docsis_dccreq_hmac_digest ,
579 "docsis_dccreq.hmac_digest",
580 FT_BYTES, BASE_NONE, NULL, 0x0,
588 /* Setup protocol subtree array */
589 static gint *ett[] = {
591 &ett_docsis_dccreq_sf_sub,
592 &ett_docsis_dccreq_ds_params,
595 /* Register the protocol name and description */
596 proto_docsis_dccreq =
597 proto_register_protocol ("DOCSIS Downstream Channel Change Request",
598 "DOCSIS DCC-REQ", "docsis_dccreq");
600 /* Required function calls to register the header fields and subtrees used */
601 proto_register_field_array (proto_docsis_dccreq, hf, array_length (hf));
602 proto_register_subtree_array (ett, array_length (ett));
604 register_dissector ("docsis_dccreq", dissect_dccreq, proto_docsis_dccreq);
608 /* If this dissector uses sub-dissector registration add a registration routine.
609 This format is required because a script is used to find these routines and
610 create the code that calls these routines.
613 proto_reg_handoff_docsis_dccreq (void)
615 dissector_handle_t docsis_dccreq_handle;
617 docsis_dccreq_handle = find_dissector ("docsis_dccreq");
618 dissector_add ("docsis_mgmt", 0x17, docsis_dccreq_handle);