[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


pcap_datalink Subroutine

Purpose

Obtains the link layer type for the packet capture device.

Library

pcap Library (libpcap.a)

Syntax


#include <pcap.h>


int pcap_datalink(pcap_t * p);

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


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 link layer type.

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.

Related Information

The pcap_close (pcap_close Subroutine) subroutine, pcap_open_live (pcap_open_live Subroutine) subroutine, pcap_open_offline (pcap_open_offline Subroutine) subroutine.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]