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

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

Issue 47283002: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compilation error Created 7 years, 1 month 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/quic_protocol_test.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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 notifier(NULL) { 106 notifier(NULL) {
107 } 107 }
108 108
109 uint32 MakeQuicTag(char a, char b, char c, char d) { 109 uint32 MakeQuicTag(char a, char b, char c, char d) {
110 return static_cast<uint32>(a) | 110 return static_cast<uint32>(a) |
111 static_cast<uint32>(b) << 8 | 111 static_cast<uint32>(b) << 8 |
112 static_cast<uint32>(c) << 16 | 112 static_cast<uint32>(c) << 16 |
113 static_cast<uint32>(d) << 24; 113 static_cast<uint32>(d) << 24;
114 } 114 }
115 115
116 QuicVersion QuicVersionMax() { return kSupportedQuicVersions[0]; } 116 QuicVersionVector QuicSupportedVersions() {
117 117 QuicVersionVector supported_versions;
118 QuicVersion QuicVersionMin() { 118 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
119 return kSupportedQuicVersions[arraysize(kSupportedQuicVersions) - 1]; 119 supported_versions.push_back(kSupportedQuicVersions[i]);
120 }
121 return supported_versions;
120 } 122 }
121 123
122 QuicTag QuicVersionToQuicTag(const QuicVersion version) { 124 QuicTag QuicVersionToQuicTag(const QuicVersion version) {
123 switch (version) { 125 switch (version) {
124 case QUIC_VERSION_10: 126 case QUIC_VERSION_10:
125 return MakeQuicTag('Q', '0', '1', '0'); 127 return MakeQuicTag('Q', '0', '1', '0');
126 case QUIC_VERSION_11: 128 case QUIC_VERSION_11:
127 return MakeQuicTag('Q', '0', '1', '1'); 129 return MakeQuicTag('Q', '0', '1', '1');
128 default: 130 default:
129 // This shold be an ERROR because we should never attempt to convert an 131 // This shold be an ERROR because we should never attempt to convert an
(...skipping 21 matching lines...) Expand all
151 153
152 string QuicVersionToString(const QuicVersion version) { 154 string QuicVersionToString(const QuicVersion version) {
153 switch (version) { 155 switch (version) {
154 RETURN_STRING_LITERAL(QUIC_VERSION_10); 156 RETURN_STRING_LITERAL(QUIC_VERSION_10);
155 RETURN_STRING_LITERAL(QUIC_VERSION_11); 157 RETURN_STRING_LITERAL(QUIC_VERSION_11);
156 default: 158 default:
157 return "QUIC_VERSION_UNSUPPORTED"; 159 return "QUIC_VERSION_UNSUPPORTED";
158 } 160 }
159 } 161 }
160 162
161 string QuicVersionArrayToString(const QuicVersion versions[], 163 string QuicVersionVectorToString(const QuicVersionVector& versions) {
162 int num_versions) {
163 string result = ""; 164 string result = "";
164 for (int i = 0; i < num_versions; ++i) { 165 for (size_t i = 0; i < versions.size(); ++i) {
165 const QuicVersion& version = versions[i]; 166 if (i != 0) {
166 result.append(QuicVersionToString(version)); 167 result.append(",");
167 result.append(","); 168 }
169 result.append(QuicVersionToString(versions[i]));
168 } 170 }
169 return result; 171 return result;
170 } 172 }
171 173
172 ostream& operator<<(ostream& os, const QuicPacketHeader& header) { 174 ostream& operator<<(ostream& os, const QuicPacketHeader& header) {
173 os << "{ guid: " << header.public_header.guid 175 os << "{ guid: " << header.public_header.guid
174 << ", guid_length:" << header.public_header.guid_length 176 << ", guid_length:" << header.public_header.guid_length
175 << ", sequence_number_length:" 177 << ", sequence_number_length:"
176 << header.public_header.sequence_number_length 178 << header.public_header.sequence_number_length
177 << ", reset_flag: " << header.public_header.reset_flag 179 << ", reset_flag: " << header.public_header.reset_flag
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 return os; 427 return os;
426 } 428 }
427 429
428 ostream& operator<<(ostream& os, const QuicConsumedData& s) { 430 ostream& operator<<(ostream& os, const QuicConsumedData& s) {
429 os << "bytes_consumed: " << s.bytes_consumed 431 os << "bytes_consumed: " << s.bytes_consumed
430 << " fin_consumed: " << s.fin_consumed; 432 << " fin_consumed: " << s.fin_consumed;
431 return os; 433 return os;
432 } 434 }
433 435
434 } // namespace net 436 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_protocol.h ('k') | net/quic/quic_protocol_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698