| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 QuicVersionVector QuicSupportedVersions() { | 147 QuicVersionVector QuicSupportedVersions() { |
| 148 QuicVersionVector supported_versions; | 148 QuicVersionVector supported_versions; |
| 149 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { | 149 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { |
| 150 supported_versions.push_back(kSupportedQuicVersions[i]); | 150 supported_versions.push_back(kSupportedQuicVersions[i]); |
| 151 } | 151 } |
| 152 return supported_versions; | 152 return supported_versions; |
| 153 } | 153 } |
| 154 | 154 |
| 155 QuicTag QuicVersionToQuicTag(const QuicVersion version) { | 155 QuicTag QuicVersionToQuicTag(const QuicVersion version) { |
| 156 switch (version) { | 156 switch (version) { |
| 157 case QUIC_VERSION_12: | |
| 158 return MakeQuicTag('Q', '0', '1', '2'); | |
| 159 case QUIC_VERSION_13: | 157 case QUIC_VERSION_13: |
| 160 return MakeQuicTag('Q', '0', '1', '3'); | 158 return MakeQuicTag('Q', '0', '1', '3'); |
| 161 case QUIC_VERSION_14: | 159 case QUIC_VERSION_14: |
| 162 return MakeQuicTag('Q', '0', '1', '4'); | 160 return MakeQuicTag('Q', '0', '1', '4'); |
| 163 case QUIC_VERSION_15: | 161 case QUIC_VERSION_15: |
| 164 return MakeQuicTag('Q', '0', '1', '5'); | 162 return MakeQuicTag('Q', '0', '1', '5'); |
| 165 case QUIC_VERSION_16: | 163 case QUIC_VERSION_16: |
| 166 return MakeQuicTag('Q', '0', '1', '6'); | 164 return MakeQuicTag('Q', '0', '1', '6'); |
| 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 |
| (...skipping 14 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_12); | |
| 194 RETURN_STRING_LITERAL(QUIC_VERSION_13); | 191 RETURN_STRING_LITERAL(QUIC_VERSION_13); |
| 195 RETURN_STRING_LITERAL(QUIC_VERSION_14); | 192 RETURN_STRING_LITERAL(QUIC_VERSION_14); |
| 196 RETURN_STRING_LITERAL(QUIC_VERSION_15); | 193 RETURN_STRING_LITERAL(QUIC_VERSION_15); |
| 197 RETURN_STRING_LITERAL(QUIC_VERSION_16); | 194 RETURN_STRING_LITERAL(QUIC_VERSION_16); |
| 198 default: | 195 default: |
| 199 return "QUIC_VERSION_UNSUPPORTED"; | 196 return "QUIC_VERSION_UNSUPPORTED"; |
| 200 } | 197 } |
| 201 } | 198 } |
| 202 | 199 |
| 203 string QuicVersionVectorToString(const QuicVersionVector& versions) { | 200 string QuicVersionVectorToString(const QuicVersionVector& versions) { |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 return os; | 729 return os; |
| 733 } | 730 } |
| 734 | 731 |
| 735 WriteResult::WriteResult(WriteStatus status, | 732 WriteResult::WriteResult(WriteStatus status, |
| 736 int bytes_written_or_error_code) | 733 int bytes_written_or_error_code) |
| 737 : status(status), | 734 : status(status), |
| 738 bytes_written(bytes_written_or_error_code) { | 735 bytes_written(bytes_written_or_error_code) { |
| 739 } | 736 } |
| 740 | 737 |
| 741 } // namespace net | 738 } // namespace net |
| OLD | NEW |