Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: net/quic/quic_protocol.cc

Issue 22311013: Removing QUIC's VERSION_6, now that QUIC no longer needs to support the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Sync with trunk Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_protocol.h ('k') | net/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 uint32 MakeQuicTag(char a, char b, char c, char d) { 117 uint32 MakeQuicTag(char a, char b, char c, char d) {
118 return static_cast<uint32>(a) | 118 return static_cast<uint32>(a) |
119 static_cast<uint32>(b) << 8 | 119 static_cast<uint32>(b) << 8 |
120 static_cast<uint32>(c) << 16 | 120 static_cast<uint32>(c) << 16 |
121 static_cast<uint32>(d) << 24; 121 static_cast<uint32>(d) << 24;
122 } 122 }
123 123
124 QuicVersion QuicVersionMax() { return kSupportedQuicVersions[0]; } 124 QuicVersion QuicVersionMax() { return kSupportedQuicVersions[0]; }
125 125
126 QuicVersion QuicVersionMin() {
127 return kSupportedQuicVersions[arraysize(kSupportedQuicVersions) - 1];
128 }
129
126 QuicTag QuicVersionToQuicTag(const QuicVersion version) { 130 QuicTag QuicVersionToQuicTag(const QuicVersion version) {
127 switch (version) { 131 switch (version) {
128 case QUIC_VERSION_6:
129 return MakeQuicTag('Q', '0', '0', '6');
130 case QUIC_VERSION_7: 132 case QUIC_VERSION_7:
131 return MakeQuicTag('Q', '0', '0', '7'); 133 return MakeQuicTag('Q', '0', '0', '7');
132 case QUIC_VERSION_8: 134 case QUIC_VERSION_8:
133 return MakeQuicTag('Q', '0', '0', '8'); 135 return MakeQuicTag('Q', '0', '0', '8');
134 default: 136 default:
135 // This shold be an ERROR because we should never attempt to convert an 137 // This shold be an ERROR because we should never attempt to convert an
136 // invalid QuicVersion to be written to the wire. 138 // invalid QuicVersion to be written to the wire.
137 LOG(ERROR) << "Unsupported QuicVersion: " << version; 139 LOG(ERROR) << "Unsupported QuicVersion: " << version;
138 return 0; 140 return 0;
139 } 141 }
140 } 142 }
141 143
142 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) { 144 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) {
143 const QuicTag quic_tag_v6 = MakeQuicTag('Q', '0', '0', '6');
144 const QuicTag quic_tag_v7 = MakeQuicTag('Q', '0', '0', '7'); 145 const QuicTag quic_tag_v7 = MakeQuicTag('Q', '0', '0', '7');
145 const QuicTag quic_tag_v8 = MakeQuicTag('Q', '0', '0', '8'); 146 const QuicTag quic_tag_v8 = MakeQuicTag('Q', '0', '0', '8');
146 147
147 if (version_tag == quic_tag_v6) { 148 if (version_tag == quic_tag_v7) {
148 return QUIC_VERSION_6;
149 } else if (version_tag == quic_tag_v7) {
150 return QUIC_VERSION_7; 149 return QUIC_VERSION_7;
151 } else if (version_tag == quic_tag_v8) { 150 } else if (version_tag == quic_tag_v8) {
152 return QUIC_VERSION_8; 151 return QUIC_VERSION_8;
153 } else { 152 } else {
154 // Reading from the client so this should not be considered an ERROR. 153 // Reading from the client so this should not be considered an ERROR.
155 DLOG(INFO) << "Unsupported QuicTag version: " 154 DLOG(INFO) << "Unsupported QuicTag version: "
156 << QuicUtils::TagToString(version_tag); 155 << QuicUtils::TagToString(version_tag);
157 return QUIC_VERSION_UNSUPPORTED; 156 return QUIC_VERSION_UNSUPPORTED;
158 } 157 }
159 } 158 }
160 159
161 #define RETURN_STRING_LITERAL(x) \ 160 #define RETURN_STRING_LITERAL(x) \
162 case x: \ 161 case x: \
163 return #x 162 return #x
164 163
165 string QuicVersionToString(const QuicVersion version) { 164 string QuicVersionToString(const QuicVersion version) {
166 switch (version) { 165 switch (version) {
167 RETURN_STRING_LITERAL(QUIC_VERSION_6);
168 RETURN_STRING_LITERAL(QUIC_VERSION_7); 166 RETURN_STRING_LITERAL(QUIC_VERSION_7);
169 RETURN_STRING_LITERAL(QUIC_VERSION_8); 167 RETURN_STRING_LITERAL(QUIC_VERSION_8);
170 default: 168 default:
171 return "QUIC_VERSION_UNSUPPORTED"; 169 return "QUIC_VERSION_UNSUPPORTED";
172 } 170 }
173 } 171 }
174 172
175 string QuicVersionArrayToString(const QuicVersion versions[], 173 string QuicVersionArrayToString(const QuicVersion versions[],
176 int num_versions) { 174 int num_versions) {
177 string result = ""; 175 string result = "";
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 return os; 420 return os;
423 } 421 }
424 422
425 ostream& operator<<(ostream& os, const QuicConsumedData& s) { 423 ostream& operator<<(ostream& os, const QuicConsumedData& s) {
426 os << "bytes_consumed: " << s.bytes_consumed 424 os << "bytes_consumed: " << s.bytes_consumed
427 << " fin_consumed: " << s.fin_consumed; 425 << " fin_consumed: " << s.fin_consumed;
428 return os; 426 return os;
429 } 427 }
430 428
431 } // namespace net 429 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_protocol.h ('k') | net/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698