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>
29 #include <epan/exceptions.h>
31 #define DCCRSP_CM_JUMP_TIME 1
32 #define DCCRSP_KEY_SEQ_NUM 31
33 #define DCCRSP_HMAC_DIGEST 27
35 /* Define DCC-RSP CM Jump Time subtypes
36 * These are subtype of DCCRSP_CM_JUMP_TIME (1)
38 #define DCCRSP_CM_JUMP_TIME_LENGTH 1
39 #define DCCRSP_CM_JUMP_TIME_START 2
41 /* Initialize the protocol and registered fields */
42 static int proto_docsis_dccrsp
= -1;
44 static int hf_docsis_dccrsp_tran_id
= -1;
45 static int hf_docsis_dccrsp_conf_code
= -1;
46 static int hf_docsis_dccrsp_cm_jump_time_length
= -1;
47 static int hf_docsis_dccrsp_cm_jump_time_start
= -1;
48 static int hf_docsis_dccrsp_key_seq_num
= -1;
49 static int hf_docsis_dccrsp_hmac_digest
= -1;
51 /* Initialize the subtree pointers */
52 static gint ett_docsis_dccrsp
= -1;
53 static gint ett_docsis_dccrsp_cm_jump_time
= -1;
56 /* Code to actually dissect the packets */
58 dissect_dccrsp_cm_jump_time (tvbuff_t
* tvb
, proto_tree
* tree
, int start
, guint16 len
)
66 dcc_item
= proto_tree_add_text ( tree
, tvb
, start
, len
, "2 DCC-RSP CM Time Jump Encodings (Length = %u)", len
);
67 dcc_tree
= proto_item_add_subtree ( dcc_item
, ett_docsis_dccrsp_cm_jump_time
);
69 while ( pos
< ( start
+ len
) )
71 type
= tvb_get_guint8 (tvb
, pos
++);
72 length
= tvb_get_guint8 (tvb
, pos
++);
76 case DCCRSP_CM_JUMP_TIME_LENGTH
:
79 proto_tree_add_item (dcc_tree
, hf_docsis_dccrsp_cm_jump_time_length
, tvb
,
80 pos
, length
, ENC_BIG_ENDIAN
);
84 THROW (ReportedBoundsError
);
87 case DCCRSP_CM_JUMP_TIME_START
:
90 proto_tree_add_item (dcc_tree
, hf_docsis_dccrsp_cm_jump_time_start
, tvb
,
91 pos
, length
, ENC_BIG_ENDIAN
);
95 THROW (ReportedBoundsError
);
103 dissect_dccrsp (tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
)
107 proto_tree
*dcc_tree
;
108 proto_item
*dcc_item
;
111 len
= tvb_length_remaining (tvb
, 0);
113 col_set_str(pinfo
->cinfo
, COL_INFO
, "DCC-RSP Message: ");
118 proto_tree_add_protocol_format (tree
, proto_docsis_dccrsp
, tvb
, 0,
119 tvb_length_remaining (tvb
, 0),
121 dcc_tree
= proto_item_add_subtree (dcc_item
, ett_docsis_dccrsp
);
122 proto_tree_add_item (dcc_tree
, hf_docsis_dccrsp_tran_id
, tvb
, 0, 2, ENC_BIG_ENDIAN
);
123 proto_tree_add_item (dcc_tree
, hf_docsis_dccrsp_conf_code
, tvb
, 2, 1, ENC_BIG_ENDIAN
);
128 type
= tvb_get_guint8 (tvb
, pos
++);
129 length
= tvb_get_guint8 (tvb
, pos
++);
132 case DCCRSP_CM_JUMP_TIME
:
133 dissect_dccrsp_cm_jump_time (tvb
, dcc_tree
, pos
, length
);
135 case DCCRSP_KEY_SEQ_NUM
:
138 proto_tree_add_item (dcc_tree
, hf_docsis_dccrsp_key_seq_num
, tvb
,
139 pos
, length
, ENC_BIG_ENDIAN
);
143 THROW (ReportedBoundsError
);
146 case DCCRSP_HMAC_DIGEST
:
149 proto_tree_add_item (dcc_tree
, hf_docsis_dccrsp_hmac_digest
, tvb
,
150 pos
, length
, ENC_NA
);
154 THROW (ReportedBoundsError
);
159 } /* while (pos < len) */
163 /* Register the protocol with Wireshark */
165 /* this format is require because a script is used to build the C function
166 that calls all the protocol registration.
171 proto_register_docsis_dccrsp (void)
173 /* Setup list of header fields See Section 1.6.1 for details*/
174 static hf_register_info hf
[] = {
175 {&hf_docsis_dccrsp_tran_id
,
178 "docsis_dccrsp.tran_id",
179 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
184 {&hf_docsis_dccrsp_conf_code
,
187 "docsis_dccrsp.conf_code",
188 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
193 {&hf_docsis_dccrsp_cm_jump_time_length
,
196 "docsis_dccrsp.cm_jump_time_length",
197 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
202 {&hf_docsis_dccrsp_cm_jump_time_start
,
205 "docsis_dccrsp.cm_jump_time_start",
206 FT_UINT64
, BASE_DEC
, NULL
, 0x0,
211 {&hf_docsis_dccrsp_key_seq_num
,
213 "Auth Key Sequence Number",
214 "docsis_dccrsp.key_seq_num",
215 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
220 {&hf_docsis_dccrsp_hmac_digest
,
223 "docsis_dccrsp.hmac_digest",
224 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
232 /* Setup protocol subtree array */
233 static gint
*ett
[] = {
235 &ett_docsis_dccrsp_cm_jump_time
,
238 /* Register the protocol name and description */
239 proto_docsis_dccrsp
=
240 proto_register_protocol ("DOCSIS Downstream Channel Change Response",
241 "DOCSIS DCC-RSP", "docsis_dccrsp");
243 /* Required function calls to register the header fields and subtrees used */
244 proto_register_field_array (proto_docsis_dccrsp
, hf
, array_length (hf
));
245 proto_register_subtree_array (ett
, array_length (ett
));
247 register_dissector ("docsis_dccrsp", dissect_dccrsp
, proto_docsis_dccrsp
);
251 /* If this dissector uses sub-dissector registration add a registration routine.
252 This format is required because a script is used to find these routines and
253 create the code that calls these routines.
256 proto_reg_handoff_docsis_dccrsp (void)
258 dissector_handle_t docsis_dccrsp_handle
;
260 docsis_dccrsp_handle
= find_dissector ("docsis_dccrsp");
261 dissector_add_uint ("docsis_mgmt", 0x18, docsis_dccrsp_handle
);