|
idfxx 1.0.0
Modern C++23 components for ESP-IDF
|
Namespaces | |
| namespace | netconn |
Classes | |
| struct | datagram |
| A datagram received together with the sender's endpoint. More... | |
| class | datagram_socket |
| A UDP datagram socket. More... | |
| class | endpoint |
| Address/port pair identifying a transport endpoint. More... | |
| class | error_category |
Error category for idfxx_net errors. More... | |
| class | ipv4_addr |
| IPv4 address value type. More... | |
| struct | ipv4_info |
| IPv4 network interface information. More... | |
| class | ipv6_addr |
| IPv6 address value type. More... | |
| struct | ipv6_info |
| IPv6 network interface information. More... | |
| class | listener |
| A TCP listening socket. More... | |
| class | raw_socket |
| A raw IP socket. More... | |
| struct | resolver_options |
| Resolver hints used by the resolution functions. More... | |
| class | stream_socket |
| A TCP stream socket. More... | |
Concepts | |
| concept | ip_address |
| Concept matching either ipv4_addr or ipv6_addr. | |
Typedefs | |
| using | port_number = uint16_t |
| Port number type for transport endpoints. | |
Enumerations | |
| enum class | address_family : int { ipv4 = 2 , ipv6 = 10 } |
| Address family. More... | |
| enum class | ip_protocol : uint8_t { icmp = 1 , igmp = 2 , tcp = 6 , udp = 17 , icmpv6 = 58 , udp_lite = 136 } |
| IP-layer protocol number, per IANA assigned protocol numbers. More... | |
| enum class | direction : int { receive , send } |
| One direction of a bidirectional transport. More... | |
| enum class | dscp : uint8_t { default_ = 0 , cs1 = 8 , cs2 = 16 , cs3 = 24 , cs4 = 32 , cs5 = 40 , cs6 = 48 , cs7 = 56 , af11 = 10 , af12 = 12 , af13 = 14 , af21 = 18 , af22 = 20 , af23 = 22 , af31 = 26 , af32 = 28 , af33 = 30 , af41 = 34 , af42 = 36 , af43 = 38 , voice_admit = 44 , ef = 46 } |
| Differentiated Services Code Point — the top 6 bits of the IPv4/IPv6 traffic-class byte, per RFC 2474 / RFC 4594. More... | |
| enum class | errc : esp_err_t { invalid_state = 1 , invalid_argument = 2 , not_supported = 3 , timed_out = 4 , operation_would_block = 5 , in_progress = 6 , interrupted = 7 , address_in_use = 8 , address_not_available = 9 , connection_refused = 10 , connection_reset = 11 , connection_aborted = 12 , not_connected = 13 , already_connected = 14 , host_unreachable = 15 , network_unreachable = 16 , network_down = 17 , broken_pipe = 18 , message_too_long = 19 , too_many_files_open = 20 , name_resolution = 21 , name_not_found = 22 , name_temporary = 23 , name_no_data = 24 , io_error = 25 , wrong_protocol_type = 26 , unexpected_eof = 27 , netconn_buffer_error = 28 , netconn_routing = 29 , netconn_illegal_value = 30 , netconn_aborted = 31 , netconn_reset = 32 , netconn_closed = 33 , no_buffer_space = 34 } |
| IP transport error codes. More... | |
Functions | |
| std::error_code | make_error_code (errc e) noexcept |
Creates an error code from an idfxx::net::errc value. | |
| endpoint | resolve_one (std::string_view host, port_number port, const resolver_options &opts={}) |
| Resolves a host and numeric port and returns the first matching endpoint. | |
| result< endpoint > | try_resolve_one (std::string_view host, port_number port, const resolver_options &opts={}) |
| Resolves a host and numeric port and returns the first matching endpoint. | |
| endpoint | resolve_one (std::string_view host, std::string_view service, const resolver_options &opts={}) |
| Resolves a host and service name and returns the first matching endpoint. | |
| result< endpoint > | try_resolve_one (std::string_view host, std::string_view service, const resolver_options &opts={}) |
| Resolves a host and service name and returns the first matching endpoint. | |
| template<typename F > | |
| void | resolve_each (std::string_view host, port_number port, F &&f, const resolver_options &opts={}) |
| Visits each resolved endpoint for a host and numeric port without allocating. | |
| template<typename F > | |
| result< void > | try_resolve_each (std::string_view host, port_number port, F &&f, const resolver_options &opts={}) |
| Visits each resolved endpoint for a host and numeric port without allocating. | |
| template<typename F > | |
| void | resolve_each (std::string_view host, std::string_view service, F &&f, const resolver_options &opts={}) |
| Visits each resolved endpoint for a host and service name without allocating. | |
| template<typename F > | |
| result< void > | try_resolve_each (std::string_view host, std::string_view service, F &&f, const resolver_options &opts={}) |
| Visits each resolved endpoint for a host and service name without allocating. | |
| std::vector< endpoint > | resolve (std::string_view host, port_number port, const resolver_options &opts={}) |
| Resolves a host and numeric port and collects every endpoint. | |
| result< std::vector< endpoint > > | try_resolve (std::string_view host, port_number port, const resolver_options &opts={}) |
| Resolves a host and numeric port and collects every endpoint. | |
| std::vector< endpoint > | resolve (std::string_view host, std::string_view service, const resolver_options &opts={}) |
| Resolves a host and service name and collects every endpoint. | |
| result< std::vector< endpoint > > | try_resolve (std::string_view host, std::string_view service, const resolver_options &opts={}) |
| Resolves a host and service name and collects every endpoint. | |
Port number type for transport endpoints.
Definition at line 60 of file endpoint.hpp.
|
strong |
Address family.
Where a "no preference" or "any family" semantic is needed (e.g. resolver hints), use std::optional<address_family> rather than a sentinel value.
| Enumerator | |
|---|---|
| ipv4 | IPv4. |
| ipv6 | IPv6. |
Definition at line 37 of file endpoint.hpp.
|
strong |
One direction of a bidirectional transport.
Used by half-shutdown operations to identify which side of the connection to close. To act on both directions, call the no-argument overload of the relevant method.
| Enumerator | |
|---|---|
| receive | The receive direction. |
| send | The send direction. |
Definition at line 70 of file endpoint.hpp.
|
strong |
Differentiated Services Code Point — the top 6 bits of the IPv4/IPv6 traffic-class byte, per RFC 2474 / RFC 4594.
Named values cover the standard per-hop behaviours (default, class selectors, assured-forwarding classes, expedited forwarding, voice-admit). Custom 6-bit values can be passed as static_cast<dscp>(n); only the low 6 bits are used.
Definition at line 84 of file endpoint.hpp.
|
strong |
IP transport error codes.
The category maps each code to its corresponding std::errc synonym (via default_error_condition), so for example
are both true for the same underlying error.
|
strong |
IP-layer protocol number, per IANA assigned protocol numbers.
Used by raw_socket to select the IP-layer protocol and by the resolver to restrict address records to a particular transport. Custom values (e.g. IPPROTO_GRE) can be passed as static_cast<ip_protocol>(n).
| Enumerator | |
|---|---|
| icmp | ICMP for IPv4. |
| igmp | IGMP. |
| tcp | TCP. |
| udp | UDP. |
| icmpv6 | ICMP for IPv6. |
| udp_lite | UDP-Lite (RFC 3828). |
Definition at line 50 of file endpoint.hpp.
|
inlinenoexcept |
Creates an error code from an idfxx::net::errc value.
| e | The error code enumerator. |
std::error_code. Definition at line 160 of file error.hpp.
References idfxx::net_category().
| std::vector< endpoint > idfxx::net::resolve | ( | std::string_view | host, |
| port_number | port, | ||
| const resolver_options & | opts = {} |
||
| ) |
Resolves a host and numeric port and collects every endpoint.
Prefer resolve_one for the common single-address case, or resolve_each to iterate candidates without allocating; this overload exists for callers that want the full result set in a container.
| host | Host name or numeric address. |
| port | Port number in host byte order. |
| opts | Resolver options. |
CONFIG_COMPILER_CXX_EXCEPTIONS is enabled. | std::system_error | on failure. |
| std::vector< endpoint > idfxx::net::resolve | ( | std::string_view | host, |
| std::string_view | service, | ||
| const resolver_options & | opts = {} |
||
| ) |
Resolves a host and service name and collects every endpoint.
Prefer resolve_one for the common single-address case, or resolve_each to iterate candidates without allocating; this overload exists for callers that want the full result set in a container.
| host | Host name or numeric address. |
| service | Service name (e.g. "http") or numeric port string. |
| opts | Resolver options. |
CONFIG_COMPILER_CXX_EXCEPTIONS is enabled. | std::system_error | on failure. |
| void idfxx::net::resolve_each | ( | std::string_view | host, |
| port_number | port, | ||
| F && | f, | ||
| const resolver_options & | opts = {} |
||
| ) |
Visits each resolved endpoint for a host and numeric port without allocating.
| F | Callable invoked as f(const endpoint&). If it returns void, every result is visited. If it returns bool, returning false stops the iteration early (e.g. once a connection attempt has succeeded). |
| host | Host name or numeric address. |
| port | Port number in host byte order. |
| f | Visitor applied to each resolved endpoint. |
| opts | Resolver options. |
CONFIG_COMPILER_CXX_EXCEPTIONS is enabled. | std::system_error | on resolution failure. The visitor stopping early is not a failure. |
Definition at line 176 of file resolver.hpp.
| void idfxx::net::resolve_each | ( | std::string_view | host, |
| std::string_view | service, | ||
| F && | f, | ||
| const resolver_options & | opts = {} |
||
| ) |
Visits each resolved endpoint for a host and service name without allocating.
| F | Callable invoked as f(const endpoint&). If it returns void, every result is visited. If it returns bool, returning false stops the iteration early. |
| host | Host name or numeric address. |
| service | Service name (e.g. "http") or numeric port string. |
| f | Visitor applied to each resolved endpoint. |
| opts | Resolver options. |
CONFIG_COMPILER_CXX_EXCEPTIONS is enabled. | std::system_error | on resolution failure. The visitor stopping early is not a failure. |
Definition at line 220 of file resolver.hpp.
| endpoint idfxx::net::resolve_one | ( | std::string_view | host, |
| port_number | port, | ||
| const resolver_options & | opts = {} |
||
| ) |
Resolves a host and numeric port and returns the first matching endpoint.
| host | Host name or numeric address. |
| port | Port number in host byte order. |
| opts | Resolver options. |
CONFIG_COMPILER_CXX_EXCEPTIONS is enabled. | std::system_error | if no endpoint is found or on other failure. |
| endpoint idfxx::net::resolve_one | ( | std::string_view | host, |
| std::string_view | service, | ||
| const resolver_options & | opts = {} |
||
| ) |
Resolves a host and service name and returns the first matching endpoint.
| host | Host name or numeric address. |
| service | Service name (e.g. "http") or numeric port string. |
| opts | Resolver options. |
CONFIG_COMPILER_CXX_EXCEPTIONS is enabled. | std::system_error | if no endpoint is found or on other failure. |
| result< std::vector< endpoint > > idfxx::net::try_resolve | ( | std::string_view | host, |
| port_number | port, | ||
| const resolver_options & | opts = {} |
||
| ) |
Resolves a host and numeric port and collects every endpoint.
Prefer try_resolve_one for the common single-address case, or try_resolve_each to iterate candidates without allocating; this overload exists for callers that want the full result set in a container.
| host | Host name or numeric address. |
| port | Port number in host byte order. |
| opts | Resolver options. |
| result< std::vector< endpoint > > idfxx::net::try_resolve | ( | std::string_view | host, |
| std::string_view | service, | ||
| const resolver_options & | opts = {} |
||
| ) |
Resolves a host and service name and collects every endpoint.
Prefer try_resolve_one for the common single-address case, or try_resolve_each to iterate candidates without allocating; this overload exists for callers that want the full result set in a container.
| host | Host name or numeric address. |
| service | Service name (e.g. "http") or numeric port string. |
| opts | Resolver options. |
| result< void > idfxx::net::try_resolve_each | ( | std::string_view | host, |
| port_number | port, | ||
| F && | f, | ||
| const resolver_options & | opts = {} |
||
| ) |
Visits each resolved endpoint for a host and numeric port without allocating.
| F | Callable invoked as f(const endpoint&). If it returns void, every result is visited. If it returns bool, returning false stops the iteration early (e.g. once a connection attempt has succeeded). |
| host | Host name or numeric address. |
| port | Port number in host byte order. |
| f | Visitor applied to each resolved endpoint. |
| opts | Resolver options. |
Definition at line 197 of file resolver.hpp.
| result< void > idfxx::net::try_resolve_each | ( | std::string_view | host, |
| std::string_view | service, | ||
| F && | f, | ||
| const resolver_options & | opts = {} |
||
| ) |
Visits each resolved endpoint for a host and service name without allocating.
| F | Callable invoked as f(const endpoint&). If it returns void, every result is visited. If it returns bool, returning false stops the iteration early. |
| host | Host name or numeric address. |
| service | Service name (e.g. "http") or numeric port string. |
| f | Visitor applied to each resolved endpoint. |
| opts | Resolver options. |
Definition at line 241 of file resolver.hpp.
| result< endpoint > idfxx::net::try_resolve_one | ( | std::string_view | host, |
| port_number | port, | ||
| const resolver_options & | opts = {} |
||
| ) |
Resolves a host and numeric port and returns the first matching endpoint.
| host | Host name or numeric address. |
| port | Port number in host byte order. |
| opts | Resolver options. |
errc::name_not_found. | result< endpoint > idfxx::net::try_resolve_one | ( | std::string_view | host, |
| std::string_view | service, | ||
| const resolver_options & | opts = {} |
||
| ) |
Resolves a host and service name and returns the first matching endpoint.
| host | Host name or numeric address. |
| service | Service name (e.g. "http") or numeric port string. |
| opts | Resolver options. |
errc::name_not_found.