s2n_quic_core/frame/
max_data.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.9
7//# A MAX_DATA frame (type=0x10) is used in flow control to inform the
8//# peer of the maximum amount of data that can be sent on the connection
9//# as a whole.
10
11macro_rules! max_data_tag {
12    () => {
13        0x10u8
14    };
15}
16
17//= https://www.rfc-editor.org/rfc/rfc9000#section-19.9
18//# MAX_DATA Frame {
19//#   Type (i) = 0x10,
20//#   Maximum Data (i),
21//# }
22
23//= https://www.rfc-editor.org/rfc/rfc9000#section-19.9
24//# MAX_DATA frames contain the following field:
25//#
26//# Maximum Data:  A variable-length integer indicating the maximum
27//#    amount of data that can be sent on the entire connection, in units
28//#    of bytes.
29
30#[derive(Copy, Clone, Debug, PartialEq, Eq)]
31pub struct MaxData {
32    /// A variable-length integer indicating the maximum amount of data
33    /// that can be sent on the entire connection, in units of bytes.
34    pub maximum_data: VarInt,
35}
36
37impl MaxData {
38    pub const fn tag(self) -> u8 {
39        max_data_tag!()
40    }
41}
42
43simple_frame_codec!(MaxData { maximum_data }, max_data_tag!());