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_ |