epan/dissectors/pidl/samr/samr.cnf cnf_dissect_lsa_BinaryString => lsarpc_dissect_str...
[wireshark-sm.git] / epan / dissectors / packet-bofl.c
blob6b41576de829557223b0ce591368cb9a22edd38d
1 /* packet-bofl.c
2 * Routines for Wellfleet BOFL dissection
3 * Wellfleet -> Baynetworks -> Nortel -> Avaya -> Extremenetworks
4 * Protocol is now called Simple Loop Protection Protocol (SLPP)
5 * Author: Endoh Akira (endoh@netmarks.co.jp)
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@unicom.net>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
13 * The following information was copied from
14 * http://web.archive.org/web/20150608035209/http://www.protocols.com/pbook/bridge.htm#WellfleetBOFL
16 * The Wellfleet Breath of Life (BOFL) protocol is used as a line sensing
17 * protocol on:
19 * - Ethernet LANs to detect transmitter jams.
20 * - Synchronous lines running WFLT STD protocols to determine if the line
21 * is up.
22 * - Dial backup PPP lines.
24 * The frame format of Wellfleet BOFL is shown following the Ethernet header
25 * in the following illustration:
27 * Destination Source 8102 PDU Sequence Padding
28 * 6 6 2 4 4 n bytes
31 /* From the above link:
33 * Wellfleet BOFL
35 * The Wellfleet Breath of Life (BOFL) protocol is used as a line sensing protocol on:
37 * Ethernet LANs to detect transmitter jams.
38 * Synchronous lines running WFLT STD protocols to determine if the line is up.
39 * Dial backup PPP lines.
40 * The frame format of Wellfleet BOFL is shown following the Ethernet header in the following illustration:
42 * Destination | Source |8102 | PDU | Sequence | Padding
43 * 6 | 6 | 2 | 4 | 4 | n bytes
44 * <-------------------------->
45 * Ethernet Header
47 * 8102
48 * EtherType (0x8102 for Wellfleet BOFL frames).
50 * PDU
51 * PDU field normally equals 0x01010000, but may equal 0x01011111 in some new releases on synchronous links.
53 * Sequence
54 * 4-byte sequence field is an incremental counter.
56 * Padding
57 * Padding to fill out the frame to 64 bytes.
60 #include "config.h"
62 #include <epan/packet.h>
64 #define ETHER_TYPE_SLPP 0x8102
65 #define BOFL_MIN_LEN 8
67 void proto_register_bofl(void);
68 void proto_reg_handoff_bofl(void);
70 static dissector_handle_t bofl_handle;
72 /* Initialize the protocol and registered fields */
73 static int proto_bofl;
74 static int hf_bofl_pdu;
75 static int hf_bofl_sequence;
76 static int hf_bofl_padding;
78 /* Initialize the subtree pointers */
79 static int ett_bofl;
81 /* Code to actually dissect the packets */
82 static int
83 dissect_bofl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
85 proto_item *ti;
86 proto_tree *bofl_tree;
87 int len;
88 uint32_t pdu, sequence;
90 col_set_str(pinfo->cinfo, COL_PROTOCOL, "BOFL");
92 col_clear(pinfo->cinfo, COL_INFO);
94 ti = proto_tree_add_item(tree, proto_bofl, tvb, 0, -1, ENC_NA);
95 bofl_tree = proto_item_add_subtree(ti, ett_bofl);
97 pdu = tvb_get_ntohl(tvb, 0);
98 col_add_fstr(pinfo->cinfo, COL_INFO,
99 "PDU: 0x%08x", pdu);
100 proto_tree_add_uint(bofl_tree, hf_bofl_pdu, tvb, 0, 4, pdu);
102 sequence = tvb_get_ntohl(tvb, 4);
104 col_append_fstr(pinfo->cinfo, COL_INFO,
105 " Sequence: %u", sequence);
107 proto_tree_add_uint(bofl_tree, hf_bofl_sequence, tvb, 4, 4, sequence);
109 len = tvb_reported_length_remaining(tvb, 8);
110 if (len > 0)
111 proto_tree_add_item(bofl_tree, hf_bofl_padding, tvb, 8, -1, ENC_NA);
113 return tvb_captured_length(tvb);
117 void
118 proto_register_bofl(void)
120 static hf_register_info hf[] = {
121 { &hf_bofl_pdu,
122 { "PDU", "bofl.pdu",
123 FT_UINT32, BASE_HEX, NULL, 0,
124 "PDU; normally equals 0x01010000 or 0x01011111", HFILL }
126 { &hf_bofl_sequence,
127 { "Sequence", "bofl.sequence",
128 FT_UINT32, BASE_DEC, NULL, 0,
129 "incremental counter", HFILL }
131 { &hf_bofl_padding,
132 { "Padding", "bofl.padding",
133 FT_BYTES, BASE_NONE, NULL, 0,
134 NULL, HFILL }
138 static int *ett[] = {
139 &ett_bofl,
142 proto_bofl = proto_register_protocol("Wellfleet Breath of Life",
143 "BOFL", "bofl");
144 proto_register_field_array(proto_bofl, hf, array_length(hf));
145 proto_register_subtree_array(ett, array_length(ett));
147 bofl_handle = register_dissector("bofl", dissect_bofl, proto_bofl);
151 void
152 proto_reg_handoff_bofl(void)
154 dissector_add_uint("ethertype", ETHER_TYPE_SLPP, bofl_handle);
158 * Editor modelines - https://www.wireshark.org/tools/modelines.html
160 * Local variables:
161 * c-basic-offset: 4
162 * tab-width: 8
163 * indent-tabs-mode: nil
164 * End:
166 * vi: set shiftwidth=4 tabstop=8 expandtab:
167 * :indentSize=4:tabSize=8:noTabs=true: