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

Side by Side Diff: net/quic/core/quic_utils.cc

Issue 2322233004: Landing Recent QUIC changes until Sun Sep 4 03:41:00 (Closed)
Patch Set: Remove simulation files from the build. Created 4 years, 3 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
« no previous file with comments | « net/quic/core/quic_spdy_stream.h ('k') | net/quic/core/quic_utils_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/core/quic_utils.h" 5 #include "net/quic/core/quic_utils.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 } 383 }
384 384
385 string QuicUtils::PeerAddressChangeTypeToString(PeerAddressChangeType type) { 385 string QuicUtils::PeerAddressChangeTypeToString(PeerAddressChangeType type) {
386 switch (type) { 386 switch (type) {
387 RETURN_STRING_LITERAL(NO_CHANGE); 387 RETURN_STRING_LITERAL(NO_CHANGE);
388 RETURN_STRING_LITERAL(PORT_CHANGE); 388 RETURN_STRING_LITERAL(PORT_CHANGE);
389 RETURN_STRING_LITERAL(IPV4_SUBNET_CHANGE); 389 RETURN_STRING_LITERAL(IPV4_SUBNET_CHANGE);
390 RETURN_STRING_LITERAL(IPV4_TO_IPV6_CHANGE); 390 RETURN_STRING_LITERAL(IPV4_TO_IPV6_CHANGE);
391 RETURN_STRING_LITERAL(IPV6_TO_IPV4_CHANGE); 391 RETURN_STRING_LITERAL(IPV6_TO_IPV4_CHANGE);
392 RETURN_STRING_LITERAL(IPV6_TO_IPV6_CHANGE); 392 RETURN_STRING_LITERAL(IPV6_TO_IPV6_CHANGE);
393 RETURN_STRING_LITERAL(UNSPECIFIED_CHANGE); 393 RETURN_STRING_LITERAL(IPV4_TO_IPV4_CHANGE);
394 } 394 }
395 return "INVALID_PEER_ADDRESS_CHANGE_TYPE"; 395 return "INVALID_PEER_ADDRESS_CHANGE_TYPE";
396 } 396 }
397 397
398 // static 398 // static
399 void QuicUtils::DeleteFrames(QuicFrames* frames) { 399 void QuicUtils::DeleteFrames(QuicFrames* frames) {
400 for (QuicFrame& frame : *frames) { 400 for (QuicFrame& frame : *frames) {
401 switch (frame.type) { 401 switch (frame.type) {
402 // Frames smaller than a pointer are inlined, so don't need to be deleted. 402 // Frames smaller than a pointer are inlined, so don't need to be deleted.
403 case PADDING_FRAME: 403 case PADDING_FRAME:
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 return migrating_ip_is_ipv4 ? IPV6_TO_IPV4_CHANGE : IPV6_TO_IPV6_CHANGE; 506 return migrating_ip_is_ipv4 ? IPV6_TO_IPV4_CHANGE : IPV6_TO_IPV6_CHANGE;
507 } 507 }
508 508
509 if (IPAddressMatchesPrefix(old_address.address(), new_address.address(), 509 if (IPAddressMatchesPrefix(old_address.address(), new_address.address(),
510 24)) { 510 24)) {
511 // Subnet part does not change (here, we use /24), which is considered to be 511 // Subnet part does not change (here, we use /24), which is considered to be
512 // caused by NATs. 512 // caused by NATs.
513 return IPV4_SUBNET_CHANGE; 513 return IPV4_SUBNET_CHANGE;
514 } 514 }
515 515
516 return UNSPECIFIED_CHANGE; 516 return IPV4_TO_IPV4_CHANGE;
517 } 517 }
518 518
519 string QuicUtils::HexEncode(const char* data, size_t length) { 519 string QuicUtils::HexEncode(const char* data, size_t length) {
520 return HexEncode(StringPiece(data, length)); 520 return HexEncode(StringPiece(data, length));
521 } 521 }
522 522
523 string QuicUtils::HexEncode(StringPiece data) { 523 string QuicUtils::HexEncode(StringPiece data) {
524 return ::base::HexEncode(data.data(), data.size()); 524 return ::base::HexEncode(data.data(), data.size());
525 } 525 }
526 526
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 566
567 bytes_remaining -= line_bytes; 567 bytes_remaining -= line_bytes;
568 offset += line_bytes; 568 offset += line_bytes;
569 p += line_bytes; 569 p += line_bytes;
570 s += '\n'; 570 s += '\n';
571 } 571 }
572 return s; 572 return s;
573 } 573 }
574 574
575 } // namespace net 575 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_spdy_stream.h ('k') | net/quic/core/quic_utils_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698