Home | History | Annotate | Download | only in congestion_control
      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.
      4 //
      5 // Fix rate send side congestion control, used for testing.
      6 
      7 #ifndef NET_QUIC_CONGESTION_CONTROL_FIX_RATE_SENDER_H_
      8 #define NET_QUIC_CONGESTION_CONTROL_FIX_RATE_SENDER_H_
      9 
     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"
     18 
     19 namespace net {
     20 
     21 class RttStats;
     22 
     23 class NET_EXPORT_PRIVATE FixRateSender : public SendAlgorithmInterface {
     24  public:
     25   explicit FixRateSender(const RttStats* rtt_stats);
     26   virtual ~FixRateSender();
     27 
     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(
     38       QuicTime sent_time,
     39       QuicByteCount bytes_in_flight,
     40       QuicPacketSequenceNumber sequence_number,
     41       QuicByteCount bytes,
     42       HasRetransmittableData has_retransmittable_data) OVERRIDE;
     43   virtual void OnRetransmissionTimeout(bool packets_retransmitted) OVERRIDE;
     44   virtual QuicTime::Delta TimeUntilSend(
     45       QuicTime now,
     46       QuicByteCount bytes_in_flight,
     47       HasRetransmittableData has_retransmittable_data) const OVERRIDE;
     48   virtual QuicBandwidth BandwidthEstimate() const OVERRIDE;
     49   virtual QuicTime::Delta RetransmissionDelay() const OVERRIDE;
     50   virtual QuicByteCount GetCongestionWindow() const OVERRIDE;
     51   // End implementation of SendAlgorithmInterface.
     52 
     53  private:
     54   QuicByteCount CongestionWindow() const;
     55 
     56   const RttStats* rtt_stats_;
     57   QuicBandwidth bitrate_;
     58   QuicByteCount max_segment_size_;
     59   LeakyBucket fix_rate_leaky_bucket_;
     60   QuicTime::Delta latest_rtt_;
     61 
     62   DISALLOW_COPY_AND_ASSIGN(FixRateSender);
     63 };
     64 
     65 }  // namespace net
     66 
     67 #endif  // NET_QUIC_CONGESTION_CONTROL_FIX_RATE_SENDER_H_
     68