(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:
parent
5ea9c97fb8
commit
d514a1aa6f
17
pcap.c
17
pcap.c
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] =
|
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
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -185,6 +185,21 @@ pcap_strerror(int errnum)
|
||||||
#endif
|
#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
|
void
|
||||||
pcap_close(pcap_t *p)
|
pcap_close(pcap_t *p)
|
||||||
{
|
{
|
||||||
|
|
Reference in New Issue