PCAP_DATALINK_VAL_TO_NAME(3PCAP)

πŸ“¦
version 1.10.7 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

okay so bestie, welcome to the PCAP_DATALINK_VAL_TO_NAME(3PCAP) page β€” yes, 3PCAP is the manual section, and this whole thing is about getting a name or description for a link-layer header type value. it’s giving β€œtiny functions, very useful” energy. πŸ’…


✨ NAME ✨

pcap_datalink_val_to_name, pcap_datalink_val_to_description, and pcap_datalink_val_to_description_or_dlt β€” get a name or description for a link-layer header type value. πŸŽ€


πŸŽ€ SYNOPSIS πŸŽ€

#include <pcap.h>

const char *pcap_datalink_val_to_name(int dlt);
const char *pcap_datalink_val_to_description(int dlt);
const char *pcap_datalink_val_to_description_or_dlt(int dlt);

πŸ’– DESCRIPTION πŸ’–

  • pcap_datalink_val_to_name() β€” translates a link-layer header type value to the corresponding link-layer header type name. that name is the DLT_ name for the link-layer header type value with the DLT_ removed. if the type value does not correspond to a known DLT_ value, NULL is returned. 😭
  • pcap_datalink_val_to_description() β€” translates a link-layer header type value to a short description of that link-layer header type. if the type value does not correspond to a known DLT_ value, NULL is returned.
  • pcap_datalink_val_to_description_or_dlt() β€” translates a link-layer header type value to a short description of that link-layer header type, just like pcap_datalink_val_to_description(). but if the type value does not correspond to a known DLT_ value, the string "DLT n" is returned, where n is the value of the dlt argument. no NULL jump-scare here, bestie. 🫢

🌈 BACKWARD COMPATIBILITY 🌈

the pcap_datalink_val_to_description_or_dlt() function first became available in libpcap release 1.9.1. in previous releases, pcap_datalink_val_to_description() would have to be called and, if it returned NULL, a default string would have to be constructed. lowkey a little手ε·₯ arts-and-crafts moment. βœ‚οΈπŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘

pcap(3PCAP) 🌟


mwah πŸ’‹ β€” source/version: PCAP_DATALINK_VAL_TO_NAME(3PCAP), date: 4 May 2022. periodt. πŸ’–

πŸ“¦ where this page comes from