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_19: | |
162 return MakeQuicTag('Q', '0', '1', '9'); | |
163 case QUIC_VERSION_21: | 161 case QUIC_VERSION_21: |
164 return MakeQuicTag('Q', '0', '2', '1'); | 162 return MakeQuicTag('Q', '0', '2', '1'); |
165 case QUIC_VERSION_22: | 163 case QUIC_VERSION_22: |
166 return MakeQuicTag('Q', '0', '2', '2'); | 164 return MakeQuicTag('Q', '0', '2', '2'); |
167 case QUIC_VERSION_23: | 165 case QUIC_VERSION_23: |
168 return MakeQuicTag('Q', '0', '2', '3'); | 166 return MakeQuicTag('Q', '0', '2', '3'); |
169 default: | 167 default: |
170 // 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 |
171 // invalid QuicVersion to be written to the wire. | 169 // invalid QuicVersion to be written to the wire. |
172 LOG(ERROR) << "Unsupported QuicVersion: " << version; | 170 LOG(ERROR) << "Unsupported QuicVersion: " << version; |
(...skipping 12 matching lines...) Expand all Loading... |
185 << QuicUtils::TagToString(version_tag); | 183 << QuicUtils::TagToString(version_tag); |
186 return QUIC_VERSION_UNSUPPORTED; | 184 return QUIC_VERSION_UNSUPPORTED; |
187 } | 185 } |
188 | 186 |
189 #define RETURN_STRING_LITERAL(x) \ | 187 #define RETURN_STRING_LITERAL(x) \ |
190 case x: \ | 188 case x: \ |
191 return #x | 189 return #x |
192 | 190 |
193 string QuicVersionToString(const QuicVersion version) { | 191 string QuicVersionToString(const QuicVersion version) { |
194 switch (version) { | 192 switch (version) { |
195 RETURN_STRING_LITERAL(QUIC_VERSION_19); | |
196 RETURN_STRING_LITERAL(QUIC_VERSION_21); | 193 RETURN_STRING_LITERAL(QUIC_VERSION_21); |
197 RETURN_STRING_LITERAL(QUIC_VERSION_22); | 194 RETURN_STRING_LITERAL(QUIC_VERSION_22); |
198 RETURN_STRING_LITERAL(QUIC_VERSION_23); | 195 RETURN_STRING_LITERAL(QUIC_VERSION_23); |
199 default: | 196 default: |
200 return "QUIC_VERSION_UNSUPPORTED"; | 197 return "QUIC_VERSION_UNSUPPORTED"; |
201 } | 198 } |
202 } | 199 } |
203 | 200 |
204 string QuicVersionVectorToString(const QuicVersionVector& versions) { | 201 string QuicVersionVectorToString(const QuicVersionVector& versions) { |
205 string result = ""; | 202 string result = ""; |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 sent_time(sent_time), | 714 sent_time(sent_time), |
718 bytes_sent(0), | 715 bytes_sent(0), |
719 nack_count(0), | 716 nack_count(0), |
720 transmission_type(transmission_type), | 717 transmission_type(transmission_type), |
721 all_transmissions(nullptr), | 718 all_transmissions(nullptr), |
722 in_flight(false), | 719 in_flight(false), |
723 is_unackable(false), | 720 is_unackable(false), |
724 is_fec_packet(false) {} | 721 is_fec_packet(false) {} |
725 | 722 |
726 } // namespace net | 723 } // namespace net |
OLD | NEW |