80 std::string m_FilterStr;
82 bpf_program* m_Program;
128 bool matchPacketWithFilter(
const uint8_t* packetData, uint32_t packetDataLength, timespec packetTimestamp, uint16_t linkType);
147 virtual void parseToString(std::string& result) = 0;
171 const std::string m_FilterStr;
174 BPFStringFilter(
const std::string& filterStr) : m_FilterStr(filterStr) {}
184 virtual void parseToString(std::string& result);
204 void parseDirection(std::string& directionAsString);
205 Direction getDir()
const {
return m_Dir; }
225 FilterOperator m_Operator;
227 std::string parseOperator();
228 FilterOperator getOperator()
const {
return m_Operator; }
249 std::string m_Address;
250 std::string m_IPv4Mask;
252 void convertToIPAddressWithMask(std::string& ipAddrmodified, std::string& mask)
const;
253 void convertToIPAddressWithLen(std::string& ipAddrmodified)
const;
272 IPFilter(
const std::string& ipAddress, Direction dir,
const std::string& ipv4Mask) :
IFilterWithDirection(dir), m_Address(ipAddress), m_IPv4Mask(ipv4Mask), m_Len(0) {}
285 void parseToString(std::string& result);
292 void setAddr(
const std::string& ipAddress) { m_Address = ipAddress; }
298 void setMask(
const std::string& ipv4Mask) { m_IPv4Mask = ipv4Mask; m_Len = 0; }
304 void setLen(
int len) { m_IPv4Mask =
""; m_Len = len; }
327 void parseToString(std::string& result);
333 void setIpID(uint16_t ipID) { m_IpID = ipID; }
347 uint16_t m_TotalLength;
356 void parseToString(std::string& result);
376 void portToString(uint16_t portAsInt);
385 void parseToString(std::string& result);
391 void setPort(uint16_t port) { portToString(port); }
416 void parseToString(std::string& result);
450 void parseToString(std::string& result);
470 uint16_t m_EtherType;
478 void parseToString(std::string& result);
500 std::vector<GeneralFilter*> m_FilterList;
512 AndFilter(std::vector<GeneralFilter*>& filters);
524 void setFilters(std::vector<GeneralFilter*>& filters);
526 void parseToString(std::string& result);
542 std::vector<GeneralFilter*> m_FilterList;
554 OrFilter(std::vector<GeneralFilter*>& filters);
562 void parseToString(std::string& result);
583 void parseToString(std::string& result);
613 void parseToString(std::string& result);
642 void parseToString(std::string& result);
670 void parseToString(std::string& result);
720 uint8_t m_TcpFlagsBitMask;
740 void parseToString(std::string& result);
753 uint16_t m_WindowSize;
763 void parseToString(std::string& result);
792 void parseToString(std::string& result);
The main namespace for the PcapPlusPlus lib.
MacAddressFilter(MacAddress address, Direction dir)
Definition: PcapFilter.h:448
Definition: PcapFilter.h:48
TcpFlags
Definition: PcapFilter.h:692
Definition: PcapFilter.h:631
Definition: PcapFilter.h:601
void setMask(const std::string &ipv4Mask)
Definition: PcapFilter.h:298
void setToPort(uint16_t toPort)
Definition: PcapFilter.h:428
void setMacAddress(MacAddress address)
Definition: PcapFilter.h:456
void setVlanID(uint16_t vlanId)
Definition: PcapFilter.h:676
Definition: PcapFilter.h:402
Definition: RawPacket.h:30
Definition: PcapFilter.h:344
AndFilter()
Definition: PcapFilter.h:506
void setAddr(const std::string &ipAddress)
Definition: PcapFilter.h:292
void setEtherType(uint16_t etherType)
Definition: PcapFilter.h:484
MatchOptions
Definition: PcapFilter.h:712
Definition: PcapFilter.h:136
void setFromPort(uint16_t fromPort)
Definition: PcapFilter.h:422
Definition: RawPacket.h:252
IPFilter(const std::string &ipAddress, Direction dir, int len)
Definition: PcapFilter.h:283
Definition: PcapFilter.h:50
TcpFlagsFilter(uint8_t tcpFlagBitMask, MatchOptions matchOption)
Definition: PcapFilter.h:730
void setOperator(FilterOperator op)
Definition: PcapFilter.h:235
virtual ~GeneralFilter()
Definition: PcapFilter.h:161
ArpOpcode
Definition: ArpLayer.h:48
void setProto(ProtocolType proto)
Definition: PcapFilter.h:620
ProtoFilter(ProtocolType proto)
Definition: PcapFilter.h:611
Definition: PcapFilter.h:467
Definition: PcapFilter.h:64
void setIpID(uint16_t ipID)
Definition: PcapFilter.h:333
Definition: PcapFilter.h:199
FilterOperator
Definition: PcapFilter.h:57
void setLength(uint16_t legnth)
Definition: PcapFilter.h:798
Definition: PcapFilter.h:438
uint64_t ProtocolType
Definition: ProtocolType.h:18
void setFilter(GeneralFilter *filterToInverse)
Definition: PcapFilter.h:589
Definition: PcapFilter.h:686
VlanFilter(uint16_t vlanId)
Definition: PcapFilter.h:668
NotFilter(GeneralFilter *filterToInverse)
Definition: PcapFilter.h:581
bool matchPacketWithFilter(const RawPacket *rawPacket)
Direction
Definition: PcapFilter.h:43
Definition: PcapFilter.h:77
Definition: PcapFilter.h:572
IPv4IDFilter(uint16_t ipID, FilterOperator op)
Definition: PcapFilter.h:325
Definition: PcapFilter.h:750
IPv4TotalLengthFilter(uint16_t totalLength, FilterOperator op)
Definition: PcapFilter.h:354
void setDirection(Direction dir)
Definition: PcapFilter.h:212
LinkLayerType
Definition: RawPacket.h:25
Definition: PcapFilter.h:222
void setTcpFlagsBitMask(uint8_t tcpFlagBitMask, MatchOptions matchOption)
Definition: PcapFilter.h:738
TcpWindowSizeFilter(uint16_t windowSize, FilterOperator op)
Definition: PcapFilter.h:761
void setTotalLength(uint16_t totalLength)
Definition: PcapFilter.h:362
Definition: PcapFilter.h:68
OrFilter()
Definition: PcapFilter.h:548
Definition: PcapFilter.h:372
ArpFilter(ArpOpcode opCode)
Definition: PcapFilter.h:640
void setWindowSize(uint16_t windowSize)
Definition: PcapFilter.h:769
Definition: PcapFilter.h:46
void setOpCode(ArpOpcode opCode)
Definition: PcapFilter.h:648
EtherTypeFilter(uint16_t etherType)
Definition: PcapFilter.h:476
void addFilter(GeneralFilter *filter)
Definition: PcapFilter.h:560
IPFilter(const std::string &ipAddress, Direction dir, const std::string &ipv4Mask)
Definition: PcapFilter.h:272
void addFilter(GeneralFilter *filter)
Definition: PcapFilter.h:518
Definition: PcapFilter.h:659
Definition: PcapFilter.h:60
PortRangeFilter(uint16_t fromPort, uint16_t toPort, Direction dir)
Definition: PcapFilter.h:414
Definition: PcapFilter.h:168
void setLen(int len)
Definition: PcapFilter.h:304
Definition: PcapFilter.h:715
Definition: PcapFilter.h:315
Definition: PcapFilter.h:62
IPFilter(const std::string &ipAddress, Direction dir)
Definition: PcapFilter.h:261
Definition: PcapFilter.h:246
Definition: PcapFilter.h:539
Definition: PcapFilter.h:66
Definition: PcapFilter.h:779
void setPort(uint16_t port)
Definition: PcapFilter.h:391
Definition: PcapFilter.h:497
Definition: MacAddress.h:28
Definition: PcapFilter.h:70
UdpLengthFilter(uint16_t legnth, FilterOperator op)
Definition: PcapFilter.h:790
bool setFilter(const std::string &filter, LinkLayerType linkType=LINKTYPE_ETHERNET)