| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 156 } |
| 157 return supported_versions; | 157 return supported_versions; |
| 158 } | 158 } |
| 159 | 159 |
| 160 QuicTag QuicVersionToQuicTag(const QuicVersion version) { | 160 QuicTag QuicVersionToQuicTag(const QuicVersion version) { |
| 161 switch (version) { | 161 switch (version) { |
| 162 case QUIC_VERSION_15: | 162 case QUIC_VERSION_15: |
| 163 return MakeQuicTag('Q', '0', '1', '5'); | 163 return MakeQuicTag('Q', '0', '1', '5'); |
| 164 case QUIC_VERSION_16: | 164 case QUIC_VERSION_16: |
| 165 return MakeQuicTag('Q', '0', '1', '6'); | 165 return MakeQuicTag('Q', '0', '1', '6'); |
| 166 case QUIC_VERSION_17: | |
| 167 return MakeQuicTag('Q', '0', '1', '7'); | |
| 168 case QUIC_VERSION_18: | 166 case QUIC_VERSION_18: |
| 169 return MakeQuicTag('Q', '0', '1', '8'); | 167 return MakeQuicTag('Q', '0', '1', '8'); |
| 170 case QUIC_VERSION_19: | 168 case QUIC_VERSION_19: |
| 171 return MakeQuicTag('Q', '0', '1', '9'); | 169 return MakeQuicTag('Q', '0', '1', '9'); |
| 172 case QUIC_VERSION_20: | 170 case QUIC_VERSION_20: |
| 173 return MakeQuicTag('Q', '0', '2', '0'); | 171 return MakeQuicTag('Q', '0', '2', '0'); |
| 174 default: | 172 default: |
| 175 // This shold be an ERROR because we should never attempt to convert an | 173 // This shold be an ERROR because we should never attempt to convert an |
| 176 // invalid QuicVersion to be written to the wire. | 174 // invalid QuicVersion to be written to the wire. |
| 177 LOG(ERROR) << "Unsupported QuicVersion: " << version; | 175 LOG(ERROR) << "Unsupported QuicVersion: " << version; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 192 } | 190 } |
| 193 | 191 |
| 194 #define RETURN_STRING_LITERAL(x) \ | 192 #define RETURN_STRING_LITERAL(x) \ |
| 195 case x: \ | 193 case x: \ |
| 196 return #x | 194 return #x |
| 197 | 195 |
| 198 string QuicVersionToString(const QuicVersion version) { | 196 string QuicVersionToString(const QuicVersion version) { |
| 199 switch (version) { | 197 switch (version) { |
| 200 RETURN_STRING_LITERAL(QUIC_VERSION_15); | 198 RETURN_STRING_LITERAL(QUIC_VERSION_15); |
| 201 RETURN_STRING_LITERAL(QUIC_VERSION_16); | 199 RETURN_STRING_LITERAL(QUIC_VERSION_16); |
| 202 RETURN_STRING_LITERAL(QUIC_VERSION_17); | |
| 203 RETURN_STRING_LITERAL(QUIC_VERSION_18); | 200 RETURN_STRING_LITERAL(QUIC_VERSION_18); |
| 204 RETURN_STRING_LITERAL(QUIC_VERSION_19); | 201 RETURN_STRING_LITERAL(QUIC_VERSION_19); |
| 205 RETURN_STRING_LITERAL(QUIC_VERSION_20); | 202 RETURN_STRING_LITERAL(QUIC_VERSION_20); |
| 206 default: | 203 default: |
| 207 return "QUIC_VERSION_UNSUPPORTED"; | 204 return "QUIC_VERSION_UNSUPPORTED"; |
| 208 } | 205 } |
| 209 } | 206 } |
| 210 | 207 |
| 211 string QuicVersionVectorToString(const QuicVersionVector& versions) { | 208 string QuicVersionVectorToString(const QuicVersionVector& versions) { |
| 212 string result = ""; | 209 string result = ""; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 281 |
| 285 QuicCongestionFeedbackFrame::QuicCongestionFeedbackFrame() : type(kTCP) {} | 282 QuicCongestionFeedbackFrame::QuicCongestionFeedbackFrame() : type(kTCP) {} |
| 286 | 283 |
| 287 QuicCongestionFeedbackFrame::~QuicCongestionFeedbackFrame() {} | 284 QuicCongestionFeedbackFrame::~QuicCongestionFeedbackFrame() {} |
| 288 | 285 |
| 289 QuicRstStreamErrorCode AdjustErrorForVersion( | 286 QuicRstStreamErrorCode AdjustErrorForVersion( |
| 290 QuicRstStreamErrorCode error_code, | 287 QuicRstStreamErrorCode error_code, |
| 291 QuicVersion version) { | 288 QuicVersion version) { |
| 292 switch (error_code) { | 289 switch (error_code) { |
| 293 case QUIC_RST_FLOW_CONTROL_ACCOUNTING: | 290 case QUIC_RST_FLOW_CONTROL_ACCOUNTING: |
| 294 if (version <= QUIC_VERSION_17) { | 291 if (version < QUIC_VERSION_18) { |
| 295 return QUIC_STREAM_NO_ERROR; | 292 return QUIC_STREAM_NO_ERROR; |
| 296 } | 293 } |
| 297 break; | 294 break; |
| 298 default: | 295 default: |
| 299 return error_code; | 296 return error_code; |
| 300 } | 297 } |
| 301 return error_code; | 298 return error_code; |
| 302 } | 299 } |
| 303 | 300 |
| 304 QuicRstStreamFrame::QuicRstStreamFrame() | 301 QuicRstStreamFrame::QuicRstStreamFrame() |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 sent_time(QuicTime::Zero()), | 781 sent_time(QuicTime::Zero()), |
| 785 bytes_sent(0), | 782 bytes_sent(0), |
| 786 nack_count(0), | 783 nack_count(0), |
| 787 transmission_type(transmission_type), | 784 transmission_type(transmission_type), |
| 788 all_transmissions(all_transmissions), | 785 all_transmissions(all_transmissions), |
| 789 in_flight(false) { | 786 in_flight(false) { |
| 790 all_transmissions->insert(sequence_number); | 787 all_transmissions->insert(sequence_number); |
| 791 } | 788 } |
| 792 | 789 |
| 793 } // namespace net | 790 } // namespace net |
| OLD | NEW |