Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: net/base/net_util.h

Issue 22538003: Add IP address handling to net::IsHostnameNonUnique (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made arrays const Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/net_util.cc » ('j') | net/base/net_util.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.h
diff --git a/net/base/net_util.h b/net/base/net_util.h
index 839735e5cd5eeb87f91fc21a3a3a4f5927ed192b..acc71d51a559b41afda8ce4d33a016fbcad7c816 100644
--- a/net/base/net_util.h
+++ b/net/base/net_util.h
@@ -112,12 +112,16 @@ 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, but you must specify which type
+// you're checking. It's the caller's responsibility to make sure that the
+// host_addr is actually the type that's indicated by |ipv4|.
+NET_EXPORT bool IsIPAddressReserved(const IPAddressNumber& address, bool ipv4);
Ryan Sleevi 2013/08/08 19:49:31 If using |IPAddressNumber|, then we just use kIPv4
felt 2013/08/09 04:53:20 Done.
+
// Convenience struct for when you need a |struct sockaddr|.
struct SockaddrStorage {
SockaddrStorage() : addr_len(sizeof(addr_storage)),
« no previous file with comments | « no previous file | net/base/net_util.cc » ('j') | net/base/net_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698