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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 | 136 |
137 DISALLOW_COPY_AND_ASSIGN(CachedState); | 137 DISALLOW_COPY_AND_ASSIGN(CachedState); |
138 }; | 138 }; |
139 | 139 |
140 QuicCryptoClientConfig(); | 140 QuicCryptoClientConfig(); |
141 ~QuicCryptoClientConfig(); | 141 ~QuicCryptoClientConfig(); |
142 | 142 |
143 // Sets the members to reasonable, default values. | 143 // Sets the members to reasonable, default values. |
144 void SetDefaults(); | 144 void SetDefaults(); |
145 | 145 |
146 // Create returns a CachedState for the given hostname. It creates a | 146 // Create returns a CachedState for the given hostname and port. It creates a |
147 // CachedState and caches it. If |quic_server_info_factory| is not NULL, then | 147 // CachedState and caches it. If |quic_server_info_factory| is not NULL, then |
148 // it is used to create QuicServerInfo which is used to fetch crypto config | 148 // it is used to create QuicServerInfo which is used to fetch crypto config |
149 // information from disk for the given hostname. | 149 // information from disk for the given hostname. |
150 CachedState* Create(const std::string& server_hostname, | 150 CachedState* Create(const std::string& server_hostname, |
151 uint16 port, | |
wtc
2014/03/11 01:41:39
Can we replace the two argument with a HostPortPai
Ryan Hamilton
2014/03/11 15:47:43
As I understand it, HostPortPair is a chrome-ism w
ramant (doing other things)
2014/03/13 01:50:12
Used QuicSessionKey and will port HostPortPair to
ramant (doing other things)
2014/03/13 01:50:12
Will port HostPortPair as we merge this CL into sh
| |
151 QuicServerInfoFactory* quic_server_info_factory); | 152 QuicServerInfoFactory* quic_server_info_factory); |
152 | 153 |
153 // LookupOrCreate returns a CachedState for the given hostname. If no such | 154 // LookupOrCreate returns a CachedState for the given hostname and port. If no |
154 // CachedState currently exists, it will be created and cached. | 155 // such CachedState currently exists, it will be created and cached. |
155 // TODO(rtenneti): fix the server code and pass QuicServerInfoFactory as | 156 // TODO(rtenneti): fix the server code and pass QuicServerInfoFactory as |
156 // argument. | 157 // argument. |
157 CachedState* LookupOrCreate(const std::string& server_hostname); | 158 CachedState* LookupOrCreate(const std::string& server_hostname, uint16 port); |
158 | 159 |
159 // FillInchoateClientHello sets |out| to be a CHLO message that elicits a | 160 // FillInchoateClientHello sets |out| to be a CHLO message that elicits a |
160 // source-address token or SCFG from a server. If |cached| is non-NULL, the | 161 // source-address token or SCFG from a server. If |cached| is non-NULL, the |
161 // source-address token will be taken from it. |out_params| is used in order | 162 // source-address token will be taken from it. |out_params| is used in order |
162 // to store the cached certs that were sent as hints to the server in | 163 // to store the cached certs that were sent as hints to the server in |
163 // |out_params->cached_certs|. |preferred_version| is the version of the QUIC | 164 // |out_params->cached_certs|. |preferred_version| is the version of the QUIC |
164 // protocol that this client chose to use initially. This allows the server to | 165 // protocol that this client chose to use initially. This allows the server to |
165 // detect downgrade attacks. | 166 // detect downgrade attacks. |
166 void FillInchoateClientHello(const std::string& server_hostname, | 167 void FillInchoateClientHello(const std::string& server_hostname, |
167 const QuicVersion preferred_version, | 168 const QuicVersion preferred_version, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 void SetProofVerifier(ProofVerifier* verifier); | 226 void SetProofVerifier(ProofVerifier* verifier); |
226 | 227 |
227 ChannelIDSigner* channel_id_signer() const; | 228 ChannelIDSigner* channel_id_signer() const; |
228 | 229 |
229 // SetChannelIDSigner sets a ChannelIDSigner that will be called when the | 230 // SetChannelIDSigner sets a ChannelIDSigner that will be called when the |
230 // server supports channel IDs to sign a message proving possession of the | 231 // server supports channel IDs to sign a message proving possession of the |
231 // given ChannelID. This object takes ownership of |signer|. | 232 // given ChannelID. This object takes ownership of |signer|. |
232 void SetChannelIDSigner(ChannelIDSigner* signer); | 233 void SetChannelIDSigner(ChannelIDSigner* signer); |
233 | 234 |
234 // Initialize the CachedState from |canonical_crypto_config| for the | 235 // Initialize the CachedState from |canonical_crypto_config| for the |
235 // |canonical_server_hostname| as the initial CachedState for | 236 // |canonical_server_hostname| and |canonical_server_port| as the initial |
236 // |server_hostname|. We will copy config data only if | 237 // CachedState for |server_hostname| and |server_port|. We will copy config |
237 // |canonical_crypto_config| has valid proof. | 238 // data only if |canonical_crypto_config| has valid proof. |
238 void InitializeFrom(const std::string& server_hostname, | 239 void InitializeFrom(const std::string& server_hostname, |
240 uint16 server_port, | |
239 const std::string& canonical_server_hostname, | 241 const std::string& canonical_server_hostname, |
242 uint16 canonical_server_port, | |
240 QuicCryptoClientConfig* canonical_crypto_config); | 243 QuicCryptoClientConfig* canonical_crypto_config); |
241 | 244 |
242 private: | 245 private: |
243 // cached_states_ maps from the server hostname to the cached information | 246 // cached_states_ maps from the server hostname to the cached information |
244 // about that server. | 247 // about that server. |
245 std::map<std::string, CachedState*> cached_states_; | 248 std::map<std::string, CachedState*> cached_states_; |
246 | 249 |
247 scoped_ptr<ProofVerifier> proof_verifier_; | 250 scoped_ptr<ProofVerifier> proof_verifier_; |
248 scoped_ptr<ChannelIDSigner> channel_id_signer_; | 251 scoped_ptr<ChannelIDSigner> channel_id_signer_; |
249 | 252 |
250 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientConfig); | 253 DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientConfig); |
251 }; | 254 }; |
252 | 255 |
253 } // namespace net | 256 } // namespace net |
254 | 257 |
255 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ | 258 #endif // NET_QUIC_CRYPTO_QUIC_CRYPTO_CLIENT_CONFIG_H_ |
OLD | NEW |