1PCAP_OPEN_LIVE(3PCAP)                                    PCAP_OPEN_LIVE(3PCAP)
2
3
4

NAME

6       pcap_open_live - open a device for capturing
7

SYNOPSIS

9       #include <pcap/pcap.h>
10
11       char errbuf[PCAP_ERRBUF_SIZE];
12
13       pcap_t *pcap_open_live(const char *device, int snaplen,
14               int promisc, int to_ms, char *errbuf);
15

DESCRIPTION

17       pcap_open_live()  is  used to obtain a packet capture handle to look at
18       packets on the network.  device is a string that specifies the  network
19       device  to  open;  on Linux systems with 2.2 or later kernels, a device
20       argument of "any" or NULL can be  used  to  capture  packets  from  all
21       interfaces.
22
23       snaplen specifies the snapshot length to be set on the handle.
24
25       promisc specifies if the interface is to be put into promiscuous mode.
26
27       to_ms  specifies the packet buffer timeout, as a non-negative value, in
28       milliseconds.  (See pcap(3PCAP) for an explanation of the packet buffer
29       timeout.)
30

RETURN VALUE

32       pcap_open_live() returns a pcap_t * on success and NULL on failure.  If
33       NULL is returned, errbuf is filled in with an  appropriate  error  mes‐
34       sage.   errbuf  may  also  be set to warning text when pcap_open_live()
35       succeeds; to detect this case the caller  should  store  a  zero-length
36       string  in errbuf before calling pcap_open_live() and display the warn‐
37       ing to the user if errbuf is no longer a zero-length string.  errbuf is
38       assumed to be able to hold at least PCAP_ERRBUF_SIZE chars.
39

SEE ALSO

41       pcap_create(3PCAP), pcap_activate(3PCAP)
42
43
44
45                                6 December 2017          PCAP_OPEN_LIVE(3PCAP)
Impressum