guoweis | 7eb7ab5 | 2014-11-14 17:42:56 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
eroman | c69886a4 | 2015-06-03 18:19:52 | [diff] [blame] | 5 | #ifndef NET_BASE_NETWORK_INTERFACES_LINUX_H_ |
| 6 | #define NET_BASE_NETWORK_INTERFACES_LINUX_H_ |
guoweis | 7eb7ab5 | 2014-11-14 17:42:56 | [diff] [blame] | 7 | |
| 8 | // This file is only used to expose some of the internals |
eroman | c69886a4 | 2015-06-03 18:19:52 | [diff] [blame] | 9 | // of network_interfaces_linux.cc to address_tracker_linux and tests. |
guoweis | 7eb7ab5 | 2014-11-14 17:42:56 | [diff] [blame] | 10 | |
meacer | bc462ea | 2015-02-17 19:32:53 | [diff] [blame] | 11 | #include <string> |
davidben | 1e912ea | 2016-04-20 19:17:07 | [diff] [blame] | 12 | #include <unordered_set> |
meacer | bc462ea | 2015-02-17 19:32:53 | [diff] [blame] | 13 | |
guoweis | 7eb7ab5 | 2014-11-14 17:42:56 | [diff] [blame] | 14 | #include "net/base/address_tracker_linux.h" |
bnc | 81c46c1f | 2016-10-04 16:25:59 | [diff] [blame^] | 15 | #include "net/base/net_export.h" |
eroman | c69886a4 | 2015-06-03 18:19:52 | [diff] [blame] | 16 | #include "net/base/network_interfaces.h" |
guoweis | 7eb7ab5 | 2014-11-14 17:42:56 | [diff] [blame] | 17 | |
| 18 | namespace net { |
| 19 | namespace internal { |
| 20 | |
derekjchow | 5482d5e | 2015-01-31 01:04:51 | [diff] [blame] | 21 | typedef char* (*GetInterfaceNameFunction)(int interface_index, char* ifname); |
guoweis | 7eb7ab5 | 2014-11-14 17:42:56 | [diff] [blame] | 22 | |
meacer | bc462ea | 2015-02-17 19:32:53 | [diff] [blame] | 23 | typedef std::string (*GetInterfaceSSIDFunction)(const std::string& ifname); |
| 24 | |
guoweis | 7eb7ab5 | 2014-11-14 17:42:56 | [diff] [blame] | 25 | NET_EXPORT bool GetNetworkListImpl( |
| 26 | NetworkInterfaceList* networks, |
| 27 | int policy, |
davidben | 1e912ea | 2016-04-20 19:17:07 | [diff] [blame] | 28 | const std::unordered_set<int>& online_links, |
guoweis | 7eb7ab5 | 2014-11-14 17:42:56 | [diff] [blame] | 29 | const internal::AddressTrackerLinux::AddressMap& address_map, |
| 30 | GetInterfaceNameFunction get_interface_name); |
| 31 | |
meacer | bc462ea | 2015-02-17 19:32:53 | [diff] [blame] | 32 | // Gets the current Wi-Fi SSID based on |interfaces|. Returns |
| 33 | // empty string if there are no interfaces or if two interfaces have different |
| 34 | // connection types. Otherwise returns the SSID of all interfaces if they have |
| 35 | // the same SSID. This is adapted from |
| 36 | // NetworkChangeNotifier::ConnectionTypeFromInterfaceList. |
| 37 | NET_EXPORT std::string GetWifiSSIDFromInterfaceListInternal( |
| 38 | const NetworkInterfaceList& interfaces, |
| 39 | internal::GetInterfaceSSIDFunction get_interface_ssid); |
| 40 | |
guoweis | 7eb7ab5 | 2014-11-14 17:42:56 | [diff] [blame] | 41 | } // namespace internal |
| 42 | } // namespace net |
| 43 | |
eroman | c69886a4 | 2015-06-03 18:19:52 | [diff] [blame] | 44 | #endif // NET_BASE_NETWORK_INTERFACES_LINUX_H_ |