MSWSP: fix dissect_mswsp_smb()
[wireshark-wip.git] / plugins / docsis / packet-regrspmp.c
blobf57013affb299c43e1ec97865de161a15cccd528
1 /* packet-regrspmp.c
2 * Routines for REG-RSP-MP Message dissection
3 * Copyright 2007, Bruno Verstuyft <bruno.verstuyft@excentis.com>
5 * Based on packet-regrsp.c (by Anand V. Narwani <anand[AT]narwani.org>)
7 * $Id$
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #include "config.h"
30 #include <epan/packet.h>
33 /* Initialize the protocol and registered fields */
34 static int proto_docsis_regrspmp = -1;
36 static int hf_docsis_regrspmp_sid = -1;
38 static int hf_docsis_regrspmp_response = -1;
40 static int hf_docsis_regrspmp_number_of_fragments = -1;
41 static int hf_docsis_regrspmp_fragment_sequence_number = -1;
43 static dissector_handle_t docsis_tlv_handle;
47 /* Initialize the subtree pointers */
48 static gint ett_docsis_regrspmp = -1;
50 static void
51 dissect_regrspmp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
53 proto_item *it;
54 proto_tree *regrspmp_tree = NULL;
55 tvbuff_t *next_tvb;
60 col_set_str(pinfo->cinfo, COL_INFO, "REG-RSP-MP Message:");
62 if (tree)
64 it = proto_tree_add_protocol_format (tree, proto_docsis_regrspmp, tvb, 0, -1,"REG-RSP-MP Message");
65 regrspmp_tree = proto_item_add_subtree (it, ett_docsis_regrspmp);
67 proto_tree_add_item (regrspmp_tree, hf_docsis_regrspmp_sid, tvb, 0, 2, ENC_BIG_ENDIAN);
68 proto_tree_add_item (regrspmp_tree, hf_docsis_regrspmp_response, tvb, 2, 1, ENC_BIG_ENDIAN);
69 proto_tree_add_item (regrspmp_tree, hf_docsis_regrspmp_number_of_fragments, tvb, 3, 1, ENC_BIG_ENDIAN);
70 proto_tree_add_item (regrspmp_tree, hf_docsis_regrspmp_fragment_sequence_number, tvb, 4, 1, ENC_BIG_ENDIAN);
73 /* Call Dissector for Appendix C TLV's */
74 next_tvb = tvb_new_subset_remaining (tvb, 5);
75 call_dissector (docsis_tlv_handle, next_tvb, pinfo, regrspmp_tree);
81 /* Register the protocol with Wireshark */
83 /* this format is require because a script is used to build the C function
84 that calls all the protocol registration.
88 void
89 proto_register_docsis_regrspmp (void)
92 /* Setup list of header fields See Section 1.6.1 for details*/
93 static hf_register_info hf[] = {
94 {&hf_docsis_regrspmp_sid,
95 {"Sid", "docsis_regrspmp.sid",
96 FT_UINT16, BASE_DEC, NULL, 0x0,
97 "Reg-Rsp-Mp Sid", HFILL}
99 {&hf_docsis_regrspmp_response,
100 {"Response", "docsis_regrspmp.response",
101 FT_UINT8, BASE_DEC, NULL, 0x0,
102 "Reg-Rsp-Mp Response", HFILL}
104 {&hf_docsis_regrspmp_number_of_fragments,
105 {"Number of Fragments", "docsis_regrspmp.number_of_fragments",
106 FT_UINT8, BASE_DEC, NULL, 0x0,
107 "Reg-Rsp-Mp Number of Fragments", HFILL}
109 {&hf_docsis_regrspmp_fragment_sequence_number,
110 {"Fragment Sequence Number", "docsis_regrspmp.fragment_sequence_number",
111 FT_UINT8, BASE_DEC, NULL, 0x0,
112 "Reg-Rsp-Mp Fragment Sequence Number", HFILL}
116 /* Setup protocol subtree array */
117 static gint *ett[] = {
118 &ett_docsis_regrspmp,
121 /* Register the protocol name and description */
122 proto_docsis_regrspmp =
123 proto_register_protocol ("DOCSIS Registration Response Multipart",
124 "DOCSIS Reg-Rsp-Mp", "docsis_regrspmp");
126 /* Required function calls to register the header fields and subtrees used */
127 proto_register_field_array (proto_docsis_regrspmp, hf, array_length (hf));
128 proto_register_subtree_array (ett, array_length (ett));
130 register_dissector ("docsis_regrspmp", dissect_regrspmp, proto_docsis_regrspmp);
134 /* If this dissector uses sub-dissector registration add a registration routine.
135 This format is required because a script is used to find these routines and
136 create the code that calls these routines.
138 void
139 proto_reg_handoff_docsis_regrspmp (void)
141 dissector_handle_t docsis_regrspmp_handle;
143 docsis_tlv_handle = find_dissector ("docsis_tlv");
144 docsis_regrspmp_handle = find_dissector ("docsis_regrspmp");
145 dissector_add_uint ("docsis_mgmt", 45, docsis_regrspmp_handle);