xtd - Reference Guide
0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
|
#include <ip_address.h>
Inherits xtd::object, and xtd::iequatable< ip_address >.
Static Public Attributes | |
static ip_address | any |
Provides an IP address that indicates that the server must listen for client activity on all network interfaces. This field is constant. More... | |
static ip_address | broadcast |
Provides the IP broadcast address. This field is constant. More... | |
static ip_address | ip_v6_any |
The Socket::Bind method uses the cIPv6Any field to indicate that a Socket must listen for client activity on all network interfaces. This field is constant. More... | |
static ip_address | ip_v6_loopback |
Provides the IP loopback address. This field is constant. More... | |
static ip_address | ip_v6_none |
Provides an IP address that indicates that no network interface should be used. This field is constant. More... | |
static ip_address | loopback |
Provides the IP loopback address. This field is constant. More... | |
static ip_address | none |
Provides an IP address that indicates that no network interface should be used. This field is constant. More... | |
Public Member Functions | |
ip_address ()=default | |
Initializes a new instance of the xtd::net::ip_address. More... | |
ip_address (byte_t quad_part_address1, byte_t quad_part_address2, byte_t quad_part_address3, byte_t quad_part_address4) | |
Initializes a new instance of the xtd::net::ip_address class with the address specified as a four Bytes. More... | |
ip_address (const std::vector< byte_t > &address) | |
Initializes a new instance of the xtd::net::ip_address class with the address specified as a byte array. More... | |
ip_address (const std::vector< byte_t > &address, uint32_t scope_id) | |
Initializes a new instance of the xtd::net::ip_address class with the address specified as a byte array. More... | |
ip_address (uint32_t address) | |
Initializes a new instance of the xtd::net::ip_address class with the address specified as an int64_t. More... | |
sockets::address_family | address_family () const noexcept |
Gets the address family of the IP address. More... | |
bool | equals (const ip_address &other) const noexcept override |
bool | equals (const object &other) const noexcept override |
Determines whether the specified object is equal to the current object. More... | |
std::vector< byte_t > | get_address_bytes () const |
Provides a copy of the IPAddress as an array of bytes. More... | |
bool | is_ip_v4_mapped_to_ip_v6 () const noexcept |
Gets whether the IP address is an IPv4-mapped IPv6 address. More... | |
bool | is_ip_v6_link_local () const noexcept |
Gets whether the address is an IPv6 link local address. More... | |
bool | is_ip_v6_multicast () const noexcept |
Gets whether the address is an IPv6 multicast global address. More... | |
bool | is_ip_v6_site_local () const noexcept |
Gets whether the address is an IPv6 site local address. More... | |
bool | is_ip_v6_teredo () const noexcept |
Gets whether the address is an IPv6 Teredo address. More... | |
ip_address | map_to_ip_v4 () const noexcept |
Maps the xtd::net::ip_address object to an IPv4 address. More... | |
ip_address | map_to_ip_v6 () const noexcept |
Maps the xtd::net::ip_address object to an IPv6 address. More... | |
uint32_t | scope_id () const |
Gets the IPv6 address scope identifier. More... | |
ip_address & | scope_id (uint32_t value) |
Sets the IPv6 address scope identifier. More... | |
ustring | to_string () const noexcept override |
Converts an Internet address to its standard notation. More... | |
Public Member Functions inherited from xtd::object | |
object ()=default | |
Create a new instance of the ultimate base class object. More... | |
virtual size_t | get_hash_code () const noexcept |
Serves as a hash function for a particular type. More... | |
template<typename object_t > | |
std::unique_ptr< object_t > | memberwise_clone () const |
Gets the type of the current instance. More... | |
Public Member Functions inherited from xtd::iequatable< ip_address > | |
virtual bool | equals (const ip_address &) const noexcept=0 |
Indicates whether the current object is equal to another object of the same type. More... | |
Static Public Member Functions | |
static double | host_to_network_order (double host) |
Converts a Double value from host byte order to network byte order. More... | |
static float | host_to_network_order (float host) |
Converts a Single value from host byte order to network byte order. More... | |
static int16_t | host_to_network_order (int16_t host) |
Converts a short value from host byte order to network byte order. More... | |
static int32_t | host_to_network_order (int32_t host) |
Converts a integer value from host byte order to network byte order. More... | |
static int64_t | host_to_network_order (int64_t host) |
Converts a long value from host byte order to network byte order. More... | |
static uint16_t | host_to_network_order (uint16_t host) |
Converts a short value from host byte order to network byte order. More... | |
static uint32_t | host_to_network_order (uint32_t host) |
Converts a integer value from host byte order to network byte order. More... | |
static uint64_t | host_to_network_order (uint64_t host) |
Converts a long value from host byte order to network byte order. More... | |
static bool | is_loopback (const ip_address &address) |
Indicates whether the specified IP address is the loopback address. More... | |
static double | network_to_host_order (double network) |
Converts a Double value from network byte order to host byte order. More... | |
static float | network_to_host_order (float network) |
Converts a Single value from network byte order to host byte order. More... | |
static int16_t | network_to_host_order (int16_t network) |
Converts a short value from network byte order to host byte order. More... | |
static int32_t | network_to_host_order (int32_t host) |
Converts a integer value from network byte order to host byte order. More... | |
static int64_t | network_to_host_order (int64_t network) |
Converts a long value from network byte order to host byte order. More... | |
static uint16_t | network_to_host_order (uint16_t network) |
Converts a short value from network byte order to host byte order. More... | |
static uint32_t | network_to_host_order (uint32_t network) |
Converts a integer value from network byte order to host byte order. More... | |
static uint64 | network_to_host_order (uint64 network) |
Converts a long value from network byte order to host byte order. More... | |
static ip_address | parse (const ustring &str) |
Converts an IP address string to an xtd::net::ip_address instance. More... | |
static bool | try_parse (const ustring &str, ip_address &address) |
Determines whether a string is a valid IP address. More... | |
Static Public Member Functions inherited from xtd::object | |
static bool | equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are considered equal. More... | |
static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are the same instance. More... | |
|
default |
Initializes a new instance of the xtd::net::ip_address.
|
explicit |
Initializes a new instance of the xtd::net::ip_address class with the address specified as an int64_t.
address | The value of the IP address. For example, the value 0x2414188F in big-endian format would be the IP address "143.24.20.36". |
|
explicit |
Initializes a new instance of the xtd::net::ip_address class with the address specified as a byte array.
address | The byte array value of the IP address. |
xtd::net::ip_address::ip_address | ( | const std::vector< byte_t > & | address, |
uint32_t | scope_id | ||
) |
Initializes a new instance of the xtd::net::ip_address class with the address specified as a byte array.
address | The byte array value of the IP address. |
scope_id | The long value of the scope identifier. |
xtd::argument_out_of_range_exception | scope_id < 0 or scope_id > 0x00000000FFFFFFFF. |
xtd::net::ip_address::ip_address | ( | byte_t | quad_part_address1, |
byte_t | quad_part_address2, | ||
byte_t | quad_part_address3, | ||
byte_t | quad_part_address4 | ||
) |
Initializes a new instance of the xtd::net::ip_address class with the address specified as a four Bytes.
quad_part_address1 | The first quad part of the IP address. |
quad_part_address2 | The second quad part of the IP address. |
quad_part_address3 | The third quad part of the IP address. |
quad_part_address4 | The fourth quad part of the IP address. |
|
noexcept |
Gets the address family of the IP address.
|
overridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
obj | The object to compare with the current object. |
Reimplemented from xtd::object.
std::vector<byte_t> xtd::net::ip_address::get_address_bytes | ( | ) | const |
Provides a copy of the IPAddress as an array of bytes.
|
static |
Converts a Double value from host byte order to network byte order.
host | The number to convert, expressed in host byte order. |
|
static |
Converts a Single value from host byte order to network byte order.
host | The number to convert, expressed in host byte order. |
|
static |
Converts a short value from host byte order to network byte order.
host | The number to convert, expressed in host byte order. |
|
static |
Converts a integer value from host byte order to network byte order.
host | The number to convert, expressed in host byte order. |
|
static |
Converts a long value from host byte order to network byte order.
host | The number to convert, expressed in host byte order. |
|
static |
Converts a short value from host byte order to network byte order.
host | The number to convert, expressed in host byte order. |
|
static |
Converts a integer value from host byte order to network byte order.
host | The number to convert, expressed in host byte order. |
|
static |
Converts a long value from host byte order to network byte order.
host | The number to convert, expressed in host byte order. |
|
noexcept |
Gets whether the IP address is an IPv4-mapped IPv6 address.
|
noexcept |
Gets whether the address is an IPv6 link local address.
|
noexcept |
Gets whether the address is an IPv6 multicast global address.
|
noexcept |
Gets whether the address is an IPv6 site local address.
|
noexcept |
Gets whether the address is an IPv6 Teredo address.
|
static |
Indicates whether the specified IP address is the loopback address.
address | An IP address. |
|
noexcept |
Maps the xtd::net::ip_address object to an IPv4 address.
|
noexcept |
Maps the xtd::net::ip_address object to an IPv6 address.
|
static |
Converts a Double value from network byte order to host byte order.
network | The number to convert, expressed in network byte order. |
|
static |
Converts a Single value from network byte order to host byte order.
network | The number to convert, expressed in host byte order. |
|
static |
Converts a short value from network byte order to host byte order.
network | The number to convert, expressed in network byte order. |
|
static |
Converts a integer value from network byte order to host byte order.
host | The number to convert, expressed in network byte order. |
|
static |
Converts a long value from network byte order to host byte order.
network | The number to convert, expressed in network byte order. |
|
static |
Converts a short value from network byte order to host byte order.
network | The number to convert, expressed in network byte order. |
|
static |
Converts a integer value from network byte order to host byte order.
network | The number to convert, expressed in network byte order. |
Converts a long value from network byte order to host byte order.
network | The number to convert, expressed in network byte order. |
|
static |
Converts an IP address string to an xtd::net::ip_address instance.
str | A string that contains an IP address in dotted-quad notation for IPv4 and in colon-hexadecimal notation for IPv6. |
xtd::format_exception | str is not a valid IP address. |
uint32_t xtd::net::ip_address::scope_id | ( | ) | const |
Gets the IPv6 address scope identifier.
xtd::net::sockets::socket_exception | if address_family = sockets::address_family::inter_network |
ip_address& xtd::net::ip_address::scope_id | ( | uint32_t | value | ) |
Sets the IPv6 address scope identifier.
value | A uint32_t that specifies the scope of the address. |
xtd::net::sockets::socket_exception | if address_family = sockets::address_family::inter_network |
|
overridevirtualnoexcept |
Converts an Internet address to its standard notation.
Reimplemented from xtd::object.
|
static |
Determines whether a string is a valid IP address.
str | The string to validate. |
address | The xtd::net::ip_address version of the string. |
|
static |
Provides an IP address that indicates that the server must listen for client activity on all network interfaces. This field is constant.
|
static |
Provides the IP broadcast address. This field is constant.
|
static |
The Socket::Bind method uses the cIPv6Any field to indicate that a Socket must listen for client activity on all network interfaces. This field is constant.
|
static |
Provides the IP loopback address. This field is constant.
|
static |
Provides an IP address that indicates that no network interface should be used. This field is constant.
|
static |
Provides the IP loopback address. This field is constant.
|
static |
Provides an IP address that indicates that no network interface should be used. This field is constant.