PcapPlusPlus  19.12
pcpp::AndFilter Class Reference

#include <PcapFilter.h>

Inheritance diagram for pcpp::AndFilter:
pcpp::GeneralFilter

Public Member Functions

 AndFilter ()
 
 AndFilter (std::vector< GeneralFilter * > &filters)
 
void addFilter (GeneralFilter *filter)
 
void setFilters (std::vector< GeneralFilter * > &filters)
 
void parseToString (std::string &result)
 
- Public Member Functions inherited from pcpp::GeneralFilter
bool matchPacketWithFilter (RawPacket *rawPacket)
 
virtual ~GeneralFilter ()
 

Additional Inherited Members

- Protected Member Functions inherited from pcpp::GeneralFilter
void freeProgram ()
 

Detailed Description

A class for connecting several filters into one filter with logical "and" between them. For example: if the 2 filters are: "IPv4 address = x.x.x.x" + "TCP port dst = 80", then the new filter will be: "IPv4 address = x.x.x.x _AND_ TCP port dst = 80"
This class follows the composite design pattern
For deeper understanding of the filter concept please refer to PcapFilter.h

Constructor & Destructor Documentation

◆ AndFilter() [1/2]

pcpp::AndFilter::AndFilter ( )
inline

An empty constructor for this class. Use addFilter() to add filters to the and condition

◆ AndFilter() [2/2]

pcpp::AndFilter::AndFilter ( std::vector< GeneralFilter * > &  filters)

A constructor that gets a list of pointers to filters and creates one filter from all filters with logical "and" between them

Parameters
[in]filtersThe list of pointers to filters

Member Function Documentation

◆ addFilter()

void pcpp::AndFilter::addFilter ( GeneralFilter filter)
inline

Add filter to the and condition

Parameters
[in]filterThe filter to add

◆ parseToString()

void pcpp::AndFilter::parseToString ( std::string &  result)
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

Implements pcpp::GeneralFilter.

◆ setFilters()

void pcpp::AndFilter::setFilters ( std::vector< GeneralFilter * > &  filters)

Remove the current filters and set new ones

Parameters
[in]filtersThe new filters to set. The previous ones will be removed