| 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 <algorithm> | 10 #include <algorithm> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 virtual void SetMaxPacketSize(QuicByteCount max_packet_size) = 0; | 56 virtual void SetMaxPacketSize(QuicByteCount max_packet_size) = 0; |
| 57 | 57 |
| 58 // Called when we receive congestion feedback from remote peer. | 58 // Called when we receive congestion feedback from remote peer. |
| 59 virtual void OnIncomingQuicCongestionFeedbackFrame( | 59 virtual void OnIncomingQuicCongestionFeedbackFrame( |
| 60 const QuicCongestionFeedbackFrame& feedback, | 60 const QuicCongestionFeedbackFrame& feedback, |
| 61 QuicTime feedback_receive_time, | 61 QuicTime feedback_receive_time, |
| 62 const SentPacketsMap& sent_packets) = 0; | 62 const SentPacketsMap& sent_packets) = 0; |
| 63 | 63 |
| 64 // Called for each received ACK, with sequence number from remote peer. | 64 // Called for each received ACK, with sequence number from remote peer. |
| 65 virtual void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number, | 65 virtual void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number, |
| 66 QuicByteCount acked_bytes, | 66 QuicByteCount acked_bytes) = 0; |
| 67 QuicTime::Delta rtt) = 0; | |
| 68 | 67 |
| 69 // Indicates a loss event of one packet. |sequence_number| is the | 68 // Indicates a loss event of one packet. |sequence_number| is the |
| 70 // sequence number of the lost packet. | 69 // sequence number of the lost packet. |
| 71 virtual void OnPacketLost(QuicPacketSequenceNumber sequence_number, | 70 virtual void OnPacketLost(QuicPacketSequenceNumber sequence_number, |
| 72 QuicTime ack_receive_time) = 0; | 71 QuicTime ack_receive_time) = 0; |
| 73 | 72 |
| 74 // Inform that we sent x bytes to the wire, and if that was a retransmission. | 73 // Inform that we sent x bytes to the wire, and if that was a retransmission. |
| 75 // Returns true if the packet should be tracked by the congestion manager, | 74 // Returns true if the packet should be tracked by the congestion manager, |
| 76 // false otherwise. This is used by implementations such as tcp_cubic_sender | 75 // false otherwise. This is used by implementations such as tcp_cubic_sender |
| 77 // that do not count outgoing ACK packets against the congestion window. | 76 // that do not count outgoing ACK packets against the congestion window. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 94 virtual QuicTime::Delta TimeUntilSend( | 93 virtual QuicTime::Delta TimeUntilSend( |
| 95 QuicTime now, | 94 QuicTime now, |
| 96 TransmissionType transmission_type, | 95 TransmissionType transmission_type, |
| 97 HasRetransmittableData has_retransmittable_data, | 96 HasRetransmittableData has_retransmittable_data, |
| 98 IsHandshake handshake) = 0; | 97 IsHandshake handshake) = 0; |
| 99 | 98 |
| 100 // What's the current estimated bandwidth in bytes per second. | 99 // What's the current estimated bandwidth in bytes per second. |
| 101 // Returns 0 when it does not have an estimate. | 100 // Returns 0 when it does not have an estimate. |
| 102 virtual QuicBandwidth BandwidthEstimate() const = 0; | 101 virtual QuicBandwidth BandwidthEstimate() const = 0; |
| 103 | 102 |
| 103 // Updates the smoothed RTT based on a new sample. |
| 104 virtual void UpdateRtt(QuicTime::Delta rtt_sample) = 0; |
| 105 |
| 104 // TODO(satyamshekhar): Monitor MinRtt. | 106 // TODO(satyamshekhar): Monitor MinRtt. |
| 105 virtual QuicTime::Delta SmoothedRtt() const = 0; | 107 virtual QuicTime::Delta SmoothedRtt() const = 0; |
| 106 | 108 |
| 107 // Get the send algorithm specific retransmission delay, called RTO in TCP, | 109 // Get the send algorithm specific retransmission delay, called RTO in TCP, |
| 108 // Note 1: the caller is responsible for sanity checking this value. | 110 // Note 1: the caller is responsible for sanity checking this value. |
| 109 // Note 2: this will return zero if we don't have enough data for an estimate. | 111 // Note 2: this will return zero if we don't have enough data for an estimate. |
| 110 virtual QuicTime::Delta RetransmissionDelay() const = 0; | 112 virtual QuicTime::Delta RetransmissionDelay() const = 0; |
| 111 | 113 |
| 112 // Returns the size of the current congestion window in bytes. Note, this is | 114 // Returns the size of the current congestion window in bytes. Note, this is |
| 113 // not the *available* window. Some send algorithms may not use a congestion | 115 // not the *available* window. Some send algorithms may not use a congestion |
| 114 // window and will return 0. | 116 // window and will return 0. |
| 115 virtual QuicByteCount GetCongestionWindow() const = 0; | 117 virtual QuicByteCount GetCongestionWindow() const = 0; |
| 116 }; | 118 }; |
| 117 | 119 |
| 118 } // namespace net | 120 } // namespace net |
| 119 | 121 |
| 120 #endif // NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ | 122 #endif // NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ |
| OLD | NEW |