MSWSP: fix dissect_mswsp_smb()
[wireshark-wip.git] / plugins / docsis / packet-bintrngreq.c
blob710efc7c5e0cf23495cb39b990b622c949fbbd2d
1 /* packet-bintrngreq.c
2 * Routines for DOCSIS 3.0 Bonded Intial Ranging Request Message dissection.
3 * Copyright 2009, Geoffrey Kimball <gekimbal[AT]cisco.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>
30 /* Initialize the protocol and registered fields */
31 static int proto_docsis_bintrngreq = -1;
32 static int hf_docsis_bintrngreq_down_chid = -1;
33 static int hf_docsis_bintrngreq_mddsgid = -1;
34 static int hf_docsis_bintrngreq_capflags = -1;
35 static int hf_docsis_bintrngreq_up_chid = -1;
36 static int hf_docsis_bintrngreq_capflags_frag = -1;
37 static int hf_docsis_bintrngreq_capflags_encrypt = -1;
40 /* Initialize the subtree pointers */
41 static gint ett_docsis_bintrngreq = -1;
43 /* Code to actually dissect the packets */
44 static void
45 dissect_bintrngreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
47 proto_item *bintrngreq_item;
48 proto_tree *bintrngreq_tree;
49 guint16 md_ds_sg_id;
51 md_ds_sg_id = tvb_get_ntohs (tvb, 0);
53 col_add_fstr (pinfo->cinfo, COL_INFO, "Bonded Ranging Request: MD-DS-SG-ID = %u (0x%X)",
54 md_ds_sg_id, md_ds_sg_id );
56 if (tree)
58 guint16 offset = 0;
59 bintrngreq_item = proto_tree_add_protocol_format (tree, proto_docsis_bintrngreq,
60 tvb, offset, tvb_length_remaining (tvb, 0),
61 "Bonded Initial Ranging Request");
62 bintrngreq_tree = proto_item_add_subtree (bintrngreq_item, ett_docsis_bintrngreq);
63 proto_tree_add_item (bintrngreq_tree, hf_docsis_bintrngreq_capflags,
64 tvb, offset, 1, ENC_BIG_ENDIAN);
65 proto_tree_add_item( bintrngreq_tree, hf_docsis_bintrngreq_capflags_frag,
66 tvb, offset, 1, ENC_BIG_ENDIAN );
67 proto_tree_add_item( bintrngreq_tree, hf_docsis_bintrngreq_capflags_encrypt,
68 tvb, offset, 1, ENC_BIG_ENDIAN );
69 offset++;
70 proto_tree_add_item (bintrngreq_tree, hf_docsis_bintrngreq_mddsgid,
71 tvb, offset, 1, ENC_BIG_ENDIAN);
72 offset++;
73 proto_tree_add_item (bintrngreq_tree, hf_docsis_bintrngreq_down_chid,
74 tvb, offset, 1, ENC_BIG_ENDIAN);
75 offset++;
76 proto_tree_add_item (bintrngreq_tree, hf_docsis_bintrngreq_up_chid,
77 tvb, offset, 1, ENC_BIG_ENDIAN);
81 /* Register the protocol with Wireshark */
84 * this format is required because a script is used to build the C function
85 * that calls all the protocol registration.
87 void
88 proto_register_docsis_bintrngreq (void)
90 /* Setup list of header fields See Section 1.6.1 for details*/
91 static hf_register_info hf[] = {
92 {&hf_docsis_bintrngreq_capflags,
93 {"Capability Flags", "docsis_bintrngreq.capflags",
94 FT_UINT8, BASE_HEX, NULL, 0x0,
95 NULL, HFILL}
97 { &hf_docsis_bintrngreq_capflags_frag,
98 {"Pre-3.0 Fragmentation", "docsis_bintrngreq.capflags.frag",
99 FT_BOOLEAN, 8, NULL, (1<<7),
100 "Pre-3.0 DOCSIS fragmentation is supported prior to registration", HFILL }
102 { &hf_docsis_bintrngreq_capflags_encrypt,
103 {"Early Auth. & Encrypt", "docsis_bintrngreq.capflags.encrypt",
104 FT_BOOLEAN, 8, NULL, (1<<6),
105 "Early Authentication and Encryption supported", HFILL }
107 {&hf_docsis_bintrngreq_mddsgid,
108 {"MD-DS-SG-ID", "docsis_bintrngreq.mddsgid",
109 FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
110 "MAC Domain Downstream Service Group Identifier", HFILL}
112 {&hf_docsis_bintrngreq_down_chid,
113 {"DS Chan ID", "docsis_bintrngreq.downchid",
114 FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
115 NULL, HFILL}
117 {&hf_docsis_bintrngreq_up_chid,
118 {"US Chan ID", "docsis_bintrngreq.upchid",
119 FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
120 NULL, HFILL}
124 /* Setup protocol subtree array */
125 static gint *ett[] = {
126 &ett_docsis_bintrngreq,
129 /* Register the protocol name and description */
130 proto_docsis_bintrngreq = proto_register_protocol ("DOCSIS Bonded Initial Ranging Message",
131 "DOCSIS B-INT-RNG-REQ",
132 "docsis_bintrngreq");
134 /* Required function calls to register the header fields and subtrees used */
135 proto_register_field_array (proto_docsis_bintrngreq, hf, array_length (hf));
136 proto_register_subtree_array (ett, array_length (ett));
138 register_dissector ("docsis_bintrngreq", dissect_bintrngreq, proto_docsis_bintrngreq);
142 /* If this dissector uses sub-dissector registration add a registration routine.
143 This format is required because a script is used to find these routines and
144 create the code that calls these routines.
146 void
147 proto_reg_handoff_docsis_bintrngreq (void)
149 dissector_handle_t docsis_bintrngreq_handle;
151 docsis_bintrngreq_handle = find_dissector ("docsis_bintrngreq");
152 dissector_add_uint ("docsis_mgmt", 0x22, docsis_bintrngreq_handle);