1PCAP_DATALINK(3PCAP)                                      PCAP_DATALINK(3PCAP)
2
3
4

NAME

6       pcap_datalink - get the link-layer header type
7

SYNOPSIS

9       #include <pcap/pcap.h>
10
11       int pcap_datalink(pcap_t *p);
12

DESCRIPTION

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 or DLT_LINUX_SLL2 even if all devices on the sys‐
29       tem at the time the "any" device is opened have some  other  data  link
30       type, such as DLT_EN10MB for Ethernet.
31

RETURN VALUE

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

SEE ALSO

38       pcap(3PCAP), pcap-linktype(7)
39
40
41
42                                 7 April 2014             PCAP_DATALINK(3PCAP)
Impressum