PCAP_SET_TSTAMP_TYPE(3PCAP)

πŸ“¦
version 1.10.7 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

🌸 NAME 🌸

okay so bestie, this is the pcap_set_tstamp_type(3PCAP) page β€” yes, that's the manual name, and yes it's a whole vibe. It's literally the function that sets the time stamp type to be used by a capture device. slay ✨

✨ SYNOPSIS ✨

#include <pcap/pcap.h>

int pcap_set_tstamp_type(pcap_t *p, int tstamp_type);

πŸ’– DESCRIPTION πŸ’–

So here's the tea: pcap_set_tstamp_type() sets the type of time stamp desired for packets captured on the pcap descriptor to the type specified by tstamp_type. Like, you're telling it what time-stamp flavor you want. πŸ“

It must be called on a pcap descriptor created by pcap_create(3PCAP) that has not yet been activated by pcap_activate(3PCAP). Periodt. Do the setup era first, activate later.

⚠️ bestie warning: this is a before-activation thing. If the handle is already activated, that's a no from the function.

pcap_list_tstamp_types(3PCAP) will give a list of the time stamp types supported by a given capture device. And pcap-tstamp(7) has the full list of all the time stamp types β€” go read it, iykyk. πŸ‘‘

πŸ”₯ RETURN VALUE πŸ”₯

pcap_set_tstamp_type() returns:

  • 0 on success if the specified time stamp type is expected to be supported by the capture device πŸ’…
  • PCAP_WARNING_TSTAMP_TYPE_NOTSUP if the specified time stamp type is not supported by the capture device πŸ™ˆ
  • PCAP_ERROR_ACTIVATED if called on a capture handle that has been activated πŸ’€
  • PCAP_ERROR_CANTSET_TSTAMP_TYPE if the capture device doesn't support setting the time stamp type β€” and only older versions of libpcap will return that; newer versions will always allow the time stamp type to be set to the default type 🫢

πŸ•°οΈ BACKWARD COMPATIBILITY πŸ•°οΈ

This function became available in libpcap release 1.2.1. In previous releases, the time stamp type cannot be set; only the default time stamp type offered by a capture source is available. ngl, old libpcap really said "default only, bestie." 😭

πŸ‘€ SEE ALSO πŸ‘€

  • pcap(3PCAP)
  • pcap_tstamp_type_name_to_val(3PCAP)

okay that's the whole vibe. This manual page is dated 8 September 2019, and it's filed under PCAP_SET_TSTAMP_TYPE(3PCAP) β€” mwah πŸ’‹ go set those time stamps, bestie. 🫢✨

πŸ“¦ where this page comes from