| OLD | NEW |
| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "net/base/address_family.h" | 13 #include "net/base/address_family.h" |
| 14 #include "net/base/ip_address_number.h" | 14 #include "net/base/ip_address_number.h" |
| 15 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
| 16 #include "net/base/sys_addrinfo.h" | 16 #include "net/base/sys_addrinfo.h" |
| 17 | 17 |
| 18 struct sockaddr; | 18 struct sockaddr; |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 | 21 |
| 22 class IPAddress; |
| 23 |
| 22 // An IPEndPoint represents the address of a transport endpoint: | 24 // An IPEndPoint represents the address of a transport endpoint: |
| 23 // * IP address (either v4 or v6) | 25 // * IP address (either v4 or v6) |
| 24 // * Port | 26 // * Port |
| 25 class NET_EXPORT IPEndPoint { | 27 class NET_EXPORT IPEndPoint { |
| 26 public: | 28 public: |
| 27 IPEndPoint(); | 29 IPEndPoint(); |
| 28 ~IPEndPoint(); | 30 ~IPEndPoint(); |
| 31 // DEPRECATED(crbug.com/496258): Use the ctor that takes IPAddress instead. |
| 29 IPEndPoint(const IPAddressNumber& address, uint16_t port); | 32 IPEndPoint(const IPAddressNumber& address, uint16_t port); |
| 33 IPEndPoint(const IPAddress& address, uint16_t port); |
| 30 IPEndPoint(const IPEndPoint& endpoint); | 34 IPEndPoint(const IPEndPoint& endpoint); |
| 31 | 35 |
| 32 const IPAddressNumber& address() const { return address_; } | 36 const IPAddressNumber& address() const { return address_; } |
| 33 uint16_t port() const { return port_; } | 37 uint16_t port() const { return port_; } |
| 34 | 38 |
| 35 // Returns AddressFamily of the address. | 39 // Returns AddressFamily of the address. |
| 36 AddressFamily GetFamily() const; | 40 AddressFamily GetFamily() const; |
| 37 | 41 |
| 38 // Returns the sockaddr family of the address, AF_INET or AF_INET6. | 42 // Returns the sockaddr family of the address, AF_INET or AF_INET6. |
| 39 int GetSockAddrFamily() const; | 43 int GetSockAddrFamily() const; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 66 bool operator==(const IPEndPoint& that) const; | 70 bool operator==(const IPEndPoint& that) const; |
| 67 | 71 |
| 68 private: | 72 private: |
| 69 IPAddressNumber address_; | 73 IPAddressNumber address_; |
| 70 uint16_t port_; | 74 uint16_t port_; |
| 71 }; | 75 }; |
| 72 | 76 |
| 73 } // namespace net | 77 } // namespace net |
| 74 | 78 |
| 75 #endif // NET_BASE_IP_ENDPOINT_H_ | 79 #endif // NET_BASE_IP_ENDPOINT_H_ |
| OLD | NEW |