PCAP_IS_SWAPPED(3)
π 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 bypcap_create(3)that has not yet been activated bypcap_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
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 1994, 1996, 1997 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms