| 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.h" | 14 #include "net/base/ip_address.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 // An IPEndPoint represents the address of a transport endpoint: | 22 // An IPEndPoint represents the address of a transport endpoint: |
| 23 // * IP address (either v4 or v6) | 23 // * IP address (either v4 or v6) |
| 24 // * Port | 24 // * Port |
| 25 class NET_EXPORT IPEndPoint { | 25 class NET_EXPORT IPEndPoint { |
| 26 public: | 26 public: |
| 27 IPEndPoint(); | 27 IPEndPoint(); |
| 28 ~IPEndPoint(); | 28 ~IPEndPoint(); |
| 29 // DEPRECATED(crbug.com/496258): Use the ctor that takes IPAddress instead. | |
| 30 IPEndPoint(const IPAddressNumber& address, uint16_t port); | |
| 31 IPEndPoint(const IPAddress& address, uint16_t port); | 29 IPEndPoint(const IPAddress& address, uint16_t port); |
| 32 IPEndPoint(const IPEndPoint& endpoint); | 30 IPEndPoint(const IPEndPoint& endpoint); |
| 33 | 31 |
| 34 const IPAddress& address() const { return address_; } | 32 const IPAddress& address() const { return address_; } |
| 35 uint16_t port() const { return port_; } | 33 uint16_t port() const { return port_; } |
| 36 | 34 |
| 37 // Returns AddressFamily of the address. | 35 // Returns AddressFamily of the address. |
| 38 AddressFamily GetFamily() const; | 36 AddressFamily GetFamily() const; |
| 39 | 37 |
| 40 // Returns the sockaddr family of the address, AF_INET or AF_INET6. | 38 // Returns the sockaddr family of the address, AF_INET or AF_INET6. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 69 bool operator==(const IPEndPoint& that) const; | 67 bool operator==(const IPEndPoint& that) const; |
| 70 | 68 |
| 71 private: | 69 private: |
| 72 IPAddress address_; | 70 IPAddress address_; |
| 73 uint16_t port_; | 71 uint16_t port_; |
| 74 }; | 72 }; |
| 75 | 73 |
| 76 } // namespace net | 74 } // namespace net |
| 77 | 75 |
| 78 #endif // NET_BASE_IP_ENDPOINT_H_ | 76 #endif // NET_BASE_IP_ENDPOINT_H_ |
| OLD | NEW |