Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
kcenon::network::protocols::quic Namespace Reference

Namespaces

namespace  cid_manager_error
 
namespace  connection_error
 
namespace  flow_control_error
 Flow control error codes.
 
namespace  quic_version
 Well-known QUIC version numbers.
 
namespace  stream_error
 Stream error codes.
 
namespace  stream_flags
 STREAM frame type flags (bits 0-2 of type byte)
 
namespace  stream_id_type
 Stream ID type information.
 
namespace  transport_param_error
 Transport parameter error codes.
 
namespace  transport_param_id
 Transport parameter IDs as defined in RFC 9000 Section 18.2.
 

Classes

struct  ack_frame
 ACK frame (RFC 9000 Section 19.3) More...
 
struct  ack_range
 ACK Range for ACK frames. More...
 
class  congestion_controller
 QUIC congestion control (RFC 9002 Section 7) More...
 
class  connection
 QUIC connection state machine (RFC 9000 Section 5) More...
 
struct  connection_close_frame
 CONNECTION_CLOSE frame (RFC 9000 Section 19.19) More...
 
class  connection_id
 QUIC Connection ID (RFC 9000 Section 5.1) More...
 
struct  connection_id_entry
 Entry for storing a peer's connection ID with metadata. More...
 
class  connection_id_manager
 Manages peer connection IDs for QUIC connections (RFC 9000 Section 5.1) More...
 
struct  crypto_frame
 CRYPTO frame (RFC 9000 Section 19.6) More...
 
struct  data_blocked_frame
 DATA_BLOCKED frame (RFC 9000 Section 19.12) More...
 
struct  ecn_counts
 ECN counts for ACK_ECN frames. More...
 
class  ecn_tracker
 ECN (Explicit Congestion Notification) tracker (RFC 9000 Section 13.4, RFC 9002 Section 7.1) More...
 
struct  flow_control_stats
 Statistics for flow control monitoring. More...
 
class  flow_controller
 Connection-level flow control for QUIC (RFC 9000 Section 4) More...
 
class  frame_builder
 Builder for QUIC frames (RFC 9000 Section 12) More...
 
class  frame_parser
 Parser for QUIC frames (RFC 9000 Section 12) More...
 
struct  handshake_done_frame
 HANDSHAKE_DONE frame (RFC 9000 Section 19.20) More...
 
class  hkdf
 HKDF (HMAC-based Key Derivation Function) utilities (RFC 5869) More...
 
class  initial_keys
 Derives initial encryption keys from Destination Connection ID. More...
 
struct  key_pair
 A pair of read and write keys for bidirectional communication. More...
 
struct  long_header
 QUIC Long Header format (RFC 9000 Section 17.2) More...
 
struct  loss_detection_result
 Result of loss detection operations. More...
 
class  loss_detector
 QUIC loss detection (RFC 9002 Section 6) More...
 
struct  max_data_frame
 MAX_DATA frame (RFC 9000 Section 19.9) More...
 
struct  max_stream_data_frame
 MAX_STREAM_DATA frame (RFC 9000 Section 19.10) More...
 
struct  max_streams_frame
 MAX_STREAMS frame (RFC 9000 Section 19.11) More...
 
struct  new_connection_id_frame
 NEW_CONNECTION_ID frame (RFC 9000 Section 19.15) More...
 
struct  new_token_frame
 NEW_TOKEN frame (RFC 9000 Section 19.7) More...
 
class  packet_builder
 Builder for QUIC packet headers (RFC 9000 Section 17) More...
 
class  packet_number
 QUIC packet number utilities (RFC 9000 Section 17.1) More...
 
struct  packet_number_space
 State for each packet number space (Initial, Handshake, Application) More...
 
class  packet_parser
 Parser for QUIC packet headers (RFC 9000 Section 17) More...
 
class  packet_protection
 QUIC packet protection (encryption/decryption) (RFC 9001 Section 5) More...
 
struct  padding_frame
 PADDING frame (RFC 9000 Section 19.1) More...
 
struct  path_challenge_frame
 PATH_CHALLENGE frame (RFC 9000 Section 19.17) More...
 
struct  path_response_frame
 PATH_RESPONSE frame (RFC 9000 Section 19.18) More...
 
struct  ping_frame
 PING frame (RFC 9000 Section 19.2) More...
 
struct  pmtud_config
 Configuration for PMTUD controller. More...
 
class  pmtud_controller
 Path MTU Discovery controller for QUIC (RFC 8899 DPLPMTUD) More...
 
struct  preferred_address_info
 QUIC preferred address transport parameter (RFC 9000 Section 18.2) More...
 
class  quic_crypto
 QUIC-TLS integration handler (RFC 9001) More...
 
struct  quic_keys
 QUIC encryption keys for a single encryption level (RFC 9001 Section 5) More...
 
class  replay_filter
 Anti-replay protection for 0-RTT data. More...
 
struct  reset_stream_frame
 RESET_STREAM frame (RFC 9000 Section 19.4) More...
 
struct  retire_connection_id_frame
 RETIRE_CONNECTION_ID frame (RFC 9000 Section 19.16) More...
 
class  rtt_estimator
 RTT estimation for QUIC (RFC 9002 Section 5) More...
 
struct  sent_packet
 Information about a sent packet for loss detection (RFC 9002 Section A.1.1) More...
 
struct  sent_packet_info
 Information about a sent packet for loss detection. More...
 
struct  session_ticket_info
 Contains session ticket data for 0-RTT resumption. More...
 
class  session_ticket_store
 Thread-safe storage for QUIC session tickets. More...
 
struct  short_header
 QUIC Short Header format (RFC 9000 Section 17.3) More...
 
struct  stop_sending_frame
 STOP_SENDING frame (RFC 9000 Section 19.5) More...
 
class  stream
 QUIC stream implementation (RFC 9000 Sections 2-4) More...
 
struct  stream_data_blocked_frame
 STREAM_DATA_BLOCKED frame (RFC 9000 Section 19.13) More...
 
struct  stream_frame
 STREAM frame (RFC 9000 Section 19.8) More...
 
class  stream_manager
 Manages QUIC streams within a connection. More...
 
struct  streams_blocked_frame
 STREAMS_BLOCKED frame (RFC 9000 Section 19.14) More...
 
struct  transport_parameters
 QUIC transport parameters (RFC 9000 Section 18) More...
 
class  varint
 QUIC variable-length integer encoding/decoding (RFC 9000 Section 16) More...
 

Typedefs

using frame
 Variant type holding any QUIC frame.
 
using packet_header = std::variant<long_header, short_header>
 Variant type for packet headers.
 

Enumerations

enum class  congestion_state { slow_start , congestion_avoidance , recovery }
 States of the congestion controller (RFC 9002 Section 7) More...
 
enum class  connection_state {
  idle , handshaking , connected , closing ,
  draining , closed
}
 QUIC connection state (RFC 9000 Section 5) More...
 
enum class  handshake_state { initial , waiting_server_hello , waiting_finished , complete }
 TLS handshake state. More...
 
enum class  ecn_result { none , congestion_signal , ecn_failure }
 Result of ECN counts processing (RFC 9000 Section 13.4) More...
 
enum class  ecn_marking : uint8_t { not_ect = 0x00 , ect1 = 0x01 , ect0 = 0x02 , ecn_ce = 0x03 }
 ECN marking values for IP header (RFC 3168) More...
 
enum class  frame_type : uint64_t {
  padding = 0x00 , ping = 0x01 , ack = 0x02 , ack_ecn = 0x03 ,
  reset_stream = 0x04 , stop_sending = 0x05 , crypto = 0x06 , new_token = 0x07 ,
  stream_base = 0x08 , max_data = 0x10 , max_stream_data = 0x11 , max_streams_bidi = 0x12 ,
  max_streams_uni = 0x13 , data_blocked = 0x14 , stream_data_blocked = 0x15 , streams_blocked_bidi = 0x16 ,
  streams_blocked_uni = 0x17 , new_connection_id = 0x18 , retire_connection_id = 0x19 , path_challenge = 0x1a ,
  path_response = 0x1b , connection_close = 0x1c , connection_close_app = 0x1d , handshake_done = 0x1e
}
 QUIC frame types as defined in RFC 9000 Section 12.4. More...
 
enum class  encryption_level : uint8_t { initial = 0 , handshake = 1 , zero_rtt = 2 , application = 3 }
 QUIC encryption levels (RFC 9001 Section 4) More...
 
enum class  loss_detection_event { none , packet_lost , pto_expired }
 Events that can occur during loss detection. More...
 
enum class  packet_type : uint8_t {
  initial = 0x00 , zero_rtt = 0x01 , handshake = 0x02 , retry = 0x03 ,
  one_rtt = 0xFF
}
 QUIC packet types (RFC 9000 Section 17) More...
 
enum class  pmtud_state {
  disabled , base , searching , search_complete ,
  error
}
 States for DPLPMTUD state machine (RFC 8899 Section 5.2) More...
 
enum class  send_stream_state {
  ready , send , data_sent , reset_sent ,
  reset_recvd , data_recvd
}
 Stream state for sending (RFC 9000 Section 3.1) More...
 
enum class  recv_stream_state {
  recv , size_known , data_recvd , reset_recvd ,
  data_read , reset_read
}
 Stream state for receiving (RFC 9000 Section 3.2) More...
 

Functions

auto congestion_state_to_string (congestion_state state) noexcept -> const char *
 Convert congestion state to string.
 
auto connection_state_to_string (connection_state state) -> const char *
 Convert connection state to string.
 
auto handshake_state_to_string (handshake_state state) -> const char *
 Convert handshake state to string.
 
auto ecn_result_to_string (ecn_result result) noexcept -> const char *
 Convert ecn_result to string.
 
auto get_flow_control_stats (const flow_controller &fc) -> flow_control_stats
 Get flow control statistics.
 
constexpr auto is_stream_frame (uint64_t type) noexcept -> bool
 Check if a frame type value represents a STREAM frame.
 
constexpr auto get_stream_flags (uint64_t type) noexcept -> uint8_t
 Extract STREAM flags from frame type.
 
constexpr auto make_stream_type (bool has_fin, bool has_length, bool has_offset) noexcept -> uint8_t
 Build STREAM frame type from flags.
 
auto get_frame_type (const frame &f) -> frame_type
 Get the frame type for a frame variant.
 
auto frame_type_to_string (frame_type type) -> std::string
 Get string name for a frame type.
 
auto encryption_level_to_string (encryption_level level) -> std::string
 Convert encryption level to string for debugging.
 
constexpr auto encryption_level_count () noexcept -> size_t
 Get the encryption level count.
 
auto packet_type_to_string (packet_type type) -> std::string
 Convert packet type to string for debugging.
 
auto pmtud_state_to_string (pmtud_state state) noexcept -> const char *
 Convert PMTUD state to string.
 
auto send_state_to_string (send_stream_state state) -> const char *
 Get string representation of send stream state.
 
