38 PcapHandle& operator=(std::nullptr_t) noexcept;
45 return m_PcapDescriptor !=
nullptr;
49 pcap_t*
get() const noexcept
51 return m_PcapDescriptor;
61 void reset(pcap_t* pcapDescriptor =
nullptr) noexcept;
69 explicit operator
bool() const noexcept
74 bool operator==(std::nullptr_t)
const noexcept
78 bool operator!=(std::nullptr_t)
const noexcept
84 pcap_t* m_PcapDescriptor =
nullptr;
Definition: PcapFilter.h:134
virtual bool setFilter(GeneralFilter &filter)
Definition: Device.h:63
Definition: PcapDevice.h:92
virtual bool setFilter(std::string filterAsString)
virtual void getStatistics(PcapStats &stats) const =0
static bool matchPacketWithFilter(GeneralFilter &filter, RawPacket *rawPacket)
static std::string getPcapLibVersionInfo()
Definition: RawPacket.h:269
A wrapper class for pcap_t* which is the libpcap packet capture descriptor. This class is used to man...
Definition: PcapDevice.h:25
pcap_t * release() noexcept
Releases ownership of the handle and returns the pcap descriptor.
char const * getLastError() const noexcept
Helper function to retrieve a view of the last error string for this handle.
void reset(pcap_t *pcapDescriptor=nullptr) noexcept
Replaces the managed handle with the provided one.
constexpr PcapHandle() noexcept=default
Creates an empty handle.
pcap_t * get() const noexcept
Definition: PcapDevice.h:49
bool isValid() const noexcept
Definition: PcapDevice.h:43
The main namespace for the PcapPlusPlus lib.
Definition: PcapDevice.h:104
uint64_t packetsRecv
Number of packets received.
Definition: PcapDevice.h:106
uint64_t packetsDrop
Number of packets dropped.
Definition: PcapDevice.h:108
uint64_t packetsDropByInterface
number of packets dropped by interface (not supported on all platforms)
Definition: PcapDevice.h:110