2000-12-29 02:27:21 +00:00
|
|
|
/* packet-lapbether.c
|
2000-12-29 01:06:24 +00:00
|
|
|
* Routines for lapbether frame disassembly
|
|
|
|
* Richard Sharpe <rsharpe@ns.aus.com> based on the lapb module by
|
2002-09-01 14:30:34 +00:00
|
|
|
* Olivier Abad <oabad@noos.fr>
|
2000-12-29 01:06:24 +00:00
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2000-12-29 01:06:24 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2000-12-29 01:06:24 +00:00
|
|
|
* Copyright 1998
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2000-12-29 01:06:24 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2000-12-29 01:06:24 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2000-12-29 01:06:24 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2000-12-29 01:06:24 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2000-12-29 01:06:24 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2005-09-17 00:02:31 +00:00
|
|
|
#include <epan/etypes.h>
|
2000-12-29 01:06:24 +00:00
|
|
|
|
2013-12-15 23:44:12 +00:00
|
|
|
void proto_register_lapbether(void);
|
|
|
|
void proto_reg_handoff_lapbether(void);
|
|
|
|
|
2000-12-29 01:06:24 +00:00
|
|
|
static int proto_lapbether = -1;
|
|
|
|
|
|
|
|
static int hf_lapbether_length = -1;
|
|
|
|
|
|
|
|
static gint ett_lapbether = -1;
|
|
|
|
|
2000-12-29 02:27:21 +00:00
|
|
|
static dissector_handle_t lapb_handle;
|
|
|
|
|
|
|
|
static void
|
2000-12-29 01:06:24 +00:00
|
|
|
dissect_lapbether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
proto_tree *lapbether_tree, *ti;
|
|
|
|
int len;
|
|
|
|
tvbuff_t *next_tvb;
|
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "LAPBETHER");
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2000-12-29 01:06:24 +00:00
|
|
|
|
|
|
|
len = tvb_get_guint8(tvb, 0) + tvb_get_guint8(tvb, 1) * 256;
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_lapbether, tvb, 0, 2,
|
2000-12-29 01:06:24 +00:00
|
|
|
"LAPBETHER");
|
|
|
|
|
|
|
|
lapbether_tree = proto_item_add_subtree(ti, ett_lapbether);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_uint_format(lapbether_tree, hf_lapbether_length, tvb, 0, 2,
|
2000-12-29 01:06:24 +00:00
|
|
|
len, "Length: %u", len);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
next_tvb = tvb_new_subset(tvb, 2, len, len);
|
2000-12-29 02:27:21 +00:00
|
|
|
call_dissector(lapb_handle, next_tvb, pinfo, tree);
|
2000-12-29 01:06:24 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_lapbether(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_lapbether_length,
|
2002-08-28 21:04:11 +00:00
|
|
|
{ "Length Field", "lapbether.length", FT_UINT16, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"LAPBEther Length Field", HFILL }},
|
2000-12-29 01:06:24 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_lapbether,
|
|
|
|
};
|
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_lapbether = proto_register_protocol ("Link Access Procedure Balanced Ethernet (LAPBETHER)",
|
|
|
|
"LAPBETHER", "lapbether");
|
2000-12-29 01:06:24 +00:00
|
|
|
proto_register_field_array (proto_lapbether, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The registration hand-off routine */
|
|
|
|
void
|
|
|
|
proto_reg_handoff_lapbether(void)
|
|
|
|
{
|
2001-12-03 04:00:26 +00:00
|
|
|
dissector_handle_t lapbether_handle;
|
2000-12-29 01:06:24 +00:00
|
|
|
|
2000-12-29 02:27:21 +00:00
|
|
|
/*
|
|
|
|
* Get a handle for the LAPB dissector.
|
|
|
|
*/
|
|
|
|
lapb_handle = find_dissector("lapb");
|
|
|
|
|
2001-12-03 04:00:26 +00:00
|
|
|
lapbether_handle = create_dissector_handle(dissect_lapbether,
|
|
|
|
proto_lapbether);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("ethertype", ETHERTYPE_DEC, lapbether_handle);
|
2000-12-29 01:06:24 +00:00
|
|
|
|
|
|
|
}
|