PCAP_OFFLINE_FILTER(3)

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

πŸ’… pcap_offline_filter β€” bestie, does this packet match the filter or not?? πŸ’…

okay so bestie, welcome to pcap_offline_filter(3) from the Library Functions Manual β€” this is the function you call when you literally just wanna know if a packet vibes with your filter. no cap. ✨


🌸 NAME 🌸

pcap_offline_filter β€” check whether a filter matches a packet πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <pcap/pcap.h>

int pcap_offline_filter(const struct bpf_program *fp,
    const struct pcap_pkthdr *h, const u_char *pkt);

πŸ’– DESCRIPTION πŸ’–

okay so like, pcap_offline_filter() checks whether a filter matches a packet. that's the whole vibe. 🫢

  • fp β€” pointer to a bpf_program struct, usually the result of a call to pcap_compile(3). it's giving "i was compiled just for this" energy πŸ‘‘
  • h β€” points to the pcap_pkthdr structure for the packet πŸ“‹
  • pkt β€” points to the data in the packet, like the actual packet payload bestie πŸ“

πŸ”₯ RETURN VALUE πŸ”₯

pcap_offline_filter() returns the return value of the filter program, periodt. πŸ’…

  • zero β†’ the packet doesn't match the filter πŸ™ˆ
  • non-zero β†’ the packet matches the filter πŸŽ‰

literally that simple, no plot twist. ⭐


🌈 SEE ALSO 🌈

  • pcap(3) β€” the main character of this whole ecosystem πŸ‘‘

mwah β€” this lil page is from 7 April 2014, brought to you by the PCAP_OFFLINE_FILTER(3) manual, part of the Library Functions Manual. go forth and filter, bestie πŸ’œβœ¨

πŸ“¦ where this page comes from