]> The Tcpdump Group git mirrors - libpcap/blobdiff - pcap.c
From Pawel Pokrywka: add support for requesting that only received
[libpcap] / pcap.c
diff --git a/pcap.c b/pcap.c
index 8aba35a3f76b7d2d33ded2d0ffff437ae4cde7eb..dcb31249396019b34214c73e8453d8a0acc7c29b 100644 (file)
--- a/pcap.c
+++ b/pcap.c
@@ -33,7 +33,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.88 2005-02-08 20:03:15 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.89 2005-05-03 18:54:01 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -685,6 +685,23 @@ pcap_setfilter(pcap_t *p, struct bpf_program *fp)
        return p->setfilter_op(p, fp);
 }
 
+/*
+ * Set direction flag, which controls whether we accept only incoming
+ * packets, only outgoing packets, or both.
+ * Note that, depending on the platform, some or all direction arguments
+ * might not be supported.
+ */
+int
+pcap_setdirection(pcap_t *p, direction_t d)
+{
+       if (p->setdirection_op == NULL) {
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                   "Setting direction is not implemented on this platform");
+               return -1;
+       } else
+               return p->setdirection_op(p, d);
+}
+
 int
 pcap_stats(pcap_t *p, struct pcap_stat *ps)
 {