auto recv_state_to_string (recv_stream_state state) -> const char *
 Get string representation of receive stream state.
 
auto make_default_client_params () -> transport_parameters
 Create default client transport parameters.
 
auto make_default_server_params () -> transport_parameters
 Create default server transport parameters.
 

Variables

constexpr std::array< uint8_t, 20 > initial_salt_v1
 QUIC version 1 initial salt (RFC 9001 Section 5.2)
 
constexpr std::array< uint8_t, 20 > initial_salt_v2
 QUIC version 2 initial salt (RFC 9369)
 
constexpr size_t aes_128_key_size = 16
 AES-128-GCM key size in bytes.
 
constexpr size_t aes_256_key_size = 32
 AES-256-GCM key size in bytes.
 
constexpr size_t aead_iv_size = 12
 AEAD IV/nonce size in bytes.
 
constexpr size_t aead_tag_size = 16
 AEAD authentication tag size in bytes.
 
constexpr size_t secret_size = 32
 Traffic secret size (SHA-256 output)
 
constexpr size_t hp_key_size = 16
 Header protection key size for AES-128.
 
constexpr size_t hp_sample_size = 16
 Header protection sample size.
 
constexpr uint64_t varint_max = 4611686018427387903ULL
 Maximum value that can be encoded in QUIC variable-length integer.
 

Typedef Documentation

◆ frame

Initial value:
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
>

Variant type holding any QUIC frame.

Definition at line 366 of file frame_types.h.

◆ packet_header

Variant type for packet headers.

Definition at line 160 of file packet.h.

Enumeration Type Documentation

◆ congestion_state

States of the congestion controller (RFC 9002 Section 7)

Enumerator
slow_start 

Exponential growth of cwnd.

congestion_avoidance 

Linear growth of cwnd.

recovery 

Congestion recovery after loss.

Definition at line 22 of file congestion_controller.h.

◆ connection_state

QUIC connection state (RFC 9000 Section 5)

Enumerator
idle 

Connection not yet started.

handshaking 

TLS handshake in progress.

connected 

Handshake complete, can send/receive data.

closing 

CONNECTION_CLOSE sent, waiting for timeout.

draining 

CONNECTION_CLOSE received, draining period.

closed 

Connection terminated.

Definition at line 42 of file connection.h.

43{
44 idle,
46 connected,
47 closing,
48 draining,
49 closed,
50};
@ closing
CONNECTION_CLOSE sent, waiting for timeout.
@ draining
CONNECTION_CLOSE received, draining period.

◆ ecn_marking

enum class kcenon::network::protocols::quic::ecn_marking : uint8_t
strong

ECN marking values for IP header (RFC 3168)

Enumerator
not_ect 

Not ECN-Capable Transport.

ect1 

ECN Capable Transport (1)

ect0 

ECN Capable Transport (0)

ecn_ce 

Congestion Experienced.

Definition at line 35 of file ecn_tracker.h.

36{
37 not_ect = 0x00,
38 ect1 = 0x01,
39 ect0 = 0x02,
40 ecn_ce = 0x03,
41};

◆ ecn_result

Result of ECN counts processing (RFC 9000 Section 13.4)

Enumerator
none 

No congestion signal.

congestion_signal 

ECN-CE increased (congestion experienced)

ecn_failure 

ECN validation failed, should disable ECN.

Definition at line 19 of file ecn_tracker.h.

20{
21 none,
24};
@ ecn_failure
ECN validation failed, should disable ECN.
@ congestion_signal
ECN-CE increased (congestion experienced)

◆ encryption_level

QUIC encryption levels (RFC 9001 Section 4)

QUIC uses four encryption levels, each with different key material:

  • Initial: Keys derived from Destination Connection ID
  • Handshake: Keys from TLS handshake
  • Zero-RTT (0-RTT): Early data keys (optional)
  • Application (1-RTT): Post-handshake keys
Enumerator
initial 

Initial encryption (derived from DCID)

handshake 

Handshake encryption.

zero_rtt 

0-RTT early data encryption

application 

1-RTT application data encryption

Definition at line 53 of file keys.h.

54{
55 initial = 0,
56 handshake = 1,
57 zero_rtt = 2,
58 application = 3
59};
@ application
1-RTT application data encryption

◆ frame_type

enum class kcenon::network::protocols::quic::frame_type : uint64_t
strong

QUIC frame types as defined in RFC 9000 Section 12.4.

Frame types indicate which fields are present in a frame. Some frame types use the low-order bits to encode specific flags.

Enumerator
padding 
ping 
ack 
ack_ecn 
reset_stream 
stop_sending 
crypto 
new_token 
stream_base 
max_data 
max_stream_data 
max_streams_bidi 
max_streams_uni 
data_blocked 
stream_data_blocked 
streams_blocked_bidi 
streams_blocked_uni 
new_connection_id 
retire_connection_id 
path_challenge 
path_response 
connection_close 
connection_close_app 
handshake_done 

Definition at line 24 of file frame_types.h.

25{
26 padding = 0x00,
27 ping = 0x01,
28 ack = 0x02,
29 ack_ecn = 0x03,
30 reset_stream = 0x04,
31 stop_sending = 0x05,
32 crypto = 0x06,
33 new_token = 0x07,
34 // STREAM frames: 0x08-0x0f (use stream_base and flags)
35 stream_base = 0x08,
36 max_data = 0x10,
37 max_stream_data = 0x11,
38 max_streams_bidi = 0x12,
39 max_streams_uni = 0x13,
40 data_blocked = 0x14,
44 new_connection_id = 0x18,
46 path_challenge = 0x1a,
47 path_response = 0x1b,
48 connection_close = 0x1c,
50 handshake_done = 0x1e,
51};

