From cd2807e08d02de68b766ed88acf3bfd3b54b2a24 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 25 Jul 2003 04:42:02 +0000 Subject: Add a "setfilter" function pointer to the pcap_t structure, which handles setting a filter for a pcap_t. Have "pcap_setfilter()" call it, rather than being a per-platform function. The per-platform functions don't need to check for an offline capture any more, as they're not called for an offline capture (and the ones that just call "install_bpf_program()" don't need to exist at all). --- pcap-snoop.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'pcap-snoop.c') diff --git a/pcap-snoop.c b/pcap-snoop.c index ef2fbc5..d2a8c48 100644 --- a/pcap-snoop.c +++ b/pcap-snoop.c @@ -20,7 +20,7 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/pcap-snoop.c,v 1.41 2003-07-25 04:04:59 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-snoop.c,v 1.42 2003-07-25 04:42:04 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -294,6 +294,7 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms, goto bad; } + p->setfilter_op = install_bpf_program; /* no kernel filtering */ p->stats_op = pcap_stats_snoop; p->close_op = pcap_close_snoop; @@ -310,15 +311,6 @@ pcap_platform_finddevs(pcap_if_t **alldevsp, char *errbuf) return (0); } -int -pcap_setfilter(pcap_t *p, struct bpf_program *fp) -{ - - if (install_bpf_program(p, fp) < 0) - return (-1); - return (0); -} - int pcap_set_datalink_platform(pcap_t *p, int dlt) { -- cgit v1.2.3