| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/base/network_interfaces_linux.h" | 5 #include "net/base/network_interfaces_linux.h" |
| 6 | 6 |
| 7 #if !defined(OS_ANDROID) | 7 #if !defined(OS_ANDROID) |
| 8 #include <linux/ethtool.h> | 8 #include <linux/ethtool.h> |
| 9 #endif // !defined(OS_ANDROID) | 9 #endif // !defined(OS_ANDROID) |
| 10 #include <linux/if.h> | 10 #include <linux/if.h> |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 wreq.u.essid.pointer = ssid; | 110 wreq.u.essid.pointer = ssid; |
| 111 wreq.u.essid.length = IW_ESSID_MAX_SIZE; | 111 wreq.u.essid.length = IW_ESSID_MAX_SIZE; |
| 112 if (ioctl(ioctl_socket.get(), SIOCGIWESSID, &wreq) != -1) | 112 if (ioctl(ioctl_socket.get(), SIOCGIWESSID, &wreq) != -1) |
| 113 return ssid; | 113 return ssid; |
| 114 return ""; | 114 return ""; |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool GetNetworkListImpl( | 117 bool GetNetworkListImpl( |
| 118 NetworkInterfaceList* networks, | 118 NetworkInterfaceList* networks, |
| 119 int policy, | 119 int policy, |
| 120 const base::hash_set<int>& online_links, | 120 const std::unordered_set<int>& online_links, |
| 121 const internal::AddressTrackerLinux::AddressMap& address_map, | 121 const internal::AddressTrackerLinux::AddressMap& address_map, |
| 122 GetInterfaceNameFunction get_interface_name) { | 122 GetInterfaceNameFunction get_interface_name) { |
| 123 std::map<int, std::string> ifnames; | 123 std::map<int, std::string> ifnames; |
| 124 | 124 |
| 125 for (internal::AddressTrackerLinux::AddressMap::const_iterator it = | 125 for (internal::AddressTrackerLinux::AddressMap::const_iterator it = |
| 126 address_map.begin(); | 126 address_map.begin(); |
| 127 it != address_map.end(); ++it) { | 127 it != address_map.end(); ++it) { |
| 128 // Ignore addresses whose links are not online. | 128 // Ignore addresses whose links are not online. |
| 129 if (online_links.find(it->second.ifa_index) == online_links.end()) | 129 if (online_links.find(it->second.ifa_index) == online_links.end()) |
| 130 continue; | 130 continue; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 std::string GetWifiSSID() { | 217 std::string GetWifiSSID() { |
| 218 NetworkInterfaceList networks; | 218 NetworkInterfaceList networks; |
| 219 if (GetNetworkList(&networks, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)) { | 219 if (GetNetworkList(&networks, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)) { |
| 220 return internal::GetWifiSSIDFromInterfaceListInternal( | 220 return internal::GetWifiSSIDFromInterfaceListInternal( |
| 221 networks, internal::GetInterfaceSSID); | 221 networks, internal::GetInterfaceSSID); |
| 222 } | 222 } |
| 223 return ""; | 223 return ""; |
| 224 } | 224 } |
| 225 | 225 |
| 226 } // namespace net | 226 } // namespace net |
| OLD | NEW |