◆ handshake_state

TLS handshake state.

Enumerator
initial 

Not started.

waiting_server_hello 

Client waiting for ServerHello.

waiting_finished 

Waiting for peer's Finished.

complete 

Handshake complete.

Definition at line 55 of file connection.h.

◆ loss_detection_event

Events that can occur during loss detection.

Enumerator
none 

No event.

packet_lost 

Packet(s) declared lost.

pto_expired 

Probe timeout expired.

Definition at line 53 of file loss_detector.h.

◆ packet_type

enum class kcenon::network::protocols::quic::packet_type : uint8_t
strong

QUIC packet types (RFC 9000 Section 17)

Long header packets (used during handshake):

  • Initial (0x00): First handshake packet
  • Zero-RTT (0x01): Early data (0-RTT)
  • Handshake (0x02): Handshake continuation
  • Retry (0x03): Address validation token

Short header packets (used after handshake):

  • One-RTT: Minimal header for application data
Enumerator
initial 
zero_rtt 
handshake 
retry 
one_rtt 

Definition at line 54 of file packet.h.

55{
56 initial = 0x00,
57 zero_rtt = 0x01,
58 handshake = 0x02,
59 retry = 0x03,
60 one_rtt = 0xFF, // Special marker for short header packets
61};

◆ pmtud_state

States for DPLPMTUD state machine (RFC 8899 Section 5.2)

Enumerator
disabled 

PMTUD is disabled.

base 

Using BASE_PLPMTU (minimum MTU)

searching 

Binary search for larger MTU.

search_complete 

Maximum MTU found and validated.

error 

Black hole detected, reset to base.

Definition at line 18 of file pmtud_controller.h.

19{
20 disabled,
21 base,
22 searching,
24 error,
25};
@ search_complete
Maximum MTU found and validated.
@ searching
Binary search for larger MTU.
Result< T > error(int code, const std::string &message, const std::string &source="network_system", const std::string &details="")

◆ recv_stream_state

Stream state for receiving (RFC 9000 Section 3.2)

Enumerator
recv 

Receiving data.

size_known 

FIN received, final size known.

data_recvd 

All data received.

reset_recvd 

RESET_STREAM received.

data_read 

All data read by application (terminal)

reset_read 

Reset acknowledged by application (terminal)

Definition at line 114 of file stream.h.

115{
116 recv,
117 size_known,
118 data_recvd,
120 data_read,
121 reset_read,
122};
@ size_known
FIN received, final size known.
@ data_read
All data read by application (terminal)
@ reset_read
Reset acknowledged by application (terminal)
@ reset_recvd
Reset acknowledged by peer (terminal)
@ data_recvd
All data acknowledged (terminal)

◆ send_stream_state

Stream state for sending (RFC 9000 Section 3.1)

Enumerator
ready 

Stream is ready, can send data.

send 

Sending data.

data_sent 

All data sent, awaiting ACKs.

reset_sent 

RESET_STREAM sent.

reset_recvd 

Reset acknowledged by peer (terminal)

data_recvd 

All data acknowledged (terminal)

Definition at line 101 of file stream.h.

Function Documentation

◆ congestion_state_to_string()

auto kcenon::network::protocols::quic::congestion_state_to_string ( congestion_state state) -> const char*
nodiscardnoexcept

Convert congestion state to string.

Definition at line 13 of file congestion_controller.cpp.

14{
15 switch (state)
16 {
17 case congestion_state::slow_start:
18 return "slow_start";
19 case congestion_state::congestion_avoidance:
20 return "congestion_avoidance";
21 case congestion_state::recovery:
22 return "recovery";
23 default:
24 return "unknown";
25 }
26}

References congestion_avoidance, recovery, and slow_start.

◆ connection_state_to_string()

auto kcenon::network::protocols::quic::connection_state_to_string ( connection_state state) -> const char*
nodiscard

Convert connection state to string.

Definition at line 21 of file connection.cpp.

22{
23 switch (state)
24 {
25 case connection_state::idle:
26 return "idle";
27 case connection_state::handshaking:
28 return "handshaking";
29 case connection_state::connected:
30 return "connected";
31 case connection_state::closing:
32 return "closing";
33 case connection_state::draining:
34 return "draining";
35 case connection_state::closed:
36 return "closed";
37 default:
38 return "unknown";
39 }
40}

References closed, closing, connected, draining, handshaking, and idle.

Referenced by kcenon::network::protocols::quic::connection::receive_packet().

Here is the caller graph for this function:

◆ ecn_result_to_string()

auto kcenon::network::protocols::quic::ecn_result_to_string ( ecn_result result) -> const char*
nodiscardnoexcept

Convert ecn_result to string.

Definition at line 10 of file ecn_tracker.cpp.

11{
12 switch (result)
13 {
14 case ecn_result::none:
15 return "none";
16 case ecn_result::congestion_signal:
17 return "congestion_signal";
18 case ecn_result::ecn_failure:
19 return "ecn_failure";
20 default:
21 return "unknown";
22 }
23}

References congestion_signal, ecn_failure, and none.

◆ encryption_level_count()

auto kcenon::network::protocols::quic::encryption_level_count ( ) -> size_t
nodiscardconstexprnoexcept

Get the encryption level count.

Returns
Number of encryption levels (4)

Definition at line 72 of file keys.h.

73{
74 return 4;
75}

◆ encryption_level_to_string()

