2 * Routines for the disassembly of the Cisco Group Management Protocol
4 * $Id: packet-cgmp.c,v 1.7 2001/01/03 06:55:27 guy Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@zing.org>
8 * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 #ifdef HAVE_SYS_TYPES_H
29 #include <sys/types.h>
41 * http://www.barnett.sk/software/bbooks/cisco_multicasting_routing/chap04.html
43 * for some information on CGMP.
46 static int proto_cgmp = -1;
47 static int hf_cgmp_version = -1;
48 static int hf_cgmp_type = -1;
49 static int hf_cgmp_count = -1;
50 static int hf_cgmp_gda = -1;
51 static int hf_cgmp_usa = -1;
53 static gint ett_cgmp = -1;
55 static const value_string type_vals[] = {
62 dissect_cgmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
65 proto_tree *cgmp_tree = NULL;
69 CHECK_DISPLAY_AS_DATA(proto_cgmp, tvb, pinfo, tree);
71 pinfo->current_proto = "CGMP";
73 if (check_col(pinfo->fd, COL_PROTOCOL))
74 col_set_str(pinfo->fd, COL_PROTOCOL, "CGMP");
75 if (check_col(pinfo->fd, COL_INFO))
76 col_set_str(pinfo->fd, COL_INFO, "Cisco Group Management Protocol");
79 ti = proto_tree_add_item(tree, proto_cgmp, tvb, offset,
80 tvb_length_remaining(tvb, offset), FALSE);
81 cgmp_tree = proto_item_add_subtree(ti, ett_cgmp);
83 proto_tree_add_item(cgmp_tree, hf_cgmp_version, tvb, offset, 1,
85 proto_tree_add_item(cgmp_tree, hf_cgmp_type, tvb, offset, 1,
89 offset += 2; /* skip reserved field */
91 count = tvb_get_guint8(tvb, offset);
92 proto_tree_add_uint(cgmp_tree, hf_cgmp_count, tvb, offset, 1,
97 proto_tree_add_item(cgmp_tree, hf_cgmp_gda, tvb, offset, 6,
101 proto_tree_add_item(cgmp_tree, hf_cgmp_usa, tvb, offset, 6,
111 proto_register_cgmp(void)
113 static hf_register_info hf[] = {
115 { "Version", "cgmp.version", FT_UINT8, BASE_DEC, NULL, 0xF0,
119 { "Type", "cgmp.type", FT_UINT8, BASE_DEC, VALS(type_vals), 0x0F,
123 { "Count", "cgmp.count", FT_UINT8, BASE_DEC, NULL, 0x0,
127 { "Group Destination Address", "cgmp.gda", FT_ETHER, BASE_NONE, NULL, 0x0,
128 "Group Destination Address" }},
131 { "Unicast Source Address", "cgmp.usa", FT_ETHER, BASE_NONE, NULL, 0x0,
132 "Unicast Source Address" }},
134 static gint *ett[] = {
138 proto_cgmp = proto_register_protocol("Cisco Group Management Protocol",
140 proto_register_field_array(proto_cgmp, hf, array_length(hf));
141 proto_register_subtree_array(ett, array_length(ett));
145 proto_reg_handoff_cgmp(void)
147 dissector_add("llc.cisco_pid", 0x2001, dissect_cgmp);