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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_22: | 161 case QUIC_VERSION_22: |
162 return MakeQuicTag('Q', '0', '2', '2'); | 162 return MakeQuicTag('Q', '0', '2', '2'); |
163 case QUIC_VERSION_23: | 163 case QUIC_VERSION_23: |
164 return MakeQuicTag('Q', '0', '2', '3'); | 164 return MakeQuicTag('Q', '0', '2', '3'); |
| 165 case QUIC_VERSION_24: |
| 166 return MakeQuicTag('Q', '0', '2', '4'); |
165 default: | 167 default: |
166 // This shold be an ERROR because we should never attempt to convert an | 168 // This shold be an ERROR because we should never attempt to convert an |
167 // invalid QuicVersion to be written to the wire. | 169 // invalid QuicVersion to be written to the wire. |
168 LOG(ERROR) << "Unsupported QuicVersion: " << version; | 170 LOG(ERROR) << "Unsupported QuicVersion: " << version; |
169 return 0; | 171 return 0; |
170 } | 172 } |
171 } | 173 } |
172 | 174 |
173 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) { | 175 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) { |
174 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { | 176 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { |
175 if (version_tag == QuicVersionToQuicTag(kSupportedQuicVersions[i])) { | 177 if (version_tag == QuicVersionToQuicTag(kSupportedQuicVersions[i])) { |
176 return kSupportedQuicVersions[i]; | 178 return kSupportedQuicVersions[i]; |
177 } | 179 } |
178 } | 180 } |
179 // Reading from the client so this should not be considered an ERROR. | 181 // Reading from the client so this should not be considered an ERROR. |
180 DVLOG(1) << "Unsupported QuicTag version: " | 182 DVLOG(1) << "Unsupported QuicTag version: " |
181 << QuicUtils::TagToString(version_tag); | 183 << QuicUtils::TagToString(version_tag); |
182 return QUIC_VERSION_UNSUPPORTED; | 184 return QUIC_VERSION_UNSUPPORTED; |
183 } | 185 } |
184 | 186 |
185 #define RETURN_STRING_LITERAL(x) \ | 187 #define RETURN_STRING_LITERAL(x) \ |
186 case x: \ | 188 case x: \ |
187 return #x | 189 return #x |
188 | 190 |
189 string QuicVersionToString(const QuicVersion version) { | 191 string QuicVersionToString(const QuicVersion version) { |
190 switch (version) { | 192 switch (version) { |
191 RETURN_STRING_LITERAL(QUIC_VERSION_22); | 193 RETURN_STRING_LITERAL(QUIC_VERSION_22); |
192 RETURN_STRING_LITERAL(QUIC_VERSION_23); | 194 RETURN_STRING_LITERAL(QUIC_VERSION_23); |
| 195 RETURN_STRING_LITERAL(QUIC_VERSION_24); |
193 default: | 196 default: |
194 return "QUIC_VERSION_UNSUPPORTED"; | 197 return "QUIC_VERSION_UNSUPPORTED"; |
195 } | 198 } |
196 } | 199 } |
197 | 200 |
198 string QuicVersionVectorToString(const QuicVersionVector& versions) { | 201 string QuicVersionVectorToString(const QuicVersionVector& versions) { |
199 string result = ""; | 202 string result = ""; |
200 for (size_t i = 0; i < versions.size(); ++i) { | 203 for (size_t i = 0; i < versions.size(); ++i) { |
201 if (i != 0) { | 204 if (i != 0) { |
202 result.append(","); | 205 result.append(","); |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 sent_time(sent_time), | 714 sent_time(sent_time), |
712 bytes_sent(0), | 715 bytes_sent(0), |
713 nack_count(0), | 716 nack_count(0), |
714 transmission_type(transmission_type), | 717 transmission_type(transmission_type), |
715 all_transmissions(nullptr), | 718 all_transmissions(nullptr), |
716 in_flight(false), | 719 in_flight(false), |
717 is_unackable(false), | 720 is_unackable(false), |
718 is_fec_packet(false) {} | 721 is_fec_packet(false) {} |
719 | 722 |
720 } // namespace net | 723 } // namespace net |
OLD | NEW |