2003-02-27 02:45:42 +00:00
|
|
|
/* packet-bofl.c
|
|
|
|
* Routines for Wellfleet BOFL dissection
|
|
|
|
* Author: Endoh Akira (endoh@netmarks.co.jp)
|
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
2003-02-27 02:45:42 +00:00
|
|
|
* By Gerald Combs <gerald@unicom.net>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-12 11:23:27 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2003-02-28 00:08:04 +00:00
|
|
|
*
|
|
|
|
* The following information was copied from
|
2017-02-21 02:58:03 +00:00
|
|
|
* http://web.archive.org/web/20150608035209/http://www.protocols.com/pbook/bridge.htm#WellfleetBOFL
|
2003-02-28 00:08:04 +00:00
|
|
|
*
|
|
|
|
* The Wellfleet Breath of Life (BOFL) protocol is used as a line sensing
|
|
|
|
* protocol on:
|
|
|
|
*
|
|
|
|
* - Ethernet LANs to detect transmitter jams.
|
|
|
|
* - Synchronous lines running WFLT STD protocols to determine if the line
|
|
|
|
* is up.
|
|
|
|
* - Dial backup PPP lines.
|
|
|
|
*
|
|
|
|
* The frame format of Wellfleet BOFL is shown following the Ethernet header
|
|
|
|
* in the following illustration:
|
|
|
|
*
|
|
|
|
* Destination Source 8102 PDU Sequence Padding
|
|
|
|
* 6 6 2 4 4 n bytes
|
2003-02-27 02:45:42 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2003-02-27 02:45:42 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
|
|
|
|
#define ETHER_TYPE_BOFL 0x8102
|
|
|
|
#define BOFL_MIN_LEN 8
|
|
|
|
|
2013-03-14 07:37:13 +00:00
|
|
|
void proto_register_bofl(void);
|
|
|
|
void proto_reg_handoff_bofl(void);
|
|
|
|
|
2003-02-27 02:45:42 +00:00
|
|
|
/* Initialize the protocol and registered fields */
|
|
|
|
static int proto_bofl = -1;
|
|
|
|
static int hf_bofl_pdu = -1;
|
|
|
|
static int hf_bofl_sequence = -1;
|
2014-08-01 14:08:57 +00:00
|
|
|
static int hf_bofl_padding = -1;
|
2003-02-27 02:45:42 +00:00
|
|
|
|
|
|
|
/* Initialize the subtree pointers */
|
|
|
|
static gint ett_bofl = -1;
|
|
|
|
|
|
|
|
/* Code to actually dissect the packets */
|
2015-11-15 13:00:10 +00:00
|
|
|
static int
|
|
|
|
dissect_bofl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
2003-02-27 02:45:42 +00:00
|
|
|
{
|
|
|
|
proto_item *ti;
|
2014-06-22 20:01:36 +00:00
|
|
|
proto_tree *bofl_tree;
|
2003-03-01 09:37:38 +00:00
|
|
|
gint len;
|
2003-02-27 02:45:42 +00:00
|
|
|
guint32 pdu, sequence;
|
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BOFL");
|
2003-02-27 02:45:42 +00:00
|
|
|
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2003-03-01 09:37:38 +00:00
|
|
|
|
2014-06-22 20:01:36 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_bofl, tvb, 0, -1, ENC_NA);
|
|
|
|
bofl_tree = proto_item_add_subtree(ti, ett_bofl);
|
2003-02-27 02:45:42 +00:00
|
|
|
|
|
|
|
pdu = tvb_get_ntohl(tvb, 0);
|
2012-04-24 18:27:06 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO,
|
|
|
|
"PDU: 0x%08x", pdu);
|
2014-06-22 20:01:36 +00:00
|
|
|
proto_tree_add_uint(bofl_tree, hf_bofl_pdu, tvb, 0, 4, pdu);
|
2003-03-01 09:37:38 +00:00
|
|
|
|
|
|
|
sequence = tvb_get_ntohl(tvb, 4);
|
2011-09-26 08:25:18 +00:00
|
|
|
|
2012-04-24 18:27:06 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO,
|
|
|
|
" Sequence: %u", sequence);
|
2014-06-22 20:01:36 +00:00
|
|
|
|
|
|
|
proto_tree_add_uint(bofl_tree, hf_bofl_sequence, tvb, 4, 4, sequence);
|
|
|
|
|
2014-08-08 21:44:42 +00:00
|
|
|
len = tvb_reported_length_remaining(tvb, 8);
|
2014-06-22 20:01:36 +00:00
|
|
|
if (len > 0)
|
2014-08-01 14:08:57 +00:00
|
|
|
proto_tree_add_item(bofl_tree, hf_bofl_padding, tvb, 8, -1, ENC_NA);
|
2015-11-15 13:00:10 +00:00
|
|
|
|
|
|
|
return tvb_captured_length(tvb);
|
2003-02-27 02:45:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_bofl(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
2012-04-24 18:27:06 +00:00
|
|
|
{ &hf_bofl_pdu,
|
|
|
|
{ "PDU", "bofl.pdu",
|
|
|
|
FT_UINT32, BASE_HEX, NULL, 0,
|
|
|
|
"PDU; normally equals 0x01010000 or 0x01011111", HFILL }
|
2014-08-01 14:08:57 +00:00
|
|
|
},
|
2012-04-24 18:27:06 +00:00
|
|
|
{ &hf_bofl_sequence,
|
|
|
|
{ "Sequence", "bofl.sequence",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
|
|
|
"incremental counter", HFILL }
|
2014-08-01 14:08:57 +00:00
|
|
|
},
|
|
|
|
{ &hf_bofl_padding,
|
|
|
|
{ "Padding", "bofl.padding",
|
2014-08-08 21:44:42 +00:00
|
|
|
FT_BYTES, BASE_NONE, NULL, 0,
|
|
|
|
NULL, HFILL }
|
2012-04-24 18:27:06 +00:00
|
|
|
}
|
2003-02-27 02:45:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
2012-04-24 18:27:06 +00:00
|
|
|
&ett_bofl,
|
2003-02-27 02:45:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
proto_bofl = proto_register_protocol("Wellfleet Breath of Life",
|
2012-04-24 18:27:06 +00:00
|
|
|
"BOFL", "bofl");
|
2003-02-27 02:45:42 +00:00
|
|
|
proto_register_field_array(proto_bofl, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_bofl(void)
|
|
|
|
{
|
|
|
|
dissector_handle_t bofl_handle;
|
|
|
|
|
2015-12-09 03:49:44 +00:00
|
|
|
bofl_handle = create_dissector_handle(dissect_bofl, proto_bofl);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("ethertype", ETHER_TYPE_BOFL, bofl_handle);
|
2003-02-27 02:45:42 +00:00
|
|
|
}
|
2014-09-28 23:25:09 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|