fix_rate_sender.h revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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 19namespace net { 20 21class 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 QuicBandwidth sent_bandwidth, 31 const SentPacketsMap& sent_packets) OVERRIDE; 32 virtual void OnIncomingAck(QuicPacketSequenceNumber acked_sequence_number, 33 QuicByteCount acked_bytes, 34 QuicTime::Delta rtt) OVERRIDE; 35 virtual void OnIncomingLoss(QuicTime ack_receive_time) OVERRIDE; 36 virtual void SentPacket(QuicTime sent_time, 37 QuicPacketSequenceNumber equence_number, 38 QuicByteCount bytes, 39 bool is_retransmission) OVERRIDE; 40 virtual void AbandoningPacket(QuicPacketSequenceNumber sequence_number, 41 QuicByteCount abandoned_bytes) OVERRIDE; 42 virtual QuicTime::Delta TimeUntilSend(QuicTime now, 43 bool is_retransmission, 44 bool has_retransmittable_data) OVERRIDE; 45 virtual QuicBandwidth BandwidthEstimate() OVERRIDE; 46 virtual QuicTime::Delta SmoothedRtt() OVERRIDE; 47 // End implementation of SendAlgorithmInterface. 48 49 private: 50 QuicByteCount CongestionWindow(); 51 52 QuicBandwidth bitrate_; 53 LeakyBucket fix_rate_leaky_bucket_; 54 PacedSender paced_sender_; 55 QuicByteCount data_in_flight_; 56 QuicTime::Delta latest_rtt_; 57 58 DISALLOW_COPY_AND_ASSIGN(FixRateSender); 59}; 60 61} // namespace net 62 63#endif // NET_QUIC_CONGESTION_CONTROL_FIX_RATE_SENDER_H_ 64