ipaddress 1.1.0
|
Represents the base class for IPv6 address manipulation. More...
#include <ipv6-address.hpp>
Public Types | |
using | base_type = typename base_v6<ipv6_address_base>::base_type |
The base type for the IPv6 address. | |
using | uint_type = typename base_v6<ipv6_address_base>::uint_type |
The unsigned integer type for the IPv6 address. | |
Public Member Functions | |
constexpr inline scope | get_scope_id () const noexcept |
Retrieves the scope identifier of the IPv6 address. | |
template<typename T , size_t N> | |
constexpr inline void | set_scope_id (const T(&scope_id)[N]) |
Sets the scope identifier of the IPv6 address. | |
template<typename T , size_t N> | |
constexpr inline void | set_scope_id (const T(&scope_id)[N], error_code &code) noexcept |
Sets the scope identifier of the IPv6 address and reports any errors encountered. | |
constexpr inline void | set_scope_id (std::string_view scope_id) |
Sets the scope identifier of the IPv6 address using a string view. | |
constexpr inline void | set_scope_id (std::wstring_view scope_id) |
Sets the scope identifier of the IPv6 address using a wide string view. | |
constexpr inline void | set_scope_id (std::u8string_view scope_id) |
Sets the scope identifier of the IPv6 address using UTF-8 string view. | |
constexpr inline void | set_scope_id (std::u16string_view scope_id) |
Sets the scope identifier of the IPv6 address using UTF-16 string view. | |
constexpr inline void | set_scope_id (std::u32string_view scope_id) |
Sets the scope identifier of the IPv6 address using UTF-32 string view. | |
constexpr inline void | set_scope_id (std::string_view scope_id, error_code &code) noexcept |
Sets the scope identifier of the IPv6 address using a string view and reports any errors encountered. | |
constexpr inline void | set_scope_id (std::wstring_view scope_id, error_code &code) noexcept |
Sets the scope identifier of the IPv6 address using a wide string view and reports any errors encountered. | |
constexpr inline void | set_scope_id (std::u8string_view scope_id, error_code &code) noexcept |
Sets the scope identifier of the IPv6 address using a UTF-8 string view and reports any errors encountered. | |
constexpr inline void | set_scope_id (std::u16string_view scope_id, error_code &code) noexcept |
Sets the scope identifier of the IPv6 address using a UTF-16 string view and reports any errors encountered. | |
constexpr inline void | set_scope_id (std::u32string_view scope_id, error_code &code) noexcept |
Sets the scope identifier of the IPv6 address using a UTF-32 string view and reports any errors encountered. | |
constexpr inline uint_type | to_uint () const noexcept |
Converts the IPv6 address to an unsigned integer. | |
constexpr inline const base_type & | bytes () const noexcept |
Provides access to the underlying bytes of the IPv6 address. | |
constexpr inline optional< ipv4_address > | ipv4_mapped () const noexcept |
Determines if the IPv6 address is an IPv4-mapped address. | |
constexpr inline optional< ipv4_address > | sixtofour () const noexcept |
Determines if the IPv6 address is a 6to4 address. | |
constexpr inline optional< std::pair< ipv4_address, ipv4_address > > | teredo () const noexcept |
Determines if the IPv6 address is a Teredo address. | |
constexpr inline bool | is_site_local () const noexcept |
Checks if the IPv6 address is a site-local address. | |
constexpr inline ip_version | version () const noexcept |
Retrieves the IP version of the address. | |
constexpr inline size_t | size () const noexcept |
Retrieves the size of the IPv6 address. | |
Static Public Member Functions | |
static constexpr inline ip_address_base< ipv6_address_base > | from_uint (uint_type ip) noexcept |
Creates an IPv6 address from an unsigned integer using a template parameter. | |
Represents the base class for IPv6 address manipulation.
This class provides the basic functionalities required for handling IPv6 addresses, including conversion to and from numeric representations, access to the underlying bytes, and utility functions that are common across different representations of IPv6 addresses.
|
inlinenoexcept |
Retrieves the scope identifier of the IPv6 address.
The scope identifier is used to determine the context in which the address is valid. It is particularly relevant for link-local and site-local addresses.
scope
object representing the scope identifier of the IPv6 address. IPADDRESS_IPV6_SCOPE_MAX_LENGTH == 0
), then an empty scope will be returned.
|
inline |
Sets the scope identifier of the IPv6 address.
This function sets the scope identifier using a character array. The length of the array should not exceed IPADDRESS_IPV6_SCOPE_MAX_LENGTH + 1
.
T | The character type of the scope identifier. |
N | The size of the scope identifier array. |
[in] | scope_id | The character array representing the scope identifier. |
IPADDRESS_IPV6_SCOPE_MAX_LENGTH == 0
) then this call will have no effect.
|
inlinenoexcept |
Sets the scope identifier of the IPv6 address and reports any errors encountered.
This function sets the scope identifier using a character array. The length of the array should not exceed IPADDRESS_IPV6_SCOPE_MAX_LENGTH + 1
.
T | The character type of the scope identifier. |
N | The size of the scope identifier array. |
[in] | scope_id | The character array representing the scope identifier. |
[out] | code | An error_code object that will be set to the error that occurred, if any. |
IPADDRESS_IPV6_SCOPE_MAX_LENGTH == 0
) then this call will have no effect.
|
inline |
Sets the scope identifier of the IPv6 address using a string view.
This function sets the scope identifier using a string view, which allows for a more efficient way to handle strings without copying them.
[in] | scope_id | The string view representing the scope identifier. |
parse_error | Exception caused by invalid input string. |
std::string
and C-strings will be used instead. IPADDRESS_IPV6_SCOPE_MAX_LENGTH == 0
) then this call will have no effect.
|
inline |
Sets the scope identifier of the IPv6 address using a wide string view.
This function sets the scope identifier using a wide string view, which allows for a more efficient way to handle strings without copying them.
[in] | scope_id | The wide string view representing the scope identifier. |
parse_error | Exception caused by invalid input string. |
std::wstring
and C-strings will be used instead. IPADDRESS_IPV6_SCOPE_MAX_LENGTH == 0
) then this call will have no effect.
|
inline |
Sets the scope identifier of the IPv6 address using UTF-8 string view.
This function sets the scope identifier using UTF-8 string view, which allows for a more efficient way to handle strings without copying them.
[in] | scope_id | The UTF-8 string view representing the scope identifier. |
parse_error | Exception caused by invalid input string. |
char8_t
is supported. IPADDRESS_IPV6_SCOPE_MAX_LENGTH == 0
) then this call will have no effect.
|
inline |
Sets the scope identifier of the IPv6 address using UTF-16 string view.
This function sets the scope identifier using UTF-16 string view, which allows for a more efficient way to handle strings without copying them.
[in] | scope_id | The UTF-16 string view representing the scope identifier. |
parse_error | Exception caused by invalid input string. |
std::u16string
and C-strings will be used instead. IPADDRESS_IPV6_SCOPE_MAX_LENGTH == 0
) then this call will have no effect.
|
inline |
Sets the scope identifier of the IPv6 address using UTF-32 string view.
This function sets the scope identifier using UTF-32 string view, which allows for a more efficient way to handle strings without copying them.
[in] | scope_id | The UTF-32 string view representing the scope identifier. |
parse_error | Exception caused by invalid input string. |
std::u32string
and C-strings will be used instead. IPADDRESS_IPV6_SCOPE_MAX_LENGTH == 0
) then this call will have no effect.
|
inlinenoexcept |
Sets the scope identifier of the IPv6 address using a string view and reports any errors encountered.
This function sets the scope identifier using a string view and provides an error code parameter to report any issues that occur during the operation.
[in] | scope_id | The string view representing the scope identifier. |
[out] | code | An error_code object that will be set to the error that occurred, if any. |
std::string
and C-strings will be used instead. IPADDRESS_IPV6_SCOPE_MAX_LENGTH == 0
) then this call will have no effect.
|
inlinenoexcept |
Sets the scope identifier of the IPv6 address using a wide string view and reports any errors encountered.
This function sets the scope identifier using a wide string view and provides an error code parameter to report any issues that occur during the operation.
[in] | scope_id | The wide string view representing the scope identifier. |
[out] | code | An error_code object that will be set to the error that occurred, if any. |
std::wstring
and C-strings will be used instead. IPADDRESS_IPV6_SCOPE_MAX_LENGTH == 0
) then this call will have no effect.
|
inlinenoexcept |
Sets the scope identifier of the IPv6 address using a UTF-8 string view and reports any errors encountered.
This function sets the scope identifier using a UTF-8 string view and provides an error code parameter to report any issues that occur during the operation.
[in] | scope_id | The UTF-8 string view representing the scope identifier. |
[out] | code | An error_code object that will be set to the error that occurred, if any. |
IPADDRESS_IPV6_SCOPE_MAX_LENGTH == 0
) then this call will have no effect.
|
inlinenoexcept |
Sets the scope identifier of the IPv6 address using a UTF-16 string view and reports any errors encountered.
This function sets the scope identifier using a UTF-16 string view and provides an error code parameter to report any issues that occur during the operation.
[in] | scope_id | The UTF-16 string view representing the scope identifier. |
[out] | code | An error_code object that will be set to the error that occurred, if any. |
std::u16string
and C-strings will be used instead. IPADDRESS_IPV6_SCOPE_MAX_LENGTH == 0
) then this call will have no effect.
|
inlinenoexcept |
Sets the scope identifier of the IPv6 address using a UTF-32 string view and reports any errors encountered.
This function sets the scope identifier using a UTF-32 string view and provides an error code parameter to report any issues that occur during the operation.
[in] | scope_id | The UTF-32 string view representing the scope identifier. |
[out] | code | An error_code object that will be set to the error that occurred, if any. |
std::u32string
and C-strings will be used instead. IPADDRESS_IPV6_SCOPE_MAX_LENGTH == 0
) then this call will have no effect.
|
inlinestaticnoexcept |
Creates an IPv6 address from an unsigned integer using a template parameter.
[in] | ip | The unsigned integer representing the IPv6 address. |
|
inlinenoexcept |
Converts the IPv6 address to an unsigned integer.
|
inlinenoexcept |
Provides access to the underlying bytes of the IPv6 address.
|
inlinenoexcept |
Determines if the IPv6 address is an IPv4-mapped address.
optional
containing the mapped IPv4 address if the IPv6 address is IPv4-mapped, or an empty optional
otherwise. ::FFFF/96
).
|
inlinenoexcept |
Determines if the IPv6 address is a 6to4 address.
2002::/16
prefix and embeds an IPv4 address in the next 32 bits.
|
inlinenoexcept |
Determines if the IPv6 address is a Teredo address.
std::pair::first | The Teredo server IPv4 address |
std::pair::second | The Teredo client IPv4 address |
2001::/32
prefix and is used for NAT traversal for IPv6.
|
noexcept |
Checks if the IPv6 address is a site-local address.
true
if the address is site-local, false
otherwise.
|
inlinenoexceptinherited |
Retrieves the IP version of the address.
|
inlinenoexceptinherited |
Retrieves the size of the IPv6 address.