| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // The pure virtual class for send side congestion control algorithm. | 5 // The pure virtual class for send side congestion control algorithm. |
| 6 | 6 |
| 7 #ifndef NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ | 7 #ifndef NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ |
| 8 #define NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ | 8 #define NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 typedef std::map<QuicPacketSequenceNumber, SentPacket*> SentPacketsMap; | 35 typedef std::map<QuicPacketSequenceNumber, SentPacket*> SentPacketsMap; |
| 36 | 36 |
| 37 static SendAlgorithmInterface* Create(const QuicClock* clock, | 37 static SendAlgorithmInterface* Create(const QuicClock* clock, |
| 38 CongestionFeedbackType type); | 38 CongestionFeedbackType type); |
| 39 | 39 |
| 40 virtual ~SendAlgorithmInterface() {} | 40 virtual ~SendAlgorithmInterface() {} |
| 41 | 41 |
| 42 // Called when we receive congestion feedback from remote peer. | 42 // Called when we receive congestion feedback from remote peer. |
| 43 virtual void OnIncomingQuicCongestionFeedbackFrame( | 43 virtual void OnIncomingQuicCongestionFeedbackFrame( |
| 44 const QuicCongestionFeedbackFrame& feedback, | 44 const QuicCongestionFeedbackFrame& feedback, |
| 45 QuicTime feedback_receive_time, |
| 46 QuicBandwidth sent_bandwidth, |
| 45 const SentPacketsMap& sent_packets) = 0; | 47 const SentPacketsMap& sent_packets) = 0; |
| 46 | 48 |
| 47 // Called for each received ACK, with sequence number from remote peer. | 49 // Called for each received ACK, with sequence number from remote peer. |
| 48 virtual void OnIncomingAck(QuicPacketSequenceNumber acked_sequence_number, | 50 virtual void OnIncomingAck(QuicPacketSequenceNumber acked_sequence_number, |
| 49 QuicByteCount acked_bytes, | 51 QuicByteCount acked_bytes, |
| 50 QuicTime::Delta rtt) = 0; | 52 QuicTime::Delta rtt) = 0; |
| 51 | 53 |
| 52 virtual void OnIncomingLoss(int number_of_lost_packets) = 0; | 54 virtual void OnIncomingLoss(QuicTime ack_receive_time) = 0; |
| 53 | 55 |
| 54 // Inform that we sent x bytes to the wire, and if that was a retransmission. | 56 // Inform that we sent x bytes to the wire, and if that was a retransmission. |
| 55 // Note: this function must be called for every packet sent to the wire. | 57 // Note: this function must be called for every packet sent to the wire. |
| 56 virtual void SentPacket(QuicPacketSequenceNumber sequence_number, | 58 virtual void SentPacket(QuicTime sent_time, |
| 59 QuicPacketSequenceNumber sequence_number, |
| 57 QuicByteCount bytes, | 60 QuicByteCount bytes, |
| 58 bool is_retransmission) = 0; | 61 bool is_retransmission) = 0; |
| 59 | 62 |
| 60 // Calculate the time until we can send the next packet. | 63 // Calculate the time until we can send the next packet. |
| 61 // Usage: When this returns 0, CongestionWindow returns the number of bytes | 64 virtual QuicTime::Delta TimeUntilSend(QuicTime now, |
| 62 // of the congestion window. | 65 bool is_retransmission) = 0; |
| 63 virtual QuicTime::Delta TimeUntilSend(bool is_retransmission) = 0; | |
| 64 | 66 |
| 65 // What's the current estimated bandwidth in bytes per second. | 67 // What's the current estimated bandwidth in bytes per second. |
| 66 // Returns 0 when it does not have an estimate. | 68 // Returns 0 when it does not have an estimate. |
| 67 virtual QuicBandwidth BandwidthEstimate() = 0; | 69 virtual QuicBandwidth BandwidthEstimate() = 0; |
| 68 }; | 70 }; |
| 69 | 71 |
| 70 } // namespace net | 72 } // namespace net |
| 71 | 73 |
| 72 #endif // NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ | 74 #endif // NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ |
| OLD | NEW |