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 21 matching lines...) Expand all Loading... |
32 // bytes: the packet size in bytes including Quic Headers. | 32 // bytes: the packet size in bytes including Quic Headers. |
33 // header: the packet header. | 33 // header: the packet header. |
34 // timestamp: the arrival time of the packet. | 34 // timestamp: the arrival time of the packet. |
35 // revived: true if the packet was lost and then recovered with help of a | 35 // revived: true if the packet was lost and then recovered with help of a |
36 // FEC packet. | 36 // FEC packet. |
37 void RecordPacketReceived(QuicByteCount bytes, | 37 void RecordPacketReceived(QuicByteCount bytes, |
38 const QuicPacketHeader& header, | 38 const QuicPacketHeader& header, |
39 QuicTime receipt_time, | 39 QuicTime receipt_time, |
40 bool revived); | 40 bool revived); |
41 | 41 |
| 42 // Checks whether |sequence_number| is missing and less than largest observed. |
| 43 bool IsMissing(QuicPacketSequenceNumber sequence_number); |
| 44 |
42 // Checks if we're still waiting for the packet with |sequence_number|. | 45 // Checks if we're still waiting for the packet with |sequence_number|. |
43 bool IsAwaitingPacket(QuicPacketSequenceNumber sequence_number); | 46 bool IsAwaitingPacket(QuicPacketSequenceNumber sequence_number); |
44 | 47 |
45 // Update the |received_info| for an outgoing ack. | 48 // Update the |received_info| for an outgoing ack. |
46 void UpdateReceivedPacketInfo(ReceivedPacketInfo* received_info, | 49 void UpdateReceivedPacketInfo(ReceivedPacketInfo* received_info, |
47 QuicTime approximate_now); | 50 QuicTime approximate_now); |
48 | 51 |
49 // Should be called before sending an ACK packet, to decide if we need | 52 // Should be called before sending an ACK packet, to decide if we need |
50 // to attach a QuicCongestionFeedbackFrame block. | 53 // to attach a QuicCongestionFeedbackFrame block. |
51 // Returns false if no QuicCongestionFeedbackFrame block is needed. | 54 // Returns false if no QuicCongestionFeedbackFrame block is needed. |
(...skipping 10 matching lines...) Expand all Loading... |
62 // These two are called by OnAckFrame. | 65 // These two are called by OnAckFrame. |
63 // | 66 // |
64 // Updates internal state based on |incoming_ack.received_info|. | 67 // Updates internal state based on |incoming_ack.received_info|. |
65 void UpdatePacketInformationReceivedByPeer(const QuicAckFrame& incoming_ack); | 68 void UpdatePacketInformationReceivedByPeer(const QuicAckFrame& incoming_ack); |
66 // Updates internal state based on |incoming_ack.sent_info|. | 69 // Updates internal state based on |incoming_ack.sent_info|. |
67 void UpdatePacketInformationSentByPeer(const QuicAckFrame& incoming_ack); | 70 void UpdatePacketInformationSentByPeer(const QuicAckFrame& incoming_ack); |
68 | 71 |
69 // Returns whether the peer is missing packets. | 72 // Returns whether the peer is missing packets. |
70 bool HasMissingPackets(); | 73 bool HasMissingPackets(); |
71 | 74 |
| 75 // Returns true when there are new missing packets to be reported within 3 |
| 76 // packets of the largest observed. |
| 77 bool HasNewMissingPackets(); |
| 78 |
72 QuicPacketSequenceNumber peer_largest_observed_packet() { | 79 QuicPacketSequenceNumber peer_largest_observed_packet() { |
73 return peer_largest_observed_packet_; | 80 return peer_largest_observed_packet_; |
74 } | 81 } |
75 | 82 |
76 QuicPacketSequenceNumber least_packet_awaited_by_peer() { | 83 QuicPacketSequenceNumber least_packet_awaited_by_peer() { |
77 return least_packet_awaited_by_peer_; | 84 return least_packet_awaited_by_peer_; |
78 } | 85 } |
79 | 86 |
80 QuicPacketSequenceNumber peer_least_packet_awaiting_ack() { | 87 QuicPacketSequenceNumber peer_least_packet_awaiting_ack() { |
81 return peer_least_packet_awaiting_ack_; | 88 return peer_least_packet_awaiting_ack_; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // no sequence numbers have been received since UpdateReceivedPacketInfo. | 144 // no sequence numbers have been received since UpdateReceivedPacketInfo. |
138 // Needed for calculating delta_time_largest_observed. | 145 // Needed for calculating delta_time_largest_observed. |
139 QuicTime time_largest_observed_; | 146 QuicTime time_largest_observed_; |
140 | 147 |
141 scoped_ptr<ReceiveAlgorithmInterface> receive_algorithm_; | 148 scoped_ptr<ReceiveAlgorithmInterface> receive_algorithm_; |
142 }; | 149 }; |
143 | 150 |
144 } // namespace net | 151 } // namespace net |
145 | 152 |
146 #endif // NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ | 153 #endif // NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ |
OLD | NEW |