Obtains the link layer type (data link type) for the packet capture device.
pcap Library (libpcap.a)
#include <pcap.h>
int pcap_datalink(pcap_t * p);
The pcap_datalink subroutine returns the link layer type of the packet capture device, for example, IFT_ETHER. This is useful in determining the size of the datalink header at the beginning of each packet that is read.
Item | Description |
---|---|
p | Points to the packet capture descriptor as returned by the pcap_open_live or the pcap_open_offline subroutine. |
The pcap_datalink subroutine returns the values of standard libpcap link layer type from the <net/bpf.h> header file.