]> The Tcpdump Group git mirrors - libpcap/commitdiff
(pcap_open_dead): add function for just creating a pcap_t that be
authorassar <assar>
Mon, 26 Jun 2000 04:58:04 +0000 (04:58 +0000)
committerassar <assar>
Mon, 26 Jun 2000 04:58:04 +0000 (04:58 +0000)
later used when calling other functions.
From Darren Reed <[email protected]>

pcap.c

diff --git a/pcap.c b/pcap.c
index 808e4dbd9ccb0a0718056784e541bf1cc4594010..f4ef1fa7bb255807d38b6a5dcaf0bfb51b7b0104 100644 (file)
--- a/pcap.c
+++ b/pcap.c
@@ -33,7 +33,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.30 2000-04-27 09:11:14 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.31 2000-06-26 04:58:04 assar Exp $ (LBL)";
 #endif
 
 #include <sys/types.h>
@@ -185,6 +185,21 @@ pcap_strerror(int errnum)
 #endif
 }
 
+pcap_t *
+pcap_open_dead(int linktype, int snaplen)
+{
+       pcap_t *p;
+
+       p = malloc(sizeof(*p));
+       if (p == NULL)
+               return NULL;
+       memset (p, 0, sizeof(*p));
+       p->fd = -1;
+       p->snapshot = snaplen;
+       p->linktype = linktype;
+       return p;
+}
+
 void
 pcap_close(pcap_t *p)
 {