| 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 14 matching lines...) Expand all Loading... |
| 25 class NET_EXPORT_PRIVATE QuicReceivedPacketManager : | 25 class NET_EXPORT_PRIVATE QuicReceivedPacketManager : |
| 26 public QuicReceivedEntropyHashCalculatorInterface { | 26 public QuicReceivedEntropyHashCalculatorInterface { |
| 27 public: | 27 public: |
| 28 explicit QuicReceivedPacketManager(CongestionFeedbackType congestion_type); | 28 explicit QuicReceivedPacketManager(CongestionFeedbackType congestion_type); |
| 29 virtual ~QuicReceivedPacketManager(); | 29 virtual ~QuicReceivedPacketManager(); |
| 30 | 30 |
| 31 // Updates the internal state concerning which packets have been received. | 31 // Updates the internal state concerning which packets have been received. |
| 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 | |
| 36 // FEC packet. | |
| 37 void RecordPacketReceived(QuicByteCount bytes, | 35 void RecordPacketReceived(QuicByteCount bytes, |
| 38 const QuicPacketHeader& header, | 36 const QuicPacketHeader& header, |
| 39 QuicTime receipt_time, | 37 QuicTime receipt_time); |
| 40 bool revived); | 38 |
| 39 void RecordPacketRevived(QuicPacketSequenceNumber sequence_number); |
| 41 | 40 |
| 42 // Checks whether |sequence_number| is missing and less than largest observed. | 41 // Checks whether |sequence_number| is missing and less than largest observed. |
| 43 bool IsMissing(QuicPacketSequenceNumber sequence_number); | 42 bool IsMissing(QuicPacketSequenceNumber sequence_number); |
| 44 | 43 |
| 45 // Checks if we're still waiting for the packet with |sequence_number|. | 44 // Checks if we're still waiting for the packet with |sequence_number|. |
| 46 bool IsAwaitingPacket(QuicPacketSequenceNumber sequence_number); | 45 bool IsAwaitingPacket(QuicPacketSequenceNumber sequence_number); |
| 47 | 46 |
| 48 // Update the |received_info| for an outgoing ack. | 47 // Update the |received_info| for an outgoing ack. |
| 49 void UpdateReceivedPacketInfo(ReceivedPacketInfo* received_info, | 48 void UpdateReceivedPacketInfo(ReceivedPacketInfo* received_info, |
| 50 QuicTime approximate_now); | 49 QuicTime approximate_now); |
| 51 | 50 |
| 52 // Should be called before sending an ACK packet, to decide if we need | 51 // Should be called before sending an ACK packet, to decide if we need |
| 53 // to attach a QuicCongestionFeedbackFrame block. | 52 // to attach a QuicCongestionFeedbackFrame block. |
| 54 // Returns false if no QuicCongestionFeedbackFrame block is needed. | 53 // Returns false if no QuicCongestionFeedbackFrame block is needed. |
| 55 // Otherwise fills in feedback and returns true. | 54 // Otherwise fills in feedback and returns true. |
| 56 virtual bool GenerateCongestionFeedback( | 55 virtual bool GenerateCongestionFeedback( |
| 57 QuicCongestionFeedbackFrame* feedback); | 56 QuicCongestionFeedbackFrame* feedback); |
| 58 | 57 |
| 59 // QuicReceivedEntropyHashCalculatorInterface | 58 // QuicReceivedEntropyHashCalculatorInterface |
| 60 // Called by QuicFramer, when the outgoing ack gets truncated, to recalculate | 59 // Called by QuicFramer, when the outgoing ack gets truncated, to recalculate |
| 61 // the received entropy hash for the truncated ack frame. | 60 // the received entropy hash for the truncated ack frame. |
| 62 virtual QuicPacketEntropyHash EntropyHash( | 61 virtual QuicPacketEntropyHash EntropyHash( |
| 63 QuicPacketSequenceNumber sequence_number) const OVERRIDE; | 62 QuicPacketSequenceNumber sequence_number) const OVERRIDE; |
| 64 | 63 |
| 65 // These two are called by OnAckFrame. | 64 // Updates internal state based on |received_info|. |
| 66 // | 65 void UpdatePacketInformationReceivedByPeer( |
| 67 // Updates internal state based on |incoming_ack.received_info|. | 66 const ReceivedPacketInfo& received_nfo); |
| 68 void UpdatePacketInformationReceivedByPeer(const QuicAckFrame& incoming_ack); | 67 // Updates internal state based on |sent_info|. |
| 69 // Updates internal state based on |incoming_ack.sent_info|. | 68 void UpdatePacketInformationSentByPeer(const SentPacketInfo& sent_info); |
| 70 void UpdatePacketInformationSentByPeer(const QuicAckFrame& incoming_ack); | |
| 71 | 69 |
| 72 // Returns whether the peer is missing packets. | 70 // Returns whether the peer is missing packets. |
| 73 bool HasMissingPackets(); | 71 bool HasMissingPackets(); |
| 74 | 72 |
| 75 // Returns true when there are new missing packets to be reported within 3 | 73 // Returns true when there are new missing packets to be reported within 3 |
| 76 // packets of the largest observed. | 74 // packets of the largest observed. |
| 77 bool HasNewMissingPackets(); | 75 bool HasNewMissingPackets(); |
| 78 | 76 |
| 79 QuicPacketSequenceNumber peer_largest_observed_packet() { | 77 QuicPacketSequenceNumber peer_largest_observed_packet() { |
| 80 return peer_largest_observed_packet_; | 78 return peer_largest_observed_packet_; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // no sequence numbers have been received since UpdateReceivedPacketInfo. | 142 // no sequence numbers have been received since UpdateReceivedPacketInfo. |
| 145 // Needed for calculating delta_time_largest_observed. | 143 // Needed for calculating delta_time_largest_observed. |
| 146 QuicTime time_largest_observed_; | 144 QuicTime time_largest_observed_; |
| 147 | 145 |
| 148 scoped_ptr<ReceiveAlgorithmInterface> receive_algorithm_; | 146 scoped_ptr<ReceiveAlgorithmInterface> receive_algorithm_; |
| 149 }; | 147 }; |
| 150 | 148 |
| 151 } // namespace net | 149 } // namespace net |
| 152 | 150 |
| 153 #endif // NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ | 151 #endif // NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ |
| OLD | NEW |