FIXUP: WIP: verification_trailer
[wireshark-wip.git] / epan / dissectors / packet-lapbether.c
blob92aa8ccefdca1d093a7fd940f64a50e909025006
1 /* packet-lapbether.c
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 * $Id$
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include "config.h"
29 #include <glib.h>
30 #include <epan/packet.h>
31 #include <epan/etypes.h>
33 static int proto_lapbether = -1;
35 static int hf_lapbether_length = -1;
37 static gint ett_lapbether = -1;
39 static dissector_handle_t lapb_handle;
41 static void
42 dissect_lapbether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
44 proto_tree *lapbether_tree, *ti;
45 int len;
46 tvbuff_t *next_tvb;
48 col_set_str(pinfo->cinfo, COL_PROTOCOL, "LAPBETHER");
49 col_clear(pinfo->cinfo, COL_INFO);
51 len = tvb_get_guint8(tvb, 0) + tvb_get_guint8(tvb, 1) * 256;
53 if (tree) {
55 ti = proto_tree_add_protocol_format(tree, proto_lapbether, tvb, 0, 2,
56 "LAPBETHER");
58 lapbether_tree = proto_item_add_subtree(ti, ett_lapbether);
59 proto_tree_add_uint_format(lapbether_tree, hf_lapbether_length, tvb, 0, 2,
60 len, "Length: %u", len);
64 next_tvb = tvb_new_subset(tvb, 2, len, len);
65 call_dissector(lapb_handle, next_tvb, pinfo, tree);
69 void
70 proto_register_lapbether(void)
72 static hf_register_info hf[] = {
73 { &hf_lapbether_length,
74 { "Length Field", "lapbether.length", FT_UINT16, BASE_DEC, NULL, 0x0,
75 "LAPBEther Length Field", HFILL }},
78 static gint *ett[] = {
79 &ett_lapbether,
82 proto_lapbether = proto_register_protocol ("Link Access Procedure Balanced Ethernet (LAPBETHER)",
83 "LAPBETHER", "lapbether");
84 proto_register_field_array (proto_lapbether, hf, array_length(hf));
85 proto_register_subtree_array(ett, array_length(ett));
88 /* The registration hand-off routine */
89 void
90 proto_reg_handoff_lapbether(void)
92 dissector_handle_t lapbether_handle;
95 * Get a handle for the LAPB dissector.
97 lapb_handle = find_dissector("lapb");
99 lapbether_handle = create_dissector_handle(dissect_lapbether,
100 proto_lapbether);
101 dissector_add_uint("ethertype", ETHERTYPE_DEC, lapbether_handle);