ddn.net.pcap.device

High-level device discovery and configuration API.

Authors

Dejan Lekić

License

BSD-3-Clause

Types 3

Represents a network device address.

Address data is deep-copied from libpcap's internal storage so that it remains valid after device enumeration returns.

Fields
private ubyte[] _addr
private ubyte[] _netmask
private ubyte[] _broadaddr
private ubyte[] _dstaddr
Methods
const(SocketAddress) * addr() const pure nothrow @nogcReturns the address.
const(SocketAddress) * netmask() const pure nothrow @nogcReturns the netmask.
const(SocketAddress) * broadaddr() const pure nothrow @nogcReturns the broadcast address.
const(SocketAddress) * dstaddr() const pure nothrow @nogcReturns the destination address.
structDevice

Represents a network device.

Fields
string name
string description
uint flags
DeviceAddress[] addresses

Builder for configuring and opening a live capture.

Fields
string _deviceName
int _snaplen
bool _promisc
int _timeout
bool _immediate
int _bufferSize
Methods
LiveCaptureBuilder snaplen(int val) ref return
LiveCaptureBuilder promiscuous(bool val) ref return
LiveCaptureBuilder timeout(int ms) ref return
LiveCaptureBuilder immediateMode(bool val) ref return
LiveCaptureBuilder bufferSize(int bytes) ref return
Pcap open()Opens the live capture with the current configuration.
Constructors
this(string deviceName)

Functions 2

private fnubyte[] copySockaddr(const(SocketAddress) * sa) pure nothrowCopies raw sockaddr bytes into an owned buffer.
fnDevice[] enumerateDevices()Returns a list of all available network devices.