PcapPlusPlus
Next
|
#include <PcapFilter.h>
Public Member Functions | |
IPFilter (const std::string &ipAddress, Direction dir) | |
IPFilter (const IPAddress &ipAddress, Direction dir) | |
IPFilter (const std::string &ipAddress, Direction dir, const std::string &netmask) | |
IPFilter (const IPAddress &ipAddress, Direction dir, const std::string &netmask) | |
IPFilter (const std::string &ipAddress, Direction dir, int len) | |
IPFilter (const IPAddress &ipAddress, Direction dir, int len) | |
IPFilter (const IPNetwork &network, Direction dir) | |
void | parseToString (std::string &result) override |
void | setNetwork (const IPNetwork &network) |
void | setAddr (const std::string &ipAddress) |
void | setAddr (const IPAddress &ipAddress) |
void | setMask (const std::string &netmask) |
void | clearMask () |
void | setLen (const int len) |
void | clearLen () |
Public Member Functions inherited from pcpp::IFilterWithDirection | |
void | setDirection (Direction dir) |
Public Member Functions inherited from pcpp::GeneralFilter | |
bool | matchPacketWithFilter (RawPacket *rawPacket) |
virtual | ~GeneralFilter () |
A class for representing IPv4 or IPv6 address filter, equivalent to "net src x.x.x.x" or "net dst x.x.x.x"
For deeper understanding of the filter concept please refer to PcapFilter.h
|
inline |
The basic constructor that creates the filter from an IP address string and direction (source or destination)
[in] | ipAddress | The IP address to build the filter with. |
[in] | dir | The address direction to filter (source or destination) |
std::invalid_argument | The provided address is not a valid IPv4 or IPv6 address. |
The basic constructor that creates the filter from an IP address and direction (source or destination)
[in] | ipAddress | The IP address to build the filter with. |
[in] | dir | The address direction to filter (source or destination) |
|
inline |
A constructor that enable to filter only part of the address by using a mask (aka subnet). For example: "filter only IP addresses that matches the subnet 10.0.0.x"
[in] | ipAddress | The IP address to use. Only the part of the address that is not masked will be matched. For example: if the address is "1.2.3.4" and the mask is "255.255.255.0" than the part of the address that will be matched is "1.2.3.X". |
[in] | dir | The address direction to filter (source or destination) |
[in] | netmask | The mask to use. The mask should be a valid IP address in either IPv4 dotted-decimal format (e.g., 255.255.255.0) or IPv6 colon-separated hexadecimal format (e.g., FFFF:FFFF:FFFF:FFFF::). |
std::invalid_argument | The provided address is not a valid IP address or the provided netmask string is invalid.. |
|
inline |
A constructor that enable to filter only part of the address by using a mask (aka subnet). For example: "filter only IP addresses that matches the subnet 10.0.0.x"
[in] | ipAddress | The IP address to use. Only the part of the address that is not masked will be matched. For example: if the address is "1.2.3.4" and the mask is "255.255.255.0" than the part of the address that will be matched is "1.2.3.X". |
[in] | dir | The address direction to filter (source or destination) |
[in] | netmask | The mask to use. The mask should be a valid IP address in either IPv4 dotted-decimal format (e.g., 255.255.255.0) or IPv6 colon-separated hexadecimal format (e.g., FFFF:FFFF:FFFF:FFFF::). |
std::invalid_argument | The provided netmask string is invalid. |
|
inline |
A constructor that enables to filter by a subnet. For example: "filter only IP addresses that matches the subnet 10.0.0.3/24" which means the part of the address that will be matched is "10.0.0.X"
[in] | ipAddress | The IP address to use. Only the part of the address that is not masked will be matched. For example: if the address is "1.2.3.4" and the subnet is "/24" than the part of the address that will be matched is "1.2.3.X". |
[in] | dir | The address direction to filter (source or destination) |
[in] | len | The subnet to use (e.g "/24"). Acceptable subnet values are [0, 32] for IPv4 and [0, 128] for IPv6. |
std::invalid_argument | The provided address is not a valid IPv4 or IPv6 address or the provided length is out of acceptable range. |
A constructor that enables to filter by a subnet. For example: "filter only IP addresses that matches the subnet 10.0.0.3/24" which means the part of the address that will be matched is "10.0.0.X"
[in] | ipAddress | The IP address to use. Only the part of the address that is not masked will be matched. For example: if the address is "1.2.3.4" and the subnet is "/24" than the part of the address that will be matched is "1.2.3.X". |
[in] | dir | The address direction to filter (source or destination) |
[in] | len | The subnet to use (e.g "/24"). Acceptable subnet values are [0, 32] for IPv4 and [0, 128] for IPv6. |
std::invalid_argument | The provided length is out of acceptable range. |
A constructor that enables to filter by a predefined network object.
[in] | network | The network to use when filtering. IP address and subnet mask are taken from the network object. |
[in] | dir | The address direction to filter (source or destination) |
|
inline |
Clears the subnet mask length.
|
inline |
Clears the subnet mask.
|
overridevirtual |
A method that parses the class instance into BPF string format
[out] | result | An empty string that the parsing will be written into. If the string isn't empty, its content will be overridden |
Implements pcpp::GeneralFilter.
|
inline |
Set the IP address
[in] | ipAddress | The IP address to build the filter with. |
|
inline |
Set the IP address
[in] | ipAddress | The IP address to build the filter with. |
std::invalid_argument | The provided string does not represent a valid IP address. |
|
inline |
Set the subnet (IPv4) or prefix length (IPv6). Acceptable subnet values are [0, 32] for IPv4 and [0, 128] for IPv6.
[in] | len | The subnet to use (e.g "/24") |
std::invalid_argument | The provided length is out of acceptable range. |
|
inline |
Set the subnet mask
[in] | netmask | The mask to use. The mask should match the IP version and be in a valid format. Valid formats: IPv4 - (X.X.X.X) - 'X' - a number in the range of 0 and 255 (inclusive)): IPv6 - (YYYY:YYYY:YYYY:YYYY:YYYY:YYYY:YYYY:YYYY) - 'Y' - a hexadecimal digit [0 - 9, A - F]. Short form IPv6 formats are allowed. |
std::invalid_argument | The provided netmask is invalid or does not correspond to the current IP address version. |
|
inline |
Set the network to build the filter with.
[in] | network | The IP Network object to be used when building the filter. |