s2n_quic_core/frame/
congestion_controlled.rs

1// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4//= https://www.rfc-editor.org/rfc/rfc9002#section-7
5//# Similar to TCP, packets containing only ACK frames do not count
6//# towards bytes in flight and are not congestion controlled.
7
8/// Trait to retrieve CongestionControlled for a given value
9pub trait CongestionControlled {
10    #[inline]
11    fn is_congestion_controlled(&self) -> bool {
12        true
13    }
14}
15
16impl<AckRanges> CongestionControlled for crate::frame::Ack<AckRanges> {
17    #[inline]
18    fn is_congestion_controlled(&self) -> bool {
19        false
20    }
21}
22impl CongestionControlled for crate::frame::ConnectionClose<'_> {}
23impl<Data> CongestionControlled for crate::frame::Crypto<Data> {}
24//= https://www.rfc-editor.org/rfc/rfc9221#section-5.4
25//# DATAGRAM frames employ the QUIC connection's congestion controller.
26impl<Data> CongestionControlled for crate::frame::Datagram<Data> {}
27impl CongestionControlled for crate::frame::DataBlocked {}
28//= https://www.rfc-editor.org/rfc/rfc9000#section-19.21
29//# Extension frames MUST be congestion controlled and MUST cause
30//# an ACK frame to be sent.
31impl CongestionControlled for crate::frame::DcStatelessResetTokens<'_> {}
32impl CongestionControlled for crate::frame::HandshakeDone {}
33impl CongestionControlled for crate::frame::MaxData {}
34impl CongestionControlled for crate::frame::MaxStreamData {}
35impl CongestionControlled for crate::frame::MaxStreams {}
36impl CongestionControlled for crate::frame::NewConnectionId<'_> {}
37impl CongestionControlled for crate::frame::NewToken<'_> {}
38impl CongestionControlled for crate::frame::Padding {
39    //= https://www.rfc-editor.org/rfc/rfc9002#section-2
40    //= type=exception
41    //= reason=https://github.com/aws/s2n-quic/pull/1514
42    //# Packets are considered in flight when they are ack-eliciting or contain a PADDING frame
43
44    //= https://www.rfc-editor.org/rfc/rfc9002#section-3
45    //= type=exception
46    //= reason=https://github.com/aws/s2n-quic/pull/1514
47    //# PADDING frames cause packets to contribute toward bytes in
48    //# flight without directly causing an acknowledgment to be sent.
49
50    #[inline]
51    fn is_congestion_controlled(&self) -> bool {
52        false
53    }
54}
55impl CongestionControlled for crate::frame::PathChallenge<'_> {}
56impl CongestionControlled for crate::frame::PathResponse<'_> {}
57impl CongestionControlled for crate::frame::Ping {}
58impl CongestionControlled for crate::frame::ResetStream {}
59impl CongestionControlled for crate::frame::RetireConnectionId {}
60impl CongestionControlled for crate::frame::StopSending {}
61impl CongestionControlled for crate::frame::StreamsBlocked {}
62impl CongestionControlled for crate::frame::StreamDataBlocked {}
63impl<Data> CongestionControlled for crate::frame::Stream<Data> {}