ddn.lib.pcap.device
Device discovery and enumeration for libpcap.
This module provides the PcapIfList RAII wrapper for device enumeration and associated flags and structures.
License
BSD-3-Clause
Copyright
© 2026 DDN (D Developer Network) Members
Types 4
enumDeviceFlags : uint
Flags for libpcap interfaces.
LOOPBACK = 0x00000001
UP = 0x00000002
RUNNING = 0x00000004
WIRELESS = 0x00000008
CONNECTION_STATUS = 0x00000030
CONNECTION_STATUS_UNKNOWN = 0x00000000
CONNECTION_STATUS_CONNECTED = 0x00000010
CONNECTION_STATUS_DISCONNECTED = 0x00000020
CONNECTION_STATUS_NOT_APPLICABLE = 0x00000030
structPcapAddress
D representation of an interface address.
This structure wraps the raw pcap_addr_t and provides a more idiomatic way to access address information.
Fields
private pcap_addr_t * _ptrMethods
Constructors
this(pcap_addr_t * ptr)Constructor.structPcapInterface
D representation of a network device/interface.
This structure wraps the raw pcap_if_t and provides a more idiomatic way to access device metadata.
Fields
private pcap_if_t * _ptrMethods
int opApply(int delegate(ref PcapAddress) dg)Support for iteration over interface addresses.Constructors
this(pcap_if_t * ptr)Constructor.structPcapIfList
RAII wrapper for the list of interfaces returned by pcap_findalldevs.
Fields
private pcap_if_t * _handleMethods
void free()Frees the interface list. It is safe to call this method multiple times.int opApply(int delegate(ref PcapInterface) dg)Support for `foreach` iteration over the interface list.Constructors
this(pcap_if_t * h)Constructor.Destructors
~thisDestructor frees the interface list.Functions 2
fn
string lookupDev(out string errBuf)Returns the name of a default device to capture on. (Obsolete, use `findAllDevs` instead)