PCAP_SET_DATALINK(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

okay bestie, welcome to the pcap_set_datalink page from the Library Functions Manual ✨ this one is lowkey short but highkey useful: it's all about setting the link-layer header type for a capture device. no cap 🫢


✨ NAME ✨

pcap_set_datalink β€” set the link-layer header type to be used by a capture device πŸ’…

🌸 SYNOPSIS 🌸

#include <pcap/pcap.h>

int pcap_set_datalink(pcap_t *p, int dlt);

πŸ’… DESCRIPTION πŸ’…

so basically, pcap_set_datalink() is used to set the current link-layer header type of the pcap descriptor to the type specified by dlt πŸ¦‹

like, that's the whole vibe. p is your pcap descriptor, and dlt is the link-layer header type you want it to use. iconic, honestly πŸ‘‘

πŸ”₯ RETURN VALUE πŸ”₯

pcap_set_datalink() returns 0 on success, bestie πŸŽ€

it returns PCAP_ERROR_NOT_ACTIVATED if you call it on a capture handle that has been created but not activated 😭

on other errors, it returns PCAP_ERROR πŸ’€

and if PCAP_ERROR is returned, you may call pcap_geterr(3) or pcap_perror(3) with p as an argument to fetch or display the error text. very helpful, very demure πŸ™ˆ

🌈 SEE ALSO 🌈


signed off from the Library Functions Manual, dated 5 March 2022, page PCAP_SET_DATALINK(3) β€” slay and goodbye, bestie πŸ’Œβœ¨πŸ’–

πŸ“¦ where this page comes from