OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "net/quic/quic_crypto_server_stream.h" | 5 #include "net/quic/quic_crypto_server_stream.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "crypto/secure_hash.h" | 8 #include "crypto/secure_hash.h" |
9 #include "net/quic/crypto/cached_network_parameters.h" | 9 #include "net/quic/crypto/cached_network_parameters.h" |
10 #include "net/quic/crypto/crypto_protocol.h" | 10 #include "net/quic/crypto/crypto_protocol.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 void QuicCryptoServerStream::SendServerConfigUpdate( | 158 void QuicCryptoServerStream::SendServerConfigUpdate( |
159 const CachedNetworkParameters* cached_network_params) { | 159 const CachedNetworkParameters* cached_network_params) { |
160 if (session()->connection()->version() <= QUIC_VERSION_21 || | 160 if (session()->connection()->version() <= QUIC_VERSION_21 || |
161 !handshake_confirmed_) { | 161 !handshake_confirmed_) { |
162 return; | 162 return; |
163 } | 163 } |
164 | 164 |
165 CryptoHandshakeMessage server_config_update_message; | 165 CryptoHandshakeMessage server_config_update_message; |
166 if (!crypto_config_.BuildServerConfigUpdateMessage( | 166 if (!crypto_config_.BuildServerConfigUpdateMessage( |
| 167 session()->connection()->self_address(), |
167 session()->connection()->peer_address(), | 168 session()->connection()->peer_address(), |
168 session()->connection()->clock(), | 169 session()->connection()->clock(), |
169 session()->connection()->random_generator(), | 170 session()->connection()->random_generator(), |
170 crypto_negotiated_params_, | 171 crypto_negotiated_params_, cached_network_params, |
171 cached_network_params, | |
172 &server_config_update_message)) { | 172 &server_config_update_message)) { |
173 DVLOG(1) << "Server: Failed to build server config update (SCUP)!"; | 173 DVLOG(1) << "Server: Failed to build server config update (SCUP)!"; |
174 return; | 174 return; |
175 } | 175 } |
176 | 176 |
177 DVLOG(1) << "Server: Sending server config update: " | 177 DVLOG(1) << "Server: Sending server config update: " |
178 << server_config_update_message.DebugString(); | 178 << server_config_update_message.DebugString(); |
179 const QuicData& data = server_config_update_message.GetSerialized(); | 179 const QuicData& data = server_config_update_message.GetSerialized(); |
180 WriteOrBufferData(string(data.data(), data.length()), false, nullptr); | 180 WriteOrBufferData(string(data.data(), data.length()), false, nullptr); |
181 | 181 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 const ValidateClientHelloResultCallback::Result& result, | 227 const ValidateClientHelloResultCallback::Result& result, |
228 CryptoHandshakeMessage* reply, | 228 CryptoHandshakeMessage* reply, |
229 string* error_details) { | 229 string* error_details) { |
230 // Store the bandwidth estimate from the client. | 230 // Store the bandwidth estimate from the client. |
231 if (result.cached_network_params.bandwidth_estimate_bytes_per_second() > 0) { | 231 if (result.cached_network_params.bandwidth_estimate_bytes_per_second() > 0) { |
232 previous_cached_network_params_.reset( | 232 previous_cached_network_params_.reset( |
233 new CachedNetworkParameters(result.cached_network_params)); | 233 new CachedNetworkParameters(result.cached_network_params)); |
234 } | 234 } |
235 | 235 |
236 return crypto_config_.ProcessClientHello( | 236 return crypto_config_.ProcessClientHello( |
237 result, | 237 result, session()->connection()->connection_id(), |
238 session()->connection()->connection_id(), | 238 session()->connection()->self_address(), |
239 session()->connection()->peer_address(), | 239 session()->connection()->peer_address(), |
240 session()->connection()->version(), | 240 session()->connection()->version(), |
241 session()->connection()->supported_versions(), | 241 session()->connection()->supported_versions(), |
242 session()->connection()->clock(), | 242 session()->connection()->clock(), |
243 session()->connection()->random_generator(), | 243 session()->connection()->random_generator(), &crypto_negotiated_params_, |
244 &crypto_negotiated_params_, reply, error_details); | 244 reply, error_details); |
245 } | 245 } |
246 | 246 |
247 void QuicCryptoServerStream::OverrideQuicConfigDefaults(QuicConfig* config) { | 247 void QuicCryptoServerStream::OverrideQuicConfigDefaults(QuicConfig* config) { |
248 } | 248 } |
249 | 249 |
250 const CachedNetworkParameters* | 250 const CachedNetworkParameters* |
251 QuicCryptoServerStream::previous_cached_network_params() const { | 251 QuicCryptoServerStream::previous_cached_network_params() const { |
252 return previous_cached_network_params_.get(); | 252 return previous_cached_network_params_.get(); |
253 } | 253 } |
254 | 254 |
255 QuicCryptoServerStream::ValidateCallback::ValidateCallback( | 255 QuicCryptoServerStream::ValidateCallback::ValidateCallback( |
256 QuicCryptoServerStream* parent) : parent_(parent) { | 256 QuicCryptoServerStream* parent) : parent_(parent) { |
257 } | 257 } |
258 | 258 |
259 void QuicCryptoServerStream::ValidateCallback::Cancel() { parent_ = nullptr; } | 259 void QuicCryptoServerStream::ValidateCallback::Cancel() { parent_ = nullptr; } |
260 | 260 |
261 void QuicCryptoServerStream::ValidateCallback::RunImpl( | 261 void QuicCryptoServerStream::ValidateCallback::RunImpl( |
262 const CryptoHandshakeMessage& client_hello, | 262 const CryptoHandshakeMessage& client_hello, |
263 const Result& result) { | 263 const Result& result) { |
264 if (parent_ != nullptr) { | 264 if (parent_ != nullptr) { |
265 parent_->FinishProcessingHandshakeMessage(client_hello, result); | 265 parent_->FinishProcessingHandshakeMessage(client_hello, result); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 } // namespace net | 269 } // namespace net |
OLD | NEW |