Chromium Code Reviews| Index: net/base/net_util.h |
| diff --git a/net/base/net_util.h b/net/base/net_util.h |
| index 839735e5cd5eeb87f91fc21a3a3a4f5927ed192b..ed3ec21af6c48dd5f5efca313c72f8d1e29bfb8e 100644 |
| --- a/net/base/net_util.h |
| +++ b/net/base/net_util.h |
| @@ -112,12 +112,15 @@ NET_EXPORT std::string GetHostAndPort(const GURL& url); |
| NET_EXPORT_PRIVATE std::string GetHostAndOptionalPort(const GURL& url); |
| // Returns true if |hostname| contains a non-registerable or non-assignable |
| -// domain name (eg: a gTLD that has not been assigned by IANA) |
| -// |
| -// TODO(rsleevi): http://crbug.com/119212 - Also match internal IP |
| -// address ranges. |
| +// domain name (eg: a gTLD that has not been assigned by IANA) or an IP address |
| +// that falls in an IANA-reserved range. |
| NET_EXPORT bool IsHostnameNonUnique(const std::string& hostname); |
| +// Returns true if an IP address hostname is in a range reserved by the IANA. |
| +// Works with both IPv4 and IPv6 addresses, and only compares against a given |
| +// protocols's reserved ranges. |
| +NET_EXPORT bool IsIPAddressReserved(const IPAddressNumber& address); |
| + |
| // Convenience struct for when you need a |struct sockaddr|. |
| struct SockaddrStorage { |
| SockaddrStorage() : addr_len(sizeof(addr_storage)), |
| @@ -481,6 +484,14 @@ NET_EXPORT_PRIVATE bool IPNumberMatchesPrefix(const IPAddressNumber& ip_number, |
| const IPAddressNumber& ip_prefix, |
| size_t prefix_length_in_bits); |
| +// This is a helper method for IPNumberMatchesPrefix and IsIPAddressReserved. |
| +// The |ip_prefix| should be a vector or an array. The |prefix_length_in_bits| |
| +// should be a size_t, unsigned char, int, etc. |
| +NET_EXPORT_PRIVATE bool IPNumberPrefixCheck( |
|
Ryan Sleevi
2013/08/12 21:11:51
I'm still not sure I've understood why you've adde
felt
2013/08/13 04:17:06
removed it
|
| + const IPAddressNumber& ip_number, |
| + const unsigned char* ip_prefix, |
| + size_t prefix_length_in_bits); |
| + |
| // Retuns the port field of the |sockaddr|. |
| const uint16* GetPortFieldFromSockaddr(const struct sockaddr* address, |
| socklen_t address_len); |