OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Manages the packet entropy calculation for both sent and received packets | 5 // Manages the packet entropy calculation for both sent and received packets |
6 // for a connection. | 6 // for a connection. |
7 | 7 |
8 #ifndef NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ | 8 #ifndef NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ |
9 #define NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ | 9 #define NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 DISALLOW_COPY_AND_ASSIGN(EntropyTracker); | 98 DISALLOW_COPY_AND_ASSIGN(EntropyTracker); |
99 }; | 99 }; |
100 | 100 |
101 explicit QuicReceivedPacketManager(QuicConnectionStats* stats); | 101 explicit QuicReceivedPacketManager(QuicConnectionStats* stats); |
102 ~QuicReceivedPacketManager() override; | 102 ~QuicReceivedPacketManager() override; |
103 | 103 |
104 // Updates the internal state concerning which packets have been received. | 104 // Updates the internal state concerning which packets have been received. |
105 // bytes: the packet size in bytes including Quic Headers. | 105 // bytes: the packet size in bytes including Quic Headers. |
106 // header: the packet header. | 106 // header: the packet header. |
107 // timestamp: the arrival time of the packet. | 107 // timestamp: the arrival time of the packet. |
108 void RecordPacketReceived(QuicByteCount bytes, | 108 virtual void RecordPacketReceived(QuicByteCount bytes, |
109 const QuicPacketHeader& header, | 109 const QuicPacketHeader& header, |
110 QuicTime receipt_time); | 110 QuicTime receipt_time); |
111 | 111 |
112 void RecordPacketRevived(QuicPacketNumber packet_number); | 112 virtual void RecordPacketRevived(QuicPacketNumber packet_number); |
113 | 113 |
114 // Checks whether |packet_number| is missing and less than largest observed. | 114 // Checks whether |packet_number| is missing and less than largest observed. |
115 bool IsMissing(QuicPacketNumber packet_number); | 115 virtual bool IsMissing(QuicPacketNumber packet_number); |
116 | 116 |
117 // Checks if we're still waiting for the packet with |packet_number|. | 117 // Checks if we're still waiting for the packet with |packet_number|. |
118 bool IsAwaitingPacket(QuicPacketNumber packet_number); | 118 virtual bool IsAwaitingPacket(QuicPacketNumber packet_number); |
119 | 119 |
120 // Update the |ack_frame| for an outgoing ack. | 120 // Update the |ack_frame| for an outgoing ack. |
121 void UpdateReceivedPacketInfo(QuicAckFrame* ack_frame, | 121 void UpdateReceivedPacketInfo(QuicAckFrame* ack_frame, |
122 QuicTime approximate_now); | 122 QuicTime approximate_now); |
123 | 123 |
124 // QuicReceivedEntropyHashCalculatorInterface | 124 // QuicReceivedEntropyHashCalculatorInterface |
125 // Called by QuicFramer, when the outgoing ack gets truncated, to recalculate | 125 // Called by QuicFramer, when the outgoing ack gets truncated, to recalculate |
126 // the received entropy hash for the truncated ack frame. | 126 // the received entropy hash for the truncated ack frame. |
127 QuicPacketEntropyHash EntropyHash( | 127 QuicPacketEntropyHash EntropyHash( |
128 QuicPacketNumber packet_number) const override; | 128 QuicPacketNumber packet_number) const override; |
129 | 129 |
130 // Updates internal state based on |stop_waiting|. | 130 // Updates internal state based on |stop_waiting|. |
131 void UpdatePacketInformationSentByPeer( | 131 virtual void UpdatePacketInformationSentByPeer( |
132 const QuicStopWaitingFrame& stop_waiting); | 132 const QuicStopWaitingFrame& stop_waiting); |
133 | 133 |
134 // Returns true when there are new missing packets to be reported within 3 | 134 // Returns true when there are new missing packets to be reported within 3 |
135 // packets of the largest observed. | 135 // packets of the largest observed. |
136 bool HasNewMissingPackets() const; | 136 virtual bool HasNewMissingPackets() const; |
137 | 137 |
138 // Returns the number of packets being tracked in the EntropyTracker. | 138 // Returns the number of packets being tracked in the EntropyTracker. |
139 size_t NumTrackedPackets() const; | 139 size_t NumTrackedPackets() const; |
140 | 140 |
141 QuicPacketNumber peer_least_packet_awaiting_ack() { | 141 QuicPacketNumber peer_least_packet_awaiting_ack() { |
142 return peer_least_packet_awaiting_ack_; | 142 return peer_least_packet_awaiting_ack_; |
143 } | 143 } |
144 | 144 |
145 bool ack_frame_updated() const { return ack_frame_updated_; } | 145 virtual bool ack_frame_updated() const; |
146 | 146 |
147 private: | 147 private: |
148 friend class test::QuicConnectionPeer; | 148 friend class test::QuicConnectionPeer; |
149 friend class test::QuicReceivedPacketManagerPeer; | 149 friend class test::QuicReceivedPacketManagerPeer; |
150 | 150 |
151 // Deletes all missing packets before least unacked. The connection won't | 151 // Deletes all missing packets before least unacked. The connection won't |
152 // process any packets with packet number before |least_unacked| that it | 152 // process any packets with packet number before |least_unacked| that it |
153 // received after this call. Returns true if there were missing packets before | 153 // received after this call. Returns true if there were missing packets before |
154 // |least_unacked| unacked, false otherwise. | 154 // |least_unacked| unacked, false otherwise. |
155 bool DontWaitForPacketsBefore(QuicPacketNumber least_unacked); | 155 bool DontWaitForPacketsBefore(QuicPacketNumber least_unacked); |
(...skipping 18 matching lines...) Expand all Loading... |
174 QuicTime time_largest_observed_; | 174 QuicTime time_largest_observed_; |
175 | 175 |
176 QuicConnectionStats* stats_; | 176 QuicConnectionStats* stats_; |
177 | 177 |
178 DISALLOW_COPY_AND_ASSIGN(QuicReceivedPacketManager); | 178 DISALLOW_COPY_AND_ASSIGN(QuicReceivedPacketManager); |
179 }; | 179 }; |
180 | 180 |
181 } // namespace net | 181 } // namespace net |
182 | 182 |
183 #endif // NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ | 183 #endif // NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ |
OLD | NEW |