2 * Routines for IGMP/RGMP packet disassembly
3 * Copyright 2006 Jaap Keuter
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 This is a setup for RGMP dissection, a simple protocol bolted on IGMP.
32 #include <epan/packet.h>
33 #include "packet-igmp.h"
35 void proto_register_rgmp(void);
36 void proto_reg_handoff_rgmp(void);
38 static int proto_rgmp = -1;
39 static int hf_type = -1;
40 static int hf_reserved = -1;
41 static int hf_checksum = -1;
42 static int hf_checksum_bad = -1;
43 static int hf_maddr = -1;
45 static int ett_rgmp = -1;
47 #define MC_RGMP 0xe0000019
49 static const value_string rgmp_types[] = {
50 {IGMP_RGMP_LEAVE, "Leave"},
51 {IGMP_RGMP_JOIN, "Join"},
52 {IGMP_RGMP_BYE, "Bye"},
53 {IGMP_RGMP_HELLO, "Hello"},
57 /* This function is only called from the IGMP dissector */
59 dissect_rgmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
65 guint32 dst = g_htonl(MC_RGMP);
67 /* Shouldn't be destined for us */
68 if (memcmp(pinfo->dst.data, &dst, 4))
71 col_set_str(pinfo->cinfo, COL_PROTOCOL, "RGMP");
72 col_clear(pinfo->cinfo, COL_INFO);
74 item = proto_tree_add_item(parent_tree, proto_rgmp, tvb, offset, -1, ENC_NA);
75 tree = proto_item_add_subtree(item, ett_rgmp);
77 type = tvb_get_guint8(tvb, offset);
78 col_add_str(pinfo->cinfo, COL_INFO,
79 val_to_str(type, rgmp_types, "Unknown Type: 0x%02x"));
80 proto_tree_add_uint(tree, hf_type, tvb, offset, 1, type);
84 proto_tree_add_item(tree, hf_reserved, tvb, offset, 1, ENC_NA);
87 igmp_checksum(tree, tvb, hf_checksum, hf_checksum_bad, pinfo, 0);
90 proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, ENC_BIG_ENDIAN);
98 proto_register_rgmp(void)
100 static hf_register_info hf[] = {
102 { "Type", "rgmp.type", FT_UINT8, BASE_HEX,
103 VALS(rgmp_types), 0, "RGMP Packet Type", HFILL }
107 { "Reserved", "rgmp.reserved", FT_UINT8, BASE_HEX,
108 NULL, 0, "RGMP Reserved", HFILL }
112 { "Checksum", "rgmp.checksum", FT_UINT16, BASE_HEX,
113 NULL, 0, NULL, HFILL }
117 { "Bad Checksum", "rgmp.checksum_bad", FT_BOOLEAN, BASE_NONE,
118 NULL, 0x0, NULL, HFILL }
122 { "Multicast group address", "rgmp.maddr", FT_IPv4, BASE_NONE,
123 NULL, 0, NULL, HFILL }
127 static gint *ett[] = {
131 proto_rgmp = proto_register_protocol("Router-port Group Management Protocol", "RGMP", "rgmp");
132 proto_register_field_array(proto_rgmp, hf, array_length(hf));
133 proto_register_subtree_array(ett, array_length(ett));
135 new_register_dissector("rgmp", dissect_rgmp, proto_rgmp);
139 proto_reg_handoff_rgmp(void)
141 dissector_handle_t rgmp_handle;
143 rgmp_handle = new_create_dissector_handle(dissect_rgmp, proto_rgmp);
144 dissector_add_uint("igmp.type", IGMP_RGMP_HELLO, rgmp_handle);
145 dissector_add_uint("igmp.type", IGMP_RGMP_BYE, rgmp_handle);
146 dissector_add_uint("igmp.type", IGMP_RGMP_JOIN, rgmp_handle);
147 dissector_add_uint("igmp.type", IGMP_RGMP_LEAVE, rgmp_handle);
151 * Editor modelines - http://www.wireshark.org/tools/modelines.html
156 * indent-tabs-mode: nil
159 * vi: set shiftwidth=4 tabstop=8 expandtab:
160 * :indentSize=4:tabSize=8:noTabs=true: