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 24 matching lines...) Expand all Loading... |
35 QuicConnectionStats* stats); | 35 QuicConnectionStats* stats); |
36 | 36 |
37 virtual ~SendAlgorithmInterface() {} | 37 virtual ~SendAlgorithmInterface() {} |
38 | 38 |
39 virtual void SetFromConfig(const QuicConfig& config, bool is_server) = 0; | 39 virtual void SetFromConfig(const QuicConfig& config, bool is_server) = 0; |
40 | 40 |
41 // Sets the number of connections to emulate when doing congestion control, | 41 // Sets the number of connections to emulate when doing congestion control, |
42 // particularly for congestion avoidance. Can be set any time. | 42 // particularly for congestion avoidance. Can be set any time. |
43 virtual void SetNumEmulatedConnections(int num_connections) = 0; | 43 virtual void SetNumEmulatedConnections(int num_connections) = 0; |
44 | 44 |
45 // Called when we receive congestion feedback from remote peer. | |
46 virtual void OnIncomingQuicCongestionFeedbackFrame( | |
47 const QuicCongestionFeedbackFrame& feedback, | |
48 QuicTime feedback_receive_time) = 0; | |
49 | |
50 // Indicates an update to the congestion state, caused either by an incoming | 45 // Indicates an update to the congestion state, caused either by an incoming |
51 // ack or loss event timeout. |rtt_updated| indicates whether a new | 46 // ack or loss event timeout. |rtt_updated| indicates whether a new |
52 // latest_rtt sample has been taken, |byte_in_flight| the bytes in flight | 47 // latest_rtt sample has been taken, |byte_in_flight| the bytes in flight |
53 // prior to the congestion event. |acked_packets| and |lost_packets| are | 48 // prior to the congestion event. |acked_packets| and |lost_packets| are |
54 // any packets considered acked or lost as a result of the congestion event. | 49 // any packets considered acked or lost as a result of the congestion event. |
55 virtual void OnCongestionEvent(bool rtt_updated, | 50 virtual void OnCongestionEvent(bool rtt_updated, |
56 QuicByteCount bytes_in_flight, | 51 QuicByteCount bytes_in_flight, |
57 const CongestionVector& acked_packets, | 52 const CongestionVector& acked_packets, |
58 const CongestionVector& lost_packets) = 0; | 53 const CongestionVector& lost_packets) = 0; |
59 | 54 |
(...skipping 15 matching lines...) Expand all Loading... |
75 | 70 |
76 // Called when the last retransmission timeout was spurious. | 71 // Called when the last retransmission timeout was spurious. |
77 virtual void RevertRetransmissionTimeout() = 0; | 72 virtual void RevertRetransmissionTimeout() = 0; |
78 | 73 |
79 // Calculate the time until we can send the next packet. | 74 // Calculate the time until we can send the next packet. |
80 virtual QuicTime::Delta TimeUntilSend( | 75 virtual QuicTime::Delta TimeUntilSend( |
81 QuicTime now, | 76 QuicTime now, |
82 QuicByteCount bytes_in_flight, | 77 QuicByteCount bytes_in_flight, |
83 HasRetransmittableData has_retransmittable_data) const = 0; | 78 HasRetransmittableData has_retransmittable_data) const = 0; |
84 | 79 |
| 80 // The pacing rate of the send algorithm. May be zero if the rate is unknown. |
85 virtual QuicBandwidth PacingRate() const = 0; | 81 virtual QuicBandwidth PacingRate() const = 0; |
86 | 82 |
87 // What's the current estimated bandwidth in bytes per second. | 83 // What's the current estimated bandwidth in bytes per second. |
88 // Returns 0 when it does not have an estimate. | 84 // Returns 0 when it does not have an estimate. |
89 virtual QuicBandwidth BandwidthEstimate() const = 0; | 85 virtual QuicBandwidth BandwidthEstimate() const = 0; |
90 | 86 |
91 // Returns true if the current bandwidth estimate is reliable. | 87 // Returns true if the current bandwidth estimate is reliable. |
92 virtual bool HasReliableBandwidthEstimate() const = 0; | 88 virtual bool HasReliableBandwidthEstimate() const = 0; |
93 | 89 |
94 // Get the send algorithm specific retransmission delay, called RTO in TCP, | 90 // Get the send algorithm specific retransmission delay, called RTO in TCP, |
(...skipping 17 matching lines...) Expand all Loading... |
112 // aka ssthresh. Some send algorithms do not define a slow start | 108 // aka ssthresh. Some send algorithms do not define a slow start |
113 // threshold and will return 0. | 109 // threshold and will return 0. |
114 virtual QuicByteCount GetSlowStartThreshold() const = 0; | 110 virtual QuicByteCount GetSlowStartThreshold() const = 0; |
115 | 111 |
116 virtual CongestionControlType GetCongestionControlType() const = 0; | 112 virtual CongestionControlType GetCongestionControlType() const = 0; |
117 }; | 113 }; |
118 | 114 |
119 } // namespace net | 115 } // namespace net |
120 | 116 |
121 #endif // NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ | 117 #endif // NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ |
OLD | NEW |