2006-10-28 21:52:38 +00:00
|
|
|
/* packet-rgmp.c
|
|
|
|
* Routines for IGMP/RGMP packet disassembly
|
|
|
|
* Copyright 2006 Jaap Keuter
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2006-10-28 21:52:38 +00:00
|
|
|
*/
|
|
|
|
|
2011-10-21 02:10:19 +00:00
|
|
|
/*
|
|
|
|
Based on RFC3488
|
2006-10-28 21:52:38 +00:00
|
|
|
|
|
|
|
This is a setup for RGMP dissection, a simple protocol bolted on IGMP.
|
|
|
|
The trick is to have IGMP dissector call this function (which by itself is not
|
|
|
|
registered as dissector). IGAP and other do the same.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2006-10-28 21:52:38 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <epan/packet.h>
|
|
|
|
#include <epan/strutil.h>
|
|
|
|
#include "packet-igmp.h"
|
|
|
|
#include "packet-rgmp.h"
|
|
|
|
|
2013-12-12 17:45:22 +00:00
|
|
|
void proto_register_rgmp(void);
|
2006-10-28 21:52:38 +00:00
|
|
|
|
|
|
|
static int proto_rgmp = -1;
|
|
|
|
static int hf_type = -1;
|
|
|
|
static int hf_checksum = -1;
|
|
|
|
static int hf_checksum_bad = -1;
|
|
|
|
static int hf_maddr = -1;
|
|
|
|
|
|
|
|
static int ett_rgmp = -1;
|
|
|
|
|
|
|
|
static const value_string rgmp_types[] = {
|
|
|
|
{IGMP_RGMP_LEAVE, "Leave"},
|
|
|
|
{IGMP_RGMP_JOIN, "Join"},
|
|
|
|
{IGMP_RGMP_BYE, "Bye"},
|
|
|
|
{IGMP_RGMP_HELLO, "Hello"},
|
|
|
|
{0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* This function is only called from the IGMP dissector */
|
|
|
|
int
|
|
|
|
dissect_rgmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset)
|
|
|
|
{
|
|
|
|
proto_tree *tree;
|
|
|
|
proto_item *item;
|
|
|
|
guint8 type;
|
|
|
|
|
|
|
|
if (!proto_is_protocol_enabled(find_protocol_by_id(proto_rgmp))) {
|
|
|
|
/* we are not enabled, skip entire packet to be nice
|
|
|
|
to the igmp layer. (so clicking on IGMP will display the data)
|
|
|
|
*/
|
2014-06-19 17:18:16 +00:00
|
|
|
return offset + tvb_length_remaining(tvb, offset);
|
2006-10-28 21:52:38 +00:00
|
|
|
}
|
|
|
|
|
2011-10-21 02:10:19 +00:00
|
|
|
item = proto_tree_add_item(parent_tree, proto_rgmp, tvb, offset, -1, ENC_NA);
|
2006-10-28 21:52:38 +00:00
|
|
|
tree = proto_item_add_subtree(item, ett_rgmp);
|
|
|
|
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RGMP");
|
2009-08-09 08:14:59 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2006-10-28 21:52:38 +00:00
|
|
|
|
|
|
|
type = tvb_get_guint8(tvb, offset);
|
2011-10-21 02:10:19 +00:00
|
|
|
col_add_str(pinfo->cinfo, COL_INFO,
|
2006-10-28 21:52:38 +00:00
|
|
|
val_to_str(type, rgmp_types, "Unknown Type: 0x%02x"));
|
|
|
|
proto_tree_add_uint(tree, hf_type, tvb, offset, 1, type);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
/* reserved */
|
|
|
|
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
igmp_checksum(tree, tvb, hf_checksum, hf_checksum_bad, pinfo, 0);
|
|
|
|
offset += 2;
|
|
|
|
|
2011-10-10 00:39:31 +00:00
|
|
|
proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, ENC_BIG_ENDIAN);
|
2006-10-28 21:52:38 +00:00
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_rgmp(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_type,
|
|
|
|
{ "Type", "rgmp.type", FT_UINT8, BASE_HEX,
|
|
|
|
VALS(rgmp_types), 0, "RGMP Packet Type", HFILL }
|
|
|
|
},
|
|
|
|
|
|
|
|
{ &hf_checksum,
|
|
|
|
{ "Checksum", "rgmp.checksum", FT_UINT16, BASE_HEX,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }
|
2006-10-28 21:52:38 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{ &hf_checksum_bad,
|
|
|
|
{ "Bad Checksum", "rgmp.checksum_bad", FT_BOOLEAN, BASE_NONE,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0x0, NULL, HFILL }
|
2006-10-28 21:52:38 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{ &hf_maddr,
|
|
|
|
{ "Multicast group address", "rgmp.maddr", FT_IPv4, BASE_NONE,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0, NULL, HFILL }
|
2006-10-28 21:52:38 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_rgmp
|
|
|
|
};
|
|
|
|
|
|
|
|
proto_rgmp = proto_register_protocol
|
|
|
|
("Router-port Group Management Protocol", "RGMP", "rgmp");
|
|
|
|
proto_register_field_array(proto_rgmp, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
}
|