12#include <system_error>
55 const std::vector<uint8_t>&,
83 [[nodiscard]]
virtual auto start(std::string_view host, uint16_t port) ->
VoidResult = 0;
107 [[nodiscard]]
virtual auto send(
108 std::vector<uint8_t>&& data,
Base interface for all network components.
Interface for UDP client components.
std::function< void(std::error_code, std::size_t)> send_callback_t
Callback type for send completion.
virtual auto set_error_callback(error_callback_t callback) -> void=0
Sets the callback for errors.
std::function< void( const std::vector< uint8_t > &, const endpoint_info &)> receive_callback_t
Callback type for received data (includes sender endpoint)
virtual auto send(std::vector< uint8_t > &&data, send_callback_t handler=nullptr) -> VoidResult=0
Sends a datagram to the configured target endpoint.
virtual auto start(std::string_view host, uint16_t port) -> VoidResult=0
Starts the UDP client targeting the specified endpoint.
virtual auto set_target(std::string_view host, uint16_t port) -> VoidResult=0
Changes the target endpoint for future sends.
std::function< void(std::error_code)> error_callback_t
Callback type for errors.
virtual auto set_receive_callback(receive_callback_t callback) -> void=0
Sets the callback for received datagrams.
virtual auto stop() -> VoidResult=0
Stops the UDP client.
Base interface for all network components.
Network-specific error and result type definitions.
Endpoint information for UDP datagrams.
uint16_t port
Port number.
std::string address
IP address string.