2 * Routines for lapbether frame disassembly
3 * Richard Sharpe <rsharpe@ns.aus.com> based on the lapb module by
4 * Olivier Abad <oabad@noos.fr>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
10 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include <epan/packet.h>
16 #include <epan/etypes.h>
18 void proto_register_lapbether(void);
19 void proto_reg_handoff_lapbether(void);
21 static int proto_lapbether = -1;
23 static int hf_lapbether_length = -1;
25 static gint ett_lapbether = -1;
27 static dissector_handle_t lapb_handle;
30 dissect_lapbether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
32 proto_tree *lapbether_tree, *ti;
36 col_set_str(pinfo->cinfo, COL_PROTOCOL, "LAPBETHER");
37 col_clear(pinfo->cinfo, COL_INFO);
39 len = tvb_get_guint8(tvb, 0) + tvb_get_guint8(tvb, 1) * 256;
43 ti = proto_tree_add_protocol_format(tree, proto_lapbether, tvb, 0, 2,
46 lapbether_tree = proto_item_add_subtree(ti, ett_lapbether);
47 proto_tree_add_uint_format(lapbether_tree, hf_lapbether_length, tvb, 0, 2,
48 len, "Length: %u", len);
52 next_tvb = tvb_new_subset_length(tvb, 2, len);
53 call_dissector(lapb_handle, next_tvb, pinfo, tree);
55 return tvb_captured_length(tvb);
59 proto_register_lapbether(void)
61 static hf_register_info hf[] = {
62 { &hf_lapbether_length,
63 { "Length Field", "lapbether.length", FT_UINT16, BASE_DEC, NULL, 0x0,
64 "LAPBEther Length Field", HFILL }},
67 static gint *ett[] = {
71 proto_lapbether = proto_register_protocol ("Link Access Procedure Balanced Ethernet (LAPBETHER)",
72 "LAPBETHER", "lapbether");
73 proto_register_field_array (proto_lapbether, hf, array_length(hf));
74 proto_register_subtree_array(ett, array_length(ett));
77 /* The registration hand-off routine */
79 proto_reg_handoff_lapbether(void)
81 dissector_handle_t lapbether_handle;
84 * Get a handle for the LAPB dissector.
86 lapb_handle = find_dissector_add_dependency("lapb", proto_lapbether);
88 lapbether_handle = create_dissector_handle(dissect_lapbether,
90 dissector_add_uint("ethertype", ETHERTYPE_DEC, lapbether_handle);
95 * Editor modelines - https://www.wireshark.org/tools/modelines.html
100 * indent-tabs-mode: nil
103 * ex: set shiftwidth=2 tabstop=8 expandtab:
104 * :indentSize=2:tabSize=8:noTabs=true: