|
Network System 0.1.1
High-performance modular networking library for scalable client-server applications
|
Core interface for data transport abstraction. More...
#include <i_transport.h>


Public Member Functions | |
| virtual | ~i_transport ()=default |
| Virtual destructor for proper cleanup of derived classes. | |
| i_transport (const i_transport &)=delete | |
| i_transport & | operator= (const i_transport &)=delete |
| i_transport (i_transport &&)=default | |
| i_transport & | operator= (i_transport &&)=default |
| virtual auto | send (std::span< const std::byte > data) -> VoidResult=0 |
| Sends raw data to the remote endpoint. | |
| virtual auto | send (std::vector< uint8_t > &&data) -> VoidResult=0 |
| Sends data from a uint8_t vector. | |
| virtual auto | is_connected () const noexcept -> bool=0 |
| Checks if the transport is currently connected. | |
| virtual auto | id () const noexcept -> std::string_view=0 |
| Gets the unique identifier for this transport/connection. | |
| virtual auto | remote_endpoint () const noexcept -> endpoint_info=0 |
| Gets the remote endpoint information. | |
| virtual auto | local_endpoint () const noexcept -> endpoint_info=0 |
| Gets the local endpoint information. | |
Protected Member Functions | |
| i_transport ()=default | |
| Default constructor (only for derived classes) | |
Core interface for data transport abstraction.
This interface defines the fundamental operations for sending and receiving data across any network transport. It serves as the base abstraction that all protocol-specific implementations share.
The i_transport interface embodies Kent Beck's "Fewest Elements" rule by providing a minimal, protocol-agnostic API for data transfer. Protocol- specific details are handled by factory functions, not interface variations.
All public methods must be thread-safe. Implementations should use appropriate synchronization for internal state.
Definition at line 73 of file i_transport.h.
|
virtualdefault |
Virtual destructor for proper cleanup of derived classes.
|
delete |
|
default |
|
protecteddefault |
Default constructor (only for derived classes)
|
nodiscardpure virtualnoexcept |
Gets the unique identifier for this transport/connection.
The ID is unique within the application and remains constant for the lifetime of the transport instance.
Implemented in kcenon::network::unified::adapters::quic_connection_adapter, kcenon::network::unified::adapters::tcp_connection_adapter, kcenon::network::unified::adapters::udp_connection_adapter, and kcenon::network::unified::adapters::ws_connection_adapter.
|
nodiscardpure virtualnoexcept |
Checks if the transport is currently connected.
Thread-safe. Uses atomic operations internally.
A false return may indicate:
Implemented in kcenon::network::unified::adapters::quic_connection_adapter, kcenon::network::unified::adapters::tcp_connection_adapter, kcenon::network::unified::adapters::udp_connection_adapter, and kcenon::network::unified::adapters::ws_connection_adapter.
|
nodiscardpure virtualnoexcept |
Gets the local endpoint information.
Returns valid information only when connected/listening. Returns empty endpoint_info if not bound.
Implemented in kcenon::network::unified::adapters::quic_connection_adapter, kcenon::network::unified::adapters::tcp_connection_adapter, kcenon::network::unified::adapters::udp_connection_adapter, and kcenon::network::unified::adapters::ws_connection_adapter.
|
delete |
|
default |
|
nodiscardpure virtualnoexcept |
Gets the remote endpoint information.
Returns valid information only when connected. Returns empty endpoint_info if not connected.
Implemented in kcenon::network::unified::adapters::quic_connection_adapter, kcenon::network::unified::adapters::tcp_connection_adapter, kcenon::network::unified::adapters::udp_connection_adapter, and kcenon::network::unified::adapters::ws_connection_adapter.
|
nodiscardpure virtual |
Sends raw data to the remote endpoint.
| data | The data to send as a span of bytes |
Thread-safe. Multiple sends may be queued internally.
Data is typically copied to an internal send buffer. For zero-copy sends, see protocol-specific implementations.
Implemented in kcenon::network::unified::adapters::quic_connection_adapter, kcenon::network::unified::adapters::tcp_connection_adapter, kcenon::network::unified::adapters::udp_connection_adapter, and kcenon::network::unified::adapters::ws_connection_adapter.
|
nodiscardpure virtual |
Sends data from a uint8_t vector.
| data | The data to send as a vector of uint8_t |
Convenience overload for compatibility with existing code using std::vector<uint8_t>.
Implemented in kcenon::network::unified::adapters::quic_connection_adapter, kcenon::network::unified::adapters::tcp_connection_adapter, kcenon::network::unified::adapters::udp_connection_adapter, and kcenon::network::unified::adapters::ws_connection_adapter.