Skip to content

Commit 6461db8

Browse files
committed
feat: support quic-multipath
1 parent d3a90fc commit 6461db8

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

src/events/quic.rs

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ pub struct PacketHeader {
6969
pub key_phase_bit: Option<bool>,
7070
pub packet_number_length: Option<u8>,
7171
pub packet_number: Option<u64>,
72+
pub path_id: Option<u64>,
7273

7374
pub token: Option<Token>,
7475

@@ -113,6 +114,7 @@ impl PacketHeader {
113114
PacketHeader {
114115
packet_type,
115116
packet_number,
117+
path_id: None,
116118
token,
117119
length,
118120
version,
@@ -222,6 +224,12 @@ pub enum TransportError {
222224
AeadLimitReached,
223225
NoViablePath,
224226
Unknown,
227+
// Multipath error codes:
228+
// https://www.ietf.org/archive/id/draft-ietf-quic-multipath-17.html#name-error-codes
229+
ApplicationAbandonPath,
230+
PathResourceLimitReached,
231+
PathUnstableOrPoor,
232+
NoCidsAvailableForPath,
225233
}
226234

227235
#[derive(Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Debug)]
@@ -440,6 +448,15 @@ pub enum QuicFrameTypeName {
440448
ApplicationClose,
441449
HandshakeDone,
442450
Datagram,
451+
PathAck,
452+
PathAbandon,
453+
PathStatusAvailable,
454+
PathStatusBackup,
455+
PathNewConnectionId,
456+
PathRetireConnectionId,
457+
MaxPathId,
458+
PathsBlocked,
459+
PathCidsBlocked,
443460
#[default]
444461
Unknown,
445462
}
@@ -583,6 +600,70 @@ pub enum QuicFrame {
583600
raw: Option<RawInfo>,
584601
},
585602

603+
// Extension: QUIC Multipath
604+
// https://datatracker.ietf.org/doc/draft-ietf-quic-multipath/17/
605+
PathAck {
606+
path_id: u64,
607+
ack_delay: Option<f32>,
608+
acked_ranges: Option<AckedRanges>,
609+
610+
ect1: Option<u64>,
611+
ect0: Option<u64>,
612+
ce: Option<u64>,
613+
614+
raw: Option<RawInfo>,
615+
},
616+
617+
PathAbandon {
618+
path_id: u64,
619+
error_code: u64,
620+
raw: Option<RawInfo>,
621+
},
622+
623+
PathStatusAvailable {
624+
path_id: u64,
625+
path_status_sequence_number: u64,
626+
raw: Option<RawInfo>,
627+
},
628+
629+
PathStatusBackup {
630+
path_id: u64,
631+
path_status_sequence_number: u64,
632+
raw: Option<RawInfo>,
633+
},
634+
635+
PathNewConnectionId {
636+
path_id: u64,
637+
sequence_number: u64,
638+
retire_prior_to: u64,
639+
connection_id_length: Option<u8>,
640+
connection_id: Bytes,
641+
stateless_reset_token: Option<StatelessResetToken>,
642+
raw: Option<RawInfo>,
643+
},
644+
645+
PathRetireConnectionId {
646+
path_id: u64,
647+
sequence_number: u64,
648+
raw: Option<RawInfo>,
649+
},
650+
651+
MaxPathId {
652+
maximum_path_id: u64,
653+
raw: Option<RawInfo>,
654+
},
655+
656+
PathsBlocked {
657+
maximum_path_id: u64,
658+
raw: Option<RawInfo>,
659+
},
660+
661+
PathCidsBlocked {
662+
path_id: u64,
663+
next_sequence_number: u64,
664+
raw: Option<RawInfo>,
665+
},
666+
586667
Unknown {
587668
frame_type_bytes: Option<u64>,
588669
raw: Option<RawInfo>,
@@ -654,6 +735,10 @@ pub struct ParametersSet {
654735

655736
pub preferred_address: Option<PreferredAddress>,
656737

738+
/// Extension: QUIC Multipath
739+
/// <https://datatracker.ietf.org/doc/draft-ietf-quic-multipath/17/>
740+
pub initial_max_path_id: Option<u64>,
741+
657742
pub unknown_parameters: Vec<UnknownTransportParameter>,
658743

659744
pub max_datagram_frame_size: Option<u64>,
@@ -972,6 +1057,8 @@ pub struct RecoveryParametersSet {
9721057
#[serde_with::skip_serializing_none]
9731058
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug, Default)]
9741059
pub struct RecoveryMetricsUpdated {
1060+
pub path_id: Option<u64>,
1061+
9751062
pub min_rtt: Option<f32>,
9761063
pub smoothed_rtt: Option<f32>,
9771064
pub latest_rtt: Option<f32>,
@@ -993,6 +1080,8 @@ pub struct RecoveryMetricsUpdated {
9931080
#[serde_with::skip_serializing_none]
9941081
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug, Default)]
9951082
pub struct CongestionStateUpdated {
1083+
pub path_id: Option<u64>,
1084+
9961085
pub old: Option<String>,
9971086
pub new: String,
9981087

@@ -1002,6 +1091,8 @@ pub struct CongestionStateUpdated {
10021091
#[serde_with::skip_serializing_none]
10031092
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
10041093
pub struct TimerUpdated {
1094+
pub path_id: Option<u64>,
1095+
10051096
pub timer_type: Option<TimerType>,
10061097
pub timer_id: Option<u64>,
10071098
pub packet_number_space: Option<PacketNumberSpace>,

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
//! let event_data =
133133
//! qlog::events::EventData::PacketSent(qlog::events::quic::PacketSent {
134134
//! header: pkt_hdr,
135+
//! path_id: None,
135136
//! frames: Some(frames.into()),
136137
//! stateless_reset_token: None,
137138
//! supported_versions: None,
@@ -337,6 +338,7 @@
337338
//! let event_data =
338339
//! qlog::events::EventData::PacketSent(qlog::events::quic::PacketSent {
339340
//! header: pkt_hdr,
341+
//! path_id: None,
340342
//! frames: Some(vec![ping, padding].into()),
341343
//! stateless_reset_token: None,
342344
//! supported_versions: None,

0 commit comments

Comments
 (0)