PcapPlusPlus
23.09
|
#include <IpAddress.h>
Public Member Functions | |
IPv6Address () | |
IPv6Address (const uint8_t bytes[16]) | |
IPv6Address (const std::string &addrAsString) | |
const uint8_t * | toBytes () const |
std::string | toString () const |
bool | isMulticast () const |
bool | isValid () const |
bool | operator== (const IPv6Address &rhs) const |
bool | operator< (const IPv6Address &rhs) const |
bool | operator!= (const IPv6Address &rhs) const |
void | copyTo (uint8_t **arr, size_t &length) const |
void | copyTo (uint8_t *arr) const |
bool | matchNetwork (const IPv6Network &network) const |
bool | matchNetwork (const std::string &network) const |
bool | matchSubnet (const IPv6Address &subnet, uint8_t prefixLength) const |
Static Public Attributes | |
static const IPv6Address | Zero |
static const IPv6Address | MulticastRangeLowerBound |
Represents an IPv6 address (of type xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx).
|
inline |
A default constructor that creates an instance of the class with unspecified/zero address
|
inline |
A constructor that creates an instance of the class out of 16-byte array.
[in] | bytes | The address as 16-byte array in network byte order |
pcpp::IPv6Address::IPv6Address | ( | const std::string & | addrAsString | ) |
A constructor that creates an instance of the class out of std::string value If the string doesn't represent a valid IPv6 address, an instance will store an unspecified address
[in] | addrAsString | The std::string representation of the address |
void pcpp::IPv6Address::copyTo | ( | uint8_t ** | arr, |
size_t & | length | ||
) | const |
Allocates a byte array and copies address value into it. Array deallocation is user responsibility
[in] | arr | A pointer to where array will be allocated |
[out] | length | Returns the length in bytes of the array that was allocated |
|
inline |
Gets a pointer to an already allocated byte array and copies the address value to it. This method assumes array allocated size is at least 16 (the size of an IPv6 address)
[in] | arr | A pointer to the array which address will be copied to |
bool pcpp::IPv6Address::isMulticast | ( | ) | const |
Determine whether the address is a multicast address
|
inline |
Determine whether the address is unspecified
bool pcpp::IPv6Address::matchNetwork | ( | const IPv6Network & | network | ) | const |
Checks whether the address matches a network.
network | An IPv6Network network |
bool pcpp::IPv6Address::matchNetwork | ( | const std::string & | network | ) | const |
Checks whether the address matches a network. For example: this method will return true for address d6e5:83dc:0c58:bc5d:1449:5898:: and network which is one of: d6e5:83dc:0c58:bc5d::/64, d6e5:83dc:0c58:bc5d::/ffff:ffff:ffff:ffff:: Another example: this method will return false for address d6e5:83dc:: and network which is one of: d6e5:83dc:0c58:bc5d::/64, d6e5:83dc:0c58:bc5d::/ffff:ffff:ffff:ffff::
[in] | network | A string in one of these formats:
|
bool pcpp::IPv6Address::matchSubnet | ( | const IPv6Address & | subnet, |
uint8_t | prefixLength | ||
) | const |
|
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 |
Returns a pointer to 16-byte array representing the IPv6 address
std::string pcpp::IPv6Address::toString | ( | ) | const |
Returns a std::string representation of the address
|
static |
A static value representing the lower bound of IPv6 multicast ranges. The bound is inclusive. MulticastRangeLowerBound is initialized to "ff00:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0". 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 IPv6 address, meaning address of value "0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0" Notice this value can be omitted in the user code because the default constructor creates an instance with an unspecified/zero address. In order to check whether the address is zero the method isValid can be used