Index: net/base/address_tracker_linux.h |
diff --git a/net/base/address_tracker_linux.h b/net/base/address_tracker_linux.h |
index a960287d4ad2abd2270ace41cd6596b13b6b5a94..f9c0c1d32b41d8ceab28e934f4b2cdbb6073b705 100644 |
--- a/net/base/address_tracker_linux.h |
+++ b/net/base/address_tracker_linux.h |
@@ -65,6 +65,14 @@ class NET_EXPORT_PRIVATE AddressTrackerLinux : |
// Safe to call from any thread, but will block until Init() has completed. |
NetworkChangeNotifier::ConnectionType GetCurrentConnectionType(); |
+ // Returns the name for the interface with interface index |interface_index|. |
+ // |buf| should be a pointer to an array of size IFNAMSIZ. The returned |
+ // pointer |
pauljensen
2015/01/26 18:09:35
why such a short line?
derekjchow1
2015/01/27 01:18:04
Done.
|
+ // will point to |buf|. This function acts like if_indextoname which cannot be |
+ // used as net/if.h cannot be mixed with linux/if.h. We'll stick with |
+ // exclusively talking to the kernel and not the C library. |
+ static char* GetInterfaceName(int interface_index, char* buf); |
+ |
private: |
friend class AddressTrackerLinuxTest; |
@@ -83,8 +91,9 @@ class NET_EXPORT_PRIVATE AddressTrackerLinux : |
}; |
// A function that returns the name of an interface given the interface index |
- // in |interface_index|. |
- typedef const char* (*GetInterfaceNameFunction)(int interface_index); |
+ // in |interface_index|. |ifname| should be a buffer of size IFNAMSIZ. The |
+ // function should return a pointer to |ifname|. |
+ typedef char* (*GetInterfaceNameFunction)(int interface_index, char* ifname); |
// Sets |*address_changed| to indicate whether |address_map_| changed and |
// sets |*link_changed| to indicate if |online_links_| changed and sets |
@@ -117,6 +126,9 @@ class NET_EXPORT_PRIVATE AddressTrackerLinux : |
// Does |msg| refer to a tunnel interface? |
bool IsTunnelInterface(const struct ifinfomsg* msg) const; |
+ // Updates current_connection_type_ based on the network list. |
+ void UpdateCurrentConnectionType(); |
+ |
// Gets the name of an interface given the interface index |interface_index|. |
// May return empty string if it fails but should not return NULL. This is |
// overridden by tests. |
@@ -136,10 +148,10 @@ class NET_EXPORT_PRIVATE AddressTrackerLinux : |
mutable base::Lock online_links_lock_; |
base::hash_set<int> online_links_; |
- base::Lock is_offline_lock_; |
- bool is_offline_; |
- bool is_offline_initialized_; |
- base::ConditionVariable is_offline_initialized_cv_; |
+ base::Lock connection_type_lock_; |
+ bool connection_type_initialized_; |
+ base::ConditionVariable connection_type_initialized_cv_; |
+ NetworkChangeNotifier::ConnectionType current_connection_type_; |
bool tracking_; |
// Used to verify single-threaded access in non-tracking mode. |