PCAP_SETFILTER(3)

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

πŸ’– NAME πŸ’–

okay so bestie, welcome to PCAP_SETFILTER(3) from the Library Functions Manual β€” the whole vibe is literally just set the filter. That’s it. That’s the name. πŸ’…

✨ SYNOPSIS ✨

#include <pcap/pcap.h>

int pcap_setfilter(pcap_t *p, struct bpf_program *fp);

πŸ¦‹ DESCRIPTION πŸ¦‹

pcap_setfilter() is the function you use to specify a filter program. The fp argument is a pointer to a bpf_program struct, and it’s usually the result of calling pcap_compile(3). iykyk 🫢

πŸŽ€ RETURN VALUE πŸŽ€

pcap_setfilter() returns 0 on success β€” slay ✨.

It returns PCAP_ERROR_NOT_ACTIVATED if you call it on a capture handle that has been created but not activated. Like, the handle is not ready yet, bestie, no cap.

Or it returns PCAP_ERROR on other errors. If PCAP_ERROR gets returned, you can call pcap_geterr(3) or pcap_perror(3) with p as an argument to fetch or display the error text. Very demure, very helpful. πŸ’–

🌈 SEE ALSO 🌈


kisses bestie, that’s the PCAP_SETFILTER(3) page from the Library Functions Manual, dated 5 March 2022 πŸŽ€πŸ’œ

πŸ“¦ where this page comes from