PCAP_IS_SWAPPED(3PCAP)

πŸ’– PCAP_IS_SWAPPED πŸ’–

okay bestie, welcome to the 3PCAP section of the manual, and lemme tell you about pcap_is_swapped β€” she's a lil function with one job and she does it flawlessly, no notes. πŸŽ€


✨ NAME ✨

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


🌸 SYNOPSIS 🌸

#include <pcap/pcap.h>

int pcap_is_swapped(pcap_t *p);

like yes, that's it, that's the whole vibe check. one include, one function, go off. πŸ’…


πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the tea, bestie. pcap_is_swapped() returns true (1) if p refers to a savefile that uses a different byte order than the current system. big endian vs little endian drama, we love a cross-platform moment. 🌈

and for a live capture? it always returns false (0). every single time. no surprises, no plot twists, just 0. periodt. ✨

πŸ’€ OKAY BUT REAL TALK: it must not be called on a pcap descriptor created by pcap_create(3PCAP) that has not yet been activated by pcap_activate(3PCAP). like, do not do that. it's giving unactivated handle, and the function is not gonna play nice. πŸ™ˆ

⭐ RETURN VALUE ⭐

  • pcap_is_swapped() returns true (1) or false (0) on success πŸ’–
  • and it returns PCAP_ERROR_NOT_ACTIVATED if you call it on a capture handle that's been created but not activated 😭

so like, either a cute lil boolean or a whole error code. choose your adventure, but activate your handle first, i'm begging. 🫢


πŸŽ€ SEE ALSO πŸŽ€

  • pcap(3PCAP)

and that's the whole page, bestie!! sourced from the PCAP_IS_SWAPPED(3PCAP) manual, dated 7 April 2014, and honestly? iconic. timeless. no cap. πŸ§šπŸ’œ mwah, go activate your handles and stay byte-order aware ✨🌸

πŸ“¦ where this page comes from