PcapPlusPlus  19.12
pcpp::IFilterableDevice Class Referenceabstract

#include <Device.h>

Inheritance diagram for pcpp::IFilterableDevice:
pcpp::IPcapDevice pcpp::PfRingDevice pcpp::IFileDevice pcpp::PcapLiveDevice pcpp::IFileReaderDevice pcpp::IFileWriterDevice pcpp::PcapRemoteDevice pcpp::WinPcapLiveDevice pcpp::PcapFileReaderDevice pcpp::PcapNgFileReaderDevice pcpp::PcapFileWriterDevice pcpp::PcapNgFileWriterDevice

Public Member Functions

virtual bool setFilter (GeneralFilter &filter)
 
virtual bool setFilter (std::string filterAsString)=0
 
virtual bool clearFilter ()=0
 

Detailed Description

An abstract interface representing all devices that have BPF (Berkeley Packet Filter) filtering capabilities, meaning devices that can filter packets based on the BPF filtering syntax. This is an abstract class that cannot be instantiated

Member Function Documentation

◆ clearFilter()

virtual bool pcpp::IFilterableDevice::clearFilter ( )
pure virtual

Clear the filter currently set on the device

Returns
True if filter was removed successfully or if no filter was set, false otherwise

Implemented in pcpp::PfRingDevice, and pcpp::IPcapDevice.

◆ setFilter() [1/2]

virtual bool pcpp::IFilterableDevice::setFilter ( GeneralFilter filter)
inlinevirtual

Set a filter for the device. When implemented by the device, only packets that match the filter will be received

Parameters
[in]filterThe filter to be set in PcapPlusPlus' GeneralFilter format
Returns
True if filter set successfully, false otherwise

◆ setFilter() [2/2]

virtual bool pcpp::IFilterableDevice::setFilter ( std::string  filterAsString)
pure virtual

Set a filter for the device. When implemented by the device, only packets that match the filter will be received

Parameters
[in]filterAsStringThe filter to be set in Berkeley Packet Filter (BPF) syntax (http://biot.com/capstats/bpf.html)
Returns
True if filter set successfully, false otherwise

Implemented in pcpp::PcapNgFileWriterDevice, pcpp::PfRingDevice, pcpp::PcapNgFileReaderDevice, and pcpp::IPcapDevice.