OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef NET_QUIC_CRYPTO_STRIKE_REGISTER_H_ | 5 #ifndef NET_QUIC_CRYPTO_STRIKE_REGISTER_H_ |
6 #define NET_QUIC_CRYPTO_STRIKE_REGISTER_H_ | 6 #define NET_QUIC_CRYPTO_STRIKE_REGISTER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // DropOldestNode removes the oldest node in the tree and updates |horizon_| | 182 // DropOldestNode removes the oldest node in the tree and updates |horizon_| |
183 // accordingly. | 183 // accordingly. |
184 void DropOldestNode(); | 184 void DropOldestNode(); |
185 | 185 |
186 void FreeExternalNode(uint32 index); | 186 void FreeExternalNode(uint32 index); |
187 | 187 |
188 void FreeInternalNode(uint32 index); | 188 void FreeInternalNode(uint32 index); |
189 | 189 |
190 void ValidateTree(uint32 internal_node, | 190 void ValidateTree(uint32 internal_node, |
191 int last_bit, | 191 int last_bit, |
192 const std::vector<std::pair<unsigned, bool> >& bits, | 192 const std::vector<std::pair<unsigned, bool>>& bits, |
193 const std::set<uint32>& free_internal_nodes, | 193 const std::set<uint32>& free_internal_nodes, |
194 const std::set<uint32>& free_external_nodes, | 194 const std::set<uint32>& free_external_nodes, |
195 std::set<uint32>* used_internal_nodes, | 195 std::set<uint32>* used_internal_nodes, |
196 std::set<uint32>* used_external_nodes); | 196 std::set<uint32>* used_external_nodes); |
197 | 197 |
198 const uint32 max_entries_; | 198 const uint32 max_entries_; |
199 const uint32 window_secs_; | 199 const uint32 window_secs_; |
200 // internal_epoch_ contains the external time value of the start of internal | 200 // internal_epoch_ contains the external time value of the start of internal |
201 // time. | 201 // time. |
202 const uint32 internal_epoch_; | 202 const uint32 internal_epoch_; |
203 uint8 orbit_[8]; | 203 uint8 orbit_[8]; |
204 // The strike register will reject nonces with internal times < |horizon_| . | 204 // The strike register will reject nonces with internal times < |horizon_| . |
205 uint32 horizon_; | 205 uint32 horizon_; |
206 | 206 |
207 uint32 internal_node_free_head_; | 207 uint32 internal_node_free_head_; |
208 uint32 external_node_free_head_; | 208 uint32 external_node_free_head_; |
209 uint32 internal_node_head_; | 209 uint32 internal_node_head_; |
210 // internal_nodes_ can't be a scoped_ptr because the type isn't defined in | 210 // internal_nodes_ can't be a scoped_ptr because the type isn't defined in |
211 // this header. | 211 // this header. |
212 InternalNode* internal_nodes_; | 212 InternalNode* internal_nodes_; |
213 scoped_ptr<uint8[]> external_nodes_; | 213 scoped_ptr<uint8[]> external_nodes_; |
214 | 214 |
215 DISALLOW_COPY_AND_ASSIGN(StrikeRegister); | 215 DISALLOW_COPY_AND_ASSIGN(StrikeRegister); |
216 }; | 216 }; |
217 | 217 |
218 } // namespace net | 218 } // namespace net |
219 | 219 |
220 #endif // NET_QUIC_CRYPTO_STRIKE_REGISTER_H_ | 220 #endif // NET_QUIC_CRYPTO_STRIKE_REGISTER_H_ |
OLD | NEW |