cubos::core::net::Address class

Represents an address, either IPv4 or IPv6.

Public static variables

static const Address Any
0.0.0.0
static const Address LocalHost
127.0.0.1

Public static functions

static auto fromIPv4(uint8_t a, uint8_t b, uint8_t c, uint8_t d) -> Address
Constructs a new IPv4 address from four octets (a.b.c.d).
static auto fromIPv6(uint32_t a, uint32_t b, uint32_t c, uint32_t d) -> Address
Constructs a new IPv6 address from four 32-bit integers (a.b.c.d).
static auto from(const std::string& address) -> memory::Opt<Address>
Converts the provided string value to an Address.

Constructors, destructors, conversion operators

Address()
Constructs a empty address (IPv4 by default).
~Address()
Deconstructs by cleaning necessary resources.

Public functions

auto toString() const -> std::string
Converts the address value to a string.

Function documentation

static Address cubos::core::net::Address::fromIPv4(uint8_t a, uint8_t b, uint8_t c, uint8_t d)

Constructs a new IPv4 address from four octets (a.b.c.d).

Parameters
a First octet.
b Second octet.
c Third octet.
d Fourth octet.

static Address cubos::core::net::Address::fromIPv6(uint32_t a, uint32_t b, uint32_t c, uint32_t d)

Constructs a new IPv6 address from four 32-bit integers (a.b.c.d).

Parameters
a First octet.
b Second octet.
c Third octet.
d Fourth octet.

static memory::Opt<Address> cubos::core::net::Address::from(const std::string& address)

Converts the provided string value to an Address.

Parameters
address The address, either in IPv4/IPv6 format, or as a domain hostname.
Returns Address object, or nothing if could not resolve the provided address.

std::string cubos::core::net::Address::toString() const

Converts the address value to a string.

Returns Address represented as a string.