Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
kcenon::network::interfaces::i_quic_client Interface Referenceabstract

Interface for QUIC client components. More...

#include <i_quic_client.h>

Inheritance diagram for kcenon::network::interfaces::i_quic_client:
Inheritance graph
Collaboration diagram for kcenon::network::interfaces::i_quic_client:
Collaboration graph

Public Types

using receive_callback_t = std::function<void(const std::vector<uint8_t>&)>
 Callback type for received data on default stream.
 
using stream_callback_t = std::function<void(uint64_t, const std::vector<uint8_t>&, bool)>
 Callback type for stream data (stream_id, data, is_fin)
 
using connected_callback_t = std::function<void()>
 Callback type for connection established.
 
using disconnected_callback_t = std::function<void()>
 Callback type for disconnection.
 
using error_callback_t = std::function<void(std::error_code)>
 Callback type for errors.
 
using session_ticket_callback_t
 Callback type for session ticket received (for 0-RTT resumption)
 
using early_data_callback_t = std::function<std::vector<uint8_t>()>
 Callback type for early data production.
 
using early_data_accepted_callback_t = std::function<void(bool accepted)>
 Callback type for early data acceptance notification.
 

Public Member Functions

virtual auto start (std::string_view host, uint16_t port) -> VoidResult=0
 Starts the QUIC client connecting to the specified server.
 
virtual auto stop () -> VoidResult=0
 Stops the QUIC client.
 
virtual auto is_connected () const -> bool=0
 Checks if the client is connected.
 
virtual auto is_handshake_complete () const -> bool=0
 Checks if TLS handshake is complete.
 
virtual auto send (std::vector< uint8_t > &&data) -> VoidResult=0
 Sends data on the default stream (stream 0).
 
virtual auto create_stream () -> Result< uint64_t >=0
 Creates a new bidirectional stream.
 
virtual auto create_unidirectional_stream () -> Result< uint64_t >=0
 Creates a new unidirectional stream.
 
virtual auto send_on_stream (uint64_t stream_id, std::vector< uint8_t > &&data, bool fin=false) -> VoidResult=0
 Sends data on a specific stream.
 
virtual auto close_stream (uint64_t stream_id) -> VoidResult=0
 Closes a stream.
 
virtual auto set_alpn_protocols (const std::vector< std::string > &protocols) -> void=0
 Sets the ALPN protocols for negotiation.
 
virtual auto alpn_protocol () const -> std::optional< std::string >=0
 Gets the negotiated ALPN protocol.
 
virtual auto is_early_data_accepted () const -> bool=0
 Checks if early data was accepted by the server.
 
virtual auto set_receive_callback (receive_callback_t callback) -> void=0
 Sets the callback for received data on default stream.
 
virtual auto set_stream_callback (stream_callback_t callback) -> void=0
 Sets the callback for stream data.
 
virtual auto set_connected_callback (connected_callback_t callback) -> void=0
 Sets the callback for connection established.
 
virtual auto set_disconnected_callback (disconnected_callback_t callback) -> void=0
 Sets the callback for disconnection.
 
virtual auto set_error_callback (error_callback_t callback) -> void=0
 Sets the callback for errors.
 
virtual auto set_session_ticket_callback (session_ticket_callback_t callback) -> void=0
 Sets the callback for session tickets (for 0-RTT).
 
virtual auto set_early_data_callback (early_data_callback_t callback) -> void=0
 Sets the callback for early data production.
 
virtual auto set_early_data_accepted_callback (early_data_accepted_callback_t callback) -> void=0
 Sets the callback for early data acceptance notification.
 
- Public Member Functions inherited from kcenon::network::interfaces::i_network_component
virtual ~i_network_component ()=default
 Virtual destructor for proper cleanup of derived classes.
 
 i_network_component (const i_network_component &)=delete
 
i_network_componentoperator= (const i_network_component &)=delete
 
 i_network_component (i_network_component &&)=delete
 
i_network_componentoperator= (i_network_component &&)=delete
 

Additional Inherited Members

- Protected Member Functions inherited from kcenon::network::interfaces::i_network_component
 i_network_component ()=default
 Default constructor (only for derived classes)
 
virtual auto is_running () const -> bool=0
 Checks if the component is currently running.
 
virtual auto wait_for_stop () -> void=0
 Blocks until the component has stopped.
 

Detailed Description

Interface for QUIC client components.

This interface extends i_network_component with QUIC-specific operations such as multi-stream support and 0-RTT session resumption.

