2 * Routines for DCC Response 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #include <epan/packet.h>
30 #define DCCRSP_CM_JUMP_TIME 1
31 #define DCCRSP_KEY_SEQ_NUM 31
32 #define DCCRSP_HMAC_DIGEST 27
34 /* Define DCC-RSP CM Jump Time subtypes
35 * These are subtype of DCCRSP_CM_JUMP_TIME (1)
37 #define DCCRSP_CM_JUMP_TIME_LENGTH 1
38 #define DCCRSP_CM_JUMP_TIME_START 2
40 /* Initialize the protocol and registered fields */
41 static int proto_docsis_dccrsp = -1;
43 static int hf_docsis_dccrsp_tran_id = -1;
44 static int hf_docsis_dccrsp_conf_code = -1;
45 static int hf_docsis_dccrsp_cm_jump_time_length = -1;
46 static int hf_docsis_dccrsp_cm_jump_time_start = -1;
47 static int hf_docsis_dccrsp_key_seq_num = -1;
48 static int hf_docsis_dccrsp_hmac_digest = -1;
50 /* Initialize the subtree pointers */
51 static gint ett_docsis_dccrsp = -1;
52 static gint ett_docsis_dccrsp_cm_jump_time = -1;
55 /* Code to actually dissect the packets */
57 dissect_dccrsp_cm_jump_time (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
65 dcc_item = proto_tree_add_text ( tree, tvb, start, len, "2 DCC-RSP CM Time Jump Encodings (Length = %u)", len);
66 dcc_tree = proto_item_add_subtree ( dcc_item , ett_docsis_dccrsp_cm_jump_time);
68 while ( pos < ( start + len) )
70 type = tvb_get_guint8 (tvb, pos++);
71 length = tvb_get_guint8 (tvb, pos++);
75 case DCCRSP_CM_JUMP_TIME_LENGTH:
78 proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_cm_jump_time_length, tvb,
79 pos, length, ENC_BIG_ENDIAN);
83 THROW (ReportedBoundsError);
86 case DCCRSP_CM_JUMP_TIME_START:
89 proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_cm_jump_time_start, tvb,
90 pos, length, ENC_BIG_ENDIAN);
94 THROW (ReportedBoundsError);
102 dissect_dccrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
106 proto_tree *dcc_tree;
107 proto_item *dcc_item;
110 len = tvb_length_remaining (tvb, 0);
112 col_set_str(pinfo->cinfo, COL_INFO, "DCC-RSP Message: ");
117 proto_tree_add_protocol_format (tree, proto_docsis_dccrsp, tvb, 0,
118 tvb_length_remaining (tvb, 0),
120 dcc_tree = proto_item_add_subtree (dcc_item, ett_docsis_dccrsp);
121 proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_tran_id, tvb, 0, 2, ENC_BIG_ENDIAN);
122 proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_conf_code, tvb, 2, 1, ENC_BIG_ENDIAN);
127 type = tvb_get_guint8 (tvb, pos++);
128 length = tvb_get_guint8 (tvb, pos++);
131 case DCCRSP_CM_JUMP_TIME:
132 dissect_dccrsp_cm_jump_time (tvb , dcc_tree , pos , length );
134 case DCCRSP_KEY_SEQ_NUM:
137 proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_key_seq_num, tvb,
138 pos, length, ENC_BIG_ENDIAN);
142 THROW (ReportedBoundsError);
145 case DCCRSP_HMAC_DIGEST:
148 proto_tree_add_item (dcc_tree, hf_docsis_dccrsp_hmac_digest, tvb,
149 pos, length, ENC_NA);
153 THROW (ReportedBoundsError);
158 } /* while (pos < len) */
162 /* Register the protocol with Wireshark */
164 /* this format is require because a script is used to build the C function
165 that calls all the protocol registration.
170 proto_register_docsis_dccrsp (void)
172 /* Setup list of header fields See Section 1.6.1 for details*/
173 static hf_register_info hf[] = {
174 {&hf_docsis_dccrsp_tran_id ,
177 "docsis_dccrsp.tran_id",
178 FT_UINT16, BASE_DEC, NULL, 0x0,
183 {&hf_docsis_dccrsp_conf_code ,
186 "docsis_dccrsp.conf_code",
187 FT_UINT8, BASE_DEC, NULL, 0x0,
192 {&hf_docsis_dccrsp_cm_jump_time_length ,
195 "docsis_dccrsp.cm_jump_time_length",
196 FT_UINT32, BASE_DEC, NULL, 0x0,
201 {&hf_docsis_dccrsp_cm_jump_time_start ,
204 "docsis_dccrsp.cm_jump_time_start",
205 FT_UINT64, BASE_DEC, NULL, 0x0,
210 {&hf_docsis_dccrsp_key_seq_num ,
212 "Auth Key Sequence Number",
213 "docsis_dccrsp.key_seq_num",
214 FT_UINT8, BASE_DEC, NULL, 0x0,
219 {&hf_docsis_dccrsp_hmac_digest ,
222 "docsis_dccrsp.hmac_digest",
223 FT_BYTES, BASE_NONE, NULL, 0x0,
231 /* Setup protocol subtree array */
232 static gint *ett[] = {
234 &ett_docsis_dccrsp_cm_jump_time,
237 /* Register the protocol name and description */
238 proto_docsis_dccrsp =
239 proto_register_protocol ("DOCSIS Downstream Channel Change Response",
240 "DOCSIS DCC-RSP", "docsis_dccrsp");
242 /* Required function calls to register the header fields and subtrees used */
243 proto_register_field_array (proto_docsis_dccrsp, hf, array_length (hf));
244 proto_register_subtree_array (ett, array_length (ett));
246 register_dissector ("docsis_dccrsp", dissect_dccrsp, proto_docsis_dccrsp);
250 /* If this dissector uses sub-dissector registration add a registration routine.
251 This format is required because a script is used to find these routines and
252 create the code that calls these routines.
255 proto_reg_handoff_docsis_dccrsp (void)
257 dissector_handle_t docsis_dccrsp_handle;
259 docsis_dccrsp_handle = find_dissector ("docsis_dccrsp");
260 dissector_add_uint ("docsis_mgmt", 0x18, docsis_dccrsp_handle);