| 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> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 bool ToSockAddr(struct sockaddr* address, socklen_t* address_length) const | 50 bool ToSockAddr(struct sockaddr* address, socklen_t* address_length) const |
| 51 WARN_UNUSED_RESULT; | 51 WARN_UNUSED_RESULT; |
| 52 | 52 |
| 53 // Convert from a sockaddr struct. | 53 // Convert from a sockaddr struct. |
| 54 // |address| is the address. | 54 // |address| is the address. |
| 55 // |address_length| is the length of |address|. | 55 // |address_length| is the length of |address|. |
| 56 // Returns true on success, false on failure. | 56 // Returns true on success, false on failure. |
| 57 bool FromSockAddr(const struct sockaddr* address, socklen_t address_length) | 57 bool FromSockAddr(const struct sockaddr* address, socklen_t address_length) |
| 58 WARN_UNUSED_RESULT; | 58 WARN_UNUSED_RESULT; |
| 59 | 59 |
| 60 // Returns value as a string (e.g. "127.0.0.1:80"). The IP address must be | 60 // Returns value as a string (e.g. "127.0.0.1:80"). Returns the empty string |
| 61 // valid. | 61 // when |address_| is invalid (the port will be ignored). |
| 62 std::string ToString() const; | 62 std::string ToString() const; |
| 63 | 63 |
| 64 // As above, but without port. | 64 // As above, but without port. Returns the empty string when address_ is |
| 65 // invalid. |
| 65 std::string ToStringWithoutPort() const; | 66 std::string ToStringWithoutPort() const; |
| 66 | 67 |
| 67 bool operator<(const IPEndPoint& that) const; | 68 bool operator<(const IPEndPoint& that) const; |
| 68 bool operator==(const IPEndPoint& that) const; | 69 bool operator==(const IPEndPoint& that) const; |
| 69 | 70 |
| 70 private: | 71 private: |
| 71 IPAddress address_; | 72 IPAddress address_; |
| 72 uint16_t port_; | 73 uint16_t port_; |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 } // namespace net | 76 } // namespace net |
| 76 | 77 |
| 77 #endif // NET_BASE_IP_ENDPOINT_H_ | 78 #endif // NET_BASE_IP_ENDPOINT_H_ |
| OLD | NEW |