1PCAP_DATALINK(3PCAP) PCAP_DATALINK(3PCAP)
2
3
4
6 pcap_datalink - get the link-layer header type
7
9 #include <pcap/pcap.h>
10
11 int pcap_datalink(pcap_t *p);
12
14 pcap_datalink() returns the link-layer header type for the live capture
15 or ``savefile'' specified by p.
16
17 It must not be called on a pcap descriptor created by
18 pcap_create(3PCAP) that has not yet been activated by
19 pcap_activate(3PCAP).
20
21 https://www.tcpdump.org/linktypes.html lists the values pcap_datalink()
22 can return and describes the packet formats that correspond to those
23 values.
24
25 Do NOT assume that the packets for a given capture or ``savefile`` will
26 have any given link-layer header type, such as DLT_EN10MB for Ethernet.
27 For example, the "any" device on Linux will have a link-layer header
28 type of DLT_LINUX_SLL even if all devices on the system at the time the
29 "any" device is opened have some other data link type, such as
30 DLT_EN10MB for Ethernet.
31
33 pcap_datalink() returns the link-layer header type on success and
34 PCAP_ERROR_NOT_ACTIVATED if called on a capture handle that has been
35 created but not activated.
36
38 pcap(3PCAP), pcap-linktype(7)
39
40
41
42 7 April 2014 PCAP_DATALINK(3PCAP)