| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_ADDRESS_NET_H_ | 5 #ifndef NET_BASE_IP_ADDRESS_NET_H_ |
| 6 #define NET_BASE_IP_ADDRESS_NET_H_ | 6 #define NET_BASE_IP_ADDRESS_NET_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 // Parses an IP address literal (either IPv4 or IPv6) to its numeric value. | 73 // Parses an IP address literal (either IPv4 or IPv6) to its numeric value. |
| 74 // Returns true on success and fills |ip_address| with the numeric value. | 74 // Returns true on success and fills |ip_address| with the numeric value. |
| 75 static bool FromIPLiteral(const base::StringPiece& ip_literal, | 75 static bool FromIPLiteral(const base::StringPiece& ip_literal, |
| 76 IPAddress* ip_address) WARN_UNUSED_RESULT; | 76 IPAddress* ip_address) WARN_UNUSED_RESULT; |
| 77 | 77 |
| 78 // Returns the underlying byte vector. | 78 // Returns the underlying byte vector. |
| 79 const std::vector<uint8_t>& bytes() const { return ip_address_; }; | 79 const std::vector<uint8_t>& bytes() const { return ip_address_; }; |
| 80 | 80 |
| 81 bool operator==(const IPAddress& that) const; | 81 bool operator==(const IPAddress& that) const; |
| 82 bool operator!=(const IPAddress& that) const; |
| 82 bool operator<(const IPAddress& that) const; | 83 bool operator<(const IPAddress& that) const; |
| 83 | 84 |
| 84 private: | 85 private: |
| 85 // IPv4 addresses will have length kIPv4AddressSize, whereas IPv6 address | 86 // IPv4 addresses will have length kIPv4AddressSize, whereas IPv6 address |
| 86 // will have length kIPv6AddressSize. | 87 // will have length kIPv6AddressSize. |
| 87 std::vector<uint8_t> ip_address_; | 88 std::vector<uint8_t> ip_address_; |
| 88 | 89 |
| 89 // This class is copyable and assignable. | 90 // This class is copyable and assignable. |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 } // namespace net | 93 } // namespace net |
| 93 | 94 |
| 94 #endif // NET_BASE_IP_ADDRESS_NET_H_ | 95 #endif // NET_BASE_IP_ADDRESS_NET_H_ |
| OLD | NEW |