libpcaps
Libpcap is a portable open-source library written in C that provides a uniform interface for capturing network traffic. It enables applications to capture packets from live network interfaces or to read from saved capture files (pcap files). By encapsulating platform-specific capture mechanisms, libpcap offers a consistent programming model across a wide range of operating systems.
Libpcap is the foundation for many network analysis tools, most notably tcpdump, and is widely used by
The API supports live capture through pcap_open_live, offline capture via pcap_open_offline, and packet iteration with pcap_loop