aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-retix-bpdu.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-02-15 21:01:51 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-02-15 21:01:51 +0000
commite8a4830bad99ddba90062c65e324d0f52fe8dd7d (patch)
tree7f3254de5a6262a1a78710bb881079133e94755f /epan/dissectors/packet-retix-bpdu.c
parentea7ef54b0da23a170ed61de375f281f592d6f551 (diff)
new protocol from Giles Scott : Retix spanning tree protocol
svn path=/trunk/; revision=13408
Diffstat (limited to 'epan/dissectors/packet-retix-bpdu.c')
-rw-r--r--epan/dissectors/packet-retix-bpdu.c135
1 files changed, 135 insertions, 0 deletions
diff --git a/epan/dissectors/packet-retix-bpdu.c b/epan/dissectors/packet-retix-bpdu.c
new file mode 100644
index 0000000000..19180954e0
--- /dev/null
+++ b/epan/dissectors/packet-retix-bpdu.c
@@ -0,0 +1,135 @@
+/* packet-retix-bpdu.c
+ * Routines for BPDU (Retix Spanning Tree Protocol) disassembly
+ *
+ *
+ * Copyright 2005 Giles Scott (gscott <AT> arubanetworks dot com>
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@ethereal.com>
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include <epan/packet.h>
+#include "llcsaps.h"
+#include "ppptypes.h"
+#include "chdlctypes.h"
+#include <epan/addr_resolv.h>
+
+static gint ett_retix_bpdu = -1;
+static int proto_retix_bpdu = -1;
+
+static int hf_retix_bpdu_root_mac = -1;
+static int hf_retix_bpdu_bridge_mac = -1;
+static int hf_retix_bpdu_max_age = -1;
+static int hf_retix_bpdu_hello_time = -1;
+static int hf_retix_bpdu_forward_delay = -1;
+
+/* I don't have the spec's for this protcol so its been reverse engineered
+ * It seems quite like 802.1d
+ * It looks like the protocol version is specified in the ethernet trailer
+ * In the single packet I have the trailer is
+ * "RevC CBPDU"
+ * There are several fields I've not dissected as I'm not exactly sure what they are
+ * What ever happened to Retix anyway?
+*/
+static void
+dissect_retix_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ proto_tree *retix_bpdu_tree;
+ proto_tree *ti;
+ const char *bridge_mac_str;
+
+ if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "R-STP");
+ }
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_clear(pinfo->cinfo, COL_INFO);
+ }
+ bridge_mac_str = tvb_get_ptr(tvb, 12, 6);
+ if (check_col(pinfo->cinfo, COL_INFO)){
+ col_add_fstr(pinfo->cinfo, COL_INFO, "Bridge MAC %s", ether_to_str(bridge_mac_str));
+ }
+
+
+ retix_bpdu_tree = NULL;
+
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_retix_bpdu, tvb, 0, -1, FALSE);
+ retix_bpdu_tree = proto_item_add_subtree(ti, ett_retix_bpdu);
+ }
+
+ proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_root_mac, tvb, 2, 6, FALSE);
+
+ proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_bridge_mac, tvb, 12, 6, FALSE);
+
+ proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_max_age, tvb, 22, 2, FALSE);
+ proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_hello_time, tvb, 24, 2, FALSE);
+ proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_forward_delay, tvb, 26, 2, FALSE);
+
+}
+
+
+void
+proto_register_retix_bpdu(void)
+{
+ static hf_register_info hf[] = {
+ { &hf_retix_bpdu_root_mac,
+ { "Root MAC", "rstp.root.hw", FT_ETHER, BASE_NONE, NULL, 0x0,
+ "", HFILL}},
+
+ { &hf_retix_bpdu_bridge_mac,
+ { "Bridge MAC", "rstp.bridge.hw", FT_ETHER, BASE_NONE, NULL, 0x0,
+ "", HFILL}},
+
+ { &hf_retix_bpdu_max_age,
+ { "Max Age", "rstp.maxage", FT_UINT16, BASE_DEC, NULL, 0x0,
+ "", HFILL}},
+
+ { &hf_retix_bpdu_hello_time,
+ { "Hello Time", "rstp.hello", FT_UINT16, BASE_DEC, NULL, 0x0,
+ "", HFILL}},
+
+ { &hf_retix_bpdu_forward_delay,
+ { "Forward Delay", "rstp.forward", FT_UINT16, BASE_DEC, NULL, 0x0,
+ "", HFILL}},
+ };
+
+ static gint *ett[] ={
+ &ett_retix_bpdu,
+ };
+
+ proto_retix_bpdu = proto_register_protocol("Retix Spanning Tree Protocol", "R-STP", "r-stp");
+ proto_register_field_array(proto_retix_bpdu, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+ register_dissector("rbpdu", dissect_retix_bpdu, proto_retix_bpdu);
+}
+
+void
+proto_reg_handoff_retix_bpdu(void)
+{
+ dissector_handle_t retix_bpdu_handle;
+
+ retix_bpdu_handle = find_dissector("rbpdu");
+ dissector_add("llc.dsap", 0x80, retix_bpdu_handle);
+}