1 // Copyright (c) 2012 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.
5 // Fix rate send side congestion control, used for testing.
7 #ifndef NET_QUIC_CONGESTION_CONTROL_FIX_RATE_SENDER_H_
8 #define NET_QUIC_CONGESTION_CONTROL_FIX_RATE_SENDER_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "net/base/net_export.h"
13 #include "net/quic/quic_clock.h"
14 #include "net/quic/quic_connection_stats.h"
15 #include "net/quic/quic_time.h"
16 #include "net/quic/congestion_control/leaky_bucket.h"
17 #include "net/quic/congestion_control/send_algorithm_interface.h"
23 class NET_EXPORT_PRIVATE FixRateSender
: public SendAlgorithmInterface
{
25 explicit FixRateSender(const RttStats
* rtt_stats
);
26 virtual ~FixRateSender();
28 // Start implementation of SendAlgorithmInterface.
29 virtual void SetFromConfig(const QuicConfig
& config
, bool is_server
) OVERRIDE
;
30 virtual void OnIncomingQuicCongestionFeedbackFrame(
31 const QuicCongestionFeedbackFrame
& feedback
,
32 QuicTime feedback_receive_time
) OVERRIDE
;
33 virtual void OnCongestionEvent(bool rtt_updated
,
34 QuicByteCount bytes_in_flight
,
35 const CongestionMap
& acked_packets
,
36 const CongestionMap
& lost_packets
) OVERRIDE
;
37 virtual bool OnPacketSent(
39 QuicByteCount bytes_in_flight
,
40 QuicPacketSequenceNumber sequence_number
,
42 HasRetransmittableData has_retransmittable_data
) OVERRIDE
;
43 virtual void OnRetransmissionTimeout(bool packets_retransmitted
) OVERRIDE
;
44 virtual void RevertRetransmissionTimeout() OVERRIDE
;
45 virtual QuicTime::Delta
TimeUntilSend(
47 QuicByteCount bytes_in_flight
,
48 HasRetransmittableData has_retransmittable_data
) const OVERRIDE
;
49 virtual QuicBandwidth
BandwidthEstimate() const OVERRIDE
;
50 virtual bool HasReliableBandwidthEstimate() const OVERRIDE
;
51 virtual QuicTime::Delta
RetransmissionDelay() const OVERRIDE
;
52 virtual QuicByteCount
GetCongestionWindow() const OVERRIDE
;
53 // End implementation of SendAlgorithmInterface.
56 QuicByteCount
CongestionWindow() const;
58 const RttStats
* rtt_stats_
;
59 QuicBandwidth bitrate_
;
60 QuicByteCount max_segment_size_
;
61 LeakyBucket fix_rate_leaky_bucket_
;
62 QuicTime::Delta latest_rtt_
;
64 DISALLOW_COPY_AND_ASSIGN(FixRateSender
);
69 #endif // NET_QUIC_CONGESTION_CONTROL_FIX_RATE_SENDER_H_