|
idfxx 1.0.0
Modern C++23 components for ESP-IDF
|
Address/port pair identifying a transport endpoint. More...
Public Member Functions | |
| constexpr | endpoint (ipv4_addr addr, port_number port) noexcept |
| Constructs an IPv4 endpoint. | |
| constexpr | endpoint (ipv6_addr addr, port_number port) noexcept |
| Constructs an IPv6 endpoint. | |
| constexpr address_family | family () const noexcept |
| Returns the address family of this endpoint. | |
| constexpr port_number | port () const noexcept |
| Returns the port number in host byte order. | |
| template<ip_address T> | |
| constexpr std::optional< T > | address () const noexcept |
| Returns the address held by this endpoint, if it is of the requested type. | |
| constexpr bool | operator== (const endpoint &) const noexcept=default |
| Compares two endpoints for equality. | |
Static Public Member Functions | |
| static std::optional< endpoint > | parse (std::string_view s) noexcept |
Parses an endpoint from a host:port or [host]:port string. | |
Address/port pair identifying a transport endpoint.
An endpoint carries either an IPv4 or IPv6 address together with a port number. It always holds an address — there is no empty state, so it is not default-constructible.
Definition at line 129 of file endpoint.hpp.
|
inlineconstexprnoexcept |
Constructs an IPv4 endpoint.
| addr | IPv4 address. |
| port | Port number in host byte order. |
Definition at line 137 of file endpoint.hpp.
References port().
|
inlineconstexprnoexcept |
Constructs an IPv6 endpoint.
| addr | IPv6 address. |
| port | Port number in host byte order. |
Definition at line 146 of file endpoint.hpp.
References port().
|
inlineconstexprnoexcept |
Returns the address held by this endpoint, if it is of the requested type.
std::nullopt if the endpoint holds an address of a different family.Definition at line 200 of file endpoint.hpp.
|
inlineconstexprnoexcept |
Returns the address family of this endpoint.
address_family::ipv4 or address_family::ipv6. Definition at line 169 of file endpoint.hpp.
References idfxx::net::ipv4, and idfxx::net::ipv6.
Compares two endpoints for equality.
Parses an endpoint from a host:port or [host]:port string.
Accepts:
1.2.3.4:80 for IPv4[fe80::1]:80 (with bracketed v6 address) for IPv6The host part is parsed by ipv4_addr::parse or ipv6_addr::parse; names are not resolved.
| s | The string to parse. |
std::nullopt on failure.
|
inlineconstexprnoexcept |
Returns the port number in host byte order.
Definition at line 181 of file endpoint.hpp.
Referenced by endpoint(), and endpoint().