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.

Authors

Dejan Lekić

License

BSD-3-Clause

Types 1

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.

Fields
private pcap_dumper_t * _dumper
Methods
void close()Closes the dumper. It is safe to call this method multiple times.
bool isNull() const @safe pure nothrow @nogcChecks if the dumper is null.
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

fnPcapDumper dumpOpen(PcapHandle * handle, string fname)Opens a savefile for writing.
fnPcapDumper dumpFopen(PcapHandle * handle, FILE * fp)Opens a savefile for writing to a standard I/O stream.
fnPcapDumper dumpHopen(PcapHandle * handle, void * osHandle)Opens a savefile for writing using an OS handle. (Windows only)
fnPcapDumper dumpOpenAppend(PcapHandle * handle, string fname)Opens a savefile for writing (append mode).