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_18: | |
162 return MakeQuicTag('Q', '0', '1', '8'); | |
163 case QUIC_VERSION_19: | 161 case QUIC_VERSION_19: |
164 return MakeQuicTag('Q', '0', '1', '9'); | 162 return MakeQuicTag('Q', '0', '1', '9'); |
165 case QUIC_VERSION_21: | 163 case QUIC_VERSION_21: |
166 return MakeQuicTag('Q', '0', '2', '1'); | 164 return MakeQuicTag('Q', '0', '2', '1'); |
167 case QUIC_VERSION_22: | 165 case QUIC_VERSION_22: |
168 return MakeQuicTag('Q', '0', '2', '2'); | 166 return MakeQuicTag('Q', '0', '2', '2'); |
169 case QUIC_VERSION_23: | 167 case QUIC_VERSION_23: |
170 return MakeQuicTag('Q', '0', '2', '3'); | 168 return MakeQuicTag('Q', '0', '2', '3'); |
171 default: | 169 default: |
172 // This shold be an ERROR because we should never attempt to convert an | 170 // This shold be an ERROR because we should never attempt to convert an |
(...skipping 14 matching lines...) Expand all Loading... |
187 << QuicUtils::TagToString(version_tag); | 185 << QuicUtils::TagToString(version_tag); |
188 return QUIC_VERSION_UNSUPPORTED; | 186 return QUIC_VERSION_UNSUPPORTED; |
189 } | 187 } |
190 | 188 |
191 #define RETURN_STRING_LITERAL(x) \ | 189 #define RETURN_STRING_LITERAL(x) \ |
192 case x: \ | 190 case x: \ |
193 return #x | 191 return #x |
194 | 192 |
195 string QuicVersionToString(const QuicVersion version) { | 193 string QuicVersionToString(const QuicVersion version) { |
196 switch (version) { | 194 switch (version) { |
197 RETURN_STRING_LITERAL(QUIC_VERSION_18); | |
198 RETURN_STRING_LITERAL(QUIC_VERSION_19); | 195 RETURN_STRING_LITERAL(QUIC_VERSION_19); |
199 RETURN_STRING_LITERAL(QUIC_VERSION_21); | 196 RETURN_STRING_LITERAL(QUIC_VERSION_21); |
200 RETURN_STRING_LITERAL(QUIC_VERSION_22); | 197 RETURN_STRING_LITERAL(QUIC_VERSION_22); |
201 RETURN_STRING_LITERAL(QUIC_VERSION_23); | 198 RETURN_STRING_LITERAL(QUIC_VERSION_23); |
202 default: | 199 default: |
203 return "QUIC_VERSION_UNSUPPORTED"; | 200 return "QUIC_VERSION_UNSUPPORTED"; |
204 } | 201 } |
205 } | 202 } |
206 | 203 |
207 string QuicVersionVectorToString(const QuicVersionVector& versions) { | 204 string QuicVersionVectorToString(const QuicVersionVector& versions) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 : receive_window(0) { | 267 : receive_window(0) { |
271 } | 268 } |
272 | 269 |
273 QuicCongestionFeedbackFrame::QuicCongestionFeedbackFrame() : type(kTCP) {} | 270 QuicCongestionFeedbackFrame::QuicCongestionFeedbackFrame() : type(kTCP) {} |
274 | 271 |
275 QuicCongestionFeedbackFrame::~QuicCongestionFeedbackFrame() {} | 272 QuicCongestionFeedbackFrame::~QuicCongestionFeedbackFrame() {} |
276 | 273 |
277 QuicRstStreamErrorCode AdjustErrorForVersion( | 274 QuicRstStreamErrorCode AdjustErrorForVersion( |
278 QuicRstStreamErrorCode error_code, | 275 QuicRstStreamErrorCode error_code, |
279 QuicVersion version) { | 276 QuicVersion version) { |
280 switch (error_code) { | |
281 case QUIC_RST_FLOW_CONTROL_ACCOUNTING: | |
282 if (version < QUIC_VERSION_18) { | |
283 return QUIC_STREAM_NO_ERROR; | |
284 } | |
285 break; | |
286 default: | |
287 return error_code; | |
288 } | |
289 return error_code; | 277 return error_code; |
290 } | 278 } |
291 | 279 |
292 QuicRstStreamFrame::QuicRstStreamFrame() | 280 QuicRstStreamFrame::QuicRstStreamFrame() |
293 : stream_id(0), | 281 : stream_id(0), |
294 error_code(QUIC_STREAM_NO_ERROR) { | 282 error_code(QUIC_STREAM_NO_ERROR) { |
295 } | 283 } |
296 | 284 |
297 QuicRstStreamFrame::QuicRstStreamFrame(QuicStreamId stream_id, | 285 QuicRstStreamFrame::QuicRstStreamFrame(QuicStreamId stream_id, |
298 QuicRstStreamErrorCode error_code, | 286 QuicRstStreamErrorCode error_code, |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 sequence_number_length(sequence_number_length), | 728 sequence_number_length(sequence_number_length), |
741 sent_time(QuicTime::Zero()), | 729 sent_time(QuicTime::Zero()), |
742 bytes_sent(0), | 730 bytes_sent(0), |
743 nack_count(0), | 731 nack_count(0), |
744 transmission_type(transmission_type), | 732 transmission_type(transmission_type), |
745 all_transmissions(all_transmissions), | 733 all_transmissions(all_transmissions), |
746 in_flight(false), | 734 in_flight(false), |
747 is_unackable(false) {} | 735 is_unackable(false) {} |
748 | 736 |
749 } // namespace net | 737 } // namespace net |
OLD | NEW |