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 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #if !defined(OS_ANDROID) | 9 #if !defined(OS_ANDROID) |
10 #include <linux/ethtool.h> | 10 #include <linux/ethtool.h> |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 wreq.u.essid.pointer = ssid; | 107 wreq.u.essid.pointer = ssid; |
108 wreq.u.essid.length = IW_ESSID_MAX_SIZE; | 108 wreq.u.essid.length = IW_ESSID_MAX_SIZE; |
109 if (ioctl(ioctl_socket.get(), SIOCGIWESSID, &wreq) != -1) | 109 if (ioctl(ioctl_socket.get(), SIOCGIWESSID, &wreq) != -1) |
110 return ssid; | 110 return ssid; |
111 return ""; | 111 return ""; |
112 } | 112 } |
113 | 113 |
114 bool GetNetworkListImpl( | 114 bool GetNetworkListImpl( |
115 NetworkInterfaceList* networks, | 115 NetworkInterfaceList* networks, |
116 int policy, | 116 int policy, |
117 const base::hash_set<int>& online_links, | 117 const std::unordered_set<int>& online_links, |
118 const internal::AddressTrackerLinux::AddressMap& address_map, | 118 const internal::AddressTrackerLinux::AddressMap& address_map, |
119 GetInterfaceNameFunction get_interface_name) { | 119 GetInterfaceNameFunction get_interface_name) { |
120 std::map<int, std::string> ifnames; | 120 std::map<int, std::string> ifnames; |
121 | 121 |
122 for (internal::AddressTrackerLinux::AddressMap::const_iterator it = | 122 for (internal::AddressTrackerLinux::AddressMap::const_iterator it = |
123 address_map.begin(); | 123 address_map.begin(); |
124 it != address_map.end(); ++it) { | 124 it != address_map.end(); ++it) { |
125 // Ignore addresses whose links are not online. | 125 // Ignore addresses whose links are not online. |
126 if (online_links.find(it->second.ifa_index) == online_links.end()) | 126 if (online_links.find(it->second.ifa_index) == online_links.end()) |
127 continue; | 127 continue; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 std::string GetWifiSSID() { | 214 std::string GetWifiSSID() { |
215 NetworkInterfaceList networks; | 215 NetworkInterfaceList networks; |
216 if (GetNetworkList(&networks, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)) { | 216 if (GetNetworkList(&networks, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)) { |
217 return internal::GetWifiSSIDFromInterfaceListInternal( | 217 return internal::GetWifiSSIDFromInterfaceListInternal( |
218 networks, internal::GetInterfaceSSID); | 218 networks, internal::GetInterfaceSSID); |
219 } | 219 } |
220 return ""; | 220 return ""; |
221 } | 221 } |
222 | 222 |
223 } // namespace net | 223 } // namespace net |
OLD | NEW |