OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "net/quic/quic_config.h" | 5 #include "net/quic/quic_config.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "net/quic/crypto/crypto_handshake_message.h" | 10 #include "net/quic/crypto/crypto_handshake_message.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 QuicErrorCode error = ReadUint32(peer_hello, | 102 QuicErrorCode error = ReadUint32(peer_hello, |
103 tag_, | 103 tag_, |
104 presence_, | 104 presence_, |
105 default_value_, | 105 default_value_, |
106 &value, | 106 &value, |
107 error_details); | 107 error_details); |
108 if (error != QUIC_NO_ERROR) { | 108 if (error != QUIC_NO_ERROR) { |
109 return error; | 109 return error; |
110 } | 110 } |
111 if (hello_type == SERVER && value > max_value_) { | 111 if (hello_type == SERVER && value > max_value_) { |
112 *error_details = "Invalid value received for " + | 112 *error_details = |
113 QuicUtils::TagToString(tag_); | 113 "Invalid value received for " + QuicUtils::TagToString(tag_); |
114 return QUIC_INVALID_NEGOTIATED_VALUE; | 114 return QUIC_INVALID_NEGOTIATED_VALUE; |
115 } | 115 } |
116 | 116 |
117 negotiated_ = true; | 117 negotiated_ = true; |
118 negotiated_value_ = min(value, max_value_); | 118 negotiated_value_ = min(value, max_value_); |
119 return QUIC_NO_ERROR; | 119 return QUIC_NO_ERROR; |
120 } | 120 } |
121 | 121 |
122 QuicNegotiableTag::QuicNegotiableTag(QuicTag tag, QuicConfigPresence presence) | 122 QuicNegotiableTag::QuicNegotiableTag(QuicTag tag, QuicConfigPresence presence) |
123 : QuicNegotiableValue(tag, presence), | 123 : QuicNegotiableValue(tag, presence), |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 has_send_value_(false), | 221 has_send_value_(false), |
222 has_receive_value_(false) { | 222 has_receive_value_(false) { |
223 } | 223 } |
224 QuicFixedUint32::~QuicFixedUint32() {} | 224 QuicFixedUint32::~QuicFixedUint32() {} |
225 | 225 |
226 bool QuicFixedUint32::HasSendValue() const { | 226 bool QuicFixedUint32::HasSendValue() const { |
227 return has_send_value_; | 227 return has_send_value_; |
228 } | 228 } |
229 | 229 |
230 uint32 QuicFixedUint32::GetSendValue() const { | 230 uint32 QuicFixedUint32::GetSendValue() const { |
231 LOG_IF(DFATAL, !has_send_value_) << "No send value to get for tag:" << tag_; | 231 LOG_IF(DFATAL, !has_send_value_) |
| 232 << "No send value to get for tag:" << QuicUtils::TagToString(tag_); |
232 return send_value_; | 233 return send_value_; |
233 } | 234 } |
234 | 235 |
235 void QuicFixedUint32::SetSendValue(uint32 value) { | 236 void QuicFixedUint32::SetSendValue(uint32 value) { |
236 has_send_value_ = true; | 237 has_send_value_ = true; |
237 send_value_ = value; | 238 send_value_ = value; |
238 } | 239 } |
239 | 240 |
240 bool QuicFixedUint32::HasReceivedValue() const { | 241 bool QuicFixedUint32::HasReceivedValue() const { |
241 return has_receive_value_; | 242 return has_receive_value_; |
242 } | 243 } |
243 | 244 |
244 uint32 QuicFixedUint32::GetReceivedValue() const { | 245 uint32 QuicFixedUint32::GetReceivedValue() const { |
245 LOG_IF(DFATAL, !has_receive_value_) | 246 LOG_IF(DFATAL, !has_receive_value_) |
246 << "No receive value to get for tag:" << tag_; | 247 << "No receive value to get for tag:" << QuicUtils::TagToString(tag_); |
247 return receive_value_; | 248 return receive_value_; |
248 } | 249 } |
249 | 250 |
250 void QuicFixedUint32::SetReceivedValue(uint32 value) { | 251 void QuicFixedUint32::SetReceivedValue(uint32 value) { |
251 has_receive_value_ = true; | 252 has_receive_value_ = true; |
252 receive_value_ = value; | 253 receive_value_ = value; |
253 } | 254 } |
254 | 255 |
255 void QuicFixedUint32::ToHandshakeMessage(CryptoHandshakeMessage* out) const { | 256 void QuicFixedUint32::ToHandshakeMessage(CryptoHandshakeMessage* out) const { |
256 if (has_send_value_) { | 257 if (has_send_value_) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 has_receive_value_(false) { | 289 has_receive_value_(false) { |
289 } | 290 } |
290 | 291 |
291 QuicFixedTag::~QuicFixedTag() {} | 292 QuicFixedTag::~QuicFixedTag() {} |
292 | 293 |
293 bool QuicFixedTag::HasSendValue() const { | 294 bool QuicFixedTag::HasSendValue() const { |
294 return has_send_value_; | 295 return has_send_value_; |
295 } | 296 } |
296 | 297 |
297 uint32 QuicFixedTag::GetSendValue() const { | 298 uint32 QuicFixedTag::GetSendValue() const { |
298 LOG_IF(DFATAL, !has_send_value_) << "No send value to get for tag:" << tag_; | 299 LOG_IF(DFATAL, !has_send_value_) |
| 300 << "No send value to get for tag:" << QuicUtils::TagToString(tag_); |
299 return send_value_; | 301 return send_value_; |
300 } | 302 } |
301 | 303 |
302 void QuicFixedTag::SetSendValue(uint32 value) { | 304 void QuicFixedTag::SetSendValue(uint32 value) { |
303 has_send_value_ = true; | 305 has_send_value_ = true; |
304 send_value_ = value; | 306 send_value_ = value; |
305 } | 307 } |
306 | 308 |
307 bool QuicFixedTag::HasReceivedValue() const { | 309 bool QuicFixedTag::HasReceivedValue() const { |
308 return has_receive_value_; | 310 return has_receive_value_; |
309 } | 311 } |
310 | 312 |
311 uint32 QuicFixedTag::GetReceivedValue() const { | 313 uint32 QuicFixedTag::GetReceivedValue() const { |
312 LOG_IF(DFATAL, !has_receive_value_) | 314 LOG_IF(DFATAL, !has_receive_value_) |
313 << "No receive value to get for tag:" << tag_; | 315 << "No receive value to get for tag:" << QuicUtils::TagToString(tag_); |
314 return receive_value_; | 316 return receive_value_; |
315 } | 317 } |
316 | 318 |
317 void QuicFixedTag::SetReceivedValue(uint32 value) { | 319 void QuicFixedTag::SetReceivedValue(uint32 value) { |
318 has_receive_value_ = true; | 320 has_receive_value_ = true; |
319 receive_value_ = value; | 321 receive_value_ = value; |
320 } | 322 } |
321 | 323 |
322 void QuicFixedTag::ToHandshakeMessage(CryptoHandshakeMessage* out) const { | 324 void QuicFixedTag::ToHandshakeMessage(CryptoHandshakeMessage* out) const { |
323 if (has_send_value_) { | 325 if (has_send_value_) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 has_receive_values_(false) { | 357 has_receive_values_(false) { |
356 } | 358 } |
357 | 359 |
358 QuicFixedTagVector::~QuicFixedTagVector() {} | 360 QuicFixedTagVector::~QuicFixedTagVector() {} |
359 | 361 |
360 bool QuicFixedTagVector::HasSendValues() const { | 362 bool QuicFixedTagVector::HasSendValues() const { |
361 return has_send_values_; | 363 return has_send_values_; |
362 } | 364 } |
363 | 365 |
364 QuicTagVector QuicFixedTagVector::GetSendValues() const { | 366 QuicTagVector QuicFixedTagVector::GetSendValues() const { |
365 LOG_IF(DFATAL, !has_send_values_) << "No send values to get for tag:" << tag_; | 367 LOG_IF(DFATAL, !has_send_values_) |
| 368 << "No send values to get for tag:" << QuicUtils::TagToString(tag_); |
366 return send_values_; | 369 return send_values_; |
367 } | 370 } |
368 | 371 |
369 void QuicFixedTagVector::SetSendValues(const QuicTagVector& values) { | 372 void QuicFixedTagVector::SetSendValues(const QuicTagVector& values) { |
370 has_send_values_ = true; | 373 has_send_values_ = true; |
371 send_values_ = values; | 374 send_values_ = values; |
372 } | 375 } |
373 | 376 |
374 bool QuicFixedTagVector::HasReceivedValues() const { | 377 bool QuicFixedTagVector::HasReceivedValues() const { |
375 return has_receive_values_; | 378 return has_receive_values_; |
376 } | 379 } |
377 | 380 |
378 QuicTagVector QuicFixedTagVector::GetReceivedValues() const { | 381 QuicTagVector QuicFixedTagVector::GetReceivedValues() const { |
379 LOG_IF(DFATAL, !has_receive_values_) | 382 LOG_IF(DFATAL, !has_receive_values_) |
380 << "No receive value to get for tag:" << tag_; | 383 << "No receive value to get for tag:" << QuicUtils::TagToString(tag_); |
381 return receive_values_; | 384 return receive_values_; |
382 } | 385 } |
383 | 386 |
384 void QuicFixedTagVector::SetReceivedValues(const QuicTagVector& values) { | 387 void QuicFixedTagVector::SetReceivedValues(const QuicTagVector& values) { |
385 has_receive_values_ = true; | 388 has_receive_values_ = true; |
386 receive_values_ = values; | 389 receive_values_ = values; |
387 } | 390 } |
388 | 391 |
389 void QuicFixedTagVector::ToHandshakeMessage(CryptoHandshakeMessage* out) const { | 392 void QuicFixedTagVector::ToHandshakeMessage(CryptoHandshakeMessage* out) const { |
390 if (has_send_values_) { | 393 if (has_send_values_) { |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 peer_hello, hello_type, error_details); | 636 peer_hello, hello_type, error_details); |
634 } | 637 } |
635 if (error == QUIC_NO_ERROR) { | 638 if (error == QUIC_NO_ERROR) { |
636 error = congestion_options_.ProcessPeerHello( | 639 error = congestion_options_.ProcessPeerHello( |
637 peer_hello, hello_type, error_details); | 640 peer_hello, hello_type, error_details); |
638 } | 641 } |
639 return error; | 642 return error; |
640 } | 643 } |
641 | 644 |
642 } // namespace net | 645 } // namespace net |
OLD | NEW |