PCAP_FILENO(3)

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

okay bestie, this is from the Library Functions Manual, and pcap_fileno is about to make file descriptors make sense. πŸ’…βœ¨

πŸŽ€ NAME πŸŽ€

pcap_fileno β€” get the file descriptor for a live capture. that's the whole assignment, and she ate. 🫢

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <pcap/pcap.h>

int pcap_fileno(pcap_t *p);

🌸 DESCRIPTION 🌸

Okay so picture this: you've got a pcap_t *p, and you're wondering what file descriptor is feeding you those captured packets. Say less. πŸ‘‘

If p refers to a network device that was opened for a live capture using a combination of pcap_create(3) and pcap_activate(3), or using pcap_open_live(3), then pcap_fileno() returns the file descriptor from which captured packets are read. iconic behavior, honestly. ✨

But if p refers to a β€œsavefile” that was opened using functions such as pcap_open_offline(3) or pcap_fopen_offline(3), a β€œdead” pcap_t opened using pcap_open_dead(3), or a pcap_t that was created with pcap_create() but that has not yet been activated with pcap_activate(), then it returns PCAP_ERROR. not the file-descriptor moment, bestie β€” it's giving error. πŸ’€

πŸ’– SEE ALSO πŸ’–


xoxo, ur Unix bestie πŸ“ β€” this page is from the Library Functions Manual, dated 25 July 2018, and its manual-page title is PCAP_FILENO(3). catch you in the next group chat! πŸ’‹

πŸ“¦ where this page comes from