/src/wireshark/epan/dissectors/packet-bofl.c
Line | Count | Source |
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) |
6 | | * |
7 | | * Wireshark - Network traffic analyzer |
8 | | * By Gerald Combs <gerald@unicom.net> |
9 | | * Copyright 1998 Gerald Combs |
10 | | * |
11 | | * SPDX-License-Identifier: GPL-2.0-or-later |
12 | | * |
13 | | * The following information was copied from |
14 | | * http://web.archive.org/web/20150608035209/http://www.protocols.com/pbook/bridge.htm#WellfleetBOFL |
15 | | * |
16 | | * The Wellfleet Breath of Life (BOFL) protocol is used as a line sensing |
17 | | * protocol on: |
18 | | * |
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. |
23 | | * |
24 | | * The frame format of Wellfleet BOFL is shown following the Ethernet header |
25 | | * in the following illustration: |
26 | | * |
27 | | * Destination Source 8102 PDU Sequence Padding |
28 | | * 6 6 2 4 4 n bytes |
29 | | */ |
30 | | |
31 | | /* From the above link: |
32 | | * |
33 | | * Wellfleet BOFL |
34 | | * |
35 | | * The Wellfleet Breath of Life (BOFL) protocol is used as a line sensing protocol on: |
36 | | * |
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: |
41 | | * |
42 | | * Destination | Source |8102 | PDU | Sequence | Padding |
43 | | * 6 | 6 | 2 | 4 | 4 | n bytes |
44 | | * <--------------------------> |
45 | | * Ethernet Header |
46 | | * |
47 | | * 8102 |
48 | | * EtherType (0x8102 for Wellfleet BOFL frames). |
49 | | * |
50 | | * PDU |
51 | | * PDU field normally equals 0x01010000, but may equal 0x01011111 in some new releases on synchronous links. |
52 | | * |
53 | | * Sequence |
54 | | * 4-byte sequence field is an incremental counter. |
55 | | * |
56 | | * Padding |
57 | | * Padding to fill out the frame to 64 bytes. |
58 | | */ |
59 | | |
60 | | #include "config.h" |
61 | | |
62 | | #include <epan/packet.h> |
63 | | |
64 | 14 | #define ETHER_TYPE_SLPP 0x8102 |
65 | | #define BOFL_MIN_LEN 8 |
66 | | |
67 | | void proto_register_bofl(void); |
68 | | void proto_reg_handoff_bofl(void); |
69 | | |
70 | | static dissector_handle_t bofl_handle; |
71 | | |
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; |
77 | | |
78 | | /* Initialize the subtree pointers */ |
79 | | static int ett_bofl; |
80 | | |
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_) |
84 | 5 | { |
85 | 5 | proto_item *ti; |
86 | 5 | proto_tree *bofl_tree; |
87 | 5 | int len; |
88 | 5 | uint32_t pdu, sequence; |
89 | | |
90 | 5 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "BOFL"); |
91 | | |
92 | 5 | col_clear(pinfo->cinfo, COL_INFO); |
93 | | |
94 | 5 | ti = proto_tree_add_item(tree, proto_bofl, tvb, 0, -1, ENC_NA); |
95 | 5 | bofl_tree = proto_item_add_subtree(ti, ett_bofl); |
96 | | |
97 | 5 | pdu = tvb_get_ntohl(tvb, 0); |
98 | 5 | col_add_fstr(pinfo->cinfo, COL_INFO, |
99 | 5 | "PDU: 0x%08x", pdu); |
100 | 5 | proto_tree_add_uint(bofl_tree, hf_bofl_pdu, tvb, 0, 4, pdu); |
101 | | |
102 | 5 | sequence = tvb_get_ntohl(tvb, 4); |
103 | | |
104 | 5 | col_append_fstr(pinfo->cinfo, COL_INFO, |
105 | 5 | " Sequence: %u", sequence); |
106 | | |
107 | 5 | proto_tree_add_uint(bofl_tree, hf_bofl_sequence, tvb, 4, 4, sequence); |
108 | | |
109 | 5 | len = tvb_reported_length_remaining(tvb, 8); |
110 | 5 | if (len > 0) |
111 | 2 | proto_tree_add_item(bofl_tree, hf_bofl_padding, tvb, 8, -1, ENC_NA); |
112 | | |
113 | 5 | return tvb_captured_length(tvb); |
114 | 5 | } |
115 | | |
116 | | |
117 | | void |
118 | | proto_register_bofl(void) |
119 | 14 | { |
120 | 14 | static hf_register_info hf[] = { |
121 | 14 | { &hf_bofl_pdu, |
122 | 14 | { "PDU", "bofl.pdu", |
123 | 14 | FT_UINT32, BASE_HEX, NULL, 0, |
124 | 14 | "PDU; normally equals 0x01010000 or 0x01011111", HFILL } |
125 | 14 | }, |
126 | 14 | { &hf_bofl_sequence, |
127 | 14 | { "Sequence", "bofl.sequence", |
128 | 14 | FT_UINT32, BASE_DEC, NULL, 0, |
129 | 14 | "incremental counter", HFILL } |
130 | 14 | }, |
131 | 14 | { &hf_bofl_padding, |
132 | 14 | { "Padding", "bofl.padding", |
133 | 14 | FT_BYTES, BASE_NONE, NULL, 0, |
134 | 14 | NULL, HFILL } |
135 | 14 | } |
136 | 14 | }; |
137 | | |
138 | 14 | static int *ett[] = { |
139 | 14 | &ett_bofl, |
140 | 14 | }; |
141 | | |
142 | 14 | proto_bofl = proto_register_protocol("Wellfleet Breath of Life", |
143 | 14 | "BOFL", "bofl"); |
144 | 14 | proto_register_field_array(proto_bofl, hf, array_length(hf)); |
145 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
146 | | |
147 | 14 | bofl_handle = register_dissector("bofl", dissect_bofl, proto_bofl); |
148 | 14 | } |
149 | | |
150 | | |
151 | | void |
152 | | proto_reg_handoff_bofl(void) |
153 | 14 | { |
154 | 14 | dissector_add_uint("ethertype", ETHER_TYPE_SLPP, bofl_handle); |
155 | 14 | } |
156 | | |
157 | | /* |
158 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
159 | | * |
160 | | * Local variables: |
161 | | * c-basic-offset: 4 |
162 | | * tab-width: 8 |
163 | | * indent-tabs-mode: nil |
164 | | * End: |
165 | | * |
166 | | * vi: set shiftwidth=4 tabstop=8 expandtab: |
167 | | * :indentSize=4:tabSize=8:noTabs=true: |
168 | | */ |