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