2 * Routines for DOCSIS 3.0 Dynamic Bonding Change Response Message dissection.
3 * Copyright 2010, Guido Reismueller <g.reismueller[AT]avm.de>
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 extern value_string docsis_conf_code
[];
32 /* Initialize the protocol and registered fields */
33 static int proto_docsis_dbcrsp
= -1;
34 static int hf_docsis_dbcrsp_tranid
= -1;
35 static int hf_docsis_dbcrsp_conf_code
= -1;
36 static dissector_handle_t docsis_tlv_handle
;
38 /* Initialize the subtree pointers */
39 static gint ett_docsis_dbcrsp
= -1;
41 /* Code to actually dissect the packets */
43 dissect_dbcrsp (tvbuff_t
* tvb
, packet_info
* pinfo
, proto_tree
* tree
)
45 proto_item
*dbcrsp_item
;
46 proto_tree
*dbcrsp_tree
= NULL
;
51 transid
= tvb_get_ntohs (tvb
, 0);
52 confcode
= tvb_get_guint8 (tvb
, 2);
54 col_add_fstr (pinfo
->cinfo
, COL_INFO
,
55 "Dynamic Bonding Change Response: Tran-Id = %u (%s)", transid
,
56 val_to_str (confcode
, docsis_conf_code
, "%d"));
60 dbcrsp_item
= proto_tree_add_protocol_format (tree
, proto_docsis_dbcrsp
,
62 "Dynamic Bonding Change Response");
63 dbcrsp_tree
= proto_item_add_subtree (dbcrsp_item
, ett_docsis_dbcrsp
);
64 proto_tree_add_item (dbcrsp_tree
, hf_docsis_dbcrsp_tranid
,
65 tvb
, 0, 2, ENC_BIG_ENDIAN
);
66 proto_tree_add_item( dbcrsp_tree
, hf_docsis_dbcrsp_conf_code
,
67 tvb
, 2, 1, ENC_BIG_ENDIAN
);
69 /* Call Dissector for Appendix C TLV's */
70 next_tvb
= tvb_new_subset_remaining (tvb
, 3);
71 call_dissector (docsis_tlv_handle
, next_tvb
, pinfo
, dbcrsp_tree
);
74 /* Register the protocol with Wireshark */
77 * this format is required because a script is used to build the C function
78 * that calls all the protocol registration.
81 proto_register_docsis_dbcrsp (void)
83 /* Setup list of header fields See Section 1.6.1 for details*/
84 static hf_register_info hf
[] = {
85 {&hf_docsis_dbcrsp_tranid
,
86 {"Transaction Id", "docsis_dbcrsp.tranid",
87 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
90 {&hf_docsis_dbcrsp_conf_code
,
91 {"Confirmation Code", "docsis_dbcrsp.conf_code",
92 FT_UINT8
, BASE_DEC
, VALS (docsis_conf_code
), 0x0,
97 /* Setup protocol subtree array */
98 static gint
*ett
[] = {
102 /* Register the protocol name and description */
103 proto_docsis_dbcrsp
= proto_register_protocol ("DOCSIS Dynamic Bonding Change Response",
107 /* Required function calls to register the header fields and subtrees used */
108 proto_register_field_array (proto_docsis_dbcrsp
, hf
, array_length (hf
));
109 proto_register_subtree_array (ett
, array_length (ett
));
111 register_dissector ("docsis_dbcrsp", dissect_dbcrsp
, proto_docsis_dbcrsp
);
115 /* If this dissector uses sub-dissector registration add a registration routine.
116 This format is required because a script is used to find these routines and
117 create the code that calls these routines.
120 proto_reg_handoff_docsis_dbcrsp (void)
122 dissector_handle_t docsis_dbcrsp_handle
;
124 docsis_dbcrsp_handle
= find_dissector ("docsis_dbcrsp");
125 docsis_tlv_handle
= find_dissector ("docsis_tlv");
126 dissector_add_uint ("docsis_mgmt", 0x25, docsis_dbcrsp_handle
);