auto kcenon::network::protocols::quic::encryption_level_to_string ( encryption_level level) -> std::string
nodiscard

Convert encryption level to string for debugging.

Parameters
levelEncryption level to convert
Returns
String representation of the level

Definition at line 13 of file keys.cpp.

14{
15 switch (level)
16 {
17 case encryption_level::initial:
18 return "Initial";
19 case encryption_level::handshake:
20 return "Handshake";
21 case encryption_level::zero_rtt:
22 return "0-RTT";
23 case encryption_level::application:
24 return "Application";
25 default:
26 return "Unknown";
27 }
28}

References application, handshake, initial, and zero_rtt.

Referenced by kcenon::network::protocols::quic::quic_crypto::get_read_keys(), and kcenon::network::protocols::quic::quic_crypto::get_write_keys().

Here is the caller graph for this function:

◆ frame_type_to_string()

auto kcenon::network::protocols::quic::frame_type_to_string ( frame_type type) -> std::string
nodiscard

Get string name for a frame type.

Definition at line 80 of file frame.cpp.

81{
82 switch (type)
83 {
84 case frame_type::padding: return "PADDING";
85 case frame_type::ping: return "PING";
86 case frame_type::ack: return "ACK";
87 case frame_type::ack_ecn: return "ACK_ECN";
88 case frame_type::reset_stream: return "RESET_STREAM";
89 case frame_type::stop_sending: return "STOP_SENDING";
90 case frame_type::crypto: return "CRYPTO";
91 case frame_type::new_token: return "NEW_TOKEN";
92 case frame_type::stream_base: return "STREAM";
93 case frame_type::max_data: return "MAX_DATA";
94 case frame_type::max_stream_data: return "MAX_STREAM_DATA";
95 case frame_type::max_streams_bidi: return "MAX_STREAMS_BIDI";
96 case frame_type::max_streams_uni: return "MAX_STREAMS_UNI";
97 case frame_type::data_blocked: return "DATA_BLOCKED";
98 case frame_type::stream_data_blocked: return "STREAM_DATA_BLOCKED";
99 case frame_type::streams_blocked_bidi: return "STREAMS_BLOCKED_BIDI";
100 case frame_type::streams_blocked_uni: return "STREAMS_BLOCKED_UNI";
101 case frame_type::new_connection_id: return "NEW_CONNECTION_ID";
102 case frame_type::retire_connection_id: return "RETIRE_CONNECTION_ID";
103 case frame_type::path_challenge: return "PATH_CHALLENGE";
104 case frame_type::path_response: return "PATH_RESPONSE";
105 case frame_type::connection_close: return "CONNECTION_CLOSE";
106 case frame_type::connection_close_app: return "CONNECTION_CLOSE_APP";
107 case frame_type::handshake_done: return "HANDSHAKE_DONE";
108 default: return "UNKNOWN";
109 }
110}

References ack, ack_ecn, connection_close, connection_close_app, crypto, data_blocked, handshake_done, max_data, max_stream_data, max_streams_bidi, max_streams_uni, new_connection_id, new_token, padding, path_challenge, path_response, ping, reset_stream, retire_connection_id, stop_sending, stream_base, stream_data_blocked, streams_blocked_bidi, and streams_blocked_uni.

◆ get_flow_control_stats()

auto kcenon::network::protocols::quic::get_flow_control_stats ( const flow_controller & fc) -> flow_control_stats
nodiscard

Get flow control statistics.

Parameters
fcFlow controller to query
Returns
Flow control statistics

Definition at line 174 of file flow_control.cpp.

