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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 NO_STARTUP_PERIOD_NEEDED, | 68 NO_STARTUP_PERIOD_NEEDED, |
69 }; | 69 }; |
70 | 70 |
71 // An external node takes 24 bytes as we don't record the orbit. | 71 // An external node takes 24 bytes as we don't record the orbit. |
72 static const uint32 kExternalNodeSize; | 72 static const uint32 kExternalNodeSize; |
73 | 73 |
74 // We address the nodes by their index in the array. This means that 0 is a | 74 // We address the nodes by their index in the array. This means that 0 is a |
75 // valid index. Therefore this is our invalid index. It also has a one bit | 75 // valid index. Therefore this is our invalid index. It also has a one bit |
76 // in the LSB position because we tend to store indexes shifted up 8 bits | 76 // in the LSB position because we tend to store indexes shifted up 8 bits |
77 // and this distinguishes kNil from (kExternalFlag | 0) << 8. | 77 // and this distinguishes kNil from (kExternalFlag | 0) << 8. |
78 static const uint32 kNil; | 78 static const uint32 kNil; |
79 | 79 |
80 // Our pointers from internal nodes can either point to an internal or | 80 // Our pointers from internal nodes can either point to an internal or |
81 // external node. We flag the 24th bit to mark a pointer as external. | 81 // external node. We flag the 24th bit to mark a pointer as external. |
82 static const uint32 kExternalFlag; | 82 static const uint32 kExternalFlag; |
83 | 83 |
84 // Construct a new set which can hold, at most, |max_entries| (which must be | 84 // Construct a new set which can hold, at most, |max_entries| (which must be |
85 // less than 2**23). See the comments around StartupType about initial | 85 // less than 2**23). See the comments around StartupType about initial |
86 // behaviour. Otherwise, all nonces that are outside +/- |window_secs| from | 86 // behaviour. Otherwise, all nonces that are outside +/- |window_secs| from |
87 // the current time will be rejected. Additionally, all nonces that have an | 87 // the current time will be rejected. Additionally, all nonces that have an |
88 // orbit value other than |orbit| will be rejected. | 88 // orbit value other than |orbit| will be rejected. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 uint32 internal_node_head_; | 180 uint32 internal_node_head_; |
181 // internal_nodes_ can't be a scoped_ptr because the type isn't defined in | 181 // internal_nodes_ can't be a scoped_ptr because the type isn't defined in |
182 // this header. | 182 // this header. |
183 InternalNode* internal_nodes_; | 183 InternalNode* internal_nodes_; |
184 scoped_ptr<uint8[]> external_nodes_; | 184 scoped_ptr<uint8[]> external_nodes_; |
185 }; | 185 }; |
186 | 186 |
187 } // namespace net | 187 } // namespace net |
188 | 188 |
189 #endif // NET_QUIC_CRYPTO_STRIKE_REGISTER_H_ | 189 #endif // NET_QUIC_CRYPTO_STRIKE_REGISTER_H_ |
OLD | NEW |