17#include <idfxx/net/endpoint>
18#include <idfxx/net/error>
19#include <idfxx/net/netconn/buffer>
28class connectionless_channel :
public base_channel {
33#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
51 [[nodiscard]] result<void>
try_connect(
const endpoint& peer);
53#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
70#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
93 [[nodiscard]] result<size_t> try_send(buffer& buf);
95#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
107 size_t send(std::span<const std::byte> data) {
return idfxx::unwrap(try_send(data)); }
118 [[nodiscard]] result<size_t> try_send(std::span<const std::byte> data);
120#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
133 size_t send_to(buffer& buf,
const endpoint& to) {
return idfxx::unwrap(try_send_to(buf, to)); }
145 [[nodiscard]] result<size_t> try_send_to(buffer& buf,
const endpoint& to);
147#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
160 size_t send_to(std::span<const std::byte> data,
const endpoint& to) {
return idfxx::unwrap(try_send_to(data, to)); }
172 [[nodiscard]] result<size_t> try_send_to(std::span<const std::byte> data,
const endpoint& to);
174#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
191 [[nodiscard]] result<buffer> try_recv();
193#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
211 [[nodiscard]] std::span<std::byte> recv(std::span<std::byte> buf) {
return idfxx::unwrap(try_recv(buf)); }
227 [[nodiscard]] result<std::span<std::byte>> try_recv(std::span<std::byte> buf);
229#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
240 [[nodiscard]] datagram recv_from(std::span<std::byte> buf) {
return idfxx::unwrap(try_recv_from(buf)); }
249 [[nodiscard]] result<datagram> try_recv_from(std::span<std::byte> buf);
251#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
261 [[nodiscard]] endpoint peer_endpoint()
const {
return idfxx::unwrap(try_peer_endpoint()); }
270 [[nodiscard]] result<endpoint> try_peer_endpoint()
const {
return _try_getaddr(
false); }
273 using base_channel::base_channel;
@ send
The send direction.
void connect()
Connects to the configured access point.
result< void > try_disconnect()
Disconnects from the current access point.
void disconnect()
Disconnects from the current access point.
result< void > try_connect()
Connects to the configured access point.
T unwrap(result< T > result)
Throws a std::system_error if the result is an error.
A datagram received together with the sender's endpoint.