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

Unified Diff: net/base/net_util.h

Issue 23726043: Added NetworkInterface::network_prefix (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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_unittest.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 6b8884dd11479c5cdfe057d4fc2121b6e3b2a01b..9429a150702a70e5f06b877c5883585d045841fb 100644
--- a/net/base/net_util.h
+++ b/net/base/net_util.h
@@ -514,15 +514,36 @@ NET_EXPORT_PRIVATE bool IsLocalhost(const std::string& host);
// struct that is used by GetNetworkList() to represent a network
// interface.
+
+#if defined(OS_ANDROID)
+
+struct NET_EXPORT NetworkInterface {
+ NetworkInterface();
+ NetworkInterface(const std::string& name,
+ const IPAddressNumber& address);
+ ~NetworkInterface();
+
+ std::string name;
+ IPAddressNumber address;
+ // network_prefix on Android is not easily accessible.
szym 2013/09/19 23:21:01 Why not? This is easily done with ioctl SIOCGIFNET
szym 2013/09/20 19:30:15 While the ioctl is forbidden (because it would byp
+};
+
+#else // OS_ANDROID
+
struct NET_EXPORT NetworkInterface {
NetworkInterface();
- NetworkInterface(const std::string& name, const IPAddressNumber& address);
+ NetworkInterface(const std::string& name,
+ const IPAddressNumber& address,
+ uint8 network_prefix);
~NetworkInterface();
std::string name;
IPAddressNumber address;
+ uint8 network_prefix;
};
+#endif // OS_ANDROID
+
typedef std::vector<NetworkInterface> NetworkInterfaceList;
// Returns list of network interfaces except loopback interface. If an
@@ -553,6 +574,13 @@ enum WifiPHYLayerProtocol {
// Currently only available on OS_WIN.
NET_EXPORT WifiPHYLayerProtocol GetWifiPHYLayerProtocol();
+// Returns number of matching initial bits between the addresses |a1| and |a2|.
+unsigned CommonPrefixLength(const IPAddressNumber& a1,
+ const IPAddressNumber& a2);
+
+// Computes the number of leading 1-bits in |mask|.
+unsigned MaskPrefixLength(const IPAddressNumber& mask);
+
} // namespace net
#endif // NET_BASE_NET_UTIL_H_
« no previous file with comments | « no previous file | net/base/net_util.cc » ('j') | net/base/net_util_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698