Cisco Group Management Protocol dissector.
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 5 Feb 2000 05:54:17 +0000 (05:54 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 5 Feb 2000 05:54:17 +0000 (05:54 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1601 f5534014-38df-0310-8fa8-9805f1628bb7

Makefile.am
Makefile.nmake
packet-cgmp.c [new file with mode: 0644]
packet-llc.c
packet.h

index 1cbfe80b249dc0a83026f0625e2bc9da4698367e..036530fb485ffbd6cdbda4a5a8953e490ce585e1 100644 (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   \
index ee10e8df9eb921e3e342d2238ac38840473fb89d..bfa854550cf5a7e1514ff040d359911e863286a5 100644 (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   \
diff --git a/packet-cgmp.c b/packet-cgmp.c
new file mode 100644 (file)
index 0000000..f07a690
--- /dev/null
@@ -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));
+}
index 1ccc5d00cb77b4fef5ea9daa982c823f4352fb39..e8dd8d42aacdfc5948214b70a94b25f39b926ce3 100644 (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;
index ba3b735fadc6f431aa284e3fa019e7506ca18933..64e1aae45375d079a2bf3f53eb4454463db27aac 100644 (file)
--- a/packet.h
+++ b/packet.h
@@ -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 *);