dect
/
libpcap
Archived
13
0
Fork 0

(pcap_open_dead): add function for just creating a pcap_t that be

later used when calling other functions.
From Darren Reed <darrenr@reed.wattle.id.au>
This commit is contained in:
assar 2000-06-26 04:58:04 +00:00
parent 5ea9c97fb8
commit d514a1aa6f
1 changed files with 16 additions and 1 deletions

17
pcap.c
View File

@ -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)
{