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_time.h"
     15 #include "net/quic/congestion_control/leaky_bucket.h"
     16 #include "net/quic/congestion_control/paced_sender.h"
     17 #include "net/quic/congestion_control/send_algorithm_interface.h"
     18 
     19 namespace net {
     20 
     21 class NET_EXPORT_PRIVATE FixRateSender : public SendAlgorithmInterface {
     22  public:
     23   explicit FixRateSender(const QuicClock* clock);
     24   virtual ~FixRateSender();
     25 
     26   // Start implementation of SendAlgorithmInterface.
     27   virtual void OnIncomingQuicCongestionFeedbackFrame(
     28       const QuicCongestionFeedbackFrame& feedback,
     29       QuicTime feedback_receive_time,
     30       const SentPacketsMap& sent_packets) OVERRIDE;
     31   virtual void OnIncomingAck(QuicPacketSequenceNumber acked_sequence_number,
     32                              QuicByteCount acked_bytes,
     33                              QuicTime::Delta rtt) OVERRIDE;
     34   virtual void OnIncomingLoss(QuicTime ack_receive_time) OVERRIDE;
     35   virtual void SentPacket(QuicTime sent_time,
     36                           QuicPacketSequenceNumber equence_number,
     37                           QuicByteCount bytes,
     38                           Retransmission is_retransmission) OVERRIDE;
     39   virtual void AbandoningPacket(QuicPacketSequenceNumber sequence_number,
     40                                 QuicByteCount abandoned_bytes) OVERRIDE;
     41   virtual QuicTime::Delta TimeUntilSend(
     42       QuicTime now,
     43       Retransmission is_retransmission,
     44       HasRetransmittableData has_retransmittable_data,
     45       IsHandshake handshake) OVERRIDE;
     46   virtual QuicBandwidth BandwidthEstimate() OVERRIDE;
     47   virtual QuicTime::Delta SmoothedRtt() OVERRIDE;
     48   virtual QuicTime::Delta RetransmissionDelay() OVERRIDE;
     49   // End implementation of SendAlgorithmInterface.
     50 
     51  private:
     52   QuicByteCount CongestionWindow();
     53 
     54   QuicBandwidth bitrate_;
     55   LeakyBucket fix_rate_leaky_bucket_;
     56   PacedSender paced_sender_;
     57   QuicByteCount data_in_flight_;
     58   QuicTime::Delta latest_rtt_;
     59 
     60   DISALLOW_COPY_AND_ASSIGN(FixRateSender);
     61 };
     62 
     63 }  // namespace net
     64 
     65 #endif  // NET_QUIC_CONGESTION_CONTROL_FIX_RATE_SENDER_H_
     66