| 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/core/quic_protocol.h" | 5 #include "net/quic/core/quic_protocol.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "net/quic/core/quic_flags.h" | 9 #include "net/quic/core/quic_flags.h" |
| 10 #include "net/quic/core/quic_utils.h" | 10 #include "net/quic/core/quic_utils.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 QuicVersionVector CurrentSupportedVersions() { | 182 QuicVersionVector CurrentSupportedVersions() { |
| 183 return FilterSupportedVersions(AllSupportedVersions()); | 183 return FilterSupportedVersions(AllSupportedVersions()); |
| 184 } | 184 } |
| 185 | 185 |
| 186 QuicVersionVector FilterSupportedVersions(QuicVersionVector versions) { | 186 QuicVersionVector FilterSupportedVersions(QuicVersionVector versions) { |
| 187 QuicVersionVector filtered_versions(versions.size()); | 187 QuicVersionVector filtered_versions(versions.size()); |
| 188 filtered_versions.clear(); // Guaranteed by spec not to change capacity. | 188 filtered_versions.clear(); // Guaranteed by spec not to change capacity. |
| 189 for (QuicVersion version : versions) { | 189 for (QuicVersion version : versions) { |
| 190 if (version < QUIC_VERSION_32) { | 190 if (version < QUIC_VERSION_32) { |
| 191 if (!FLAGS_quic_disable_pre_32) { | 191 if (!FLAGS_quic_disable_pre_32 && |
| 192 !FLAGS_quic_disable_pre_34) { |
| 193 filtered_versions.push_back(version); |
| 194 } |
| 195 } else if (version < QUIC_VERSION_34) { |
| 196 if (!FLAGS_quic_disable_pre_34) { |
| 192 filtered_versions.push_back(version); | 197 filtered_versions.push_back(version); |
| 193 } | 198 } |
| 194 } else if (version == QUIC_VERSION_35) { | 199 } else if (version == QUIC_VERSION_35) { |
| 195 if (FLAGS_quic_enable_version_35) { | 200 if (FLAGS_quic_enable_version_35) { |
| 196 filtered_versions.push_back(version); | 201 filtered_versions.push_back(version); |
| 197 } | 202 } |
| 198 } else if (version == QUIC_VERSION_36) { | 203 } else if (version == QUIC_VERSION_36) { |
| 199 if (FLAGS_quic_enable_version_35 && FLAGS_quic_enable_version_36_v2) { | 204 if (FLAGS_quic_enable_version_35 && FLAGS_quic_enable_version_36_v2) { |
| 200 filtered_versions.push_back(version); | 205 filtered_versions.push_back(version); |
| 201 } | 206 } |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 StringPiece QuicPacket::Plaintext(QuicVersion version) const { | 778 StringPiece QuicPacket::Plaintext(QuicVersion version) const { |
| 774 const size_t start_of_encrypted_data = GetStartOfEncryptedData( | 779 const size_t start_of_encrypted_data = GetStartOfEncryptedData( |
| 775 version, connection_id_length_, includes_version_, includes_path_id_, | 780 version, connection_id_length_, includes_version_, includes_path_id_, |
| 776 includes_diversification_nonce_, packet_number_length_); | 781 includes_diversification_nonce_, packet_number_length_); |
| 777 return StringPiece(data() + start_of_encrypted_data, | 782 return StringPiece(data() + start_of_encrypted_data, |
| 778 length() - start_of_encrypted_data); | 783 length() - start_of_encrypted_data); |
| 779 } | 784 } |
| 780 | 785 |
| 781 QuicVersionManager::QuicVersionManager(QuicVersionVector supported_versions) | 786 QuicVersionManager::QuicVersionManager(QuicVersionVector supported_versions) |
| 782 : disable_pre_32_(FLAGS_quic_disable_pre_32), | 787 : disable_pre_32_(FLAGS_quic_disable_pre_32), |
| 788 disable_pre_34_(FLAGS_quic_disable_pre_34), |
| 783 enable_version_35_(FLAGS_quic_enable_version_35), | 789 enable_version_35_(FLAGS_quic_enable_version_35), |
| 784 enable_version_36_(FLAGS_quic_enable_version_36_v2), | 790 enable_version_36_(FLAGS_quic_enable_version_36_v2), |
| 785 allowed_supported_versions_(supported_versions), | 791 allowed_supported_versions_(supported_versions), |
| 786 filtered_supported_versions_( | 792 filtered_supported_versions_( |
| 787 FilterSupportedVersions(supported_versions)) {} | 793 FilterSupportedVersions(supported_versions)) {} |
| 788 | 794 |
| 789 QuicVersionManager::~QuicVersionManager() {} | 795 QuicVersionManager::~QuicVersionManager() {} |
| 790 | 796 |
| 791 const QuicVersionVector& QuicVersionManager::GetSupportedVersions() { | 797 const QuicVersionVector& QuicVersionManager::GetSupportedVersions() { |
| 792 if (disable_pre_32_ != FLAGS_quic_disable_pre_32 || | 798 if (disable_pre_32_ != FLAGS_quic_disable_pre_32 || |
| 799 disable_pre_34_ != FLAGS_quic_disable_pre_34 || |
| 793 enable_version_35_ != FLAGS_quic_enable_version_35 || | 800 enable_version_35_ != FLAGS_quic_enable_version_35 || |
| 794 enable_version_36_ != FLAGS_quic_enable_version_36_v2) { | 801 enable_version_36_ != FLAGS_quic_enable_version_36_v2) { |
| 795 disable_pre_32_ = FLAGS_quic_disable_pre_32; | 802 disable_pre_32_ = FLAGS_quic_disable_pre_32; |
| 803 disable_pre_34_ = FLAGS_quic_disable_pre_34; |
| 796 enable_version_35_ = FLAGS_quic_enable_version_35; | 804 enable_version_35_ = FLAGS_quic_enable_version_35; |
| 797 enable_version_36_ = FLAGS_quic_enable_version_36_v2; | 805 enable_version_36_ = FLAGS_quic_enable_version_36_v2; |
| 798 filtered_supported_versions_ = | 806 filtered_supported_versions_ = |
| 799 FilterSupportedVersions(allowed_supported_versions_); | 807 FilterSupportedVersions(allowed_supported_versions_); |
| 800 } | 808 } |
| 801 return filtered_supported_versions_; | 809 return filtered_supported_versions_; |
| 802 } | 810 } |
| 803 | 811 |
| 804 AckListenerWrapper::AckListenerWrapper(QuicAckListenerInterface* listener, | 812 AckListenerWrapper::AckListenerWrapper(QuicAckListenerInterface* listener, |
| 805 QuicPacketLength data_length) | 813 QuicPacketLength data_length) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 is_unackable(false), | 875 is_unackable(false), |
| 868 has_crypto_handshake(has_crypto_handshake), | 876 has_crypto_handshake(has_crypto_handshake), |
| 869 num_padding_bytes(num_padding_bytes), | 877 num_padding_bytes(num_padding_bytes), |
| 870 retransmission(0) {} | 878 retransmission(0) {} |
| 871 | 879 |
| 872 TransmissionInfo::TransmissionInfo(const TransmissionInfo& other) = default; | 880 TransmissionInfo::TransmissionInfo(const TransmissionInfo& other) = default; |
| 873 | 881 |
| 874 TransmissionInfo::~TransmissionInfo() {} | 882 TransmissionInfo::~TransmissionInfo() {} |
| 875 | 883 |
| 876 } // namespace net | 884 } // namespace net |
| OLD | NEW |