Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: net/quic/crypto/strike_register.h

Issue 157383006: Doing early validation of quic config, to change a potential (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/quic/crypto/strike_register.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Allows early validation before a strike register is created.
85 static void ValidateStrikeRegisterConfig(unsigned max_entries);
86
84 // Construct a new set which can hold, at most, |max_entries| (which must be 87 // 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 88 // less than 2**23). See the comments around StartupType about initial
86 // behaviour. Otherwise, all nonces that are outside +/- |window_secs| from 89 // behaviour. Otherwise, all nonces that are outside +/- |window_secs| from
87 // the current time will be rejected. Additionally, all nonces that have an 90 // the current time will be rejected. Additionally, all nonces that have an
88 // orbit value other than |orbit| will be rejected. 91 // orbit value other than |orbit| will be rejected.
89 // 92 //
90 // (Note that this code is independent of the actual units of time used, but 93 // (Note that this code is independent of the actual units of time used, but
91 // you should use seconds.) 94 // you should use seconds.)
92 StrikeRegister(unsigned max_entries, 95 StrikeRegister(unsigned max_entries,
93 uint32 current_time_external, 96 uint32 current_time_external,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 uint32 internal_node_head_; 179 uint32 internal_node_head_;
177 // internal_nodes_ can't be a scoped_ptr because the type isn't defined in 180 // internal_nodes_ can't be a scoped_ptr because the type isn't defined in
178 // this header. 181 // this header.
179 InternalNode* internal_nodes_; 182 InternalNode* internal_nodes_;
180 scoped_ptr<uint8[]> external_nodes_; 183 scoped_ptr<uint8[]> external_nodes_;
181 }; 184 };
182 185
183 } // namespace net 186 } // namespace net
184 187
185 #endif // NET_QUIC_CRYPTO_STRIKE_REGISTER_H_ 188 #endif // NET_QUIC_CRYPTO_STRIKE_REGISTER_H_
OLDNEW
« no previous file with comments | « no previous file | net/quic/crypto/strike_register.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698