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

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

Issue 146033003: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error Created 6 years, 10 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/quic_sent_packet_manager.h » ('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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 155 }
156 156
157 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) { 157 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) {
158 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { 158 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
159 if (version_tag == QuicVersionToQuicTag(kSupportedQuicVersions[i])) { 159 if (version_tag == QuicVersionToQuicTag(kSupportedQuicVersions[i])) {
160 return kSupportedQuicVersions[i]; 160 return kSupportedQuicVersions[i];
161 } 161 }
162 } 162 }
163 // Reading from the client so this should not be considered an ERROR. 163 // Reading from the client so this should not be considered an ERROR.
164 DVLOG(1) << "Unsupported QuicTag version: " 164 DVLOG(1) << "Unsupported QuicTag version: "
165 << QuicUtils::TagToString(version_tag); 165 << QuicUtils::TagToString(version_tag);
166 return QUIC_VERSION_UNSUPPORTED; 166 return QUIC_VERSION_UNSUPPORTED;
167 } 167 }
168 168
169 #define RETURN_STRING_LITERAL(x) \ 169 #define RETURN_STRING_LITERAL(x) \
170 case x: \ 170 case x: \
171 return #x 171 return #x
172 172
173 string QuicVersionToString(const QuicVersion version) { 173 string QuicVersionToString(const QuicVersion version) {
174 switch (version) { 174 switch (version) {
175 RETURN_STRING_LITERAL(QUIC_VERSION_12); 175 RETURN_STRING_LITERAL(QUIC_VERSION_12);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 os << " ] "; 268 os << " ] ";
269 return os; 269 return os;
270 } 270 }
271 271
272 QuicCongestionFeedbackFrame::QuicCongestionFeedbackFrame() { 272 QuicCongestionFeedbackFrame::QuicCongestionFeedbackFrame() {
273 } 273 }
274 274
275 QuicCongestionFeedbackFrame::~QuicCongestionFeedbackFrame() { 275 QuicCongestionFeedbackFrame::~QuicCongestionFeedbackFrame() {
276 } 276 }
277 277
278 ostream& operator<<(ostream& os, const QuicFrame& frame) {
279 switch (frame.type) {
280 case PADDING_FRAME: {
281 os << "type { PADDING_FRAME } ";
282 break;
283 }
284 case RST_STREAM_FRAME: {
285 os << "type { " << RST_STREAM_FRAME << " } " << *(frame.rst_stream_frame);
286 break;
287 }
288 case CONNECTION_CLOSE_FRAME: {
289 os << "type { CONNECTION_CLOSE_FRAME } "
290 << *(frame.connection_close_frame);
291 break;
292 }
293 case GOAWAY_FRAME: {
294 os << "type { GOAWAY_FRAME } " << *(frame.goaway_frame);
295 break;
296 }
297 case STREAM_FRAME: {
298 os << "type { STREAM_FRAME } " << *(frame.stream_frame);
299 break;
300 }
301 case ACK_FRAME: {
302 os << "type { ACK_FRAME } " << *(frame.ack_frame);
303 break;
304 }
305 case CONGESTION_FEEDBACK_FRAME: {
306 os << "type { CONGESTION_FEEDBACK_FRAME } "
307 << *(frame.congestion_feedback_frame);
308 break;
309 }
310 default: {
311 LOG(ERROR) << "Unknown frame type: " << frame.type;
312 break;
313 }
314 }
315 return os;
316 }
317
318 ostream& operator<<(ostream& os, const QuicRstStreamFrame& rst_frame) {
319 os << "stream_id { " << rst_frame.stream_id << " } "
320 << "error_code { " << rst_frame.error_code << " } "
321 << "error_details { " << rst_frame.error_details << " }\n";
322 return os;
323 }
324
325 ostream& operator<<(ostream& os,
326 const QuicConnectionCloseFrame& connection_close_frame) {
327 os << "error_code { " << connection_close_frame.error_code << " } "
328 << "error_details { " << connection_close_frame.error_details << " }\n";
329 return os;
330 }
331
332 ostream& operator<<(ostream& os, const QuicGoAwayFrame& goaway_frame) {
333 os << "error_code { " << goaway_frame.error_code << " } "
334 << "last_good_stream_id { " << goaway_frame.last_good_stream_id << " } "
335 << "reason_phrase { " << goaway_frame.reason_phrase << " }\n";
336 return os;
337 }
338
339 ostream& operator<<(ostream& os, const QuicStreamFrame& stream_frame) {
340 os << "stream_id { " << stream_frame.stream_id << " } "
341 << "fin { " << stream_frame.fin << " } "
342 << "offset { " << stream_frame.offset << " } "
343 << "data { "
344 << QuicUtils::StringToHexASCIIDump(*(stream_frame.GetDataAsString()))
345 << " }\n";
346 return os;
347 }
348
349 ostream& operator<<(ostream& os, const QuicAckFrame& ack_frame) {
350 os << "sent info { " << ack_frame.sent_info << " } "
351 << "received info { " << ack_frame.received_info << " }\n";
352 return os;
353 }
354
278 ostream& operator<<(ostream& os, 355 ostream& operator<<(ostream& os,
279 const QuicCongestionFeedbackFrame& congestion_frame) { 356 const QuicCongestionFeedbackFrame& congestion_frame) {
280 os << "type: " << congestion_frame.type; 357 os << "type: " << congestion_frame.type;
281 switch (congestion_frame.type) { 358 switch (congestion_frame.type) {
282 case kInterArrival: { 359 case kInterArrival: {
283 const CongestionFeedbackMessageInterArrival& inter_arrival = 360 const CongestionFeedbackMessageInterArrival& inter_arrival =
284 congestion_frame.inter_arrival; 361 congestion_frame.inter_arrival;
285 os << " accumulated_number_of_lost_packets: " 362 os << " accumulated_number_of_lost_packets: "
286 << inter_arrival.accumulated_number_of_lost_packets; 363 << inter_arrival.accumulated_number_of_lost_packets;
287 os << " received packets: [ "; 364 os << " received packets: [ ";
(...skipping 14 matching lines...) Expand all
302 const CongestionFeedbackMessageTCP& tcp = congestion_frame.tcp; 379 const CongestionFeedbackMessageTCP& tcp = congestion_frame.tcp;
303 os << " accumulated_number_of_lost_packets: " 380 os << " accumulated_number_of_lost_packets: "
304 << congestion_frame.tcp.accumulated_number_of_lost_packets; 381 << congestion_frame.tcp.accumulated_number_of_lost_packets;
305 os << " receive_window: " << tcp.receive_window; 382 os << " receive_window: " << tcp.receive_window;
306 break; 383 break;
307 } 384 }
308 } 385 }
309 return os; 386 return os;
310 } 387 }
311 388
312 ostream& operator<<(ostream& os, const QuicAckFrame& ack_frame) {
313 os << "sent info { " << ack_frame.sent_info << " } "
314 << "received info { " << ack_frame.received_info << " }\n";
315 return os;
316 }
317
318 CongestionFeedbackMessageFixRate::CongestionFeedbackMessageFixRate() 389 CongestionFeedbackMessageFixRate::CongestionFeedbackMessageFixRate()
319 : bitrate(QuicBandwidth::Zero()) { 390 : bitrate(QuicBandwidth::Zero()) {
320 } 391 }
321 392
322 CongestionFeedbackMessageInterArrival:: 393 CongestionFeedbackMessageInterArrival::
323 CongestionFeedbackMessageInterArrival() {} 394 CongestionFeedbackMessageInterArrival() {}
324 395
325 CongestionFeedbackMessageInterArrival:: 396 CongestionFeedbackMessageInterArrival::
326 ~CongestionFeedbackMessageInterArrival() {} 397 ~CongestionFeedbackMessageInterArrival() {}
327 398
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 return os; 535 return os;
465 } 536 }
466 537
467 ostream& operator<<(ostream& os, const QuicConsumedData& s) { 538 ostream& operator<<(ostream& os, const QuicConsumedData& s) {
468 os << "bytes_consumed: " << s.bytes_consumed 539 os << "bytes_consumed: " << s.bytes_consumed
469 << " fin_consumed: " << s.fin_consumed; 540 << " fin_consumed: " << s.fin_consumed;
470 return os; 541 return os;
471 } 542 }
472 543
473 } // namespace net 544 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_protocol.h ('k') | net/quic/quic_sent_packet_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698