Key Features

  • Multiple concurrent bidirectional streams
  • Unidirectional stream support
  • 0-RTT early data for reduced latency
  • Built-in TLS 1.3 integration

Thread Safety

  • All public methods must be thread-safe
  • Callbacks may be invoked from I/O threads
See also
i_client

Definition at line 41 of file i_quic_client.h.

Member Typedef Documentation

◆ connected_callback_t

Callback type for connection established.

Definition at line 51 of file i_quic_client.h.

◆ disconnected_callback_t

Callback type for disconnection.

Definition at line 54 of file i_quic_client.h.

◆ early_data_accepted_callback_t

Callback type for early data acceptance notification.

Definition at line 69 of file i_quic_client.h.

◆ early_data_callback_t

using kcenon::network::interfaces::i_quic_client::early_data_callback_t = std::function<std::vector<uint8_t>()>

Callback type for early data production.

Definition at line 66 of file i_quic_client.h.

◆ error_callback_t

using kcenon::network::interfaces::i_quic_client::error_callback_t = std::function<void(std::error_code)>

Callback type for errors.

Definition at line 57 of file i_quic_client.h.

◆ receive_callback_t

using kcenon::network::interfaces::i_quic_client::receive_callback_t = std::function<void(const std::vector<uint8_t>&)>

Callback type for received data on default stream.

Definition at line 45 of file i_quic_client.h.

◆ session_ticket_callback_t

Initial value:
std::function<void(
std::vector<uint8_t> ticket_data,
uint32_t lifetime_hint,
uint32_t max_early_data)>

Callback type for session ticket received (for 0-RTT resumption)

Definition at line 60 of file i_quic_client.h.

◆ stream_callback_t

using kcenon::network::interfaces::i_quic_client::stream_callback_t = std::function<void(uint64_t, const std::vector<uint8_t>&, bool)>

Callback type for stream data (stream_id, data, is_fin)

Definition at line 48 of file i_quic_client.h.

Member Function Documentation

◆ alpn_protocol()

virtual auto kcenon::network::interfaces::i_quic_client::alpn_protocol ( ) const -> std::optional< std::string >
nodiscardpure virtual

Gets the negotiated ALPN protocol.

Returns
Protocol string if negotiated, empty optional otherwise.

Implemented in kcenon::network::core::messaging_quic_client.

◆ close_stream()

virtual auto kcenon::network::interfaces::i_quic_client::close_stream ( uint64_t stream_id) -> VoidResult
nodiscardpure virtual

Closes a stream.

Parameters
stream_idThe stream to close.
Returns
VoidResult indicating success or failure.

Implemented in kcenon::network::core::messaging_quic_client.

◆ create_stream()

virtual auto kcenon::network::interfaces::i_quic_client::create_stream ( ) -> Result< uint64_t >
nodiscardpure virtual

Creates a new bidirectional stream.

Returns
Stream ID or error.

Implemented in kcenon::network::core::messaging_quic_client.

◆ create_unidirectional_stream()

virtual auto kcenon::network::interfaces::i_quic_client::create_unidirectional_stream ( ) -> Result< uint64_t >
nodiscardpure virtual

Creates a new unidirectional stream.

Returns
Stream ID or error.

Implemented in kcenon::network::core::messaging_quic_client.

◆ is_connected()

virtual auto kcenon::network::interfaces::i_quic_client::is_connected ( ) const -> bool
nodiscardpure virtual

Checks if the client is connected.

Returns
true if connected, false otherwise.

Implemented in kcenon::network::core::messaging_quic_client.

◆ is_early_data_accepted()

virtual auto kcenon::network::interfaces::i_quic_client::is_early_data_accepted ( ) const -> bool
nodiscardpure virtual

Checks if early data was accepted by the server.

Returns
true if accepted, false otherwise.

Implemented in kcenon::network::core::messaging_quic_client.

◆ is_handshake_complete()

virtual auto kcenon::network::interfaces::i_quic_client::is_handshake_complete ( ) const -> bool
nodiscardpure virtual

Checks if TLS handshake is complete.

Returns
true if handshake is done, false otherwise.

Implemented in kcenon::network::core::messaging_quic_client.

◆ send()

virtual auto kcenon::network::interfaces::i_quic_client::send ( std::vector< uint8_t > && data) -> VoidResult
nodiscardpure virtual

Sends data on the default stream (stream 0).

Parameters
dataThe data to send.
Returns
VoidResult indicating success or failure.

