From 8a5d5f9bde91019a785a23bab01677cb6eba8739 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 24 Apr 2002 06:03:34 +0000 Subject: From Joerg Mayer: get rid of extra arguments to capture routines. svn path=/trunk/; revision=5233 --- capture.c | 6 +++--- packet-atalk.c | 4 ++-- packet-atalk.h | 4 ++-- packet-eth.c | 4 ++-- packet-ethertype.c | 6 +++--- packet-ieee80211.c | 4 ++-- packet-ipx.c | 4 ++-- packet-ipx.h | 4 ++-- packet-llc.c | 60 ++++++++++++++++-------------------------------------- packet-netbios.c | 4 ++-- packet-netbios.h | 4 ++-- packet-ppp.c | 6 +++--- packet-sll.c | 4 ++-- packet-vines.c | 4 ++-- packet-vines.h | 4 ++-- packet-vlan.c | 4 ++-- 16 files changed, 50 insertions(+), 76 deletions(-) diff --git a/capture.c b/capture.c index 68ea732eaf..fab54534d4 100644 --- a/capture.c +++ b/capture.c @@ -1,7 +1,7 @@ /* capture.c * Routines for packet capture windows * - * $Id: capture.c,v 1.172 2002/04/08 09:09:47 guy Exp $ + * $Id: capture.c,v 1.173 2002/04/24 06:03:33 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1242,7 +1242,7 @@ pipe_dispatch(int fd, loop_data *ld, struct pcap_hdr *hdr) capture_chdlc(pd, 0, whdr.caplen, &ld->counts); break; case WTAP_ENCAP_LOCALTALK: - capture_llap(pd, whdr.caplen, &ld->counts); + capture_llap(&ld->counts); break; /* XXX - FreeBSD may append 4-byte ATM pseudo-header to DLT_ATM_RFC1483, with LLC header following; we should implement it at some @@ -2064,7 +2064,7 @@ capture_pcap_cb(u_char *user, const struct pcap_pkthdr *phdr, capture_clip(pd, phdr->len, &ld->counts); break; case WTAP_ENCAP_LOCALTALK: - capture_llap(pd, phdr->len, &ld->counts); + capture_llap(&ld->counts); break; /* XXX - FreeBSD may append 4-byte ATM pseudo-header to DLT_ATM_RFC1483, with LLC header following; we should implement it at some diff --git a/packet-atalk.c b/packet-atalk.c index 413ccb835b..f96862feca 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.62 2002/01/21 07:36:32 guy Exp $ + * $Id: packet-atalk.c,v 1.63 2002/04/24 06:03:33 guy Exp $ * * Simon Wilkinson * @@ -503,7 +503,7 @@ static const value_string llap_type_vals[] = { }; void -capture_llap(const u_char *pd, int len, packet_counts *ld) +capture_llap(packet_counts *ld) { ld->other++; } diff --git a/packet-atalk.h b/packet-atalk.h index ca5f10d4d4..24bec82b31 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.7 2001/11/30 07:14:20 guy Exp $ + * $Id: packet-atalk.h,v 1.8 2002/04/24 06:03:33 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,6 @@ struct atalk_ddp_addr { */ extern gchar *atalk_addr_to_str(const struct atalk_ddp_addr *addrp); -extern void capture_llap(const u_char *pd, int len, packet_counts *ld); +extern void capture_llap(packet_counts *ld); #endif diff --git a/packet-eth.c b/packet-eth.c index 4c2a7c500d..87e9749c9f 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.72 2002/01/21 07:36:34 guy Exp $ + * $Id: packet-eth.c,v 1.73 2002/04/24 06:03:33 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -125,7 +125,7 @@ capture_eth(const u_char *pd, int offset, int len, packet_counts *ld) switch (ethhdr_type) { case ETHERNET_802_3: - capture_ipx(pd, offset, len, ld); + capture_ipx(ld); break; case ETHERNET_802_2: capture_llc(pd, offset, len, ld); diff --git a/packet-ethertype.c b/packet-ethertype.c index c881a960d9..349d942aed 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.27 2002/03/23 22:02:20 guy Exp $ + * $Id: packet-ethertype.c,v 1.28 2002/04/24 06:03:33 guy Exp $ * * Gilbert Ramirez * @@ -111,13 +111,13 @@ capture_ethertype(guint16 etype, const u_char *pd, int offset, int len, capture_ip(pd, offset, len, ld); break; case ETHERTYPE_IPX: - capture_ipx(pd, offset, len, ld); + capture_ipx(ld); break; case ETHERTYPE_VLAN: capture_vlan(pd, offset, len, ld); break; case ETHERTYPE_VINES: - capture_vines(pd, offset, len, ld); + capture_vines(ld); break; default: ld->other++; diff --git a/packet-ieee80211.c b/packet-ieee80211.c index 28ec7b8f44..891597b285 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.59 2002/04/22 08:14:12 guy Exp $ + * $Id: packet-ieee80211.c,v 1.60 2002/04/24 06:03:33 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -451,7 +451,7 @@ capture_ieee80211_common (const u_char * pd, int offset, int len, return; } if (pd[offset+hdr_length] == 0xff && pd[offset+hdr_length+1] == 0xff) { - capture_ipx (pd, offset + hdr_length, len, ld); + capture_ipx (ld); } else { capture_llc (pd, offset + hdr_length, len, ld); diff --git a/packet-ipx.c b/packet-ipx.c index f0949bd861..5e75058541 100644 --- a/packet-ipx.c +++ b/packet-ipx.c @@ -2,7 +2,7 @@ * Routines for NetWare's IPX * Gilbert Ramirez * - * $Id: packet-ipx.c,v 1.102 2002/02/17 00:51:19 guy Exp $ + * $Id: packet-ipx.c,v 1.103 2002/04/24 06:03:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -192,7 +192,7 @@ static const value_string ipxmsg_sigchar_vals[] = { }; void -capture_ipx(const u_char *pd, int offset, int len, packet_counts *ld) +capture_ipx(packet_counts *ld) { ld->ipx++; } diff --git a/packet-ipx.h b/packet-ipx.h index d4c911d080..94b1376dad 100644 --- a/packet-ipx.h +++ b/packet-ipx.h @@ -2,7 +2,7 @@ * Routines for NetWare's IPX * Gilbert Ramirez * - * $Id: packet-ipx.h,v 1.15 2001/11/20 21:59:13 guy Exp $ + * $Id: packet-ipx.h,v 1.16 2002/04/24 06:03:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -144,6 +144,6 @@ struct ipx_rip_packet #define IPX_SOCKET_UDP_TUNNEL 0x9092 /* RFC 1791 */ -void capture_ipx(const u_char *, int, int, packet_counts *); +void capture_ipx(packet_counts *); #endif diff --git a/packet-llc.c b/packet-llc.c index 3bbe3a88d4..fc48ab741f 100644 --- a/packet-llc.c +++ b/packet-llc.c @@ -2,7 +2,7 @@ * Routines for IEEE 802.2 LLC layer * Gilbert Ramirez * - * $Id: packet-llc.c,v 1.96 2002/03/31 21:09:00 guy Exp $ + * $Id: packet-llc.c,v 1.97 2002/04/24 06:03:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -67,17 +67,6 @@ static dissector_handle_t fddi_handle; static dissector_handle_t tr_handle; static dissector_handle_t data_handle; -typedef void (capture_func_t)(const u_char *, int, int, packet_counts *); - -/* The SAP info is split into two tables, one value_string table and one - * table of sap_info. This is so that the value_string can be used in the - * header field registration. - */ -struct sap_info { - guint8 sap; - capture_func_t *capture_func; -}; - /* * Group/Individual bit, in the DSAP. */ @@ -145,13 +134,6 @@ static const value_string sap_vals[] = { { 0x00, NULL } }; -static struct sap_info saps[] = { - { SAP_IP, capture_ip }, - { SAP_NETWARE, capture_ipx }, - { SAP_NETBIOS, capture_netbios }, - { 0x00, NULL} -}; - /* * See * @@ -174,22 +156,6 @@ http://www.cisco.com/univercd/cc/td/doc/product/software/ios113ed/113ed_cr/ibm_r { 0, NULL } }; -static capture_func_t * -sap_capture_func(u_char sap) { - int i=0; - - /* look for the second record where sap == 0, which should - * be the last record - */ - while (saps[i].sap > 0 || i == 0) { - if (saps[i].sap == sap) { - return saps[i].capture_func; - } - i++; - } - return NULL; -} - void capture_llc(const u_char *pd, int offset, int len, packet_counts *ld) { @@ -198,7 +164,6 @@ capture_llc(const u_char *pd, int offset, int len, packet_counts *ld) { int llc_header_len; guint32 oui; guint16 etype; - capture_func_t *capture; if (!BYTES_ARE_IN_FRAME(offset, len, 2)) { ld->other++; @@ -252,17 +217,26 @@ capture_llc(const u_char *pd, int offset, int len, packet_counts *ld) { } } else { + /* non-SNAP */ if (XDLC_IS_INFORMATION(control)) { - capture = sap_capture_func(pd[offset]); + switch (pd[offset]) { - /* non-SNAP */ - offset += llc_header_len; + case SAP_IP: + capture_ip(pd, offset + llc_header_len, len, + ld); + break; - if (capture) { - capture(pd, offset, len, ld); - } - else { + case SAP_NETWARE: + capture_ipx(ld); + break; + + case SAP_NETBIOS: + capture_netbios(ld); + break; + + default: ld->other++; + break; } } } diff --git a/packet-netbios.c b/packet-netbios.c index a991b59392..03b3706f12 100644 --- a/packet-netbios.c +++ b/packet-netbios.c @@ -5,7 +5,7 @@ * * derived from the packet-nbns.c * - * $Id: packet-netbios.c,v 1.44 2002/01/21 07:36:37 guy Exp $ + * $Id: packet-netbios.c,v 1.45 2002/04/24 06:03:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -220,7 +220,7 @@ static const true_false_string netb_version_str = { }; -void capture_netbios(const u_char *pd, int offset, int len, packet_counts *ld) +void capture_netbios(packet_counts *ld) { ld->netbios++; } diff --git a/packet-netbios.h b/packet-netbios.h index 0795c40208..69f0303ae3 100644 --- a/packet-netbios.h +++ b/packet-netbios.h @@ -5,7 +5,7 @@ * * derived from the packet-nbns.c * - * $Id: packet-netbios.h,v 1.12 2001/11/20 21:59:13 guy Exp $ + * $Id: packet-netbios.h,v 1.13 2002/04/24 06:03:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -32,7 +32,7 @@ /* Length of NetBIOS names */ #define NETBIOS_NAME_LEN 16 -void capture_netbios(const u_char *, int, int, packet_counts *); +void capture_netbios(packet_counts *); extern int process_netbios_name(const u_char *name_ptr, char *name_ret); extern int get_netbios_name(tvbuff_t *tvb, int offset, diff --git a/packet-ppp.c b/packet-ppp.c index b65d4a2ed4..59c7a721b3 100644 --- a/packet-ppp.c +++ b/packet-ppp.c @@ -1,7 +1,7 @@ /* packet-ppp.c * Routines for ppp packet disassembly * - * $Id: packet-ppp.c,v 1.90 2002/04/14 23:04:03 guy Exp $ + * $Id: packet-ppp.c,v 1.91 2002/04/24 06:03:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1354,10 +1354,10 @@ capture_ppp_hdlc( const u_char *pd, int offset, int len, packet_counts *ld ) { capture_ip(pd, offset + 4, len, ld); break; case PPP_IPX: - capture_ipx(pd, offset + 4, len, ld); + capture_ipx(ld); break; case PPP_VINES: - capture_vines(pd, offset + 4, len, ld); + capture_vines(ld); break; default: ld->other++; diff --git a/packet-sll.c b/packet-sll.c index bed9459242..0569d34d9d 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.16 2002/01/21 07:36:42 guy Exp $ + * $Id: packet-sll.c,v 1.17 2002/04/24 06:03:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -121,7 +121,7 @@ capture_sll(const u_char *pd, int len, packet_counts *ld) * Novell IPX inside 802.3 with no 802.2 LLC * header. */ - capture_ipx(pd, len, SLL_HEADER_SIZE, ld); + capture_ipx(ld); break; default: diff --git a/packet-vines.c b/packet-vines.c index b383b738f1..e70845e3bf 100644 --- a/packet-vines.c +++ b/packet-vines.c @@ -1,7 +1,7 @@ /* packet-vines.c * Routines for Banyan VINES protocol packet disassembly * - * $Id: packet-vines.c,v 1.39 2002/01/21 07:36:44 guy Exp $ + * $Id: packet-vines.c,v 1.40 2002/04/24 06:03:34 guy Exp $ * * Don Lafontaine * @@ -71,7 +71,7 @@ static void dissect_vines_spp(tvbuff_t *, packet_info *, proto_tree *); static void dissect_vines(tvbuff_t *, packet_info *, proto_tree *); void -capture_vines(const u_char *pd, int offset, int len, packet_counts *ld) +capture_vines(packet_counts *ld) { ld->vines++; } diff --git a/packet-vines.h b/packet-vines.h index 8ccb580848..bb5a486ead 100644 --- a/packet-vines.h +++ b/packet-vines.h @@ -1,7 +1,7 @@ /* packet-vines.h * Definitions for packet disassembly structures and routines * - * $Id: packet-vines.h,v 1.11 2002/01/21 07:36:44 guy Exp $ + * $Id: packet-vines.h,v 1.12 2002/04/24 06:03:34 guy Exp $ * * Don Lafontaine * @@ -108,6 +108,6 @@ typedef struct _e_vsmb { guint32 vsmb_ttw; } e_vsmb; -void capture_vines(const u_char *, int, int, packet_counts *); +void capture_vines(packet_counts *); #endif /* packet-vines.h */ diff --git a/packet-vlan.c b/packet-vlan.c index cf181cd9c5..bd22cd5a8d 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.38 2002/01/21 07:36:44 guy Exp $ + * $Id: packet-vlan.c,v 1.39 2002/04/24 06:03:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -62,7 +62,7 @@ capture_vlan(const u_char *pd, int offset, int len, packet_counts *ld ) { encap_proto = pntohs( &pd[offset+2] ); if ( encap_proto <= IEEE_802_3_MAX_LEN) { if ( pd[offset+4] == 0xff && pd[offset+5] == 0xff ) { - capture_ipx(pd,offset+4,len,ld); + capture_ipx(ld); } else { capture_llc(pd,offset+4,len,ld); } -- cgit v1.2.3