77namespace connection_error
402 [[nodiscard]]
auto close(uint64_t error_code,
const std::string& reason =
"")
412 const std::string& reason =
"") ->
VoidResult;
436 -> std::optional<std::chrono::steady_clock::time_point>;
446 [[nodiscard]] auto
idle_deadline() const -> std::chrono::steady_clock::time_point
473 [[nodiscard]]
auto path_mtu() const noexcept ->
size_t;
611 std::span<const uint8_t> payload)
618 std::span<const uint8_t> payload)
624 [[nodiscard]]
auto process_frames(std::span<const uint8_t> payload,
674 -> std::optional<ack_frame>;
QUIC congestion control (RFC 9002 Section 7)
Manages peer connection IDs for QUIC connections (RFC 9000 Section 5.1)
QUIC Connection ID (RFC 9000 Section 5.1)
QUIC connection state machine (RFC 9000 Section 5)
std::chrono::steady_clock::time_point idle_deadline_
void generate_probe_packets()
Generate probe packets for PTO (RFC 9002 Section 6.2.4) Sends one or two ack-eliciting packets to pro...
void enable_pmtud()
Enable Path MTU Discovery.
std::deque< std::vector< uint8_t > > pending_crypto_app_
auto handle_frame(const frame &frame, encryption_level level) -> VoidResult
Handle a specific frame.
void disable_pmtud()
Disable Path MTU Discovery.
loss_detector loss_detector_
connection_id_manager peer_cid_manager_
auto packets_sent() const noexcept -> uint64_t
Get packets sent count.
std::deque< std::vector< uint8_t > > pending_crypto_initial_
auto operator=(connection &&) -> connection &=delete
auto remote_params() const -> const transport_parameters &
Get remote transport parameters.
pmtud_controller pmtud_controller_
auto is_established() const noexcept -> bool
Check if connection is established (handshake complete)
rtt_estimator rtt_estimator_
void update_state()
Update connection state based on handshake progress.
auto next_timeout() const -> std::optional< std::chrono::steady_clock::time_point >
Get the next timeout deadline.
auto is_draining() const noexcept -> bool
Check if connection is draining or closing.
std::string close_reason_
auto init_server_handshake(const std::string &cert_file, const std::string &key_file) -> VoidResult
Initialize server handshake.
auto rotate_peer_cid() -> VoidResult
Rotate to a new peer connection ID.
auto packets_received() const noexcept -> uint64_t
Get packets received count.
auto receive_packet(std::span< const uint8_t > data) -> VoidResult
Receive and process a packet.
void enter_draining()
Transition to draining state.
auto initial_dcid() const -> const connection_id &
Get initial Destination Connection ID (for key derivation)
void apply_remote_params()
Apply remote transport parameters.
std::chrono::steady_clock::time_point drain_deadline_
auto flow_control() const -> const flow_controller &
Get the connection-level flow controller (const)
packet_number_space initial_space_
auto get_pn_space(encryption_level level) -> packet_number_space &
Get packet number space for an encryption level.
congestion_controller congestion_controller_
auto remote_cid() const -> const connection_id &
Get remote Connection ID.
uint64_t next_cid_sequence_
bool pending_ack_initial_
auto is_server() const noexcept -> bool
Check if this is a server-side connection.
auto pmtud() -> pmtud_controller &
Get the PMTUD controller.
auto idle_deadline() const -> std::chrono::steady_clock::time_point
Get idle timeout deadline.
flow_controller flow_ctrl_
void set_local_params(const transport_parameters ¶ms)
Set local transport parameters.
auto generate_ack_frame(const packet_number_space &space) -> std::optional< ack_frame >
Generate ACK frame for a packet number space.
auto flow_control() -> flow_controller &
Get the connection-level flow controller.
auto generate_packets() -> std::vector< std::vector< uint8_t > >
Generate packets to send.
void enter_closing()
Transition to closing state.
auto bytes_received() const noexcept -> uint64_t
Get total bytes received.
packet_number_space handshake_space_
auto path_mtu() const noexcept -> size_t
Get current path MTU.
uint64_t packets_received_
std::optional< uint64_t > close_error_code_
std::deque< std::vector< uint8_t > > pending_crypto_handshake_
auto has_pending_data() const -> bool
Check if there are packets to send.
auto close_reason() const -> const std::string &
Get the close reason (if connection was closed)
auto crypto() -> quic_crypto &
Get crypto handler.
auto close_error_code() const -> std::optional< uint64_t >
Get the close error code (if connection was closed)
auto local_params() const -> const transport_parameters &
Get local transport parameters.
auto operator=(const connection &) -> connection &=delete
connection_id initial_dcid_
transport_parameters remote_params_
auto retire_cid(uint64_t sequence) -> VoidResult
Retire a Connection ID.
packet_number_space app_space_
connection(const connection &)=delete
void on_timeout()
Handle timeout event.
auto is_closed() const noexcept -> bool
Check if connection is closed.
void queue_frames_for_retransmission(const sent_packet &lost_packet)
Queue frames from lost packet for retransmission.
auto close(uint64_t error_code, const std::string &reason="") -> VoidResult
Close the connection.
auto process_frames(std::span< const uint8_t > payload, encryption_level level) -> VoidResult
Process frames from a decrypted packet.
auto build_packet(encryption_level level) -> std::vector< uint8_t >
Build a packet at the given encryption level.
bool pending_ack_handshake_
void handle_loss_detection_result(const loss_detection_result &result)
Handle loss detection result (RFC 9002)
auto start_handshake(const std::string &server_name) -> Result< std::vector< uint8_t > >
Start the handshake (client only)
void reset_idle_timer()
Reset idle timer.
auto streams() const -> const stream_manager &
Get the stream manager (const)
auto local_cid() const -> const connection_id &
Get local Connection ID.
connection_id remote_cid_
auto streams() -> stream_manager &
Get the stream manager.
auto add_local_cid(const connection_id &cid, uint64_t sequence) -> VoidResult
Add a new local Connection ID.
std::vector< std::pair< uint64_t, connection_id > > local_cids_
auto state() const noexcept -> connection_state
Get current connection state.
auto process_short_header_packet(const short_header &hdr, std::span< const uint8_t > payload) -> VoidResult
Process a short header packet.
transport_parameters local_params_
auto close_application(uint64_t error_code, const std::string &reason="") -> VoidResult
Close connection due to application error.
auto handshake_state() const noexcept -> enum handshake_state
Get current handshake state.
void set_remote_params(const transport_parameters ¶ms)
Set remote transport parameters.
auto process_long_header_packet(const long_header &hdr, std::span< const uint8_t > payload) -> VoidResult
Process a long header packet.
connection(connection &&)=delete
std::chrono::steady_clock::time_point pto_deadline_
auto peer_cid_manager() const -> const connection_id_manager &
Get the peer connection ID manager (const)
auto active_peer_cid() const -> const connection_id &
Get the currently active peer connection ID.
auto to_sent_packet(const sent_packet_info &info) const -> sent_packet
Convert sent_packet_info to sent_packet for loss detector.
auto crypto() const -> const quic_crypto &
Get crypto handler (const)
auto bytes_sent() const noexcept -> uint64_t
Get total bytes sent.
auto pmtud_enabled() const noexcept -> bool
Check if PMTUD is enabled.
auto pmtud() const -> const pmtud_controller &
Get the PMTUD controller (const)
stream_manager stream_mgr_
auto peer_cid_manager() -> connection_id_manager &
Get the peer connection ID manager.
std::deque< frame > pending_frames_
Connection-level flow control for QUIC (RFC 9000 Section 4)
QUIC loss detection (RFC 9002 Section 6)
QUIC packet number utilities (RFC 9000 Section 17.1)
Path MTU Discovery controller for QUIC (RFC 8899 DPLPMTUD)
QUIC-TLS integration handler (RFC 9001)
RTT estimation for QUIC (RFC 9002 Section 5)
Manages QUIC streams within a connection.
QUIC connection identifier type.
constexpr int not_established
constexpr int invalid_state
constexpr int protocol_violation
constexpr int connection_refused
constexpr int handshake_failed
constexpr int connection_closed
constexpr int idle_timeout
connection_state
QUIC connection state (RFC 9000 Section 5)
@ connected
Handshake complete, can send/receive data.
@ handshaking
TLS handshake in progress.
@ closed
Connection terminated.
@ closing
CONNECTION_CLOSE sent, waiting for timeout.
@ draining
CONNECTION_CLOSE received, draining period.
@ idle
Connection not yet started.
encryption_level
QUIC encryption levels (RFC 9001 Section 4)
@ initial
Initial encryption (derived from DCID)
std::variant< padding_frame, ping_frame, ack_frame, reset_stream_frame, stop_sending_frame, crypto_frame, new_token_frame, stream_frame, max_data_frame, max_stream_data_frame, max_streams_frame, data_blocked_frame, stream_data_blocked_frame, streams_blocked_frame, new_connection_id_frame, retire_connection_id_frame, path_challenge_frame, path_response_frame, connection_close_frame, handshake_done_frame > frame
Variant type holding any QUIC frame.
auto handshake_state_to_string(handshake_state state) -> const char *
Convert handshake state to string.
handshake_state
TLS handshake state.
@ waiting_server_hello
Client waiting for ServerHello.
@ waiting_finished
Waiting for peer's Finished.
@ complete
Handshake complete.
auto connection_state_to_string(connection_state state) -> const char *
Convert connection state to string.
Result< std::monostate > VoidResult
Network-specific error and result type definitions.
Result of loss detection operations.
State for each packet number space (Initial, Handshake, Application)
std::chrono::microseconds ack_delay
ACK delay for this space.
uint64_t largest_received
Largest received packet number.
std::chrono::steady_clock::time_point largest_received_time
Time of receiving largest packet.
std::map< uint64_t, sent_packet_info > sent_packets
Packets awaiting acknowledgment.
uint64_t largest_acked
Largest acknowledged packet number.
bool ack_needed
Whether an ACK is needed.
uint64_t next_pn
Next packet number to use.
Information about a sent packet for loss detection.
std::chrono::steady_clock::time_point sent_time
std::vector< frame > frames
Information about a sent packet for loss detection (RFC 9002 Section A.1.1)
QUIC transport parameters (RFC 9000 Section 18)