1PCAP_CREATE(3PCAP) PCAP_CREATE(3PCAP)
2
3
4
6 pcap_create - create a live capture handle
7
9 #include <pcap/pcap.h>
10
11 char errbuf[PCAP_ERRBUF_SIZE];
12
13 pcap_t *pcap_create(const char *source, char *errbuf);
14
16 pcap_create() is used to create a packet capture handle to look at
17 packets on the network. source is a string that specifies the network
18 device to open; on Linux systems with 2.2 or later kernels, a source
19 argument of "any" or NULL can be used to capture packets from all
20 interfaces.
21
22 The returned handle must be activated with pcap_activate(3PCAP) before
23 packets can be captured with it; options for the capture, such as pro‐
24 miscuous mode, can be set on the handle before activating it.
25
27 pcap_create() returns a pcap_t * on success and NULL on failure. If
28 NULL is returned, errbuf is filled in with an appropriate error mes‐
29 sage. errbuf is assumed to be able to hold at least PCAP_ERRBUF_SIZE
30 chars.
31
33 pcap(3PCAP)
34
35
36
37 3 January 2014 PCAP_CREATE(3PCAP)