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

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

Issue 11528012: [net] Make IPEndPoint::GetFamily() return AddressFamily and add GetSockAddrFamily() to be used when… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update uses of GetFamily in net/dns/ Created 8 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 | Annotate | Revision Log
« no previous file with comments | « net/base/address_list_unittest.cc ('k') | net/base/ip_endpoint.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 #ifndef NET_BASE_IP_ENDPOINT_H_ 5 #ifndef NET_BASE_IP_ENDPOINT_H_
6 #define NET_BASE_IP_ENDPOINT_H_ 6 #define NET_BASE_IP_ENDPOINT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "net/base/address_family.h"
12 #include "net/base/net_export.h" 13 #include "net/base/net_export.h"
13 #include "net/base/net_util.h" 14 #include "net/base/net_util.h"
14 15
15 struct sockaddr; 16 struct sockaddr;
16 17
17 namespace net { 18 namespace net {
18 19
19 // An IPEndPoint represents the address of a transport endpoint: 20 // An IPEndPoint represents the address of a transport endpoint:
20 // * IP address (either v4 or v6) 21 // * IP address (either v4 or v6)
21 // * Port 22 // * Port
22 class NET_EXPORT IPEndPoint { 23 class NET_EXPORT IPEndPoint {
23 public: 24 public:
24 IPEndPoint(); 25 IPEndPoint();
25 virtual ~IPEndPoint(); 26 virtual ~IPEndPoint();
26 IPEndPoint(const IPAddressNumber& address, int port); 27 IPEndPoint(const IPAddressNumber& address, int port);
27 IPEndPoint(const IPEndPoint& endpoint); 28 IPEndPoint(const IPEndPoint& endpoint);
28 29
29 const IPAddressNumber& address() const { return address_; } 30 const IPAddressNumber& address() const { return address_; }
30 int port() const { return port_; } 31 int port() const { return port_; }
31 32
32 // Returns AF_INET or AF_INET6 depending on the type of the address. 33 // Returns AddressFamily of the address.
33 int GetFamily() const; 34 AddressFamily GetFamily() const;
35
36 // Returns the sockaddr family of the address, AF_INET or AF_INET6.
37 int GetSockAddrFamily() const;
34 38
35 // Convert to a provided sockaddr struct. 39 // Convert to a provided sockaddr struct.
36 // |address| is the sockaddr to copy into. Should be at least 40 // |address| is the sockaddr to copy into. Should be at least
37 // sizeof(struct sockaddr_storage) bytes. 41 // sizeof(struct sockaddr_storage) bytes.
38 // |address_length| is an input/output parameter. On input, it is the 42 // |address_length| is an input/output parameter. On input, it is the
39 // size of data in |address| available. On output, it is the size of 43 // size of data in |address| available. On output, it is the size of
40 // the address that was copied into |address|. 44 // the address that was copied into |address|.
41 // Returns true on success, false on failure. 45 // Returns true on success, false on failure.
42 bool ToSockAddr(struct sockaddr* address, socklen_t* address_length) const 46 bool ToSockAddr(struct sockaddr* address, socklen_t* address_length) const
43 WARN_UNUSED_RESULT; 47 WARN_UNUSED_RESULT;
(...skipping 17 matching lines...) Expand all
61 bool operator==(const IPEndPoint& that) const; 65 bool operator==(const IPEndPoint& that) const;
62 66
63 private: 67 private:
64 IPAddressNumber address_; 68 IPAddressNumber address_;
65 int port_; 69 int port_;
66 }; 70 };
67 71
68 } // namespace net 72 } // namespace net
69 73
70 #endif // NET_BASE_IP_ENDPOINT_H_ 74 #endif // NET_BASE_IP_ENDPOINT_H_
OLDNEW
« no previous file with comments | « net/base/address_list_unittest.cc ('k') | net/base/ip_endpoint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698