From d481cd7b3fb4399a5da1e7401ce6d6de3b87f206 Mon Sep 17 00:00:00 2001 From: Richard Sharpe Date: Fri, 29 Dec 2000 01:06:24 +0000 Subject: Added a LAPBETHER dissector as per Guy's wishes ... :-) Damn, took more than half an hour :-( svn path=/trunk/; revision=2796 --- Makefile.am | 3 +- packet-lapbether.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 packet-lapbether.c diff --git a/Makefile.am b/Makefile.am index 896e681064..78b01a7ea2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.264 2000/12/28 09:49:09 guy Exp $ +# $Id: Makefile.am,v 1.265 2000/12/29 01:06:24 sharpe Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs @@ -91,6 +91,7 @@ DISSECTOR_SOURCES = \ packet-kerberos.c \ packet-l2tp.c \ packet-lapb.c \ + packet-lapbether.c \ packet-lapd.c \ packet-ldap.c \ packet-ldp.c \ diff --git a/packet-lapbether.c b/packet-lapbether.c new file mode 100644 index 0000000000..a97b1904eb --- /dev/null +++ b/packet-lapbether.c @@ -0,0 +1,108 @@ +/* packet-lapb.c + * Routines for lapbether frame disassembly + * Richard Sharpe based on the lapb module by + * Olivier Abad + * + * $Id: packet-lapbether.c,v 1.1 2000/12/29 01:06:24 sharpe Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 + * + * + * 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. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_SYS_TYPES_H +# include +#endif + +#include +#include +#include +#include "packet.h" +#include "packet-lapb.h" +#include "packet-x25.h" +#include "xdlc.h" +#include "etypes.h" + +static int proto_lapbether = -1; + +static int hf_lapbether_length = -1; + +static gint ett_lapbether = -1; + +void +dissect_lapbether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_tree *lapbether_tree, *ti; + int len; + tvbuff_t *next_tvb; + + CHECK_DISPLAY_AS_DATA(proto_lapbether, tvb, pinfo, tree); + + pinfo->current_proto = "LAPBETHER"; + + if (check_col(pinfo->fd, COL_PROTOCOL)) + col_set_str(pinfo->fd, COL_PROTOCOL, "LAPBETHER"); + + len = tvb_get_guint8(tvb, 0) + tvb_get_guint8(tvb, 1) * 256; + + if (tree) { + + ti = proto_tree_add_protocol_format(tree, proto_lapbether, tvb, 0, 2, + "LAPBETHER"); + + lapbether_tree = proto_item_add_subtree(ti, ett_lapbether); + proto_tree_add_uint_format(lapbether_tree, hf_lapbether_length, tvb, 0, 2, + len, "Length: %u", len); + + } + + next_tvb = tvb_new_subset(tvb, 2, len, len); + dissect_lapb(next_tvb, pinfo, tree); + +} + +void +proto_register_lapbether(void) +{ + static hf_register_info hf[] = { + { &hf_lapbether_length, + { "Length Field", "lapbether.length", FT_UINT16, BASE_DEC, NULL, 0x0, + "LAPBEther Length Field"}}, + + }; + static gint *ett[] = { + &ett_lapbether, + }; + + proto_lapbether = proto_register_protocol ("Link Access Procedure Balanced Ethernet (LAPBETHER)", "lapbether"); + 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) +{ + + dissector_add("ethertype", ETHERTYPE_DEC, dissect_lapbether); + +} -- cgit v1.2.3