| 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_protocol.h" | 5 #include "net/quic/quic_protocol.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "net/quic/quic_utils.h" | 8 #include "net/quic/quic_utils.h" |
| 9 | 9 |
| 10 using base::StringPiece; | 10 using base::StringPiece; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 QuicVersionVector QuicSupportedVersions() { | 151 QuicVersionVector QuicSupportedVersions() { |
| 152 QuicVersionVector supported_versions; | 152 QuicVersionVector supported_versions; |
| 153 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { | 153 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { |
| 154 supported_versions.push_back(kSupportedQuicVersions[i]); | 154 supported_versions.push_back(kSupportedQuicVersions[i]); |
| 155 } | 155 } |
| 156 return supported_versions; | 156 return supported_versions; |
| 157 } | 157 } |
| 158 | 158 |
| 159 QuicTag QuicVersionToQuicTag(const QuicVersion version) { | 159 QuicTag QuicVersionToQuicTag(const QuicVersion version) { |
| 160 switch (version) { | 160 switch (version) { |
| 161 case QUIC_VERSION_21: | |
| 162 return MakeQuicTag('Q', '0', '2', '1'); | |
| 163 case QUIC_VERSION_22: | 161 case QUIC_VERSION_22: |
| 164 return MakeQuicTag('Q', '0', '2', '2'); | 162 return MakeQuicTag('Q', '0', '2', '2'); |
| 165 case QUIC_VERSION_23: | 163 case QUIC_VERSION_23: |
| 166 return MakeQuicTag('Q', '0', '2', '3'); | 164 return MakeQuicTag('Q', '0', '2', '3'); |
| 167 default: | 165 default: |
| 168 // This shold be an ERROR because we should never attempt to convert an | 166 // This shold be an ERROR because we should never attempt to convert an |
| 169 // invalid QuicVersion to be written to the wire. | 167 // invalid QuicVersion to be written to the wire. |
| 170 LOG(ERROR) << "Unsupported QuicVersion: " << version; | 168 LOG(ERROR) << "Unsupported QuicVersion: " << version; |
| 171 return 0; | 169 return 0; |
| 172 } | 170 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 183 << QuicUtils::TagToString(version_tag); | 181 << QuicUtils::TagToString(version_tag); |
| 184 return QUIC_VERSION_UNSUPPORTED; | 182 return QUIC_VERSION_UNSUPPORTED; |
| 185 } | 183 } |
| 186 | 184 |
| 187 #define RETURN_STRING_LITERAL(x) \ | 185 #define RETURN_STRING_LITERAL(x) \ |
| 188 case x: \ | 186 case x: \ |
| 189 return #x | 187 return #x |
| 190 | 188 |
| 191 string QuicVersionToString(const QuicVersion version) { | 189 string QuicVersionToString(const QuicVersion version) { |
| 192 switch (version) { | 190 switch (version) { |
| 193 RETURN_STRING_LITERAL(QUIC_VERSION_21); | |
| 194 RETURN_STRING_LITERAL(QUIC_VERSION_22); | 191 RETURN_STRING_LITERAL(QUIC_VERSION_22); |
| 195 RETURN_STRING_LITERAL(QUIC_VERSION_23); | 192 RETURN_STRING_LITERAL(QUIC_VERSION_23); |
| 196 default: | 193 default: |
| 197 return "QUIC_VERSION_UNSUPPORTED"; | 194 return "QUIC_VERSION_UNSUPPORTED"; |
| 198 } | 195 } |
| 199 } | 196 } |
| 200 | 197 |
| 201 string QuicVersionVectorToString(const QuicVersionVector& versions) { | 198 string QuicVersionVectorToString(const QuicVersionVector& versions) { |
| 202 string result = ""; | 199 string result = ""; |
| 203 for (size_t i = 0; i < versions.size(); ++i) { | 200 for (size_t i = 0; i < versions.size(); ++i) { |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 sent_time(sent_time), | 711 sent_time(sent_time), |
| 715 bytes_sent(0), | 712 bytes_sent(0), |
| 716 nack_count(0), | 713 nack_count(0), |
| 717 transmission_type(transmission_type), | 714 transmission_type(transmission_type), |
| 718 all_transmissions(nullptr), | 715 all_transmissions(nullptr), |
| 719 in_flight(false), | 716 in_flight(false), |
| 720 is_unackable(false), | 717 is_unackable(false), |
| 721 is_fec_packet(false) {} | 718 is_fec_packet(false) {} |
| 722 | 719 |
| 723 } // namespace net | 720 } // namespace net |
| OLD | NEW |