Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: net/quic/crypto/quic_crypto_client_config.h

Issue 149413008: QUIC - Start the process for reading crypto config data from disk cache (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 13 matching lines...) Expand all
24 // client. Note that this object isn't thread-safe. It's designed to be used on 24 // client. Note that this object isn't thread-safe. It's designed to be used on
25 // a single thread at a time. 25 // a single thread at a time.
26 class NET_EXPORT_PRIVATE QuicCryptoClientConfig : public QuicCryptoConfig { 26 class NET_EXPORT_PRIVATE QuicCryptoClientConfig : public QuicCryptoConfig {
27 public: 27 public:
28 // A CachedState contains the information that the client needs in order to 28 // A CachedState contains the information that the client needs in order to
29 // perform a 0-RTT handshake with a server. This information can be reused 29 // perform a 0-RTT handshake with a server. This information can be reused
30 // over several connections to the same server. 30 // over several connections to the same server.
31 class NET_EXPORT_PRIVATE CachedState { 31 class NET_EXPORT_PRIVATE CachedState {
32 public: 32 public:
33 CachedState(); 33 CachedState();
34 CachedState(scoped_ptr<QuicServerInfo> quic_server_info);
wtc 2014/01/30 20:14:26 Please add "explicit" because this constructor tak
ramant (doing other things) 2014/02/02 19:35:10 Done.
34 ~CachedState(); 35 ~CachedState();
35 36
36 // IsComplete returns true if this object contains enough information to 37 // IsComplete returns true if this object contains enough information to
37 // perform a handshake with the server. |now| is used to judge whether any 38 // perform a handshake with the server. |now| is used to judge whether any
38 // cached server config has expired. 39 // cached server config has expired.
39 bool IsComplete(QuicWallTime now) const; 40 bool IsComplete(QuicWallTime now) const;
40 41
41 // GetServerConfig returns the parsed contents of |server_config|, or NULL 42 // GetServerConfig returns the parsed contents of |server_config|, or NULL
42 // if |server_config| is empty. The return value is owned by this object 43 // if |server_config| is empty. The return value is owned by this object
43 // and is destroyed when this object is. 44 // and is destroyed when this object is.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 83
83 // SetProofVerifyDetails takes ownership of |details|. 84 // SetProofVerifyDetails takes ownership of |details|.
84 void SetProofVerifyDetails(ProofVerifyDetails* details); 85 void SetProofVerifyDetails(ProofVerifyDetails* details);
85 86
86 // Copy the |server_config_|, |source_address_token_|, |certs_| and 87 // Copy the |server_config_|, |source_address_token_|, |certs_| and
87 // |server_config_sig_| from the |other|. The remaining fields, 88 // |server_config_sig_| from the |other|. The remaining fields,
88 // |generation_counter_|, |proof_verify_details_|, and |scfg_| remain 89 // |generation_counter_|, |proof_verify_details_|, and |scfg_| remain
89 // unchanged. 90 // unchanged.
90 void InitializeFrom(const CachedState& other); 91 void InitializeFrom(const CachedState& other);
91 92
92 // TODO(rtenneti): Need to flesh out the details of this method. A temporary
93 // place holder to load CachedState from disk cache.
94 void LoadFromDiskCache(QuicServerInfoFactory* quic_server_info_factory,
95 const std::string& server_hostname);
96
97 private: 93 private:
98 std::string server_config_id_; // An opaque id from the server. 94 std::string server_config_id_; // An opaque id from the server.
99 std::string server_config_; // A serialized handshake message. 95 std::string server_config_; // A serialized handshake message.
100 std::string source_address_token_; // An opaque proof of IP ownership. 96 std::string source_address_token_; // An opaque proof of IP ownership.
101 std::vector<std::string> certs_; // A list of certificates in leaf-first 97 std::vector<std::string> certs_; // A list of certificates in leaf-first
102 // order. 98 // order.
103 std::string server_config_sig_; // A signature of |server_config_|. 99 std::string server_config_sig_; // A signature of |server_config_|.
104 bool server_config_valid_; // True if |server_config_| is correctly 100 bool server_config_valid_; // True if |server_config_| is correctly
105 // signed and |certs_| has been 101 // signed and |certs_| has been
106 // validated. 102 // validated.
107 // Generation counter associated with the |server_config_|, |certs_| and 103 // Generation counter associated with the |server_config_|, |certs_| and
108 // |server_config_sig_| combination. It is incremented whenever we set 104 // |server_config_sig_| combination. It is incremented whenever we set
109 // server_config_valid_ to false. 105 // server_config_valid_ to false.
110 uint64 generation_counter_; 106 uint64 generation_counter_;
111 107
112 scoped_ptr<ProofVerifyDetails> proof_verify_details_; 108 scoped_ptr<ProofVerifyDetails> proof_verify_details_;
113 109
114 // scfg contains the cached, parsed value of |server_config|. 110 // scfg contains the cached, parsed value of |server_config|.
115 mutable scoped_ptr<CryptoHandshakeMessage> scfg_; 111 mutable scoped_ptr<CryptoHandshakeMessage> scfg_;
116 112
117 scoped_ptr<QuicServerInfo> quic_server_info_; 113 scoped_ptr<QuicServerInfo> quic_server_info_;
118 114
119 DISALLOW_COPY_AND_ASSIGN(CachedState); 115 DISALLOW_COPY_AND_ASSIGN(CachedState);
120 }; 116 };
121 117
122 QuicCryptoClientConfig(); 118 QuicCryptoClientConfig();
123 explicit QuicCryptoClientConfig( 119 explicit QuicCryptoClientConfig(scoped_ptr<QuicServerInfo> quic_server_info);
wtc 2014/01/30 20:14:26 Just to make sure I understand correctly: this cha
ramant (doing other things) 2014/02/02 19:35:10 Thanks for the catch. Deleted this member.
124 QuicServerInfoFactory* quic_server_info_factory);
125 ~QuicCryptoClientConfig(); 120 ~QuicCryptoClientConfig();
126 121
127 // Sets the members to reasonable, default values. 122 // Sets the members to reasonable, default values.
128 void SetDefaults(); 123 void SetDefaults();
129 124
130 // LookupOrCreate returns a CachedState for the given hostname. If no such 125 // LookupOrCreate returns a CachedState for the given hostname. If no such
131 // CachedState currently exists, it will be created and cached. 126 // CachedState currently exists, it will be created and cached.
132 CachedState* LookupOrCreate(const std::string& server_hostname); 127 CachedState* LookupOrCreate(const std::string& server_hostname);
133 128
134 // FillInchoateClientHello sets |out| to be a CHLO message that elicits a 129 // FillInchoateClientHello sets |out| to be a CHLO message that elicits a
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // |canonical_crypto_config| has valid proof. 207 // |canonical_crypto_config| has valid proof.
213 void InitializeFrom(const std::string& server_hostname, 208 void InitializeFrom(const std::string& server_hostname,
214 const std::string& canonical_server_hostname, 209 const std::string& canonical_server_hostname,
215 QuicCryptoClientConfig* canonical_crypto_config); 210 QuicCryptoClientConfig* canonical_crypto_config);
216 211
217 private: 212 private:
218 // cached_states_ maps from the server hostname to the cached information 213 // cached_states_ maps from the server hostname to the cached information
219 // about that server. 214 // about that server.
220 std::map<std::string, CachedState*> cached_states_; 215 std::map<std::string, CachedState*> cached_states_;
221 216
222 QuicServerInfoFactory* quic_server_info_factory_; 217 scoped_ptr<QuicServerInfo> quic_server_info_;
223 scoped_ptr<ProofVerifier> proof_verifier_; 218 scoped_ptr<ProofVerifier> proof_verifier_;
224 scoped_ptr<ChannelIDSigner> channel_id_signer_; 219 scoped_ptr<ChannelIDSigner> channel_id_signer_;
225 220
226 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientConfig); 221 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientConfig);
227 }; 222 };
228 223
229 } // namespace net 224 } // namespace net
230 225
231 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ 226 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_
OLDNEW
« no previous file with comments | « no previous file | net/quic/crypto/quic_crypto_client_config.cc » ('j') | net/quic/quic_stream_factory.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698