ddn.lib.pcap.error

Error handling for libpcap.

This module defines the PcapStatus enumeration for return codes and the PcapError structure for encapsulated error information.

Authors

Dejan Lekić

License

BSD-3-Clause

Types 2

enumPcapStatus : int

Status codes returned by libpcap functions.

SUCCESS = 0Success
ERROR = - 1Generic error code
ERROR_BREAK = - 2Loop terminated by pcap_breakloop
ERROR_NOT_ACTIVATED = - 3The capture needs to be activated
ERROR_ACTIVATED = - 4The operation can't be performed on already activated captures
ERROR_NO_SUCH_DEVICE = - 5No such device exists
ERROR_RFMON_NOTSUP = - 6This device doesn't support rfmon (monitor) mode
ERROR_NOT_RFMON = - 7Operation supported only in monitor mode
ERROR_PERM_DENIED = - 8No permission to open the device
ERROR_IFACE_NOT_UP = - 9Interface isn't up
ERROR_CANTSET_TSTAMP_TYPE = - 10This device doesn't support setting the time stamp type
ERROR_PROMISC_PERM_DENIED = - 11You don't have permission to capture in promiscuous mode
ERROR_TSTAMP_PRECISION_NOTSUP = - 12The requested time stamp precision is not supported
ERROR_CAPTURE_NOTSUP = - 13Capture mechanism not available
WARNING = 1Generic warning code
WARNING_PROMISC_NOTSUP = 2This device doesn't support promiscuous mode
WARNING_TSTAMP_TYPE_NOTSUP = 3The requested time stamp type is not supported
structPcapError

Encapsulates error information from libpcap.

Fields
PcapStatus status
string message
Methods
string toString() constFormats the error for display.

Functions 4

fnbool isError(PcapStatus status) pure nothrow @safe @nogcChecks if the given status code represents an error.
fnbool isWarning(PcapStatus status) pure nothrow @safe @nogcChecks if the given status code represents a warning.
fnstring statusToString(PcapStatus status)Returns a human-readable string representation of a `PcapStatus`.
fnPcapStatus safePcapStatus(int code, out int rawCode)Safely converts an integer status code from libpcap into a `PcapStatus`.