PcapPlusPlus  Next
pcpp::CompositeFilter Class Reference

#include <PcapFilter.h>

Inheritance diagram for pcpp::CompositeFilter:
pcpp::GeneralFilter pcpp::CompositeLogicFilter< op >

Public Member Functions

 CompositeFilter ()=default
 
 CompositeFilter (const std::vector< GeneralFilter * > &filters)
 
void addFilter (GeneralFilter *filter)
 
void removeFilter (GeneralFilter *filter)
 
void setFilters (const std::vector< GeneralFilter * > &filters)
 
void clearAllFilters ()
 
- Public Member Functions inherited from pcpp::GeneralFilter
virtual void parseToString (std::string &result)=0
 
bool matchPacketWithFilter (RawPacket *rawPacket)
 
virtual ~GeneralFilter ()
 

Detailed Description

The base class for all filter classes composed of several other filters. 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

◆ CompositeFilter() [1/2]

pcpp::CompositeFilter::CompositeFilter ( )
default

An empty constructor for this class. Use addFilter() to add filters to the composite filter.

◆ CompositeFilter() [2/2]

pcpp::CompositeFilter::CompositeFilter ( const std::vector< GeneralFilter * > &  filters)
explicit

A constructor that gets a list of pointers to filters and creates one filter from all filters

Parameters
[in]filtersThe list of pointers to filters

Member Function Documentation

◆ addFilter()

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

Add filter to the composite filter

Parameters
[in]filterThe filter to add

◆ clearAllFilters()

void pcpp::CompositeFilter::clearAllFilters ( )
inline

Remove all filters from the composite filter.

◆ removeFilter()

void pcpp::CompositeFilter::removeFilter ( GeneralFilter filter)

Removes the first matching filter from the composite filter

Parameters
[in]filterThe filter to remove

◆ setFilters()

void pcpp::CompositeFilter::setFilters ( const 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