PCAP_OPEN_DEAD(3PCAP)
π PCAP_OPEN_DEAD π
okay bestie, welcome to PCAP_OPEN_DEAD(3PCAP) β yes the name sounds dramatic but it's literally just "open a fake pcap_t for compiling filters or opening a capture for output" and honestly? iconic. π
β¨ NAME β¨
pcap_open_dead, pcap_open_dead_with_tstamp_precision β open a fake pcap_t for compiling filters or opening a capture for output
πΈ SYNOPSIS πΈ
#include <pcap/pcap.h>
pcap_t *pcap_open_dead(int linktype, int snaplen);
pcap_t *pcap_open_dead_with_tstamp_precision(int linktype, int snaplen,
u_int precision);
π¦ DESCRIPTION π¦
so the tea is: pcap_open_dead() and pcap_open_dead_with_tstamp_precision() are how you create a pcap_t structure to use when you're calling the other functions in libpcap. it's typically used when you're just using libpcap for compiling BPF code β that's its whole main character moment. it can also be used if you're using pcap_dump_open(3PCAP), pcap_dump(3PCAP), and pcap_dump_close(3PCAP) to write a savefile, for when there's no pcap_t that supplies the packets to be written. like, nobody's feeding you packets, so you bring your own pretend one π«Ά
linktype specifies the link-layer type for the pcap_t.
snaplen specifies the snapshot length for the pcap_t.
now when pcap_open_dead_with_tstamp_precision() is used to create a pcap_t for use with pcap_dump_open(), precision specifies the time stamp precision for packets. so:
PCAP_TSTAMP_PRECISION_MICROβ specify this if the packets to be written have time stamps in seconds and microsecondsPCAP_TSTAMP_PRECISION_NANOβ specify this if the packets to be written have time stamps in seconds and nanoseconds
β οΈ heads up bestie: its value does not affect pcap_compile(3PCAP). like, at all. don't come for me, that's just the lore.
π BACKWARD COMPATIBILITY π
the pcap_open_dead_with_tstamp_precision() function became available in libpcap release 1.5.1. in previous releases, there was literally no mechanism to open a savefile for writing with time stamps given in seconds and nanoseconds. not me crying for the pre-1.5.1 girlies π
π SEE ALSO π
pcap(3PCAP)pcap-linktype(7)
and that's the whole vibe, bestie. this page is dated 3 January 2014 and it comes to you straight from the libpcap world β go forth and open your fake pcap_ts, you absolute legend πβ¨π
π¦ where this page comes from
- alpine 3.22: libpcap-doc 1.10.7-r0 Β· BSD-3-Clause
- alpine 3.23: libpcap-doc 1.10.7-r0 Β· BSD-3-Clause
- alpine 3.24: libpcap-doc 1.10.7-r0 Β· BSD-3-Clause
- arch rolling: libpcap 1.11.0-1 Β· BSD-3-Clause
- centos-stream 10: libpcap-devel 14:1.10.4-8.el10 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- centos-stream 9: libpcap-devel 14:1.10.0-5.el9 Β· BSD with advertising
- centos-stream 9: libpcap-devel 14:1.10.0-5.el9 Β· BSD with advertising
- debian bookworm: libpcap0.8-dev 1.10.3-1
- debian trixie: libpcap0.8-dev 1.10.5-2
- fedora 43: libpcap-devel 14:1.10.5-3.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 43: libpcap-devel 14:1.10.5-3.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 43: libpcap-devel 14:1.10.7-1.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 43: libpcap-devel 14:1.10.7-1.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.6-2.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.6-2.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.7-1.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- fedora 44: libpcap-devel 14:1.10.7-1.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC
- nixos 26.05: libpcap 1.10.7
- nixpkgs unstable: libpcap 146
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libpcap-devel 1.10.5-160000.5.1 Β· BSD-3-Clause
- ubuntu jammy: libpcap0.8-dev 1.10.1-4build1
- ubuntu jammy: libpcap0.8-dev 1.10.1-4ubuntu1.22.04.2
- ubuntu noble: libpcap0.8-dev 1.10.4-4.1ubuntu3
- ubuntu noble: libpcap0.8-dev 1.10.4-4.1ubuntu3.1
- ubuntu questing: libpcap0.8-dev 1.10.5-2ubuntu2
- ubuntu resolute: libpcap0.8-dev 1.10.6-1ubuntu1 Β· BSD-3-clause-var3
- ubuntu resolute: libpcap0.8-dev 1.10.6-1ubuntu1.1 Β· BSD-3-clause-var3
- ubuntu stonking: libpcap0.8-dev 1.10.7-1ubuntu1 Β· BSD-3-clause-var3
- Copyright (c) 1994, 1996, 1997 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms