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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 // QUIC_VERSION_19. | 440 // QUIC_VERSION_19. |
441 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), | 441 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), |
442 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring | 442 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring |
443 // QUIC_VERSION_19. | 443 // QUIC_VERSION_19. |
444 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), | 444 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), |
445 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL) { | 445 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL) { |
446 } | 446 } |
447 | 447 |
448 QuicConfig::~QuicConfig() {} | 448 QuicConfig::~QuicConfig() {} |
449 | 449 |
450 void QuicConfig::set_congestion_feedback( | 450 void QuicConfig::SetCongestionFeedback( |
451 const QuicTagVector& congestion_feedback, | 451 const QuicTagVector& congestion_feedback, |
452 QuicTag default_congestion_feedback) { | 452 QuicTag default_congestion_feedback) { |
453 congestion_feedback_.set(congestion_feedback, default_congestion_feedback); | 453 congestion_feedback_.set(congestion_feedback, default_congestion_feedback); |
454 } | 454 } |
455 | 455 |
456 QuicTag QuicConfig::congestion_feedback() const { | 456 QuicTag QuicConfig::CongestionFeedback() const { |
457 return congestion_feedback_.GetTag(); | 457 return congestion_feedback_.GetTag(); |
458 } | 458 } |
459 | 459 |
460 void QuicConfig::SetConnectionOptionsToSend( | 460 void QuicConfig::SetConnectionOptionsToSend( |
461 const QuicTagVector& connection_options) { | 461 const QuicTagVector& connection_options) { |
462 connection_options_.SetSendValues(connection_options); | 462 connection_options_.SetSendValues(connection_options); |
463 } | 463 } |
464 | 464 |
465 bool QuicConfig::HasReceivedConnectionOptions() const { | 465 bool QuicConfig::HasReceivedConnectionOptions() const { |
466 return connection_options_.HasReceivedValues(); | 466 return connection_options_.HasReceivedValues(); |
467 } | 467 } |
468 | 468 |
469 QuicTagVector QuicConfig::ReceivedConnectionOptions() const { | 469 QuicTagVector QuicConfig::ReceivedConnectionOptions() const { |
470 return connection_options_.GetReceivedValues(); | 470 return connection_options_.GetReceivedValues(); |
471 } | 471 } |
472 | 472 |
473 bool QuicConfig::HasSendConnectionOptions() const { | 473 bool QuicConfig::HasSendConnectionOptions() const { |
474 return connection_options_.HasSendValues(); | 474 return connection_options_.HasSendValues(); |
475 } | 475 } |
476 | 476 |
477 QuicTagVector QuicConfig::SendConnectionOptions() const { | 477 QuicTagVector QuicConfig::SendConnectionOptions() const { |
478 return connection_options_.GetSendValues(); | 478 return connection_options_.GetSendValues(); |
479 } | 479 } |
480 | 480 |
481 void QuicConfig::set_idle_connection_state_lifetime( | 481 void QuicConfig::SetIdleConnectionStateLifetime( |
482 QuicTime::Delta max_idle_connection_state_lifetime, | 482 QuicTime::Delta max_idle_connection_state_lifetime, |
483 QuicTime::Delta default_idle_conection_state_lifetime) { | 483 QuicTime::Delta default_idle_conection_state_lifetime) { |
484 idle_connection_state_lifetime_seconds_.set( | 484 idle_connection_state_lifetime_seconds_.set( |
485 max_idle_connection_state_lifetime.ToSeconds(), | 485 max_idle_connection_state_lifetime.ToSeconds(), |
486 default_idle_conection_state_lifetime.ToSeconds()); | 486 default_idle_conection_state_lifetime.ToSeconds()); |
487 } | 487 } |
488 | 488 |
489 QuicTime::Delta QuicConfig::idle_connection_state_lifetime() const { | 489 QuicTime::Delta QuicConfig::IdleConnectionStateLifetime() const { |
490 return QuicTime::Delta::FromSeconds( | 490 return QuicTime::Delta::FromSeconds( |
491 idle_connection_state_lifetime_seconds_.GetUint32()); | 491 idle_connection_state_lifetime_seconds_.GetUint32()); |
492 } | 492 } |
493 | 493 |
494 QuicTime::Delta QuicConfig::keepalive_timeout() const { | 494 QuicTime::Delta QuicConfig::KeepaliveTimeout() const { |
495 return QuicTime::Delta::FromSeconds( | 495 return QuicTime::Delta::FromSeconds( |
496 keepalive_timeout_seconds_.GetUint32()); | 496 keepalive_timeout_seconds_.GetUint32()); |
497 } | 497 } |
498 | 498 |
499 void QuicConfig::set_max_streams_per_connection(size_t max_streams, | 499 void QuicConfig::SetMaxStreamsPerConnection(size_t max_streams, |
500 size_t default_streams) { | 500 size_t default_streams) { |
501 max_streams_per_connection_.set(max_streams, default_streams); | 501 max_streams_per_connection_.set(max_streams, default_streams); |
502 } | 502 } |
503 | 503 |
504 uint32 QuicConfig::max_streams_per_connection() const { | 504 uint32 QuicConfig::MaxStreamsPerConnection() const { |
505 return max_streams_per_connection_.GetUint32(); | 505 return max_streams_per_connection_.GetUint32(); |
506 } | 506 } |
507 | 507 |
508 void QuicConfig::set_max_time_before_crypto_handshake( | 508 void QuicConfig::set_max_time_before_crypto_handshake( |
509 QuicTime::Delta max_time_before_crypto_handshake) { | 509 QuicTime::Delta max_time_before_crypto_handshake) { |
510 max_time_before_crypto_handshake_ = max_time_before_crypto_handshake; | 510 max_time_before_crypto_handshake_ = max_time_before_crypto_handshake; |
511 } | 511 } |
512 | 512 |
513 QuicTime::Delta QuicConfig::max_time_before_crypto_handshake() const { | 513 QuicTime::Delta QuicConfig::max_time_before_crypto_handshake() const { |
514 return max_time_before_crypto_handshake_; | 514 return max_time_before_crypto_handshake_; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 } | 639 } |
640 | 640 |
641 void QuicConfig::SetDefaults() { | 641 void QuicConfig::SetDefaults() { |
642 QuicTagVector congestion_feedback; | 642 QuicTagVector congestion_feedback; |
643 congestion_feedback.push_back(kQBIC); | 643 congestion_feedback.push_back(kQBIC); |
644 congestion_feedback_.set(congestion_feedback, kQBIC); | 644 congestion_feedback_.set(congestion_feedback, kQBIC); |
645 idle_connection_state_lifetime_seconds_.set(kMaximumIdleTimeoutSecs, | 645 idle_connection_state_lifetime_seconds_.set(kMaximumIdleTimeoutSecs, |
646 kDefaultInitialTimeoutSecs); | 646 kDefaultInitialTimeoutSecs); |
647 // kKATO is optional. Return 0 if not negotiated. | 647 // kKATO is optional. Return 0 if not negotiated. |
648 keepalive_timeout_seconds_.set(0, 0); | 648 keepalive_timeout_seconds_.set(0, 0); |
649 set_max_streams_per_connection(kDefaultMaxStreamsPerConnection, | 649 SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection, |
650 kDefaultMaxStreamsPerConnection); | 650 kDefaultMaxStreamsPerConnection); |
651 max_time_before_crypto_handshake_ = QuicTime::Delta::FromSeconds( | 651 max_time_before_crypto_handshake_ = QuicTime::Delta::FromSeconds( |
652 kDefaultMaxTimeForCryptoHandshakeSecs); | 652 kDefaultMaxTimeForCryptoHandshakeSecs); |
653 | 653 |
654 SetInitialFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 654 SetInitialFlowControlWindowToSend(kDefaultFlowControlSendWindow); |
655 SetInitialStreamFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 655 SetInitialStreamFlowControlWindowToSend(kDefaultFlowControlSendWindow); |
656 SetInitialSessionFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 656 SetInitialSessionFlowControlWindowToSend(kDefaultFlowControlSendWindow); |
657 } | 657 } |
658 | 658 |
659 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { | 659 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { |
660 congestion_feedback_.ToHandshakeMessage(out); | 660 congestion_feedback_.ToHandshakeMessage(out); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 peer_hello, hello_type, error_details); | 718 peer_hello, hello_type, error_details); |
719 } | 719 } |
720 if (error == QUIC_NO_ERROR) { | 720 if (error == QUIC_NO_ERROR) { |
721 error = connection_options_.ProcessPeerHello( | 721 error = connection_options_.ProcessPeerHello( |
722 peer_hello, hello_type, error_details); | 722 peer_hello, hello_type, error_details); |
723 } | 723 } |
724 return error; | 724 return error; |
725 } | 725 } |
726 | 726 |
727 } // namespace net | 727 } // namespace net |
OLD | NEW |