PCAP_DATALINK(3)
hiii bestie π welcome to PCAP_DATALINK(3) from the Library Functions Manual β itβs here to spill the tea on link-layer header types, and honestly itβs kind of iconic.
β¨ NAME β¨
pcap_datalink β get the link-layer header type π
πΈ SYNOPSIS πΈ
#include <pcap/pcap.h>
int pcap_datalink(pcap_t *p);
π DESCRIPTION π
Okay so pcap_datalink() returns the link-layer header type for the live capture or βsavefileβ specified by p. Thatβs the whole vibe. π¦
Wait β important: it must not be called on a pcap descriptor created bypcap_create(3)that has not yet been activated bypcap_activate(3). Like, do not come for this function before activation, bestie. π
The page https://www.tcpdump.org/linktypes.html lists the values pcap_datalink() can return and describes the packet formats that correspond to those values. Go look, itβs giving reference material. πβ¨
Do NOT assume that the packets for a given capture or βsavefileβ will have any given link-layer header type, such as DLT_EN10MB for Ethernet. No cap. For example, the βanyβ device on Linux will have a link-layer header type of DLT_LINUX_SLL or DLT_LINUX_SLL2 even if all devices on the system at the time the βanyβ device is opened have some other data link type, such as DLT_EN10MB for Ethernet. The βanyβ device is lowkey doing its own thing. ππ₯
π¦ RETURN VALUE π¦
pcap_datalink() returns the link-layer header type on success, and PCAP_ERROR_NOT_ACTIVATED if called on a capture handle that has been created but not activated. Periodt. π
π SEE ALSO π
thatβs the whole page, bestie π«Ά this cutie is dated 7 April 2014, and its footer tag is PCAP_DATALINK(3) πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 1994, 1996, 1997 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms