1PCAP_LOOKUPDEV(3PCAP) PCAP_LOOKUPDEV(3PCAP)
2
3
4
6 pcap_lookupdev - find the default device on which to capture
7
9 #include <pcap/pcap.h>
10
11 char errbuf[PCAP_ERRBUF_SIZE];
12
13 [DEPRECATED] char *pcap_lookupdev(char *errbuf);
14
16 This interface is obsoleted by pcap_findalldevs(3PCAP). To find a
17 default device on which to capture, call pcap_findalldevs() and, if the
18 list it returns is not empty, use the first device in the list. (If
19 the list is empty, there are no devices on which capture is possible.)
20
21 If pcap_init(3PCAP) has been called, this interface always returns
22 NULL.
23
24 pcap_lookupdev() returns a pointer to a string giving the name of a
25 network device suitable for use with pcap_create(3PCAP) and
26 pcap_activate(3PCAP), or with pcap_open_live(3PCAP), and with
27 pcap_lookupnet(3PCAP). If there is an error, or if pcap_init(3PCAP)
28 has been called, NULL is returned and errbuf is filled in with an
29 appropriate error message. errbuf is assumed to be able to hold at
30 least PCAP_ERRBUF_SIZE chars.
31
33 pcap(3PCAP)
34
36 The pointer returned by pcap_lookupdev() points to a static buffer;
37 subsequent calls to pcap_lookupdev() in the same thread, or calls to
38 pcap_lookupdev() in another thread, may overwrite that buffer.
39
40 In WinPcap and Npcap, this function may return a UTF-16 string rather
41 than an ASCII or UTF-8 string.
42
43
44
45 8 September 2017 PCAP_LOOKUPDEV(3PCAP)