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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_13: | 157 case QUIC_VERSION_13: |
158 return MakeQuicTag('Q', '0', '1', '3'); | 158 return MakeQuicTag('Q', '0', '1', '3'); |
159 case QUIC_VERSION_14: | |
160 return MakeQuicTag('Q', '0', '1', '4'); | |
161 case QUIC_VERSION_15: | 159 case QUIC_VERSION_15: |
162 return MakeQuicTag('Q', '0', '1', '5'); | 160 return MakeQuicTag('Q', '0', '1', '5'); |
163 case QUIC_VERSION_16: | 161 case QUIC_VERSION_16: |
164 return MakeQuicTag('Q', '0', '1', '6'); | 162 return MakeQuicTag('Q', '0', '1', '6'); |
165 default: | 163 default: |
166 // This shold be an ERROR because we should never attempt to convert an | 164 // This shold be an ERROR because we should never attempt to convert an |
167 // invalid QuicVersion to be written to the wire. | 165 // invalid QuicVersion to be written to the wire. |
168 LOG(ERROR) << "Unsupported QuicVersion: " << version; | 166 LOG(ERROR) << "Unsupported QuicVersion: " << version; |
169 return 0; | 167 return 0; |
170 } | 168 } |
(...skipping 11 matching lines...) Expand all Loading... |
182 return QUIC_VERSION_UNSUPPORTED; | 180 return QUIC_VERSION_UNSUPPORTED; |
183 } | 181 } |
184 | 182 |
185 #define RETURN_STRING_LITERAL(x) \ | 183 #define RETURN_STRING_LITERAL(x) \ |
186 case x: \ | 184 case x: \ |
187 return #x | 185 return #x |
188 | 186 |
189 string QuicVersionToString(const QuicVersion version) { | 187 string QuicVersionToString(const QuicVersion version) { |
190 switch (version) { | 188 switch (version) { |
191 RETURN_STRING_LITERAL(QUIC_VERSION_13); | 189 RETURN_STRING_LITERAL(QUIC_VERSION_13); |
192 RETURN_STRING_LITERAL(QUIC_VERSION_14); | |
193 RETURN_STRING_LITERAL(QUIC_VERSION_15); | 190 RETURN_STRING_LITERAL(QUIC_VERSION_15); |
194 RETURN_STRING_LITERAL(QUIC_VERSION_16); | 191 RETURN_STRING_LITERAL(QUIC_VERSION_16); |
195 default: | 192 default: |
196 return "QUIC_VERSION_UNSUPPORTED"; | 193 return "QUIC_VERSION_UNSUPPORTED"; |
197 } | 194 } |
198 } | 195 } |
199 | 196 |
200 string QuicVersionVectorToString(const QuicVersionVector& versions) { | 197 string QuicVersionVectorToString(const QuicVersionVector& versions) { |
201 string result = ""; | 198 string result = ""; |
202 for (size_t i = 0; i < versions.size(); ++i) { | 199 for (size_t i = 0; i < versions.size(); ++i) { |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 return os; | 726 return os; |
730 } | 727 } |
731 | 728 |
732 WriteResult::WriteResult(WriteStatus status, | 729 WriteResult::WriteResult(WriteStatus status, |
733 int bytes_written_or_error_code) | 730 int bytes_written_or_error_code) |
734 : status(status), | 731 : status(status), |
735 bytes_written(bytes_written_or_error_code) { | 732 bytes_written(bytes_written_or_error_code) { |
736 } | 733 } |
737 | 734 |
738 } // namespace net | 735 } // namespace net |
OLD | NEW |