29#include <system_error>
139 [[nodiscard]]
virtual auto start(std::string_view host, uint16_t port) ->
VoidResult = 0;
Observer interface for client connection events.
Base interface for all network components.
Unified interface for all protocol client implementations.
virtual auto stop() -> VoidResult=0
Stops the client and closes the connection.
std::function< void(const std::vector< uint8_t > &)> receive_callback_t
Callback type for received data.
std::function< void()> connected_callback_t
Callback type for connection established.
virtual auto set_error_callback(error_callback_t callback) -> void=0
Sets the callback for errors.
std::function< void(std::error_code)> error_callback_t
Callback type for errors.
virtual auto start(std::string_view host, uint16_t port) -> VoidResult=0
Starts the client and connects to the specified server.
virtual auto set_connected_callback(connected_callback_t callback) -> void=0
Sets the callback for connection established.
virtual auto set_receive_callback(receive_callback_t callback) -> void=0
Sets the callback for received data.
virtual auto set_disconnected_callback(disconnected_callback_t callback) -> void=0
Sets the callback for disconnection.
virtual auto set_observer(std::shared_ptr< connection_observer > observer) -> void=0
Sets the connection observer for unified event handling.
virtual auto send(std::vector< uint8_t > &&data) -> VoidResult=0
Sends data to the connected server.
virtual auto is_connected() const -> bool=0
Checks if the client is connected to the server.
std::function< void()> disconnected_callback_t
Callback type for disconnection.
Observer interface for connection state change notifications.
Base interface for all network components.
Public header for Result<T> error handling types.