PcapPlusPlus
|
#include <PcapDevice.h>
Public Member Functions | |
virtual bool | open ()=0 |
virtual void | close ()=0 |
bool | isOpened () |
virtual void | getStatistics (pcap_stat &stats)=0 |
bool | setFilter (GeneralFilter &filter) |
virtual bool | setFilter (std::string filterAsString) |
void | clearFilter () |
Static Public Member Functions | |
static bool | verifyFilter (std::string filterAsString) |
static bool | matchPakcetWithFilter (std::string filterAsString, RawPacket *rawPacket) |
An abstract class representing all possible packet capturing devices: files, libPcap, WinPcap, RemoteCapture, PF_RING, etc. This class cannot obviously be instantiated
void pcpp::IPcapDevice::clearFilter | ( | ) |
Clear the filter currently set on device
|
pure virtual |
Close the device
Implemented in pcpp::DpdkDevice, pcpp::PcapNgFileWriterDevice, pcpp::PcapLiveDevice, pcpp::PcapFileWriterDevice, pcpp::PcapNgFileReaderDevice, pcpp::PfRingDevice, and pcpp::IFileDevice.
|
pure virtual |
Get statistics from device:
[out] | stats | The stats struct where stats are returned |
Implemented in pcpp::DpdkDevice, pcpp::PcapNgFileWriterDevice, pcpp::PcapLiveDevice, pcpp::PcapFileWriterDevice, pcpp::PcapNgFileReaderDevice, pcpp::PfRingDevice, pcpp::PcapFileReaderDevice, and pcpp::PcapRemoteDevice.
|
inline |
|
static |
Match a raw packet with a given BPF filter. Notice this method is static which means you don't need any device instance in order to perform this match
[in] | filterAsString | The BPF filter |
[in] | rawPacket | A pointer to the raw packet to match the BPF filter with |
|
pure virtual |
Open the device
Implemented in pcpp::DpdkDevice, pcpp::PcapNgFileWriterDevice, pcpp::PcapLiveDevice, pcpp::PcapFileWriterDevice, pcpp::PcapNgFileReaderDevice, pcpp::PfRingDevice, pcpp::PcapFileReaderDevice, and pcpp::PcapRemoteDevice.
bool pcpp::IPcapDevice::setFilter | ( | GeneralFilter & | filter | ) |
Set a filter for the device. When implemented by the device, only packets that match the filter will be received
[in] | filter | The filter to be set in PcapPlusPlus' GeneralFilter format |
|
virtual |
Set a filter for the device. When implemented by the device, only packets that match the filter will be received
[in] | filterAsString | The filter to be set in Berkeley Packet Filter (BPF) syntax (http://biot.com/capstats/bpf.html) |
Reimplemented in pcpp::DpdkDevice, pcpp::PfRingDevice, and pcpp::PcapNgFileReaderDevice.
|
static |
Verify a filter is valid
[in] | filterAsString | The filter in Berkeley Packet Filter (BPF) syntax (http://biot.com/capstats/bpf.html) |