diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2000-11-17 06:02:21 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2000-11-17 06:02:21 +0000 |
commit | a4e0ded59a8b7fce18ca2bb5afa067c202ca5bd6 (patch) | |
tree | e100d9c5b026a703e9a005330eed9e9cfe1595e0 | |
parent | 633189a0629d889f6cccbb2be820ac3d40c885db (diff) |
Give the "null" link-layer header dissector a dissector table, and put
the BSD AF_ type values it uses into an "aftypes.h" header file for
dissectors that register themselves in that dissector table include.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2653 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | aftypes.h | 33 | ||||
-rw-r--r-- | packet-atalk.c | 6 | ||||
-rw-r--r-- | packet-atalk.h | 4 | ||||
-rw-r--r-- | packet-ip.c | 4 | ||||
-rw-r--r-- | packet-ipv6.c | 5 | ||||
-rw-r--r-- | packet-ipx.c | 4 | ||||
-rw-r--r-- | packet-null.c | 48 | ||||
-rw-r--r-- | packet-osi.c | 4 |
9 files changed, 63 insertions, 49 deletions
diff --git a/Makefile.am b/Makefile.am index cfd263b1f8..99d7d11a92 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.248 2000/11/16 07:35:37 guy Exp $ +# $Id: Makefile.am,v 1.249 2000/11/17 06:02:20 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@zing.org> @@ -269,6 +269,7 @@ noinst_HEADERS = \ packet-ypxfr.h ETHEREAL_COMMON_SOURCES = \ + aftypes.h \ alignment.h \ asn1.c \ asn1.h \ @@ -612,4 +613,3 @@ debian-package: debian/rules clean-local: rm -rf $(top_stagedir) - diff --git a/aftypes.h b/aftypes.h new file mode 100644 index 0000000000..2ae1d92187 --- /dev/null +++ b/aftypes.h @@ -0,0 +1,33 @@ +/* aftypes.h + * AF_ values on various flavors of BSD + * + * $Id: aftypes.h,v 1.1 2000/11/17 06:02:20 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@zing.org> + * + * This file created and by Mike Hall <mlh@io.com> + * 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. + */ + +/* BSD AF_ values. */ +#define BSD_AF_INET 2 +#define BSD_AF_ISO 7 +#define BSD_AF_APPLETALK 16 +#define BSD_AF_IPX 23 +#define BSD_AF_INET6_BSD 24 /* OpenBSD (and probably NetBSD), BSD/OS */ +#define BSD_AF_INET6_FREEBSD 28 diff --git a/packet-atalk.c b/packet-atalk.c index 5e70302e75..4680a869e2 100644 --- a/packet-atalk.c +++ b/packet-atalk.c @@ -1,7 +1,7 @@ /* packet-atalk.c * Routines for Appletalk packet disassembly (DDP, currently). * - * $Id: packet-atalk.c,v 1.44 2000/11/16 07:35:37 guy Exp $ + * $Id: packet-atalk.c,v 1.45 2000/11/17 06:02:20 guy Exp $ * * Simon Wilkinson <sxw@dcs.ed.ac.uk> * @@ -37,6 +37,7 @@ #include "packet-atalk.h" #include "etypes.h" #include "ppptypes.h" +#include "aftypes.h" static int proto_ddp = -1; static int hf_ddp_hopcount = -1; @@ -376,7 +377,7 @@ dissect_nbp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { return; } -void +static void dissect_ddp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { e_ddp ddp; proto_tree *ddp_tree; @@ -583,6 +584,7 @@ proto_reg_handoff_atalk(void) { dissector_add("ethertype", ETHERTYPE_ATALK, dissect_ddp); dissector_add("ppp.protocol", PPP_AT, dissect_ddp); + dissector_add("null.type", BSD_AF_APPLETALK, dissect_ddp); dissector_add("ddp.type", DDP_NBP, dissect_nbp); dissector_add("ddp.type", DDP_RTMPREQ, dissect_rtmp_request); dissector_add("ddp.type", DDP_RTMPDATA, dissect_rtmp_data); diff --git a/packet-atalk.h b/packet-atalk.h index 43d8c8d826..b3eabdc220 100644 --- a/packet-atalk.h +++ b/packet-atalk.h @@ -1,7 +1,7 @@ /* packet-atalk.h * Definitions for Appletalk packet disassembly (DDP, currently). * - * $Id: packet-atalk.h,v 1.5 2000/11/13 04:49:45 guy Exp $ + * $Id: packet-atalk.h,v 1.6 2000/11/17 06:02:20 guy Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -48,6 +48,4 @@ struct atalk_ddp_addr { */ extern gchar *atalk_addr_to_str(const struct atalk_ddp_addr *addrp); -void dissect_ddp(tvbuff_t *, packet_info *, proto_tree *); - #endif diff --git a/packet-ip.c b/packet-ip.c index 7faedf8c80..324c9b710c 100644 --- a/packet-ip.c +++ b/packet-ip.c @@ -1,7 +1,7 @@ /* packet-ip.c * Routines for IP and miscellaneous IP protocol packet disassembly * - * $Id: packet-ip.c,v 1.104 2000/10/21 04:34:47 guy Exp $ + * $Id: packet-ip.c,v 1.105 2000/11/17 06:02:20 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -49,6 +49,7 @@ #include "etypes.h" #include "ppptypes.h" #include "llcsaps.h" +#include "aftypes.h" #include "packet-ip.h" #include "packet-ipsec.h" @@ -1478,6 +1479,7 @@ proto_reg_handoff_ip(void) old_dissector_add("llc.dsap", SAP_IP, dissect_ip); old_dissector_add("ip.proto", IP_PROTO_IPV4, dissect_ip); old_dissector_add("ip.proto", IP_PROTO_IPIP, dissect_ip); + old_dissector_add("null.type", BSD_AF_INET, dissect_ip); } void diff --git a/packet-ipv6.c b/packet-ipv6.c index 3668bcfb73..51aa504988 100644 --- a/packet-ipv6.c +++ b/packet-ipv6.c @@ -1,7 +1,7 @@ /* packet-ipv6.c * Routines for IPv6 packet disassembly * - * $Id: packet-ipv6.c,v 1.44 2000/11/11 10:23:41 guy Exp $ + * $Id: packet-ipv6.c,v 1.45 2000/11/17 06:02:20 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -44,6 +44,7 @@ #include <glib.h> #include "etypes.h" #include "ppptypes.h" +#include "aftypes.h" #include "packet.h" #include "packet-ip.h" #include "packet-ipsec.h" @@ -495,5 +496,7 @@ proto_reg_handoff_ipv6(void) old_dissector_add("ethertype", ETHERTYPE_IPv6, dissect_ipv6); old_dissector_add("ppp.protocol", PPP_IPV6, dissect_ipv6); old_dissector_add("ip.proto", IP_PROTO_IPV6, dissect_ipv6); + old_dissector_add("null.type", BSD_AF_INET6_BSD, dissect_ipv6); + old_dissector_add("null.type", BSD_AF_INET6_FREEBSD, dissect_ipv6); old_dissector_add("ip.proto", IP_PROTO_NONE, dissect_ipv6_none); } diff --git a/packet-ipx.c b/packet-ipx.c index 308efde1b6..65b77bb90e 100644 --- a/packet-ipx.c +++ b/packet-ipx.c @@ -2,7 +2,7 @@ * Routines for NetWare's IPX * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-ipx.c,v 1.67 2000/11/16 07:35:38 guy Exp $ + * $Id: packet-ipx.c,v 1.68 2000/11/17 06:02:20 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -37,6 +37,7 @@ #include "etypes.h" #include "ppptypes.h" #include "llcsaps.h" +#include "aftypes.h" #include "packet.h" #include "packet-ipx.h" #include "packet-nbipx.h" @@ -906,6 +907,7 @@ proto_reg_handoff_ipx(void) dissector_add("ethertype", ETHERTYPE_IPX, dissect_ipx); dissector_add("ppp.protocol", PPP_IPX, dissect_ipx); dissector_add("llc.dsap", SAP_NETWARE, dissect_ipx); + dissector_add("null.type", BSD_AF_IPX, dissect_ipx); dissector_add("ipx.packet_type", IPX_PACKET_TYPE_SPX, dissect_spx); dissector_add("ipx.socket", IPX_SOCKET_SAP, dissect_ipxsap); dissector_add("ipx.socket", IPX_SOCKET_IPXRIP, dissect_ipxrip); diff --git a/packet-null.c b/packet-null.c index 648bb790d0..243ddaf735 100644 --- a/packet-null.c +++ b/packet-null.c @@ -1,7 +1,7 @@ /* packet-null.c * Routines for null packet disassembly * - * $Id: packet-null.c,v 1.30 2000/11/16 07:35:38 guy Exp $ + * $Id: packet-null.c,v 1.31 2000/11/17 06:02:21 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -47,6 +47,9 @@ #include "packet-osi.h" #include "packet-ppp.h" #include "etypes.h" +#include "aftypes.h" + +static dissector_table_t null_dissector_table; extern const value_string etype_vals[]; @@ -59,14 +62,6 @@ static gint ett_null = -1; /* Null/loopback structs and definitions */ -/* BSD AF_ values. */ -#define BSD_AF_INET 2 -#define BSD_AF_ISO 7 -#define BSD_AF_APPLETALK 16 -#define BSD_AF_IPX 23 -#define BSD_AF_INET6_BSD 24 /* OpenBSD (and probably NetBSD), BSD/OS */ -#define BSD_AF_INET6_FREEBSD 28 - /* Family values. */ static const value_string family_vals[] = { {BSD_AF_INET, "IP" }, @@ -218,8 +213,6 @@ dissect_null(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *fh_tree; proto_item *ti; tvbuff_t *next_tvb; - const guint8 *next_pd; - int next_offset; CHECK_DISPLAY_AS_DATA(proto_null, tvb, pinfo, tree); @@ -282,34 +275,10 @@ dissect_null(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } next_tvb = tvb_new_subset(tvb, 4, -1, -1); - tvb_compat(next_tvb, &next_pd, &next_offset); - - switch (null_header) { - - case BSD_AF_INET: - dissect_ip(next_pd, next_offset, pinfo->fd, tree); - break; - - case BSD_AF_APPLETALK: - dissect_ddp(next_tvb, pinfo, tree); - break; - - case BSD_AF_IPX: - dissect_ipx(next_tvb, pinfo, tree); - break; - - case BSD_AF_ISO: - dissect_osi(next_pd, next_offset, pinfo->fd, tree); - break; - - case BSD_AF_INET6_BSD: - case BSD_AF_INET6_FREEBSD: - dissect_ipv6(next_pd, next_offset, pinfo->fd, tree); - break; - - default: + if (!dissector_try_port(null_dissector_table, null_header, + next_tvb, pinfo, tree)) { + /* No sub-dissector found. Label rest of packet as "Data" */ dissect_data(next_tvb, 0, pinfo, tree); - break; } } } @@ -336,4 +305,7 @@ proto_register_null(void) proto_null = proto_register_protocol ("Null/Loopback", "null" ); proto_register_field_array(proto_null, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + /* subdissector code */ + null_dissector_table = register_dissector_table("null.type"); } diff --git a/packet-osi.c b/packet-osi.c index ab3ab43f59..e2a9c8c5e3 100644 --- a/packet-osi.c +++ b/packet-osi.c @@ -2,7 +2,7 @@ * Routines for ISO/OSI network and transport protocol packet disassembly * Main entrance point and common functions * - * $Id: packet-osi.c,v 1.34 2000/08/07 03:20:58 guy Exp $ + * $Id: packet-osi.c,v 1.35 2000/11/17 06:02:21 guy Exp $ * Laurent Deniel <deniel@worldnet.fr> * Ralf Schneider <Ralf.Schneider@t-online.de> * @@ -41,6 +41,7 @@ #include <glib.h> #include "packet.h" #include "llcsaps.h" +#include "aftypes.h" #include "nlpid.h" #include "packet-osi.h" #include "packet-clnp.h" @@ -269,4 +270,5 @@ void proto_reg_handoff_osi(void) { old_dissector_add("llc.dsap", SAP_OSINL, dissect_osi); + old_dissector_add("null.type", BSD_AF_ISO, dissect_osi); } |