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

Side by Side Diff: net/base/ip_endpoint.cc

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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/base/ip_endpoint.h ('k') | net/base/ip_endpoint_unittest.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/base/ip_endpoint.h" 5 #include "net/base/ip_endpoint.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/sys_byteorder.h" 9 #include "base/sys_byteorder.h"
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
11 #include <winsock2.h> 11 #include <winsock2.h>
12 #elif defined(OS_POSIX) 12 #elif defined(OS_POSIX)
13 #include <netinet/in.h> 13 #include <netinet/in.h>
14 #endif 14 #endif
15 15
16 namespace net { 16 namespace net {
17 17
18 namespace { 18 namespace {
19 // By definition, socklen_t is large enough to hold both sizes. 19 // By definition, socklen_t is large enough to hold both sizes.
20 const socklen_t kSockaddrInSize = sizeof(struct sockaddr_in); 20 const socklen_t kSockaddrInSize = sizeof(struct sockaddr_in);
21 const socklen_t kSockaddrIn6Size = sizeof(struct sockaddr_in6); 21 const socklen_t kSockaddrIn6Size = sizeof(struct sockaddr_in6);
22 } 22 }
23 23
24 IPEndPoint::IPEndPoint() : port_(0) {} 24 IPEndPoint::IPEndPoint() : port_(0) {}
25 25
26 IPEndPoint::~IPEndPoint() {} 26 IPEndPoint::~IPEndPoint() {}
27 27
28 IPEndPoint::IPEndPoint(const IPAddressNumber& address, int port) 28 IPEndPoint::IPEndPoint(const IPAddressNumber& address, uint16 port)
29 : address_(address), 29 : address_(address),
30 port_(port) {} 30 port_(port) {}
31 31
32 IPEndPoint::IPEndPoint(const IPEndPoint& endpoint) { 32 IPEndPoint::IPEndPoint(const IPEndPoint& endpoint) {
33 address_ = endpoint.address_; 33 address_ = endpoint.address_;
34 port_ = endpoint.port_; 34 port_ = endpoint.port_;
35 } 35 }
36 36
37 AddressFamily IPEndPoint::GetFamily() const { 37 AddressFamily IPEndPoint::GetFamily() const {
38 return GetAddressFamily(address_); 38 return GetAddressFamily(address_);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return address_ < that.address_; 118 return address_ < that.address_;
119 } 119 }
120 return port_ < that.port_; 120 return port_ < that.port_;
121 } 121 }
122 122
123 bool IPEndPoint::operator==(const IPEndPoint& that) const { 123 bool IPEndPoint::operator==(const IPEndPoint& that) const {
124 return address_ == that.address_ && port_ == that.port_; 124 return address_ == that.address_ && port_ == that.port_;
125 } 125 }
126 126
127 } // namespace net 127 } // namespace net
OLDNEW
« no previous file with comments | « net/base/ip_endpoint.h ('k') | net/base/ip_endpoint_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698