PCAP_SNAPSHOT(3PCAP)

✨ PCAP_SNAPSHOT ✨

okay bestie, welcome to the 3PCAP section of the manual, this one's a lil cutie, it's like one function and she EATS πŸ’…

🌸 NAME 🌸

pcap_snapshot β€” get the snapshot length 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <pcap/pcap.h>

int pcap_snapshot(pcap_t *p);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, pcap_snapshot() hands you back the snapshot length, right? and which snapshot length, you ask? bestie it depends:

  • if you're doing a live capture, it's the snapshot length that got specified back when pcap_set_snaplen(3PCAP) or pcap_open_live(3PCAP) was called
  • if you're working with a savefile'' `` (a capture file, the lil time capsule of packets), it's the snapshot length straight out of that capture file
🚨 okay so important!! you literally must not call this on a pcap descriptor that came from pcap_create(3PCAP) if it hasn't been activated by pcap_activate(3PCAP) yet. like, not yet bestie, she's not ready, do not perceive her πŸ™ˆ

⭐ RETURN VALUE ⭐

  • on success, pcap_snapshot() returns the snapshot length πŸ’–
  • but if you called it on a capture handle that was created but not activated, you get PCAP_ERROR_NOT_ACTIVATED 😭 (yes, exactly the thing we just told you not to do, she will call you out fr fr)

πŸ‘‘ SEE ALSO πŸ‘‘

pcap(3PCAP)


mwah πŸ’‹ that's the whole page, 7 April 2014, straight from the PCAP_SNAPSHOT(3PCAP) girlies herself, no cap 🫢✨

πŸ“¦ where this page comes from