PcapPlusPlus
Next
|
A wrapper class for pcap_t* which is the libpcap packet capture descriptor. This class is used to manage the lifecycle of the pcap_t* object. More...
#include <PcapDevice.h>
Public Member Functions | |
constexpr | PcapHandle () noexcept=default |
Creates an empty handle. | |
PcapHandle (pcap_t *pcapDescriptor) noexcept | |
Creates a handle from the provided pcap descriptor. More... | |
bool | isValid () const noexcept |
pcap_t * | get () const noexcept |
pcap_t * | release () noexcept |
Releases ownership of the handle and returns the pcap descriptor. More... | |
void | reset (pcap_t *pcapDescriptor=nullptr) noexcept |
Replaces the managed handle with the provided one. More... | |
char const * | getLastError () const noexcept |
Helper function to retrieve a view of the last error string for this handle. More... | |
bool | setFilter (std::string const &filter) |
Sets a filter on the handle. Only packets that match the filter will be captured by the handle. More... | |
bool | clearFilter () |
Clears the filter currently set on the handle. More... | |
operator bool () const noexcept | |
A wrapper class for pcap_t* which is the libpcap packet capture descriptor. This class is used to manage the lifecycle of the pcap_t* object.
|
explicitnoexcept |
Creates a handle from the provided pcap descriptor.
pcapDescriptor | The pcap descriptor to wrap. |
bool pcpp::internal::PcapHandle::clearFilter | ( | ) |
Clears the filter currently set on the handle.
|
inlinenoexcept |
|
noexcept |
Helper function to retrieve a view of the last error string for this handle.
|
inlinenoexcept |
|
inlineexplicitnoexcept |
|
noexcept |
Releases ownership of the handle and returns the pcap descriptor.
|
noexcept |
Replaces the managed handle with the provided one.
pcapDescriptor | A new pcap descriptor to manage. |
bool pcpp::internal::PcapHandle::setFilter | ( | std::string const & | filter | ) |
Sets a filter on the handle. Only packets that match the filter will be captured by the handle.
The filter uses Berkeley Packet Filter (BPF) syntax (http://biot.com/capstats/bpf.html).
[in] | filter | The filter to set in Berkeley Packet Filter (BPF) syntax. |