Implemented in kcenon::network::core::messaging_quic_client.

◆ send_on_stream()

virtual auto kcenon::network::interfaces::i_quic_client::send_on_stream ( uint64_t stream_id,
std::vector< uint8_t > && data,
bool fin = false ) -> VoidResult
nodiscardpure virtual

Sends data on a specific stream.

Parameters
stream_idThe target stream ID.
dataThe data to send.
finTrue if this is the final data on the stream.
Returns
VoidResult indicating success or failure.

Implemented in kcenon::network::core::messaging_quic_client.

◆ set_alpn_protocols()

virtual auto kcenon::network::interfaces::i_quic_client::set_alpn_protocols ( const std::vector< std::string > & protocols) -> void
pure virtual

Sets the ALPN protocols for negotiation.

Parameters
protocolsList of protocol identifiers (e.g., {"h3", "hq-29"}).

Implemented in kcenon::network::core::messaging_quic_client.

◆ set_connected_callback()

virtual auto kcenon::network::interfaces::i_quic_client::set_connected_callback ( connected_callback_t callback) -> void
pure virtual

Sets the callback for connection established.

Parameters
callbackThe callback function.

Implemented in kcenon::network::core::messaging_quic_client.

◆ set_disconnected_callback()

virtual auto kcenon::network::interfaces::i_quic_client::set_disconnected_callback ( disconnected_callback_t callback) -> void
pure virtual

Sets the callback for disconnection.

Parameters
callbackThe callback function.

Implemented in kcenon::network::core::messaging_quic_client.

◆ set_early_data_accepted_callback()

virtual auto kcenon::network::interfaces::i_quic_client::set_early_data_accepted_callback ( early_data_accepted_callback_t callback) -> void
pure virtual

Sets the callback for early data acceptance notification.

Parameters
callbackThe callback function.

Implemented in kcenon::network::core::messaging_quic_client.

◆ set_early_data_callback()

virtual auto kcenon::network::interfaces::i_quic_client::set_early_data_callback ( early_data_callback_t callback) -> void
pure virtual

Sets the callback for early data production.

Parameters
callbackThe callback function.

Implemented in kcenon::network::core::messaging_quic_client.

◆ set_error_callback()

virtual auto kcenon::network::interfaces::i_quic_client::set_error_callback ( error_callback_t callback) -> void
pure virtual

Sets the callback for errors.

Parameters
callbackThe callback function.

Implemented in kcenon::network::core::messaging_quic_client.

◆ set_receive_callback()

virtual auto kcenon::network::interfaces::i_quic_client::set_receive_callback ( receive_callback_t callback) -> void
pure virtual

Sets the callback for received data on default stream.

Parameters
callbackThe callback function.

Implemented in kcenon::network::core::messaging_quic_client.

◆ set_session_ticket_callback()

virtual auto kcenon::network::interfaces::i_quic_client::set_session_ticket_callback ( session_ticket_callback_t callback) -> void
pure virtual

Sets the callback for session tickets (for 0-RTT).

Parameters
callbackThe callback function.

Implemented in kcenon::network::core::messaging_quic_client.

◆ set_stream_callback()

virtual auto kcenon::network::interfaces::i_quic_client::set_stream_callback ( stream_callback_t callback) -> void
pure virtual

Sets the callback for stream data.

Parameters
callbackThe callback function.

Implemented in kcenon::network::core::messaging_quic_client.

◆ start()

virtual auto kcenon::network::interfaces::i_quic_client::start ( std::string_view host,
uint16_t port ) -> VoidResult
nodiscardpure virtual

Starts the QUIC client connecting to the specified server.

Parameters
hostThe server hostname or IP address.
portThe server port number.
Returns
VoidResult indicating success or failure.

Behavior

  • Resolves the server address
  • Initiates QUIC handshake (includes TLS 1.3)
  • Creates default stream (stream 0)

Thread Safety

Thread-safe. Only one start operation can succeed at a time.

Implemented in kcenon::network::core::messaging_quic_client.

◆ stop()

virtual auto kcenon::network::interfaces::i_quic_client::stop ( ) -> VoidResult
nodiscardpure virtual

Stops the QUIC client.

Returns
VoidResult indicating success or failure.

Behavior

  • Closes all streams gracefully
  • Sends connection close frame

Thread Safety

Thread-safe.

Implemented in kcenon::network::core::messaging_quic_client.


The documentation for this interface was generated from the following file: