xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/core/congestion_control/bbr2_drain.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2019 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_CONGESTION_CONTROL_BBR2_DRAIN_H_
6 #define QUICHE_QUIC_CORE_CONGESTION_CONTROL_BBR2_DRAIN_H_
7 
8 #include "quiche/quic/core/congestion_control/bbr2_misc.h"
9 #include "quiche/quic/core/quic_time.h"
10 #include "quiche/quic/core/quic_types.h"
11 #include "quiche/quic/platform/api/quic_export.h"
12 
13 namespace quic {
14 
15 class Bbr2Sender;
16 class QUICHE_EXPORT Bbr2DrainMode final : public Bbr2ModeBase {
17  public:
18   using Bbr2ModeBase::Bbr2ModeBase;
19 
Enter(QuicTime,const Bbr2CongestionEvent *)20   void Enter(QuicTime /*now*/,
21              const Bbr2CongestionEvent* /*congestion_event*/) override {}
Leave(QuicTime,const Bbr2CongestionEvent *)22   void Leave(QuicTime /*now*/,
23              const Bbr2CongestionEvent* /*congestion_event*/) override {}
24 
25   Bbr2Mode OnCongestionEvent(
26       QuicByteCount prior_in_flight, QuicTime event_time,
27       const AckedPacketVector& acked_packets,
28       const LostPacketVector& lost_packets,
29       const Bbr2CongestionEvent& congestion_event) override;
30 
GetCwndLimits()31   Limits<QuicByteCount> GetCwndLimits() const override {
32     return NoGreaterThan(model_->inflight_lo());
33   }
34 
IsProbingForBandwidth()35   bool IsProbingForBandwidth() const override { return false; }
36 
OnExitQuiescence(QuicTime,QuicTime)37   Bbr2Mode OnExitQuiescence(QuicTime /*now*/,
38                             QuicTime /*quiescence_start_time*/) override {
39     return Bbr2Mode::DRAIN;
40   }
41 
42   struct QUICHE_EXPORT DebugState {
43     QuicByteCount drain_target;
44   };
45 
46   DebugState ExportDebugState() const;
47 
48  private:
49   const Bbr2Params& Params() const;
50 
51   QuicByteCount DrainTarget() const;
52 };
53 
54 QUICHE_EXPORT std::ostream& operator<<(std::ostream& os,
55                                        const Bbr2DrainMode::DebugState& state);
56 
57 }  // namespace quic
58 
59 #endif  // QUICHE_QUIC_CORE_CONGESTION_CONTROL_BBR2_DRAIN_H_
60