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 pcap_create()
18 that has not yet been activated by pcap_activate().
19
20 http://www.tcpdump.org/linktypes.html lists the values pcap_datalink()
21 can return and describes the packet formats that correspond to those
22 values.
23
24 Do NOT assume that the packets for a given capture or ``savefile`` will
25 have any given link-layer header type, such as DLT_EN10MB for Ethernet.
26 For example, the "any" device on Linux will have a link-layer header
27 type of DLT_LINUX_SLL even if all devices on the system at the time the
28 "any" device is opened have some other data link type, such as
29 DLT_EN10MB for Ethernet.
30
32 pcap_datalink() returns the link-layer header type on success and
33 PCAP_ERROR_NOT_ACTIVATED if called on a capture handle that has been
34 created but not activated.
35
37 pcap(3PCAP), pcap-linktype(7)
38
39
40
41 22 August 2010 PCAP_DATALINK(3PCAP)