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_CORE_CRYPTO_STRIKE_REGISTER_H_ | 5 #ifndef NET_QUIC_CORE_CRYPTO_STRIKE_REGISTER_H_ |
6 #define NET_QUIC_CORE_CRYPTO_STRIKE_REGISTER_H_ | 6 #define NET_QUIC_CORE_CRYPTO_STRIKE_REGISTER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <set> | 11 #include <set> |
12 #include <utility> | 12 #include <utility> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "net/base/net_export.h" | 16 #include "net/quic/platform/api/quic_export.h" |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 | 19 |
20 // InsertStatus enum values cannot be changed, they need to be stable. | 20 // InsertStatus enum values cannot be changed, they need to be stable. |
21 enum InsertStatus { | 21 enum InsertStatus { |
22 NONCE_OK = 0, | 22 NONCE_OK = 0, |
23 // The default error value for nonce verification failures from strike | 23 // The default error value for nonce verification failures from strike |
24 // register (covers old strike registers and unknown failures). | 24 // register (covers old strike registers and unknown failures). |
25 NONCE_UNKNOWN_FAILURE = 1, | 25 NONCE_UNKNOWN_FAILURE = 1, |
26 // Decrypted nonce had incorrect length. | 26 // Decrypted nonce had incorrect length. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // The branching bit number (considering the MSB to be the 1st bit) is | 64 // The branching bit number (considering the MSB to be the 1st bit) is |
65 // monotonically increasing as you go down the tree. | 65 // monotonically increasing as you go down the tree. |
66 // | 66 // |
67 // There are two distinct time representations used. External times are those | 67 // There are two distinct time representations used. External times are those |
68 // which are exposed to the users of this class. They are expected to be a | 68 // which are exposed to the users of this class. They are expected to be a |
69 // count of the number of seconds since the UNIX epoch. Internal times are a | 69 // count of the number of seconds since the UNIX epoch. Internal times are a |
70 // count of the number of seconds since a point in time a couple of years | 70 // count of the number of seconds since a point in time a couple of years |
71 // before the creation time given to the constructor. (See | 71 // before the creation time given to the constructor. (See |
72 // |ExternalTimeToInternal|) This avoids having to worry about overflow since | 72 // |ExternalTimeToInternal|) This avoids having to worry about overflow since |
73 // we assume that no process will run for 130 years. | 73 // we assume that no process will run for 130 years. |
74 class NET_EXPORT_PRIVATE StrikeRegister { | 74 class QUIC_EXPORT_PRIVATE StrikeRegister { |
75 public: | 75 public: |
76 enum StartupType { | 76 enum StartupType { |
77 // DENY_REQUESTS_AT_STARTUP is the typical mode for a strike register. | 77 // DENY_REQUESTS_AT_STARTUP is the typical mode for a strike register. |
78 // Because servers can crash and the strike-register memory-based, the | 78 // Because servers can crash and the strike-register memory-based, the |
79 // state of the strike-register may be lost at any time. Thus the previous | 79 // state of the strike-register may be lost at any time. Thus the previous |
80 // instance of the server may have accepted an nonce with time | 80 // instance of the server may have accepted an nonce with time |
81 // now+window_secs, which was forgotten in the crash. Therefore | 81 // now+window_secs, which was forgotten in the crash. Therefore |
82 // DENY_REQUESTS_AT_STARTUP causes the strike-register to reject all | 82 // DENY_REQUESTS_AT_STARTUP causes the strike-register to reject all |
83 // requests timestampped before window_secs + the creation time (the | 83 // requests timestampped before window_secs + the creation time (the |
84 // quiescent period). | 84 // quiescent period). |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // this header. | 214 // this header. |
215 InternalNode* internal_nodes_; | 215 InternalNode* internal_nodes_; |
216 std::unique_ptr<uint8_t[]> external_nodes_; | 216 std::unique_ptr<uint8_t[]> external_nodes_; |
217 | 217 |
218 DISALLOW_COPY_AND_ASSIGN(StrikeRegister); | 218 DISALLOW_COPY_AND_ASSIGN(StrikeRegister); |
219 }; | 219 }; |
220 | 220 |
221 } // namespace net | 221 } // namespace net |
222 | 222 |
223 #endif // NET_QUIC_CORE_CRYPTO_STRIKE_REGISTER_H_ | 223 #endif // NET_QUIC_CORE_CRYPTO_STRIKE_REGISTER_H_ |
OLD | NEW |