175{
176 flow_control_stats stats;
177
178 // Send side
179 stats.send_limit = fc.send_limit();
180 stats.bytes_sent = fc.bytes_sent();
182 stats.send_blocked = fc.is_send_blocked();
183
184 // Receive side
185 stats.receive_limit = fc.receive_limit();
186 stats.bytes_received = fc.bytes_received();
187 stats.bytes_consumed = fc.bytes_consumed();
189
190 return stats;
191}
auto bytes_consumed() const noexcept -> uint64_t
Get bytes consumed by application.
auto receive_limit() const noexcept -> uint64_t
Get our receive limit (advertised as MAX_DATA)
auto is_send_blocked() const noexcept -> bool
Check if send is blocked.
auto available_send_window() const noexcept -> uint64_t
Get available send window.
auto bytes_sent() const noexcept -> uint64_t
Get total bytes sent.
auto send_limit() const noexcept -> uint64_t
Get the current send limit (peer's MAX_DATA)
auto bytes_received() const noexcept -> uint64_t
Get total bytes received.
Statistics for flow control monitoring.

References kcenon::network::protocols::quic::flow_control_stats::bytes_consumed, kcenon::network::protocols::quic::flow_control_stats::bytes_received, kcenon::network::protocols::quic::flow_control_stats::bytes_sent, kcenon::network::protocols::quic::flow_control_stats::receive_limit, kcenon::network::protocols::quic::flow_control_stats::receive_window_available, kcenon::network::protocols::quic::flow_control_stats::send_blocked, kcenon::network::protocols::quic::flow_control_stats::send_limit, and kcenon::network::protocols::quic::flow_control_stats::send_window_available.

◆ get_frame_type()

auto kcenon::network::protocols::quic::get_frame_type ( const frame & f) -> frame_type
nodiscard

Get the frame type for a frame variant.

Definition at line 28 of file frame.cpp.

29{
30 return std::visit([](const auto& fr) -> frame_type {
31 using T = std::decay_t<decltype(fr)>;
32 if constexpr (std::is_same_v<T, padding_frame>)
33 return frame_type::padding;
34 else if constexpr (std::is_same_v<T, ping_frame>)
35 return frame_type::ping;
36 else if constexpr (std::is_same_v<T, ack_frame>)
37 return fr.ecn ? frame_type::ack_ecn : frame_type::ack;
38 else if constexpr (std::is_same_v<T, reset_stream_frame>)
39 return frame_type::reset_stream;
40 else if constexpr (std::is_same_v<T, stop_sending_frame>)
41 return frame_type::stop_sending;
42 else if constexpr (std::is_same_v<T, crypto_frame>)
43 return frame_type::crypto;
44 else if constexpr (std::is_same_v<T, new_token_frame>)
45 return frame_type::new_token;
46 else if constexpr (std::is_same_v<T, stream_frame>)
47 return frame_type::stream_base;
48 else if constexpr (std::is_same_v<T, max_data_frame>)
49 return frame_type::max_data;
50 else if constexpr (std::is_same_v<T, max_stream_data_frame>)
51 return frame_type::max_stream_data;
52 else if constexpr (std::is_same_v<T, max_streams_frame>)
53 return fr.bidirectional ? frame_type::max_streams_bidi
55 else if constexpr (std::is_same_v<T, data_blocked_frame>)
56 return frame_type::data_blocked;
57 else if constexpr (std::is_same_v<T, stream_data_blocked_frame>)
58 return frame_type::stream_data_blocked;
59 else if constexpr (std::is_same_v<T, streams_blocked_frame>)
60 return fr.bidirectional ? frame_type::streams_blocked_bidi
62 else if constexpr (std::is_same_v<T, new_connection_id_frame>)
63 return frame_type::new_connection_id;
64 else if constexpr (std::is_same_v<T, retire_connection_id_frame>)
65 return frame_type::retire_connection_id;
66 else if constexpr (std::is_same_v<T, path_challenge_frame>)
67 return frame_type::path_challenge;
68 else if constexpr (std::is_same_v<T, path_response_frame>)
69 return frame_type::path_response;
70 else if constexpr (std::is_same_v<T, connection_close_frame>)
71 return fr.is_application_error ? frame_type::connection_close_app
73 else if constexpr (std::is_same_v<T, handshake_done_frame>)
74 return frame_type::handshake_done;
75 else
76 return frame_type::padding;
77 }, f);
78}
frame_type
QUIC frame types as defined in RFC 9000 Section 12.4.
Definition frame_types.h:25

References ack, ack_ecn, connection_close, connection_close_app, crypto, data_blocked, handshake_done, max_data, max_stream_data, max_streams_bidi, max_streams_uni, new_connection_id, new_token, padding, path_challenge, path_response, ping, reset_stream, retire_connection_id, stop_sending, stream_base, stream_data_blocked, streams_blocked_bidi, and streams_blocked_uni.

◆ get_stream_flags()

auto kcenon::network::protocols::quic::get_stream_flags ( uint64_t type) -> uint8_t
nodiscardconstexprnoexcept

Extract STREAM flags from frame type.

Definition at line 81 of file frame_types.h.

82{
83 return static_cast<uint8_t>(type & stream_flags::mask);
84}

References kcenon::network::protocols::quic::stream_flags::mask.

Referenced by kcenon::network::protocols::quic::frame_parser::parse().

Here is the caller graph for this function:

◆ handshake_state_to_string()

auto kcenon::network::protocols::quic::handshake_state_to_string ( handshake_state state) -> const char*
nodiscard

Convert handshake state to string.

Definition at line 42 of file connection.cpp.

43{
44 switch (state)
45 {
46 case handshake_state::initial:
47 return "initial";
48 case handshake_state::waiting_server_hello:
49 return "waiting_server_hello";
50 case handshake_state::waiting_finished:
51 return "waiting_finished";
52 case handshake_state::complete:
53 return "complete";
54 default:
55 return "unknown";
56 }
57}

References complete, initial, waiting_finished, and waiting_server_hello.

◆ is_stream_frame()

auto kcenon::network::protocols::quic::is_stream_frame ( uint64_t type) -> bool
nodiscardconstexprnoexcept

Check if a frame type value represents a STREAM frame.

Definition at line 73 of file frame_types.h.

74{
75 return (type >= 0x08 && type <= 0x0f);
76}

Referenced by kcenon::network::protocols::quic::frame_parser::parse().

Here is the caller graph for this function:

◆ make_default_client_params()

auto kcenon::network::protocols::quic::make_default_client_params ( ) -> transport_parameters
nodiscard

Create default client transport parameters.

Returns
Transport parameters with reasonable defaults for a client

Definition at line 640 of file transport_params.cpp.

641{
643
644 // Set reasonable defaults for a client
645 params.max_idle_timeout = 30000; // 30 seconds
646 params.max_udp_payload_size = 65527;
647 params.initial_max_data = 1048576; // 1 MB
648 params.initial_max_stream_data_bidi_local = 262144; // 256 KB
650 params.initial_max_stream_data_uni = 262144;
651 params.initial_max_streams_bidi = 100;
652 params.initial_max_streams_uni = 100;
653 params.ack_delay_exponent = 3;
654 params.max_ack_delay = 25;
656
657 return params;
658}
QUIC transport parameters (RFC 9000 Section 18)
uint64_t max_idle_timeout
Maximum idle timeout in milliseconds (0 = disabled)
uint64_t initial_max_data
Initial maximum data for connection (default: 0)
uint64_t ack_delay_exponent
ACK delay exponent (default: 3, meaning 8 microseconds)
uint64_t initial_max_streams_uni
Initial maximum unidirectional streams.
uint64_t initial_max_streams_bidi
Initial maximum bidirectional streams.
uint64_t max_udp_payload_size
Maximum UDP payload size (default: 65527)
uint64_t initial_max_stream_data_bidi_remote
Initial maximum data for remotely-initiated bidirectional streams.
uint64_t max_ack_delay
Maximum ACK delay in milliseconds (default: 25)
uint64_t active_connection_id_limit
Maximum number of connection IDs from the peer.
uint64_t initial_max_stream_data_bidi_local
Initial maximum data for locally-initiated bidirectional streams.
uint64_t initial_max_stream_data_uni
Initial maximum data for unidirectional streams.

References kcenon::network::protocols::quic::transport_parameters::ack_delay_exponent, kcenon::network::protocols::quic::transport_parameters::active_connection_id_limit, kcenon::network::protocols::quic::transport_parameters::initial_max_data, kcenon::network::protocols::quic::transport_parameters::initial_max_stream_data_bidi_local, kcenon::network::protocols::quic::transport_parameters::initial_max_stream_data_bidi_remote, kcenon::network::protocols::quic::transport_parameters::initial_max_stream_data_uni, kcenon::network::protocols::quic::transport_parameters::initial_max_streams_bidi, kcenon::network::protocols::quic::transport_parameters::initial_max_streams_uni, kcenon::network::protocols::quic::transport_parameters::max_ack_delay, kcenon::network::protocols::quic::transport_parameters::max_idle_timeout, and kcenon::network::protocols::quic::transport_parameters::max_udp_payload_size.

Referenced by kcenon::network::protocols::quic::connection::connection().

Here is the caller graph for this function:

◆ make_default_server_params()

auto kcenon::network::protocols::quic::make_default_server_params ( ) -> transport_parameters
nodiscard

Create default server transport parameters.

Returns
Transport parameters with reasonable defaults for a server

Definition at line 660 of file transport_params.cpp.

661{
663
664 // Set reasonable defaults for a server
665 params.max_idle_timeout = 30000; // 30 seconds
666 params.max_udp_payload_size = 65527;
667 params.initial_max_data = 1048576; // 1 MB
668 params.initial_max_stream_data_bidi_local = 262144; // 256 KB
670 params.initial_max_stream_data_uni = 262144;
671 params.initial_max_streams_bidi = 100;
672 params.initial_max_streams_uni = 100;
673 params.ack_delay_exponent = 3;
674 params.max_ack_delay = 25;
676
677 return params;
678}

References kcenon::network::protocols::quic::transport_parameters::ack_delay_exponent, kcenon::network::protocols::quic::transport_parameters::active_connection_id_limit, kcenon::network::protocols::quic::transport_parameters::initial_max_data, kcenon::network::protocols::quic::transport_parameters::initial_max_stream_data_bidi_local, kcenon::network::protocols::quic::transport_parameters::initial_max_stream_data_bidi_remote, kcenon::network::protocols::quic::transport_parameters::initial_max_stream_data_uni, kcenon::network::protocols::quic::transport_parameters::initial_max_streams_bidi, kcenon::network::protocols::quic::transport_parameters::initial_max_streams_uni, kcenon::network::protocols::quic::transport_parameters::max_ack_delay, kcenon::network::protocols::quic::transport_parameters::max_idle_timeout, and kcenon::network::protocols::quic::transport_parameters::max_udp_payload_size.

Referenced by kcenon::network::protocols::quic::connection::connection().

Here is the caller graph for this function:

◆ make_stream_type()

auto kcenon::network::protocols::quic::make_stream_type ( bool has_fin,
bool has_length,
bool has_offset ) -> uint8_t
nodiscardconstexprnoexcept

Build STREAM frame type from flags.

Definition at line 89 of file frame_types.h.

91{
92 uint8_t type = stream_flags::base;
93 if (has_fin) type |= stream_flags::fin;
94 if (has_length) type |= stream_flags::len;
95 if (has_offset) type |= stream_flags::off;
96 return type;
97}

References kcenon::network::protocols::quic::stream_flags::base, kcenon::network::protocols::quic::stream_flags::fin, kcenon::network::protocols::quic::stream_flags::len, and kcenon::network::protocols::quic::stream_flags::off.

Referenced by kcenon::network::protocols::quic::frame_builder::build_stream().

Here is the caller graph for this function:

◆ packet_type_to_string()

auto kcenon::network::protocols::quic::packet_type_to_string ( packet_type type) -> std::string
nodiscard

Convert packet type to string for debugging.

Definition at line 43 of file packet.cpp.

44{
45 switch (type)
46 {
47 case packet_type::initial: return "Initial";
48 case packet_type::zero_rtt: return "0-RTT";
49 case packet_type::handshake: return "Handshake";
50 case packet_type::retry: return "Retry";
51 case packet_type::one_rtt: return "1-RTT";
52 default: return "Unknown";
53 }
54}

References handshake, initial, one_rtt, retry, and zero_rtt.

◆ pmtud_state_to_string()

auto kcenon::network::protocols::quic::pmtud_state_to_string ( pmtud_state state) -> const char*
nodiscardnoexcept

Convert PMTUD state to string.

Definition at line 12 of file pmtud_controller.cpp.

13{
14 switch (state)
15 {
16 case pmtud_state::disabled:
17 return "disabled";
18 case pmtud_state::base:
19 return "base";
20 case pmtud_state::searching:
21 return "searching";
22 case pmtud_state::search_complete:
23 return "search_complete";
24 case pmtud_state::error:
25 return "error";
26 }
27 return "unknown";
28}

References base, disabled, error, search_complete, and searching.

◆ recv_state_to_string()

auto kcenon::network::protocols::quic::recv_state_to_string ( recv_stream_state state) -> const char*
nodiscard

Get string representation of receive stream state.

Definition at line 498 of file stream.cpp.

499{
500 switch (state) {
501 case recv_stream_state::recv: return "recv";
502 case recv_stream_state::size_known: return "size_known";
503 case recv_stream_state::data_recvd: return "data_recvd";
504 case recv_stream_state::reset_recvd: return "reset_recvd";
505 case recv_stream_state::data_read: return "data_read";
506 case recv_stream_state::reset_read: return "reset_read";
507 default: return "unknown";
508 }
509}

References data_read, data_recvd, recv, reset_read, reset_recvd, and size_known.

◆ send_state_to_string()

auto kcenon::network::protocols::quic::send_state_to_string ( send_stream_state state) -> const char*
nodiscard

Get string representation of send stream state.

Definition at line 485 of file stream.cpp.

486{
487 switch (state) {
488 case send_stream_state::ready: return "ready";
489 case send_stream_state::send: return "send";
490 case send_stream_state::data_sent: return "data_sent";
491 case send_stream_state::reset_sent: return "reset_sent";
492 case send_stream_state::reset_recvd: return "reset_recvd";
493 case send_stream_state::data_recvd: return "data_recvd";
494 default: return "unknown";
495 }
496}

References data_recvd, data_sent, ready, reset_recvd, reset_sent, and send.

Variable Documentation

◆ aead_iv_size

size_t kcenon::network::protocols::quic::aead_iv_size = 12
constexpr

◆ aead_tag_size

size_t kcenon::network::protocols::quic::aead_tag_size = 16
constexpr

AEAD authentication tag size in bytes.

Definition at line 28 of file keys.h.

Referenced by kcenon::network::protocols::quic::packet_protection::protect(), and kcenon::network::protocols::quic::packet_protection::unprotect().

◆ aes_128_key_size

size_t kcenon::network::protocols::quic::aes_128_key_size = 16
constexpr

AES-128-GCM key size in bytes.

Definition at line 19 of file keys.h.

Referenced by kcenon::network::protocols::quic::initial_keys::derive_keys().

◆ aes_256_key_size

size_t kcenon::network::protocols::quic::aes_256_key_size = 32
constexpr

AES-256-GCM key size in bytes.

Definition at line 22 of file keys.h.

◆ hp_key_size

size_t kcenon::network::protocols::quic::hp_key_size = 16
constexpr

Header protection key size for AES-128.

Definition at line 34 of file keys.h.

Referenced by kcenon::network::protocols::quic::initial_keys::derive_keys().

◆ hp_sample_size

size_t kcenon::network::protocols::quic::hp_sample_size = 16
constexpr

◆ initial_salt_v1

std::array<uint8_t, 20> kcenon::network::protocols::quic::initial_salt_v1
constexpr
Initial value:
= {
0x38, 0x76, 0x2c, 0xf7, 0xf5, 0x59, 0x34, 0xb3, 0x4d, 0x17,
0x9a, 0xe6, 0xa4, 0xc8, 0x0c, 0xad, 0xcc, 0xbb, 0x7f, 0x0a
}

QUIC version 1 initial salt (RFC 9001 Section 5.2)

This salt is used to derive the initial secrets from the Destination Connection ID. It is a fixed value defined in the RFC.

Definition at line 36 of file crypto.h.

36 {
37 0x38, 0x76, 0x2c, 0xf7, 0xf5, 0x59, 0x34, 0xb3, 0x4d, 0x17,
38 0x9a, 0xe6, 0xa4, 0xc8, 0x0c, 0xad, 0xcc, 0xbb, 0x7f, 0x0a
39};

Referenced by kcenon::network::protocols::quic::initial_keys::derive(), and kcenon::network::protocols::quic::quic_crypto::derive_zero_rtt_keys().

◆ initial_salt_v2

std::array<uint8_t, 20> kcenon::network::protocols::quic::initial_salt_v2
constexpr
Initial value:
= {
0x0d, 0xed, 0xe3, 0xde, 0xf7, 0x00, 0xa6, 0xdb, 0x81, 0x93,
0x81, 0xbe, 0x6e, 0x26, 0x9d, 0xcb, 0xf9, 0xbd, 0x2e, 0xd9
}

QUIC version 2 initial salt (RFC 9369)

Definition at line 44 of file crypto.h.

44 {
45 0x0d, 0xed, 0xe3, 0xde, 0xf7, 0x00, 0xa6, 0xdb, 0x81, 0x93,
46 0x81, 0xbe, 0x6e, 0x26, 0x9d, 0xcb, 0xf9, 0xbd, 0x2e, 0xd9
47};

Referenced by kcenon::network::protocols::quic::initial_keys::derive().

◆ secret_size

size_t kcenon::network::protocols::quic::secret_size = 32
constexpr

◆ varint_max

uint64_t kcenon::network::protocols::quic::varint_max = 4611686018427387903ULL
constexpr

Maximum value that can be encoded in QUIC variable-length integer.

This is 2^62 - 1, the maximum 62-bit unsigned integer.

Definition at line 21 of file varint.h.

Referenced by kcenon::network::protocols::quic::varint::encode(), kcenon::network::protocols::quic::varint::encode_with_length(), and kcenon::network::protocols::quic::varint::is_valid().