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
;
23 static int hf_lapbether_length
;
25 static int ett_lapbether
;
27 static dissector_handle_t lapbether_handle
;
28 static dissector_handle_t lapb_handle
;
31 dissect_lapbether(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
33 proto_tree
*lapbether_tree
, *ti
;
37 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "LAPBETHER");
38 col_clear(pinfo
->cinfo
, COL_INFO
);
40 len
= tvb_get_uint8(tvb
, 0) + tvb_get_uint8(tvb
, 1) * 256;
44 ti
= proto_tree_add_protocol_format(tree
, proto_lapbether
, tvb
, 0, 2,
47 lapbether_tree
= proto_item_add_subtree(ti
, ett_lapbether
);
48 proto_tree_add_uint_format(lapbether_tree
, hf_lapbether_length
, tvb
, 0, 2,
49 len
, "Length: %u", len
);
53 next_tvb
= tvb_new_subset_length(tvb
, 2, len
);
54 call_dissector(lapb_handle
, next_tvb
, pinfo
, tree
);
56 return tvb_captured_length(tvb
);
60 proto_register_lapbether(void)
62 static hf_register_info hf
[] = {
63 { &hf_lapbether_length
,
64 { "Length Field", "lapbether.length", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
65 "LAPBEther Length Field", HFILL
}},
72 proto_lapbether
= proto_register_protocol ("Link Access Procedure Balanced Ethernet (LAPBETHER)",
73 "LAPBETHER", "lapbether");
74 proto_register_field_array (proto_lapbether
, hf
, array_length(hf
));
75 proto_register_subtree_array(ett
, array_length(ett
));
77 lapbether_handle
= register_dissector("lapbether", dissect_lapbether
, proto_lapbether
);
80 /* The registration hand-off routine */
82 proto_reg_handoff_lapbether(void)
85 * Get a handle for the LAPB dissector.
87 lapb_handle
= find_dissector_add_dependency("lapb", proto_lapbether
);
89 dissector_add_uint("ethertype", ETHERTYPE_DEC
, lapbether_handle
);
94 * Editor modelines - https://www.wireshark.org/tools/modelines.html
99 * indent-tabs-mode: nil
102 * ex: set shiftwidth=2 tabstop=8 expandtab:
103 * :indentSize=2:tabSize=8:noTabs=true: