s2n_quic_core/frame/
data_blocked.rs

1// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4use crate::varint::VarInt;
5
6//= https://www.rfc-editor.org/rfc/rfc9000#section-19.12
7//# A sender SHOULD send a DATA_BLOCKED frame (type=0x14) when it wishes
8//# to send data, but is unable to do so due to connection-level flow
9//# control; see Section 4.  DATA_BLOCKED frames can be used as input to
10//# tuning of flow control algorithms; see Section 4.2.
11
12macro_rules! data_blocked_tag {
13    () => {
14        0x14u8
15    };
16}
17
18//= https://www.rfc-editor.org/rfc/rfc9000#section-19.12
19//# DATA_BLOCKED Frame {
20//#   Type (i) = 0x14,
21//#   Maximum Data (i),
22//# }
23
24//= https://www.rfc-editor.org/rfc/rfc9000#section-19.12
25//# DATA_BLOCKED frames contain the following field:
26//#
27//# Maximum Data:  A variable-length integer indicating the connection-
28//#    level limit at which blocking occurred.
29
30#[derive(Copy, Clone, Debug, PartialEq, Eq)]
31pub struct DataBlocked {
32    /// A variable-length integer indicating the connection-level limit
33    /// at which blocking occurred.
34    pub data_limit: VarInt,
35}
36
37impl DataBlocked {
38    pub const fn tag(self) -> u8 {
39        data_blocked_tag!()
40    }
41}
42
43simple_frame_codec!(DataBlocked { data_limit }, data_blocked_tag!());