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

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

Issue 1565303002: Change IPEndpoint::address() to return a net::IPAddress (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase for ChromeOS Created 4 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
« no previous file with comments | « net/quic/quic_socket_address_coder.h ('k') | net/quic/quic_stream_factory.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_socket_address_coder.h" 5 #include "net/quic/quic_socket_address_coder.h"
6 6
7 #include "net/base/sys_addrinfo.h" 7 #include "net/base/sys_addrinfo.h"
8 8
9 using std::string; 9 using std::string;
10 10
(...skipping 23 matching lines...) Expand all
34 address_family = kIPv4; 34 address_family = kIPv4;
35 break; 35 break;
36 case AF_INET6: 36 case AF_INET6:
37 address_family = kIPv6; 37 address_family = kIPv6;
38 break; 38 break;
39 default: 39 default:
40 return serialized; 40 return serialized;
41 } 41 }
42 serialized.append(reinterpret_cast<const char*>(&address_family), 42 serialized.append(reinterpret_cast<const char*>(&address_family),
43 sizeof(address_family)); 43 sizeof(address_family));
44 serialized.append(IPAddressToPackedString(address_.address())); 44 serialized.append(IPAddressToPackedString(address_.address().bytes()));
45 uint16_t port = address_.port(); 45 uint16_t port = address_.port();
46 serialized.append(reinterpret_cast<const char*>(&port), sizeof(port)); 46 serialized.append(reinterpret_cast<const char*>(&port), sizeof(port));
47 return serialized; 47 return serialized;
48 } 48 }
49 49
50 bool QuicSocketAddressCoder::Decode(const char* data, size_t length) { 50 bool QuicSocketAddressCoder::Decode(const char* data, size_t length) {
51 uint16_t address_family; 51 uint16_t address_family;
52 if (length < sizeof(address_family)) { 52 if (length < sizeof(address_family)) {
53 return false; 53 return false;
54 } 54 }
(...skipping 24 matching lines...) Expand all
79 if (length != sizeof(port)) { 79 if (length != sizeof(port)) {
80 return false; 80 return false;
81 } 81 }
82 memcpy(&port, data, length); 82 memcpy(&port, data, length);
83 83
84 address_ = IPEndPoint(ip, port); 84 address_ = IPEndPoint(ip, port);
85 return true; 85 return true;
86 } 86 }
87 87
88 } // namespace net 88 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_socket_address_coder.h ('k') | net/quic/quic_stream_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698