PcapPlusPlus
24.09
|
#include <IpAddress.h>
Public Member Functions | |
IPv4Address ()=default | |
IPv4Address (const uint32_t addrAsInt) | |
IPv4Address (const uint8_t bytes[4]) | |
IPv4Address (const std::array< uint8_t, 4 > &bytes) | |
IPv4Address (const std::string &addrAsString) | |
uint32_t | toInt () const |
const uint8_t * | toBytes () const |
const std::array< uint8_t, 4 > & | toByteArray () const |
std::string | toString () const |
bool | isMulticast () const |
bool | operator== (const IPv4Address &rhs) const |
bool | operator< (const IPv4Address &rhs) const |
bool | operator!= (const IPv4Address &rhs) const |
bool | matchNetwork (const IPv4Network &network) const |
bool | matchNetwork (const std::string &network) const |
Static Public Member Functions | |
static bool | isValidIPv4Address (const std::string &addrAsString) |
Static Public Attributes | |
static const IPv4Address | Zero |
static const IPv4Address | MulticastRangeLowerBound |
Represents an IPv4 address (of type XXX.XXX.XXX.XXX)
|
default |
A default constructor that creates an instance of the class with the zero-initialized address
|
inline |
A constructor that creates an instance of the class out of 4-byte integer value.
[in] | addrAsInt | The address as 4-byte integer in network byte order |
|
inline |
A constructor that creates an instance of the class out of 4-byte array.
[in] | bytes | The address as 4-byte array in network byte order |
|
inline |
A constructor that creates an instance of the class out of a 4-byte standard array.
[in] | bytes | The address as 4-byte standard array in network byte order |
pcpp::IPv4Address::IPv4Address | ( | const std::string & | addrAsString | ) |
A constructor that creates an instance of the class out of std::string value.
[in] | addrAsString | The std::string representation of the address |
std::invalid_argument | The provided string does not represent a valid IPv4 address. |
bool pcpp::IPv4Address::isMulticast | ( | ) | const |
|
static |
A static method that checks whether a string represents a valid IPv4 address
[in] | addrAsString | The std::string representation of the address |
bool pcpp::IPv4Address::matchNetwork | ( | const IPv4Network & | network | ) | const |
Checks whether the address matches a network.
network | An IPv4Network network |
bool pcpp::IPv4Address::matchNetwork | ( | const std::string & | network | ) | const |
Checks whether the address matches a network. For example: this method will return true for address 10.1.1.9 and network which is one of: 10.1.1.1/24, 10.1.1.1/255.255.255.0 Another example: this method will return false for address 11.1.1.9 and network which is one of: 10.1.1.1/16, 10.1.1.1/255.255.0.0
[in] | network | A string in one of these formats:
|
|
inline |
Overload of the not-equal-to operator
[in] | rhs | The object to compare with |
|
inline |
Overload of the less-than operator
[in] | rhs | The object to compare with |
|
inline |
Overload of the equal-to operator
[in] | rhs | The object to compare with |
|
inline |
|
inline |
|
inline |
std::string pcpp::IPv4Address::toString | ( | ) | const |
|
static |
A static values representing the lower and upper bound of IPv4 multicast ranges. The bounds are inclusive. MulticastRangeLowerBound is initialized to "224.0.0.0". MulticastRangeUpperBound is initialized to "239.255.255.255". In order to check whether the address is a multicast address the isMulticast method can be used.
|
static |
A static value representing a zero value of IPv4 address, meaning address of value "0.0.0.0".