diff options
author | Guy Harris <guy@alum.mit.edu> | 2001-01-03 10:34:42 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2001-01-03 10:34:42 +0000 |
commit | b151ddecbb6800271e1cc2b8b0d2bb355dadbe89 (patch) | |
tree | b9e74ab80383b0add3d88c281308f9fb06f0b32e | |
parent | b92ebd4a23fb75f3972527609abd4f8360489805 (diff) |
Have the TR MAC and LLC dissectors register themselves, make them
static, and have other dissectors call them through handles.
svn path=/trunk/; revision=2816
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | packet-atm.c | 11 | ||||
-rw-r--r-- | packet-eth.c | 12 | ||||
-rw-r--r-- | packet-fddi.c | 11 | ||||
-rw-r--r-- | packet-ieee80211.c | 21 | ||||
-rw-r--r-- | packet-llc.c | 6 | ||||
-rw-r--r-- | packet-llc.h | 3 | ||||
-rw-r--r-- | packet-sll.c | 11 | ||||
-rw-r--r-- | packet-tr.c | 16 | ||||
-rw-r--r-- | packet-trmac.c | 6 | ||||
-rw-r--r-- | packet-trmac.h | 30 | ||||
-rw-r--r-- | packet-vlan.c | 11 |
12 files changed, 79 insertions, 62 deletions
diff --git a/Makefile.am b/Makefile.am index 78b01a7ea2..b6a44dccda 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.265 2000/12/29 01:06:24 sharpe Exp $ +# $Id: Makefile.am,v 1.266 2001/01/03 10:34:41 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@zing.org> @@ -246,7 +246,6 @@ noinst_HEADERS = \ packet-tns.h \ packet-tpkt.h \ packet-tr.h \ - packet-trmac.h \ packet-udp.h \ packet-vines.h \ packet-vlan.h \ diff --git a/packet-atm.c b/packet-atm.c index f3630e8100..ab070798e1 100644 --- a/packet-atm.c +++ b/packet-atm.c @@ -1,7 +1,7 @@ /* packet-atm.c * Routines for ATM packet disassembly * - * $Id: packet-atm.c,v 1.29 2001/01/03 06:55:27 guy Exp $ + * $Id: packet-atm.c,v 1.30 2001/01/03 10:34:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -482,6 +482,8 @@ static const value_string ipsilon_type_vals[] = { { 0, NULL } }; +static dissector_handle_t llc_handle; + /* * We don't know what kind of traffic this is; try to guess. * We at least know it's AAL5.... @@ -731,7 +733,7 @@ dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Dissect as WTAP_ENCAP_ATM_RFC1483 */ /* The ATM iptrace capture that we have shows LLC at this point, * so that's what I'm calling */ - dissect_llc(tvb, &pi, tree); + call_dissector(llc_handle, tvb, pinfo, tree); break; case ATT_HL_LANE: @@ -794,5 +796,10 @@ proto_register_atm(void) void proto_reg_handoff_atm(void) { + /* + * Get a handle for the LLC dissector. + */ + llc_handle = find_dissector("llc"); + dissector_add("wtap_encap", WTAP_ENCAP_ATM_SNIFFER, dissect_atm); } diff --git a/packet-eth.c b/packet-eth.c index 109910086e..1404102c16 100644 --- a/packet-eth.c +++ b/packet-eth.c @@ -1,7 +1,7 @@ /* packet-eth.c * Routines for ethernet packet disassembly * - * $Id: packet-eth.c,v 1.52 2001/01/03 06:55:28 guy Exp $ + * $Id: packet-eth.c,v 1.53 2001/01/03 10:34:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -55,6 +55,7 @@ static gint ett_ieee8023 = -1; static gint ett_ether2 = -1; static dissector_handle_t isl_handle; +static dissector_handle_t llc_handle; #define ETH_HEADER_SIZE 14 @@ -62,10 +63,10 @@ static dissector_handle_t isl_handle; EthernetII: The ethernet with a Type field instead of a length field Ethernet802.2: An 802.3 header followed by an 802.2 header Ethernet802.3: A raw 802.3 packet. IPX/SPX can be the only payload. - There's not 802.2 hdr in this. + There's no 802.2 hdr in this. EthernetSNAP: Basically 802.2, just with 802.2SNAP. For our purposes, there's no difference between 802.2 and 802.2SNAP, since we just - pass it down to dissect_llc(). -- Gilbert + pass it down to the LLC dissector. -- Gilbert */ #define ETHERNET_II 0 #define ETHERNET_802_2 1 @@ -304,7 +305,7 @@ dissect_eth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_ipx(next_tvb, pinfo, tree); break; case ETHERNET_802_2: - dissect_llc(next_tvb, pinfo, tree); + call_dissector(llc_handle, next_tvb, pinfo, tree); break; case ETHERNET_II: length_before = tvb_reported_length(tvb); @@ -386,9 +387,10 @@ void proto_reg_handoff_eth(void) { /* - * Get a handle for the ISL dissector. + * Get handles for the ISL and LLC dissectors. */ isl_handle = find_dissector("isl"); + llc_handle = find_dissector("llc"); dissector_add("wtap_encap", WTAP_ENCAP_ETHERNET, dissect_eth); } diff --git a/packet-fddi.c b/packet-fddi.c index 85dc71ab24..701edcfd33 100644 --- a/packet-fddi.c +++ b/packet-fddi.c @@ -3,7 +3,7 @@ * * Laurent Deniel <deniel@worldnet.fr> * - * $Id: packet-fddi.c,v 1.44 2001/01/03 06:55:28 guy Exp $ + * $Id: packet-fddi.c,v 1.45 2001/01/03 10:34:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -94,6 +94,8 @@ static gint ett_fddi = -1; #define FDDI_P_DHOST 1 #define FDDI_P_SHOST 7 +static dissector_handle_t llc_handle; + static void swap_mac_addr(u_char *swapped_addr, const u_char *orig_addr) { @@ -315,7 +317,7 @@ dissect_fddi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, case FDDI_FC_LLC_ASYNC + 13 : case FDDI_FC_LLC_ASYNC + 14 : case FDDI_FC_LLC_ASYNC + 15 : - dissect_llc(next_tvb, pinfo, tree); + call_dissector(llc_handle, next_tvb, pinfo, tree); return; default : @@ -378,6 +380,11 @@ proto_register_fddi(void) void proto_reg_handoff_fddi(void) { + /* + * Get a handle for the LLC dissector. + */ + llc_handle = find_dissector("llc"); + dissector_add("wtap_encap", WTAP_ENCAP_FDDI, dissect_fddi_not_bitswapped); dissector_add("wtap_encap", WTAP_ENCAP_FDDI_BITSWAPPED, dissect_fddi_bitswapped); } diff --git a/packet-ieee80211.c b/packet-ieee80211.c index a7cdcc812b..a073c3cb71 100644 --- a/packet-ieee80211.c +++ b/packet-ieee80211.c @@ -3,7 +3,7 @@ * Copyright 2000, Axis Communications AB * Inquiries/bugreports should be sent to Johan.Jorgensen@axis.com * - * $Id: packet-ieee80211.c,v 1.7 2001/01/03 06:55:28 guy Exp $ + * $Id: packet-ieee80211.c,v 1.8 2001/01/03 10:34:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -277,6 +277,9 @@ static gint ett_cap_tree = -1; static gint ett_fc_tree = -1; static gint ett_fixed_parameters = -1; static gint ett_tagged_parameters = -1; + +static dissector_handle_t llc_handle; + /* ************************************************************************* */ /* */ /* ************************************************************************* */ @@ -1337,8 +1340,7 @@ dissect_ieee80211 (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) hdr_len = find_header_length (tvb_get_ptr (tvb, 0, cap_len), 0); next_tvb = tvb_new_subset (tvb, hdr_len, -1, -1); - dissect_llc (next_tvb, pinfo, tree); - + call_dissector (llc_handle, next_tvb, pinfo, tree); } break; @@ -1351,7 +1353,7 @@ dissect_ieee80211 (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) hdr_len = find_header_length (tvb_get_ptr (tvb, 0, cap_len), 0); next_tvb = tvb_new_subset (tvb, hdr_len, -1, -1); - dissect_llc (next_tvb, pinfo, tree); + call_dissector (llc_handle, next_tvb, pinfo, tree); } break; @@ -1363,7 +1365,7 @@ dissect_ieee80211 (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { hdr_len = find_header_length (tvb_get_ptr (tvb, 0, cap_len), 0); next_tvb = tvb_new_subset (tvb, hdr_len, -1, -1); - dissect_llc (next_tvb, pinfo, tree); + call_dissector (llc_handle, next_tvb, pinfo, tree); } break; @@ -1375,7 +1377,7 @@ dissect_ieee80211 (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { hdr_len = find_header_length (tvb_get_ptr (tvb, 0, cap_len), 0); next_tvb = tvb_new_subset (tvb, hdr_len, -1, -1); - dissect_llc (next_tvb, pinfo, tree); + call_dissector (llc_handle, next_tvb, pinfo, tree); } break; @@ -1744,5 +1746,10 @@ proto_register_wlan (void) void proto_reg_handoff_wlan(void) { - dissector_add("wtap_encap", WTAP_ENCAP_IEEE_802_11, dissect_ieee80211); + /* + * Get a handle for the LLC dissector. + */ + llc_handle = find_dissector("llc"); + + dissector_add("wtap_encap", WTAP_ENCAP_IEEE_802_11, dissect_ieee80211); } diff --git a/packet-llc.c b/packet-llc.c index 54a1829f87..4d731e094d 100644 --- a/packet-llc.c +++ b/packet-llc.c @@ -2,7 +2,7 @@ * Routines for IEEE 802.2 LLC layer * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-llc.c,v 1.74 2001/01/03 06:55:29 guy Exp $ + * $Id: packet-llc.c,v 1.75 2001/01/03 10:34:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -262,7 +262,7 @@ capture_llc(const u_char *pd, int offset, packet_counts *ld) { } } -void +static void dissect_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *llc_tree = NULL; @@ -475,6 +475,8 @@ proto_register_llc(void) /* subdissector code */ subdissector_table = register_dissector_table("llc.dsap"); cisco_subdissector_table = register_dissector_table("llc.cisco_pid"); + + register_dissector("llc", dissect_llc); } void diff --git a/packet-llc.h b/packet-llc.h index 4bff2efbaf..a228605d87 100644 --- a/packet-llc.h +++ b/packet-llc.h @@ -1,6 +1,6 @@ /* packet-llc.h * - * $Id: packet-llc.h,v 1.3 2000/08/11 13:34:08 deniel Exp $ + * $Id: packet-llc.h,v 1.4 2001/01/03 10:34:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -26,6 +26,5 @@ #define __PACKET_LLC_H__ void capture_llc(const u_char *, int, packet_counts *); -void dissect_llc(tvbuff_t *, packet_info *, proto_tree *); #endif diff --git a/packet-sll.c b/packet-sll.c index 3cdf97b0c5..25e3794620 100644 --- a/packet-sll.c +++ b/packet-sll.c @@ -1,7 +1,7 @@ /* packet-sll.c * Routines for disassembly of packets from Linux "cooked mode" captures * - * $Id: packet-sll.c,v 1.2 2001/01/03 06:55:32 guy Exp $ + * $Id: packet-sll.c,v 1.3 2001/01/03 10:34:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -87,6 +87,8 @@ static const value_string ltype_vals[] = { { 0, NULL } }; +static dissector_handle_t llc_handle; + void capture_sll(const u_char *pd, packet_counts *ld) { @@ -205,7 +207,7 @@ dissect_sll(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * 802.2 LLC. */ - dissect_llc(next_tvb, pinfo, tree); + call_dissector(llc_handle, next_tvb, pinfo, tree); break; case LINUX_SLL_P_802_3: @@ -313,5 +315,10 @@ proto_register_sll(void) void proto_reg_handoff_sll(void) { + /* + * Get a handle for the LLC dissector. + */ + llc_handle = find_dissector("llc"); + dissector_add("wtap_encap", WTAP_ENCAP_SLL, dissect_sll); } diff --git a/packet-tr.c b/packet-tr.c index 64ae7ed87c..8d8698d069 100644 --- a/packet-tr.c +++ b/packet-tr.c @@ -2,7 +2,7 @@ * Routines for Token-Ring packet disassembly * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-tr.c,v 1.53 2001/01/03 06:55:34 guy Exp $ + * $Id: packet-tr.c,v 1.54 2001/01/03 10:34:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -38,7 +38,6 @@ #include "packet.h" #include "packet-tr.h" #include "packet-llc.h" -#include "packet-trmac.h" static int proto_tr = -1; static int hf_tr_dst = -1; @@ -117,6 +116,9 @@ static const value_string direction_vals[] = { { 0, NULL } }; +static dissector_handle_t trmac_handle; +static dissector_handle_t llc_handle; + /* * DODGY LINUX HACK DODGY LINUX HACK * Linux 2.0.x always passes frames to the Token Ring driver for transmission with @@ -522,10 +524,10 @@ dissect_tr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) switch (frame_type) { /* MAC */ case 0: - dissect_trmac(next_tvb, pinfo, tree); + call_dissector(trmac_handle, next_tvb, pinfo, tree); break; case 1: - dissect_llc(next_tvb, pinfo, tree); + call_dissector(llc_handle, next_tvb, pinfo, tree); break; default: /* non-MAC, non-LLC, i.e., "Reserved" */ @@ -674,5 +676,11 @@ proto_register_tr(void) void proto_reg_handoff_tr(void) { + /* + * Get handles for the TR MAC and LLC dissectors. + */ + trmac_handle = find_dissector("trmac"); + llc_handle = find_dissector("llc"); + dissector_add("wtap_encap", WTAP_ENCAP_TOKEN_RING, dissect_tr); } diff --git a/packet-trmac.c b/packet-trmac.c index 9cd4fc32d9..8c1da0ddf4 100644 --- a/packet-trmac.c +++ b/packet-trmac.c @@ -2,7 +2,7 @@ * Routines for Token-Ring Media Access Control * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-trmac.c,v 1.27 2001/01/03 06:55:34 guy Exp $ + * $Id: packet-trmac.c,v 1.28 2001/01/03 10:34:42 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -271,7 +271,7 @@ sv_text(tvbuff_t *tvb, int svoff, proto_tree *tree) return sv_length; } -void +static void dissect_trmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *mac_tree = NULL; @@ -406,4 +406,6 @@ proto_register_trmac(void) "TR MAC", "trmac"); proto_register_field_array(proto_trmac, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + register_dissector("trmac", dissect_trmac); } diff --git a/packet-trmac.h b/packet-trmac.h deleted file mode 100644 index 07796aa6ee..0000000000 --- a/packet-trmac.h +++ /dev/null @@ -1,30 +0,0 @@ -/* packet-trmac.h - * - * $Id: packet-trmac.h,v 1.3 2000/08/11 13:33:58 deniel Exp $ - * - * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> - * 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. - */ - -#ifndef __PACKET_TRMAC_H__ -#define __PACKET_TRMAC_H__ - -void dissect_trmac(tvbuff_t *, packet_info *, proto_tree *); - -#endif diff --git a/packet-vlan.c b/packet-vlan.c index b94e71fcda..c97e1f24e6 100644 --- a/packet-vlan.c +++ b/packet-vlan.c @@ -1,7 +1,7 @@ /* packet-vlan.c * Routines for VLAN 802.1Q ethernet header disassembly * - * $Id: packet-vlan.c,v 1.26 2001/01/03 06:55:34 guy Exp $ + * $Id: packet-vlan.c,v 1.27 2001/01/03 10:34:42 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -51,6 +51,8 @@ static int hf_vlan_trailer = -1; static gint ett_vlan = -1; +static dissector_handle_t llc_handle; + void capture_vlan(const u_char *pd, int offset, packet_counts *ld ) { guint32 encap_proto; @@ -157,7 +159,7 @@ dissect_vlan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ENDTRY; if (is_802_2 ) { /* 802.2 LLC */ - dissect_llc(next_tvb, pinfo, tree); + call_dissector(llc_handle, next_tvb, pinfo, tree); } else { dissect_ipx(next_tvb, pinfo, tree); } @@ -233,5 +235,10 @@ proto_register_vlan(void) void proto_reg_handoff_vlan(void) { + /* + * Get a handle for the LLC dissector. + */ + llc_handle = find_dissector("llc"); + dissector_add("ethertype", ETHERTYPE_VLAN, dissect_vlan); } |