| 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_CLIENT_CONFIG_H_ | 5 #ifndef NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ |
| 6 #define NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ | 6 #define NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 // the CPU has hardware acceleration for AES-GCM. This method can only be | 332 // the CPU has hardware acceleration for AES-GCM. This method can only be |
| 333 // called after SetDefaults(). | 333 // called after SetDefaults(). |
| 334 void PreferAesGcm(); | 334 void PreferAesGcm(); |
| 335 | 335 |
| 336 // Saves the |user_agent_id| that will be passed in QUIC's CHLO message. | 336 // Saves the |user_agent_id| that will be passed in QUIC's CHLO message. |
| 337 void set_user_agent_id(const std::string& user_agent_id) { | 337 void set_user_agent_id(const std::string& user_agent_id) { |
| 338 user_agent_id_ = user_agent_id; | 338 user_agent_id_ = user_agent_id; |
| 339 } | 339 } |
| 340 | 340 |
| 341 private: | 341 private: |
| 342 typedef std::map<QuicServerId, CachedState*> CachedStateMap; | |
| 343 | |
| 344 // Sets the members to reasonable, default values. | 342 // Sets the members to reasonable, default values. |
| 345 void SetDefaults(); | 343 void SetDefaults(); |
| 346 | 344 |
| 347 // CacheNewServerConfig checks for SCFG, STK, PROF, and CRT tags in |message|, | 345 // CacheNewServerConfig checks for SCFG, STK, PROF, and CRT tags in |message|, |
| 348 // verifies them, and stores them in the cached state if they validate. | 346 // verifies them, and stores them in the cached state if they validate. |
| 349 // This is used on receipt of a REJ from a server, or when a server sends | 347 // This is used on receipt of a REJ from a server, or when a server sends |
| 350 // updated server config during a connection. | 348 // updated server config during a connection. |
| 351 QuicErrorCode CacheNewServerConfig( | 349 QuicErrorCode CacheNewServerConfig( |
| 352 const CryptoHandshakeMessage& message, | 350 const CryptoHandshakeMessage& message, |
| 353 QuicWallTime now, | 351 QuicWallTime now, |
| 354 const QuicVersion version, | 352 const QuicVersion version, |
| 355 base::StringPiece chlo_hash, | 353 base::StringPiece chlo_hash, |
| 356 const std::vector<std::string>& cached_certs, | 354 const std::vector<std::string>& cached_certs, |
| 357 CachedState* cached, | 355 CachedState* cached, |
| 358 std::string* error_details); | 356 std::string* error_details); |
| 359 | 357 |
| 360 // If the suffix of the hostname in |server_id| is in |canonical_suffixes_|, | 358 // If the suffix of the hostname in |server_id| is in |canonical_suffixes_|, |
| 361 // then populate |cached| with the canonical cached state from | 359 // then populate |cached| with the canonical cached state from |
| 362 // |canonical_server_map_| for that suffix. Returns true if |cached| is | 360 // |canonical_server_map_| for that suffix. Returns true if |cached| is |
| 363 // initialized with canonical cached state. | 361 // initialized with canonical cached state. |
| 364 bool PopulateFromCanonicalConfig(const QuicServerId& server_id, | 362 bool PopulateFromCanonicalConfig(const QuicServerId& server_id, |
| 365 CachedState* cached); | 363 CachedState* cached); |
| 366 | 364 |
| 367 // cached_states_ maps from the server_id to the cached information about | 365 // cached_states_ maps from the server_id to the cached information about |
| 368 // that server. | 366 // that server. |
| 369 CachedStateMap cached_states_; | 367 std::map<QuicServerId, std::unique_ptr<CachedState>> cached_states_; |
| 370 | 368 |
| 371 // Contains a map of servers which could share the same server config. Map | 369 // Contains a map of servers which could share the same server config. Map |
| 372 // from a canonical host suffix/port/scheme to a representative server with | 370 // from a canonical host suffix/port/scheme to a representative server with |
| 373 // the canonical suffix, which has a plausible set of initial certificates | 371 // the canonical suffix, which has a plausible set of initial certificates |
| 374 // (or at least server public key). | 372 // (or at least server public key). |
| 375 std::map<QuicServerId, QuicServerId> canonical_server_map_; | 373 std::map<QuicServerId, QuicServerId> canonical_server_map_; |
| 376 | 374 |
| 377 // Contains list of suffixes (for exmaple ".c.youtube.com", | 375 // Contains list of suffixes (for exmaple ".c.youtube.com", |
| 378 // ".googlevideo.com") of canonical hostnames. | 376 // ".googlevideo.com") of canonical hostnames. |
| 379 std::vector<std::string> canonical_suffixes_; | 377 std::vector<std::string> canonical_suffixes_; |
| 380 | 378 |
| 381 std::unique_ptr<ProofVerifier> proof_verifier_; | 379 std::unique_ptr<ProofVerifier> proof_verifier_; |
| 382 std::unique_ptr<ChannelIDSource> channel_id_source_; | 380 std::unique_ptr<ChannelIDSource> channel_id_source_; |
| 383 | 381 |
| 384 // The |user_agent_id_| passed in QUIC's CHLO message. | 382 // The |user_agent_id_| passed in QUIC's CHLO message. |
| 385 std::string user_agent_id_; | 383 std::string user_agent_id_; |
| 386 | 384 |
| 387 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientConfig); | 385 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientConfig); |
| 388 }; | 386 }; |
| 389 | 387 |
| 390 } // namespace net | 388 } // namespace net |
| 391 | 389 |
| 392 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ | 390 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ |
| OLD | NEW |