PcapPlusPlus  19.12
pcpp::GeneralFilter Class Referenceabstract

#include <PcapFilter.h>

Inheritance diagram for pcpp::GeneralFilter:
pcpp::AndFilter pcpp::ArpFilter pcpp::BPFStringFilter pcpp::EtherTypeFilter pcpp::IFilterWithDirection pcpp::IFilterWithOperator pcpp::NotFilter pcpp::OrFilter pcpp::ProtoFilter pcpp::TcpFlagsFilter pcpp::VlanFilter

Public Member Functions

virtual void parseToString (std::string &result)=0
 
bool matchPacketWithFilter (RawPacket *rawPacket)
 
virtual ~GeneralFilter ()
 

Protected Member Functions

void freeProgram ()
 

Detailed Description

The base class for all filter classes. This class is virtual and abstract, hence cannot be instantiated.
For deeper understanding of the filter concept please refer to PcapFilter.h

Constructor & Destructor Documentation

◆ ~GeneralFilter()

virtual pcpp::GeneralFilter::~GeneralFilter ( )
inlinevirtual

Virtual destructor, frees the bpf program

Member Function Documentation

◆ freeProgram()

void pcpp::GeneralFilter::freeProgram ( )
protected

Free the held program and any resources allocated for it.

◆ matchPacketWithFilter()

bool pcpp::GeneralFilter::matchPacketWithFilter ( RawPacket rawPacket)

Match a raw packet with a given BPF filter.

Parameters
[in]rawPacketA pointer to the raw packet to match the BPF filter with
Returns
True if a raw packet matches the BPF filter or false otherwise

◆ parseToString()

virtual void pcpp::GeneralFilter::parseToString ( std::string &  result)
pure virtual

A method that parses the class instance into BPF string format

Parameters
[out]resultAn empty string that the parsing will be written into. If the string isn't empty, its content will be overridden

Implemented in pcpp::UdpLengthFilter, pcpp::TcpWindowSizeFilter, pcpp::TcpFlagsFilter, pcpp::VlanFilter, pcpp::ArpFilter, pcpp::ProtoFilter, pcpp::NotFilter, pcpp::OrFilter, pcpp::AndFilter, pcpp::EtherTypeFilter, pcpp::MacAddressFilter, pcpp::PortRangeFilter, pcpp::PortFilter, pcpp::IPv4TotalLengthFilter, pcpp::IPv4IDFilter, pcpp::IPFilter, and pcpp::BPFStringFilter.