PCAP_IS_SWAPPED(3)

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

πŸ’… PCAP_IS_SWAPPED(3) β€” like, the library functions manual, but make it cute

okay so bestie, welcome to the PCAP_IS_SWAPPED(3) page from the Library Functions Manual β€” she's short, she's iconic, she's here to answer exactly one (1) question. let's get into it πŸŽ€


✨ NAME ✨

pcap_is_swapped β€” find out whether a savefile has the native byte order πŸ¦‹

like literally that's the whole job. she peeks at your savefile and tells you if it's speaking a different byte-order language than your machine. no cap.


🌸 SYNOPSIS 🌸

#include <pcap/pcap.h>

int pcap_is_swapped(pcap_t *p);

that's it. one include, one function, one pcap_t *p. she's low-maintenance, we love that for her πŸ’–


πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the tea β˜• β€” pcap_is_swapped() returns true (1) if p refers to a ``savefile'' that uses a different byte order than the current system. like, your machine reads numbers one way, the savefile wrote them the other way, and she's the one who notices. icon behavior, honestly.

for a live capture, it always returns false (0). always. every time. no drama, no surprises πŸ’€

⚠️ okay this part is important, don't skip it: it must not be called on a pcap descriptor created by pcap_create(3) that has not yet been activated by pcap_activate(3). like, don't do that. she's not ready. let her activate first bestie 😭

πŸ”₯ RETURN VALUE πŸ”₯

  • 1 β€” true, bestie, the byte order is swapped πŸŒ€
  • 0 β€” false, everything's native, we're chilling ✨
  • PCAP_ERROR_NOT_ACTIVATED β€” the sitch where you called her on a capture handle that's been created but not activated. rude, but she'll tell you πŸ’…

so yeah: true (1) or false (0) on success, and PCAP_ERROR_NOT_ACTIVATED when you jumped the gun. periodt.


🫢 SEE ALSO 🫢

  • pcap(3) β€” go say hi to the main character πŸ‘‘

kisses bestie, that's the whole page 🌈 this little gem is dated 7 April 2014 and lives in the PCAP_IS_SWAPPED(3) corner of the Library Functions Manual β€” go forth and check those byte orders responsibly πŸ’œπŸŽ€

πŸ“¦ where this page comes from