| 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 #ifndef NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ | 5 #ifndef NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ |
| 6 #define NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ | 6 #define NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // |server_nonce_entropy|: an entropy source used to generate the orbit and | 94 // |server_nonce_entropy|: an entropy source used to generate the orbit and |
| 95 // key for server nonces, which are always local to a given instance of a | 95 // key for server nonces, which are always local to a given instance of a |
| 96 // server. | 96 // server. |
| 97 QuicCryptoServerConfig(base::StringPiece source_address_token_secret, | 97 QuicCryptoServerConfig(base::StringPiece source_address_token_secret, |
| 98 QuicRandom* server_nonce_entropy); | 98 QuicRandom* server_nonce_entropy); |
| 99 ~QuicCryptoServerConfig(); | 99 ~QuicCryptoServerConfig(); |
| 100 | 100 |
| 101 // TESTING is a magic parameter for passing to the constructor in tests. | 101 // TESTING is a magic parameter for passing to the constructor in tests. |
| 102 static const char TESTING[]; | 102 static const char TESTING[]; |
| 103 | 103 |
| 104 // DefaultConfig generates a QuicServerConfigProtobuf protobuf suitable for | 104 // Generates a QuicServerConfigProtobuf protobuf suitable for |
| 105 // using in tests. | 105 // AddConfig and SetConfigs. |
| 106 static QuicServerConfigProtobuf* DefaultConfig( | 106 static QuicServerConfigProtobuf* GenerateConfig( |
| 107 QuicRandom* rand, | 107 QuicRandom* rand, |
| 108 const QuicClock* clock, | 108 const QuicClock* clock, |
| 109 const ConfigOptions& options); | 109 const ConfigOptions& options); |
| 110 | 110 |
| 111 // AddConfig adds a QuicServerConfigProtobuf to the availible configurations. | 111 // AddConfig adds a QuicServerConfigProtobuf to the availible configurations. |
| 112 // It returns the SCFG message from the config if successful. The caller | 112 // It returns the SCFG message from the config if successful. The caller |
| 113 // takes ownership of the CryptoHandshakeMessage. |now| is used in | 113 // takes ownership of the CryptoHandshakeMessage. |now| is used in |
| 114 // conjunction with |protobuf->primary_time()| to determine whether the | 114 // conjunction with |protobuf->primary_time()| to determine whether the |
| 115 // config should be made primary. | 115 // config should be made primary. |
| 116 CryptoHandshakeMessage* AddConfig(QuicServerConfigProtobuf* protobuf, | 116 CryptoHandshakeMessage* AddConfig(QuicServerConfigProtobuf* protobuf, |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 // is_primary is true if this config is the one that we'll give out to | 290 // is_primary is true if this config is the one that we'll give out to |
| 291 // clients as the current one. | 291 // clients as the current one. |
| 292 bool is_primary; | 292 bool is_primary; |
| 293 | 293 |
| 294 // primary_time contains the timestamp when this config should become the | 294 // primary_time contains the timestamp when this config should become the |
| 295 // primary config. A value of QuicWallTime::Zero() means that this config | 295 // primary config. A value of QuicWallTime::Zero() means that this config |
| 296 // will not be promoted at a specific time. | 296 // will not be promoted at a specific time. |
| 297 QuicWallTime primary_time; | 297 QuicWallTime primary_time; |
| 298 | 298 |
| 299 // Secondary sort key for use when selecting primary configs and |
| 300 // there are multiple configs with the same primary time. |
| 301 // Smaller numbers mean higher priority. |
| 302 uint64 priority; |
| 303 |
| 299 private: | 304 private: |
| 300 friend class base::RefCounted<Config>; | 305 friend class base::RefCounted<Config>; |
| 301 virtual ~Config(); | 306 virtual ~Config(); |
| 302 | 307 |
| 303 DISALLOW_COPY_AND_ASSIGN(Config); | 308 DISALLOW_COPY_AND_ASSIGN(Config); |
| 304 }; | 309 }; |
| 305 | 310 |
| 306 typedef std::map<ServerConfigID, scoped_refptr<Config> > ConfigMap; | 311 typedef std::map<ServerConfigID, scoped_refptr<Config> > ConfigMap; |
| 307 | 312 |
| 308 // ConfigPrimaryTimeLessThan returns true if a->primary_time < | 313 // ConfigPrimaryTimeLessThan returns true if a->primary_time < |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 uint32 strike_register_window_secs_; | 423 uint32 strike_register_window_secs_; |
| 419 uint32 source_address_token_future_secs_; | 424 uint32 source_address_token_future_secs_; |
| 420 uint32 source_address_token_lifetime_secs_; | 425 uint32 source_address_token_lifetime_secs_; |
| 421 uint32 server_nonce_strike_register_max_entries_; | 426 uint32 server_nonce_strike_register_max_entries_; |
| 422 uint32 server_nonce_strike_register_window_secs_; | 427 uint32 server_nonce_strike_register_window_secs_; |
| 423 }; | 428 }; |
| 424 | 429 |
| 425 } // namespace net | 430 } // namespace net |
| 426 | 431 |
| 427 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ | 432 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ |
| OLD | NEW |