Cisco Group Management Protocol dissector.

svn path=/trunk/; revision=1601
This commit is contained in:
Guy Harris 2000-02-05 05:54:17 +00:00
parent 1d03243542
commit 4b81b2dbc9
5 changed files with 149 additions and 3 deletions

View File

@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
# $Id: Makefile.am,v 1.160 2000/01/30 16:57:20 nneul Exp $
# $Id: Makefile.am,v 1.161 2000/02/05 05:54:17 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@zing.org>
@ -50,6 +50,7 @@ DISSECTOR_SOURCES = \
packet-bootparams.h \
packet-bpdu.c \
packet-cdp.c \
packet-cgmp.c \
packet-clip.c \
packet-data.c \
packet-dns.c \

View File

@ -33,6 +33,7 @@ DISSECTOR_OBJECTS = \
packet-bootparams.obj \
packet-bpdu.obj \
packet-cdp.obj \
packet-cgmp.obj \
packet-clip.obj \
packet-data.obj \
packet-dns.obj \

139
packet-cgmp.c Normal file
View File

@ -0,0 +1,139 @@
/* packet-cgmp.c
* Routines for the disassembly of the Cisco Group Management Protocol
*
* $Id: packet-cgmp.c,v 1.1 2000/02/05 05:54:15 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "packet.h"
/*
* See
*
* http://www.barnett.sk/software/bbooks/cisco_multicasting_routing/chap04.html
*
* for some information on CGMP.
*/
static int proto_cgmp = -1;
static int hf_cgmp_version = -1;
static int hf_cgmp_type = -1;
static int hf_cgmp_count = -1;
static int hf_cgmp_gda = -1;
static int hf_cgmp_usa = -1;
static gint ett_cgmp = -1;
static const value_string type_vals[] = {
{ 0, "Join" },
{ 1, "Leave" },
{ 0, NULL },
};
void
dissect_cgmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
{
proto_item *ti;
proto_tree *cgmp_tree = NULL;
guint8 count;
if (check_col(fd, COL_PROTOCOL))
col_add_str(fd, COL_PROTOCOL, "CGMP");
if (check_col(fd, COL_INFO))
col_add_str(fd, COL_INFO, "Cisco Group Management Protocol");
if (tree) {
ti = proto_tree_add_item(tree, proto_cgmp, offset, END_OF_FRAME, NULL);
cgmp_tree = proto_item_add_subtree(ti, ett_cgmp);
proto_tree_add_item(cgmp_tree, hf_cgmp_version, offset, 1,
pd[offset]);
proto_tree_add_item(cgmp_tree, hf_cgmp_type, offset, 1,
pd[offset]);
offset += 1;
offset += 2; /* skip reserved field */
count = pd[offset];
proto_tree_add_item(cgmp_tree, hf_cgmp_count, offset, 1,
count);
offset += 1;
while (count != 0) {
if (!BYTES_ARE_IN_FRAME(offset, 6))
break;
proto_tree_add_item(cgmp_tree, hf_cgmp_gda, offset, 6,
&pd[offset]);
offset += 6;
if (!BYTES_ARE_IN_FRAME(offset, 6))
break;
proto_tree_add_item(cgmp_tree, hf_cgmp_usa, offset, 6,
&pd[offset]);
offset += 6;
count--;
}
}
}
void
proto_register_cgmp(void)
{
static hf_register_info hf[] = {
{ &hf_cgmp_version,
{ "Version", "cgmp.version", FT_UINT8, BASE_DEC, NULL, 0xF0,
"" }},
{ &hf_cgmp_type,
{ "Type", "cgmp.type", FT_UINT8, BASE_DEC, VALS(type_vals), 0x0F,
"" }},
{ &hf_cgmp_count,
{ "Count", "cgmp.count", FT_UINT8, BASE_DEC, NULL, 0x0,
"" }},
{ &hf_cgmp_gda,
{ "Group Destination Address", "cgmp.gda", FT_ETHER, BASE_NONE, NULL, 0x0,
"Group Destination Address" }},
{ &hf_cgmp_usa,
{ "Unicast Source Address", "cgmp.usa", FT_ETHER, BASE_NONE, NULL, 0x0,
"Unicast Source Address" }},
};
static gint *ett[] = {
&ett_cgmp,
};
proto_cgmp = proto_register_protocol("Cisco Group Management Protocol", "cgmp");
proto_register_field_array(proto_cgmp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}

View File

@ -2,7 +2,7 @@
* Routines for IEEE 802.2 LLC layer
* Gilbert Ramirez <gramirez@tivoli.com>
*
* $Id: packet-llc.c,v 1.44 2000/01/24 02:44:52 guy Exp $
* $Id: packet-llc.c,v 1.45 2000/02/05 05:54:15 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -397,6 +397,10 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
dissect_cdp(pd, offset+8, fd, tree);
break;
case 0x2001:
dissect_cgmp(pd, offset+8, fd, tree);
break;
default:
dissect_data(pd, offset+8, fd, tree);
break;

View File

@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
* $Id: packet.h,v 1.168 2000/01/24 18:46:45 guy Exp $
* $Id: packet.h,v 1.169 2000/02/05 05:54:16 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -334,6 +334,7 @@ void dissect_bgp(const u_char *, int, frame_data *, proto_tree *);
void dissect_bootp(const u_char *, int, frame_data *, proto_tree *);
void dissect_bpdu(const u_char *, int, frame_data *, proto_tree *);
void dissect_cdp(const u_char *, int, frame_data *, proto_tree *);
void dissect_cgmp(const u_char *, int, frame_data *, proto_tree *);
void dissect_cotp(const u_char *, int, frame_data *, proto_tree *);
void dissect_data(const u_char *, int, frame_data *, proto_tree *);
void dissect_ddp(const u_char *, int, frame_data *, proto_tree *);