xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/core/frames/quic_ack_frequency_frame.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright (c) 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef QUICHE_QUIC_CORE_FRAMES_QUIC_ACK_FREQUENCY_FRAME_H_
6 #define QUICHE_QUIC_CORE_FRAMES_QUIC_ACK_FREQUENCY_FRAME_H_
7 
8 #include <cstdint>
9 #include <ostream>
10 
11 #include "quiche/quic/core/quic_constants.h"
12 #include "quiche/quic/core/quic_time.h"
13 #include "quiche/quic/core/quic_types.h"
14 #include "quiche/quic/platform/api/quic_export.h"
15 
16 namespace quic {
17 
18 // A frame that allows sender control of acknowledgement delays.
19 struct QUICHE_EXPORT QuicAckFrequencyFrame {
20   friend QUICHE_EXPORT std::ostream& operator<<(
21       std::ostream& os, const QuicAckFrequencyFrame& ack_frequency_frame);
22 
23   QuicAckFrequencyFrame() = default;
24   QuicAckFrequencyFrame(QuicControlFrameId control_frame_id,
25                         uint64_t sequence_number, uint64_t packet_tolerance,
26                         QuicTime::Delta max_ack_delay);
27 
28   // A unique identifier of this control frame. 0 when this frame is
29   // received, and non-zero when sent.
30   QuicControlFrameId control_frame_id = kInvalidControlFrameId;
31 
32   // If true, do not ack immediately upon observeation of packet reordering.
33   bool ignore_order = false;
34 
35   // Sequence number assigned to the ACK_FREQUENCY frame by the sender to allow
36   // receivers to ignore obsolete frames.
37   uint64_t sequence_number = 0;
38 
39   // The maximum number of ack-eliciting packets after which the receiver sends
40   // an acknowledgement. Invald if == 0.
41   uint64_t packet_tolerance = 2;
42 
43   // The maximum time that ack packets can be delayed.
44   QuicTime::Delta max_ack_delay =
45       QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
46 };
47 
48 }  // namespace quic
49 
50 #endif  // QUICHE_QUIC_CORE_FRAMES_QUIC_ACK_FREQUENCY_FRAME_H_
51