diff options
author | guy <guy> | 2003-07-25 04:42:02 +0000 |
---|---|---|
committer | guy <guy> | 2003-07-25 04:42:02 +0000 |
commit | cd2807e08d02de68b766ed88acf3bfd3b54b2a24 (patch) | |
tree | 32510d11551eab43465b88894a38d7b627eb1413 /pcap-snoop.c | |
parent | 9792990eb80889004b39ee70caa98b3d91ac8012 (diff) |
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).
Diffstat (limited to 'pcap-snoop.c')
-rw-r--r-- | pcap-snoop.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/pcap-snoop.c b/pcap-snoop.c index ef2fbc5f..d2a8c486 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; @@ -311,15 +312,6 @@ pcap_platform_finddevs(pcap_if_t **alldevsp, char *errbuf) } 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) { return (0); |