aboutsummaryrefslogtreecommitdiffstats
path: root/pcap-dag.c
diff options
context:
space:
mode:
authorguy <guy>2003-07-25 04:42:02 +0000
committerguy <guy>2003-07-25 04:42:02 +0000
commitcd2807e08d02de68b766ed88acf3bfd3b54b2a24 (patch)
tree32510d11551eab43465b88894a38d7b627eb1413 /pcap-dag.c
parent9792990eb80889004b39ee70caa98b3d91ac8012 (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-dag.c')
-rw-r--r--pcap-dag.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pcap-dag.c b/pcap-dag.c
index c03625e..1d0243b 100644
--- a/pcap-dag.c
+++ b/pcap-dag.c
@@ -19,7 +19,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap-dag.c,v 1.3 2003-07-25 04:04:57 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap-dag.c,v 1.4 2003-07-25 04:42:02 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -59,14 +59,13 @@ static int atexit_handler_installed = 0;
#include "pcap-dag.h"
/* Replace dag function names with pcap equivalent. */
-#define dag_stats pcap_stats
#define dag_read pcap_read
#define dag_open_live pcap_open_live
#define dag_platform_finddevs pcap_platform_finddevs
-#define dag_setfilter pcap_setfilter
#define dag_set_datalink_platform pcap_set_datalink_platform
#endif /* DAG_ONLY */
+static int dag_setfilter(pcap_t *p, struct bpf_program *fp);
static int dag_stats(pcap_t *p, struct pcap_stat *ps);
static void delete_pcap_dag(pcap_t *p) {
@@ -387,6 +386,7 @@ pcap_t *dag_open_live(const char *device, int snaplen, int promisc, int to_ms, c
return NULL;
}
+ handle->setfilter_op = dag_setfilter;
handle->stats_op = dag_stats;
handle->close_op = dag_platform_close;
@@ -507,7 +507,7 @@ dag_platform_finddevs(pcap_if_t **devlistp, char *errbuf)
* no attempt to store the filter in kernel memory as that is not supported
* with DAG cards.
*/
-int dag_setfilter(pcap_t *p, struct bpf_program *fp) {
+static int dag_setfilter(pcap_t *p, struct bpf_program *fp) {
if (!p)
return -1;
if (!fp) {