138 : _ep(std::pair<ipv4_addr, port_number>{addr,
port}) {}
147 : _ep(std::pair<ipv6_addr, port_number>{addr,
port}) {}
170 if (std::holds_alternative<std::pair<ipv4_addr, port_number>>(_ep)) {
182 return std::visit([](
const auto&
p) {
return p.second; }, _ep);
199 template<ip_address T>
201 if (
auto*
p = std::get_if<std::pair<T, port_number>>(&_ep)) {
211 std::variant<std::pair<ipv4_addr, port_number>, std::pair<ipv6_addr, port_number>> _ep;
253#include "sdkconfig.h"
254#ifdef CONFIG_IDFXX_STD_FORMAT
257#include <string_view>
266struct formatter<
idfxx::net::endpoint> {
267 std::formatter<std::string_view> _underlying;
269 constexpr auto parse(format_parse_context& ctx) {
return _underlying.parse(ctx); }
271 template<
typename FormatContext>
Address/port pair identifying a transport endpoint.
constexpr bool operator==(const endpoint &) const noexcept=default
Compares two endpoints for equality.
constexpr endpoint(ipv4_addr addr, port_number port) noexcept
Constructs an IPv4 endpoint.
constexpr port_number port() const noexcept
Returns the port number in host byte order.
static std::optional< endpoint > parse(std::string_view s) noexcept
Parses an endpoint from a host:port or [host]:port string.
constexpr endpoint(ipv6_addr addr, port_number port) noexcept
Constructs an IPv6 endpoint.
constexpr std::optional< T > address() const noexcept
Returns the address held by this endpoint, if it is of the requested type.
constexpr address_family family() const noexcept
Returns the address family of this endpoint.
std::string to_string(core_id c)
Returns a string representation of a CPU core identifier.
address_family
Address family.
ip_protocol
IP-layer protocol number, per IANA assigned protocol numbers.
@ udp_lite
UDP-Lite (RFC 3828).
direction
One direction of a bidirectional transport.
@ send
The send direction.
@ receive
The receive direction.
uint16_t port_number
Port number type for transport endpoints.
dscp
Differentiated Services Code Point โ the top 6 bits of the IPv4/IPv6 traffic-class byte,...
@ default_
CS0 โ best-effort (default).
@ voice_admit
Voice-admit (RFC 5865).
@ ef
Expedited forwarding (RFC 3246).
std::expected< T, std::error_code > result
result type wrapping a value or error code.
A datagram received together with the sender's endpoint.
bool truncated
True if the datagram was larger than the buffer; data holds the leading portion and the remainder was...
endpoint from
Source endpoint of the datagram.
std::span< std::byte > data
Filled portion of the caller's receive buffer (aliases it).