ddn.lib.pcap.dumper
Pcap file writing (dumping) support.
This module provides the PcapDumper RAII wrapper for pcap_dumper_t and functions to create and manage pcap savefiles.
License
BSD-3-Clause
Copyright
© 2026 DDN (D Developer Network) Members
struct PcapDumper
Types 1
structPcapDumper
RAII wrapper for libpcap's pcap_dumper_t.
This structure ensures that the underlying dumper is closed automatically when the wrapper goes out of scope.
Methods
void close()Closes the dumper. It is safe to call this method multiple times.FILE * file()Returns the standard I/O stream associated with the dumper.void dump(const(pcap_pkthdr) * header, const(ubyte) * data)Writes a packet to the savefile.PcapStatus flush()Flushes buffered packet data to the savefile.long ftell()Returns the current file position in the savefile.long ftell64()Returns the current file position in the savefile (64-bit).Constructors
this(pcap_dumper_t * d)Constructor.Destructors
~thisDestructor closes the dumper.Functions 4
fn
PcapDumper dumpFopen(PcapHandle * handle, FILE * fp)Opens a savefile for writing to a standard I/O stream.fn
PcapDumper dumpHopen(PcapHandle * handle, void * osHandle)Opens a savefile for writing using an OS handle. (Windows only)fn
PcapDumper dumpOpenAppend(PcapHandle * handle, string fname)Opens a savefile for writing (append mode).