| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 QuicRandom* rand, | 210 QuicRandom* rand, |
| 211 QuicCryptoNegotiatedParameters* params, | 211 QuicCryptoNegotiatedParameters* params, |
| 212 CryptoHandshakeMessage* out, | 212 CryptoHandshakeMessage* out, |
| 213 std::string* error_details) const; | 213 std::string* error_details) const; |
| 214 | 214 |
| 215 // BuildServerConfigUpdateMessage sets |out| to be a SCUP message containing | 215 // BuildServerConfigUpdateMessage sets |out| to be a SCUP message containing |
| 216 // the current primary config, an up to date source-address token, and cert | 216 // the current primary config, an up to date source-address token, and cert |
| 217 // chain and proof in the case of secure QUIC. Returns true if successfully | 217 // chain and proof in the case of secure QUIC. Returns true if successfully |
| 218 // filled |out|. | 218 // filled |out|. |
| 219 // | 219 // |
| 220 // |cached_network_params| is optional, and can be NULL. | 220 // |cached_network_params| is optional, and can be nullptr. |
| 221 bool BuildServerConfigUpdateMessage( | 221 bool BuildServerConfigUpdateMessage( |
| 222 const IPEndPoint& client_ip, | 222 const IPEndPoint& client_ip, |
| 223 const QuicClock* clock, | 223 const QuicClock* clock, |
| 224 QuicRandom* rand, | 224 QuicRandom* rand, |
| 225 const QuicCryptoNegotiatedParameters& params, | 225 const QuicCryptoNegotiatedParameters& params, |
| 226 const CachedNetworkParameters* cached_network_params, | 226 const CachedNetworkParameters* cached_network_params, |
| 227 CryptoHandshakeMessage* out) const; | 227 CryptoHandshakeMessage* out) const; |
| 228 | 228 |
| 229 // SetProofSource installs |proof_source| as the ProofSource for handshakes. | 229 // SetProofSource installs |proof_source| as the ProofSource for handshakes. |
| 230 // This object takes ownership of |proof_source|. | 230 // This object takes ownership of |proof_source|. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 void BuildRejection( | 385 void BuildRejection( |
| 386 const Config& config, | 386 const Config& config, |
| 387 const CryptoHandshakeMessage& client_hello, | 387 const CryptoHandshakeMessage& client_hello, |
| 388 const ClientHelloInfo& info, | 388 const ClientHelloInfo& info, |
| 389 QuicRandom* rand, | 389 QuicRandom* rand, |
| 390 QuicCryptoNegotiatedParameters *params, | 390 QuicCryptoNegotiatedParameters *params, |
| 391 CryptoHandshakeMessage* out) const; | 391 CryptoHandshakeMessage* out) const; |
| 392 | 392 |
| 393 // ParseConfigProtobuf parses the given config protobuf and returns a | 393 // ParseConfigProtobuf parses the given config protobuf and returns a |
| 394 // scoped_refptr<Config> if successful. The caller adopts the reference to the | 394 // scoped_refptr<Config> if successful. The caller adopts the reference to the |
| 395 // Config. On error, ParseConfigProtobuf returns NULL. | 395 // Config. On error, ParseConfigProtobuf returns nullptr. |
| 396 scoped_refptr<Config> ParseConfigProtobuf(QuicServerConfigProtobuf* protobuf); | 396 scoped_refptr<Config> ParseConfigProtobuf(QuicServerConfigProtobuf* protobuf); |
| 397 | 397 |
| 398 // NewSourceAddressToken returns a fresh source address token for the given | 398 // NewSourceAddressToken returns a fresh source address token for the given |
| 399 // IP address. |cached_network_params| is optional, and can be NULL. | 399 // IP address. |cached_network_params| is optional, and can be nullptr. |
| 400 std::string NewSourceAddressToken( | 400 std::string NewSourceAddressToken( |
| 401 const Config& config, | 401 const Config& config, |
| 402 const IPEndPoint& ip, | 402 const IPEndPoint& ip, |
| 403 QuicRandom* rand, | 403 QuicRandom* rand, |
| 404 QuicWallTime now, | 404 QuicWallTime now, |
| 405 const CachedNetworkParameters* cached_network_params) const; | 405 const CachedNetworkParameters* cached_network_params) const; |
| 406 | 406 |
| 407 // ValidateSourceAddressToken returns HANDSHAKE_OK if the source address token | 407 // ValidateSourceAddressToken returns HANDSHAKE_OK if the source address token |
| 408 // in |token| is a valid and timely token for the IP address |ip| given that | 408 // in |token| is a valid and timely token for the IP address |ip| given that |
| 409 // the current time is |now|. Otherwise it returns the reason for failure. | 409 // the current time is |now|. Otherwise it returns the reason for failure. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 422 // HANDSHAKE_OK. Otherwise it returns the reason for failure. | 422 // HANDSHAKE_OK. Otherwise it returns the reason for failure. |
| 423 HandshakeFailureReason ValidateServerNonce( | 423 HandshakeFailureReason ValidateServerNonce( |
| 424 base::StringPiece echoed_server_nonce, | 424 base::StringPiece echoed_server_nonce, |
| 425 QuicWallTime now) const; | 425 QuicWallTime now) const; |
| 426 | 426 |
| 427 // replay_protection_ controls whether the server enforces that handshakes | 427 // replay_protection_ controls whether the server enforces that handshakes |
| 428 // aren't replays. | 428 // aren't replays. |
| 429 bool replay_protection_; | 429 bool replay_protection_; |
| 430 | 430 |
| 431 // configs_ satisfies the following invariants: | 431 // configs_ satisfies the following invariants: |
| 432 // 1) configs_.empty() <-> primary_config_ == NULL | 432 // 1) configs_.empty() <-> primary_config_ == nullptr |
| 433 // 2) primary_config_ != NULL -> primary_config_->is_primary | 433 // 2) primary_config_ != nullptr -> primary_config_->is_primary |
| 434 // 3) ∀ c∈configs_, c->is_primary <-> c == primary_config_ | 434 // 3) ∀ c∈configs_, c->is_primary <-> c == primary_config_ |
| 435 mutable base::Lock configs_lock_; | 435 mutable base::Lock configs_lock_; |
| 436 // configs_ contains all active server configs. It's expected that there are | 436 // configs_ contains all active server configs. It's expected that there are |
| 437 // about half-a-dozen configs active at any one time. | 437 // about half-a-dozen configs active at any one time. |
| 438 ConfigMap configs_; | 438 ConfigMap configs_; |
| 439 // primary_config_ points to a Config (which is also in |configs_|) which is | 439 // primary_config_ points to a Config (which is also in |configs_|) which is |
| 440 // the primary config - i.e. the one that we'll give out to new clients. | 440 // the primary config - i.e. the one that we'll give out to new clients. |
| 441 mutable scoped_refptr<Config> primary_config_; | 441 mutable scoped_refptr<Config> primary_config_; |
| 442 // next_config_promotion_time_ contains the nearest, future time when an | 442 // next_config_promotion_time_ contains the nearest, future time when an |
| 443 // active config will be promoted to primary. | 443 // active config will be promoted to primary. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 uint32 source_address_token_lifetime_secs_; | 488 uint32 source_address_token_lifetime_secs_; |
| 489 uint32 server_nonce_strike_register_max_entries_; | 489 uint32 server_nonce_strike_register_max_entries_; |
| 490 uint32 server_nonce_strike_register_window_secs_; | 490 uint32 server_nonce_strike_register_window_secs_; |
| 491 | 491 |
| 492 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerConfig); | 492 DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerConfig); |
| 493 }; | 493 }; |
| 494 | 494 |
| 495 } // namespace net | 495 } // namespace net |
| 496 | 496 |
| 497 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ | 497 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_SERVER_CONFIG_H_ |
| OLD | NEW |