diff options
author | Richard Sharpe <sharpe@ns.aus.com> | 2000-12-29 01:06:24 +0000 |
---|---|---|
committer | Richard Sharpe <sharpe@ns.aus.com> | 2000-12-29 01:06:24 +0000 |
commit | d481cd7b3fb4399a5da1e7401ce6d6de3b87f206 (patch) | |
tree | f6f7c812180e81ff6c320bd5bebea5dea123a8d6 /packet-lapbether.c | |
parent | bc40aeeadec325c9b9d5b6e6a1fb33acc174df83 (diff) | |
download | wireshark-d481cd7b3fb4399a5da1e7401ce6d6de3b87f206.tar.gz wireshark-d481cd7b3fb4399a5da1e7401ce6d6de3b87f206.tar.bz2 wireshark-d481cd7b3fb4399a5da1e7401ce6d6de3b87f206.zip |
Added a LAPBETHER dissector as per Guy's wishes ... :-)
Damn, took more than half an hour :-(
svn path=/trunk/; revision=2796
Diffstat (limited to 'packet-lapbether.c')
-rw-r--r-- | packet-lapbether.c | 108 |
1 files changed, 108 insertions, 0 deletions
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 <rsharpe@ns.aus.com> based on the lapb module by + * Olivier Abad <oabad@cybercable.fr> + * + * $Id: packet-lapbether.c,v 1.1 2000/12/29 01:06:24 sharpe Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@zing.org> + * 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 <sys/types.h> +#endif + +#include <stdio.h> +#include <glib.h> +#include <string.h> +#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); + +} |