pcap_datalink Subroutine
Purpose
Obtains the link layer type (data link type) for the packet capture device.
Library
pcap Library (libpcap.a)
Syntax
Description
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.
Parameters
Item | Description |
---|---|
p | Points to the packet capture descriptor as returned by the pcap_open_live or the pcap_open_offline subroutine. |
Return Values
The pcap_datalink subroutine returns the values of standard libpcap link layer type from the <net/bpf.h> header file.
Note: Only call this
subroutine after successful calls to either the pcap_open_live or
the pcap_open_offline subroutine. Never call the pcap_datalink subroutine
after a call to pcap_close as unpredictable results will occur.