| 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 21 matching lines...) Expand all Loading... |
| 32 class QuicServerConfigProtobuf; | 32 class QuicServerConfigProtobuf; |
| 33 class StrikeRegister; | 33 class StrikeRegister; |
| 34 class StrikeRegisterClient; | 34 class StrikeRegisterClient; |
| 35 | 35 |
| 36 struct ClientHelloInfo; | 36 struct ClientHelloInfo; |
| 37 | 37 |
| 38 namespace test { | 38 namespace test { |
| 39 class QuicCryptoServerConfigPeer; | 39 class QuicCryptoServerConfigPeer; |
| 40 } // namespace test | 40 } // namespace test |
| 41 | 41 |
| 42 // Hook that allows application code to subscribe to primary config changes. |
| 43 class PrimaryConfigChangedCallback { |
| 44 public: |
| 45 PrimaryConfigChangedCallback(); |
| 46 virtual ~PrimaryConfigChangedCallback(); |
| 47 virtual void Run(const std::string& scid) = 0; |
| 48 }; |
| 49 |
| 42 // Callback used to accept the result of the |client_hello| validation step. | 50 // Callback used to accept the result of the |client_hello| validation step. |
| 43 class NET_EXPORT_PRIVATE ValidateClientHelloResultCallback { | 51 class NET_EXPORT_PRIVATE ValidateClientHelloResultCallback { |
| 44 public: | 52 public: |
| 45 // Opaque token that holds information about the client_hello and | 53 // Opaque token that holds information about the client_hello and |
| 46 // its validity. Can be interpreted by calling ProcessClientHello. | 54 // its validity. Can be interpreted by calling ProcessClientHello. |
| 47 struct Result; | 55 struct Result; |
| 48 | 56 |
| 49 ValidateClientHelloResultCallback(); | 57 ValidateClientHelloResultCallback(); |
| 50 virtual ~ValidateClientHelloResultCallback(); | 58 virtual ~ValidateClientHelloResultCallback(); |
| 51 void Run(const Result* result); | 59 void Run(const Result* result); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // the client and back. | 258 // the client and back. |
| 251 void set_server_nonce_strike_register_max_entries(uint32 max_entries); | 259 void set_server_nonce_strike_register_max_entries(uint32 max_entries); |
| 252 | 260 |
| 253 // set_server_nonce_strike_register_window_secs sets the number of seconds | 261 // set_server_nonce_strike_register_window_secs sets the number of seconds |
| 254 // around the current time that the server-nonce strike-register will accept | 262 // around the current time that the server-nonce strike-register will accept |
| 255 // nonces from. Setting a larger value allows for clients to delay follow-up | 263 // nonces from. Setting a larger value allows for clients to delay follow-up |
| 256 // client hellos for longer and still use server nonces as proofs of | 264 // client hellos for longer and still use server nonces as proofs of |
| 257 // uniqueness. | 265 // uniqueness. |
| 258 void set_server_nonce_strike_register_window_secs(uint32 window_secs); | 266 void set_server_nonce_strike_register_window_secs(uint32 window_secs); |
| 259 | 267 |
| 268 // Set and take ownership of the callback to invoke on primary config changes. |
| 269 void AcquirePrimaryConfigChangedCb(PrimaryConfigChangedCallback* cb); |
| 270 |
| 260 private: | 271 private: |
| 261 friend class test::QuicCryptoServerConfigPeer; | 272 friend class test::QuicCryptoServerConfigPeer; |
| 262 | 273 |
| 263 // Config represents a server config: a collection of preferences and | 274 // Config represents a server config: a collection of preferences and |
| 264 // Diffie-Hellman public values. | 275 // Diffie-Hellman public values. |
| 265 class NET_EXPORT_PRIVATE Config : public QuicCryptoConfig, | 276 class NET_EXPORT_PRIVATE Config : public QuicCryptoConfig, |
| 266 public base::RefCounted<Config> { | 277 public base::RefCounted<Config> { |
| 267 public: | 278 public: |
| 268 Config(); | 279 Config(); |
| 269 | 280 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 mutable base::Lock configs_lock_; | 389 mutable base::Lock configs_lock_; |
| 379 // configs_ contains all active server configs. It's expected that there are | 390 // configs_ contains all active server configs. It's expected that there are |
| 380 // about half-a-dozen configs active at any one time. | 391 // about half-a-dozen configs active at any one time. |
| 381 ConfigMap configs_; | 392 ConfigMap configs_; |
| 382 // primary_config_ points to a Config (which is also in |configs_|) which is | 393 // primary_config_ points to a Config (which is also in |configs_|) which is |
| 383 // the primary config - i.e. the one that we'll give out to new clients. | 394 // the primary config - i.e. the one that we'll give out to new clients. |
| 384 mutable scoped_refptr<Config> primary_config_; | 395 mutable scoped_refptr<Config> primary_config_; |
| 385 // next_config_promotion_time_ contains the nearest, future time when an | 396 // next_config_promotion_time_ contains the nearest, future time when an |
| 386 // active config will be promoted to primary. | 397 // active config will be promoted to primary. |
| 387 mutable QuicWallTime next_config_promotion_time_; | 398 mutable QuicWallTime next_config_promotion_time_; |
| 399 // Callback to invoke when the primary config changes. |
| 400 scoped_ptr<PrimaryConfigChangedCallback> primary_config_changed_cb_; |
| 388 | 401 |
| 389 // Protects access to the pointer held by strike_register_client_. | 402 // Protects access to the pointer held by strike_register_client_. |
| 390 mutable base::Lock strike_register_client_lock_; | 403 mutable base::Lock strike_register_client_lock_; |
| 391 // strike_register_ contains a data structure that keeps track of previously | 404 // strike_register_ contains a data structure that keeps track of previously |
| 392 // observed client nonces in order to prevent replay attacks. | 405 // observed client nonces in order to prevent replay attacks. |
| 393 mutable scoped_ptr<StrikeRegisterClient> strike_register_client_; | 406 mutable scoped_ptr<StrikeRegisterClient> strike_register_client_; |
| 394 | 407 |
| 395 // source_address_token_boxer_ is used to protect the source-address tokens | 408 // source_address_token_boxer_ is used to protect the source-address tokens |
| 396 // that are given to clients. | 409 // that are given to clients. |
| 397 CryptoSecretBoxer source_address_token_boxer_; | 410 CryptoSecretBoxer source_address_token_boxer_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 426 uint32 strike_register_window_secs_; | 439 uint32 strike_register_window_secs_; |
| 427 uint32 source_address_token_future_secs_; | 440 uint32 source_address_token_future_secs_; |
| 428 uint32 source_address_token_lifetime_secs_; | 441 uint32 source_address_token_lifetime_secs_; |
| 429 uint32 server_nonce_strike_register_max_entries_; | 442 uint32 server_nonce_strike_register_max_entries_; |
| 430 uint32 server_nonce_strike_register_window_secs_; | 443 uint32 server_nonce_strike_register_window_secs_; |
| 431 }; | 444 }; |
| 432 | 445 |
| 433 } // namespace net | 446 } // namespace net |
| 434 | 447 |
| 435 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ | 448 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ |
| OLD | NEW |