epan/dissectors/pidl/ C99 drsuapi
[wireshark-sm.git] / epan / dissectors / packet-retix-bpdu.c
blobd5698fdef94dedaa27ae80f5323a18a335aeab64
1 /* packet-retix-bpdu.c
2 * Routines for BPDU (Retix Spanning Tree Protocol) disassembly
4 * Copyright 2005 Giles Scott (gscott <AT> arubanetworks dot com>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #include "config.h"
15 #if 0
16 #endif
17 #include <epan/packet.h>
18 #if 0
19 #include <epan/llcsaps.h>
20 #include <epan/ppptypes.h>
21 #include <epan/chdlctypes.h>
22 #endif
23 #include <epan/addr_resolv.h>
25 void proto_register_retix_bpdu(void);
27 static int ett_retix_bpdu;
28 static int proto_retix_bpdu;
30 static int hf_retix_bpdu_root_mac;
31 static int hf_retix_bpdu_bridge_mac;
32 static int hf_retix_bpdu_max_age;
33 static int hf_retix_bpdu_hello_time;
34 static int hf_retix_bpdu_forward_delay;
36 /* I don't have the spec's for this protcol so it's been reverse engineered
37 * It seems quite like 802.1D
38 * It looks like the protocol version is specified in the ethernet trailer
39 * In the single packet I have the trailer is
40 * "RevC CBPDU"
41 * There are several fields I've not dissected as I'm not exactly sure what they are
42 * What ever happened to Retix anyway?
44 static int
45 dissect_retix_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
47 proto_tree *retix_bpdu_tree;
48 proto_tree *ti;
50 col_set_str(pinfo->cinfo, COL_PROTOCOL, "R-STP");
52 ti = proto_tree_add_item(tree, proto_retix_bpdu, tvb, 0, -1, ENC_NA);
53 retix_bpdu_tree = proto_item_add_subtree(ti, ett_retix_bpdu);
55 proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_root_mac, tvb, 0, 6, ENC_NA);
57 proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_bridge_mac, tvb, 10, 6, ENC_NA);
58 col_add_fstr(pinfo->cinfo, COL_INFO, "Bridge MAC %s", tvb_ether_to_str(pinfo->pool, tvb, 10));
60 proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_max_age, tvb, 20, 2, ENC_BIG_ENDIAN);
61 proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_hello_time, tvb, 22, 2, ENC_BIG_ENDIAN);
62 proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_forward_delay, tvb, 24, 2, ENC_BIG_ENDIAN);
64 return tvb_captured_length(tvb);
68 void
69 proto_register_retix_bpdu(void)
71 static hf_register_info hf[] = {
72 { &hf_retix_bpdu_root_mac,
73 { "Root MAC", "r-stp.root.hw", FT_ETHER, BASE_NONE, NULL, 0x0,
74 NULL, HFILL}},
76 { &hf_retix_bpdu_bridge_mac,
77 { "Bridge MAC", "r-stp.bridge.hw", FT_ETHER, BASE_NONE, NULL, 0x0,
78 NULL, HFILL}},
80 { &hf_retix_bpdu_max_age,
81 { "Max Age", "r-stp.maxage", FT_UINT16, BASE_DEC, NULL, 0x0,
82 NULL, HFILL}},
84 { &hf_retix_bpdu_hello_time,
85 { "Hello Time", "r-stp.hello", FT_UINT16, BASE_DEC, NULL, 0x0,
86 NULL, HFILL}},
88 { &hf_retix_bpdu_forward_delay,
89 { "Forward Delay", "r-stp.forward", FT_UINT16, BASE_DEC, NULL, 0x0,
90 NULL, HFILL}},
93 static int *ett[] ={
94 &ett_retix_bpdu,
97 proto_retix_bpdu = proto_register_protocol("Retix Spanning Tree Protocol", "R-STP", "r-stp");
98 proto_register_field_array(proto_retix_bpdu, hf, array_length(hf));
99 proto_register_subtree_array(ett, array_length(ett));
100 register_dissector("rbpdu", dissect_retix_bpdu, proto_retix_bpdu);
104 * Editor modelines - https://www.wireshark.org/tools/modelines.html
106 * Local Variables:
107 * c-basic-offset: 2
108 * tab-width: 8
109 * indent-tabs-mode: nil
110 * End:
112 * ex: set shiftwidth=2 tabstop=8 expandtab:
113 * :indentSize=2:tabSize=8:noTabs=true: