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_SENT_ENTROPY_MANAGER_H_ | 8 #ifndef NET_QUIC_QUIC_SENT_ENTROPY_MANAGER_H_ |
9 #define NET_QUIC_QUIC_SENT_ENTROPY_MANAGER_H_ | 9 #define NET_QUIC_QUIC_SENT_ENTROPY_MANAGER_H_ |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 QuicPacketEntropyHash entropy_hash); | 34 QuicPacketEntropyHash entropy_hash); |
35 | 35 |
36 // Retrieves the cumulative entropy up to |packet_number|. | 36 // Retrieves the cumulative entropy up to |packet_number|. |
37 // Must always be called with a monotonically increasing |packet_number|. | 37 // Must always be called with a monotonically increasing |packet_number|. |
38 QuicPacketEntropyHash GetCumulativeEntropy(QuicPacketNumber packet_number); | 38 QuicPacketEntropyHash GetCumulativeEntropy(QuicPacketNumber packet_number); |
39 | 39 |
40 // Returns true if |entropy_hash| matches the expected sent entropy hash | 40 // Returns true if |entropy_hash| matches the expected sent entropy hash |
41 // up to |largest_observed| removing packet numbers from |missing_packets|. | 41 // up to |largest_observed| removing packet numbers from |missing_packets|. |
42 // Must always be called with a monotonically increasing |largest_observed|. | 42 // Must always be called with a monotonically increasing |largest_observed|. |
43 bool IsValidEntropy(QuicPacketNumber largest_observed, | 43 bool IsValidEntropy(QuicPacketNumber largest_observed, |
44 const PacketNumberSet& missing_packets, | 44 const PacketNumberQueue& missing_packets, |
45 QuicPacketEntropyHash entropy_hash); | 45 QuicPacketEntropyHash entropy_hash); |
46 | 46 |
47 // Removes unnecessary entries before |packet_number|. | 47 // Removes unnecessary entries before |packet_number|. |
48 void ClearEntropyBefore(QuicPacketNumber packet_number); | 48 void ClearEntropyBefore(QuicPacketNumber packet_number); |
49 | 49 |
50 private: | 50 private: |
51 friend class test::QuicConnectionPeer; | 51 friend class test::QuicConnectionPeer; |
52 | 52 |
53 typedef std::deque<QuicPacketEntropyHash> SentEntropyMap; | 53 typedef std::deque<QuicPacketEntropyHash> SentEntropyMap; |
54 | 54 |
(...skipping 23 matching lines...) Expand all Loading... |
78 | 78 |
79 // Cache the cumulative entropy for the packet number used by EntropyHash. | 79 // Cache the cumulative entropy for the packet number used by EntropyHash. |
80 CumulativeEntropy last_cumulative_entropy_; | 80 CumulativeEntropy last_cumulative_entropy_; |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(QuicSentEntropyManager); | 82 DISALLOW_COPY_AND_ASSIGN(QuicSentEntropyManager); |
83 }; | 83 }; |
84 | 84 |
85 } // namespace net | 85 } // namespace net |
86 | 86 |
87 #endif // NET_QUIC_QUIC_SENT_ENTROPY_MANAGER_H_ | 87 #endif // NET_QUIC_QUIC_SENT_ENTROPY_MANAGER_H_ |
OLD | NEW |