diff options
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | Makefile.nmake | 3 | ||||
-rw-r--r-- | etypes.h | 6 | ||||
-rw-r--r-- | packet-ethertype.c | 3 | ||||
-rw-r--r-- | packet-snaeth.c | 117 |
5 files changed, 128 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am index 3cf34463b8..f0b5629273 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.411 2002/02/02 12:04:22 guy Exp $ +# $Id: Makefile.am,v 1.412 2002/02/17 00:16:19 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@ethereal.com> @@ -258,6 +258,7 @@ DISSECTOR_SRC = \ packet-smpp.c \ packet-smtp.c \ packet-sna.c \ + packet-snaeth.c \ packet-snmp.c \ packet-socks.c \ packet-spray.c \ diff --git a/Makefile.nmake b/Makefile.nmake index 9c9f32295c..272faeb0db 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -1,7 +1,7 @@ ## Makefile for building ethereal.exe with Microsoft C and nmake ## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake # -# $Id: Makefile.nmake,v 1.170 2002/02/02 12:04:22 guy Exp $ +# $Id: Makefile.nmake,v 1.171 2002/02/17 00:16:19 guy Exp $ include config.nmake include <win32.mak> @@ -209,6 +209,7 @@ DISSECTOR_SRC = \ packet-smpp.c \ packet-smtp.c \ packet-sna.c \ + packet-snaeth.c \ packet-snmp.c \ packet-socks.c \ packet-spray.c \ @@ -1,7 +1,7 @@ /* etypes.h * Defines ethernet packet types, similar to tcpdump's ethertype.h * - * $Id: etypes.h,v 1.22 2001/11/06 20:30:39 guy Exp $ + * $Id: etypes.h,v 1.23 2002/02/17 00:16:19 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -120,6 +120,10 @@ #define ETHERTYPE_ATALK 0x809b #endif +#ifndef ETHERTYPE_SNA +#define ETHERTYPE_SNA 0x80d5 +#endif + #ifndef ETHERTYPE_AARP #define ETHERTYPE_AARP 0x80f3 #endif diff --git a/packet-ethertype.c b/packet-ethertype.c index 12044e625c..931f3c5a11 100644 --- a/packet-ethertype.c +++ b/packet-ethertype.c @@ -1,7 +1,7 @@ /* ethertype.c * Routines for calling the right protocol for the ethertype. * - * $Id: packet-ethertype.c,v 1.25 2002/01/21 07:36:34 guy Exp $ + * $Id: packet-ethertype.c,v 1.26 2002/02/17 00:16:19 guy Exp $ * * Gilbert Ramirez <gram@alumni.rice.edu> * @@ -53,6 +53,7 @@ const value_string etype_vals[] = { {ETHERTYPE_REVARP, "RARP" }, {ETHERTYPE_DEC_LB, "DEC LanBridge" }, {ETHERTYPE_ATALK, "Appletalk" }, + {ETHERTYPE_SNA, "SNA-over-Ethernet" }, {ETHERTYPE_AARP, "AARP" }, {ETHERTYPE_IPX, "Netware IPX/SPX" }, {ETHERTYPE_VINES, "Vines" }, diff --git a/packet-snaeth.c b/packet-snaeth.c new file mode 100644 index 0000000000..61a6b45bd3 --- /dev/null +++ b/packet-snaeth.c @@ -0,0 +1,117 @@ +/* packet-snaeth.c + * Routines for SNA-over-Ethernet (Ethernet type 80d5) + * + * $Id: packet-snaeth.c,v 1.1 2002/02/17 00:16:19 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * Copyright 1998 Gerald Combs + * + * 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 <glib.h> +#include <epan/packet.h> +#include "etypes.h" + +/* + * See + * + * http://www.cisco.com/univercd/cc/td/doc/product/software/ssr90/rpc_r/18059.pdf + */ + +static int proto_snaeth = -1; +static int hf_snaeth_len = -1; + +static gint ett_snaeth = -1; + +static dissector_handle_t llc_handle; + +static void +dissect_snaeth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_tree *snaeth_tree; + proto_item *snaeth_ti; + guint16 len; + tvbuff_t *next_tvb; + + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "SNAETH"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_set_str(pinfo->cinfo, COL_INFO, "SNA over Ethernet"); + + /* length */ + len = tvb_get_ntohs(tvb, 0); + + if (tree) { + snaeth_ti = proto_tree_add_item(tree, proto_snaeth, tvb, 0, 3, + FALSE); + snaeth_tree = proto_item_add_subtree(snaeth_ti, ett_snaeth); + proto_tree_add_uint(snaeth_tree, hf_snaeth_len, tvb, 0, 2, len); + proto_tree_add_text(snaeth_tree, tvb, 2, 1, "Padding"); + } + + /* + * Adjust the length of this tvbuff to include only the SNA-over- + * Ethernet header and data. + */ + set_actual_length(tvb, pinfo, 3 + len); + + /* + * Rest of packet starts with an 802.2 LLC header. + */ + next_tvb = tvb_new_subset(tvb, 3, -1, -1); + call_dissector(llc_handle, next_tvb, pinfo, tree); +} + +void +proto_register_snaeth(void) +{ + static hf_register_info hf[] = { + { &hf_snaeth_len, + { "Length", "snaeth_len", FT_UINT16, BASE_DEC, NULL, 0x0, + "Length of LLC payload", HFILL }}, + }; + static gint *ett[] = { + &ett_snaeth, + }; + + proto_snaeth = proto_register_protocol("SNA-over-Ethernet", + "SNAETH", "snaeth"); + proto_register_field_array(proto_snaeth, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); +} + +void +proto_reg_handoff_snaeth(void) +{ + dissector_handle_t snaeth_handle; + + /* + * Get handle for the LLC dissector. + */ + llc_handle = find_dissector("llc"); + + snaeth_handle = create_dissector_handle(dissect_snaeth, proto_snaeth); + dissector_add("ethertype", ETHERTYPE_SNA, snaeth_handle); +} |