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

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

Issue 15074007: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for windows Created 7 years, 7 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 | « no previous file | net/base/net_util.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/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/string_number_conversions.h" 8 #include "base/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)
(...skipping 17 matching lines...) Expand all
28 IPEndPoint::IPEndPoint(const IPAddressNumber& address, int port) 28 IPEndPoint::IPEndPoint(const IPAddressNumber& address, int 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 switch (address_.size()) { 38 return GetAddressFamily(address_);
39 case kIPv4AddressSize:
40 return ADDRESS_FAMILY_IPV4;
41 case kIPv6AddressSize:
42 return ADDRESS_FAMILY_IPV6;
43 default:
44 NOTREACHED() << "Bad IP address";
45 return ADDRESS_FAMILY_UNSPECIFIED;
46 }
47 } 39 }
48 40
49 int IPEndPoint::GetSockAddrFamily() const { 41 int IPEndPoint::GetSockAddrFamily() const {
50 switch (address_.size()) { 42 switch (address_.size()) {
51 case kIPv4AddressSize: 43 case kIPv4AddressSize:
52 return AF_INET; 44 return AF_INET;
53 case kIPv6AddressSize: 45 case kIPv6AddressSize:
54 return AF_INET6; 46 return AF_INET6;
55 default: 47 default:
56 NOTREACHED() << "Bad IP address"; 48 NOTREACHED() << "Bad IP address";
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return address_ < that.address_; 118 return address_ < that.address_;
127 } 119 }
128 return port_ < that.port_; 120 return port_ < that.port_;
129 } 121 }
130 122
131 bool IPEndPoint::operator==(const IPEndPoint& that) const { 123 bool IPEndPoint::operator==(const IPEndPoint& that) const {
132 return address_ == that.address_ && port_ == that.port_; 124 return address_ == that.address_ && port_ == that.port_;
133 } 125 }
134 126
135 } // namespace net 127 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/base/net_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698