blob: 9dfea10fb3a1f09ecbe184a4076d06e05a17f197 [file] [log] [blame]
guoweis7eb7ab52014-11-14 17:42:561// 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
eromanc69886a42015-06-03 18:19:525#ifndef NET_BASE_NETWORK_INTERFACES_LINUX_H_
6#define NET_BASE_NETWORK_INTERFACES_LINUX_H_
guoweis7eb7ab52014-11-14 17:42:567
8// This file is only used to expose some of the internals
eromanc69886a42015-06-03 18:19:529// of network_interfaces_linux.cc to address_tracker_linux and tests.
guoweis7eb7ab52014-11-14 17:42:5610
meacerbc462ea2015-02-17 19:32:5311#include <string>
davidben1e912ea2016-04-20 19:17:0712#include <unordered_set>
meacerbc462ea2015-02-17 19:32:5313
guoweis7eb7ab52014-11-14 17:42:5614#include "net/base/address_tracker_linux.h"
bnc81c46c1f2016-10-04 16:25:5915#include "net/base/net_export.h"
eromanc69886a42015-06-03 18:19:5216#include "net/base/network_interfaces.h"
guoweis7eb7ab52014-11-14 17:42:5617
18namespace net {
19namespace internal {
20
derekjchow5482d5e2015-01-31 01:04:5121typedef char* (*GetInterfaceNameFunction)(int interface_index, char* ifname);
guoweis7eb7ab52014-11-14 17:42:5622
meacerbc462ea2015-02-17 19:32:5323typedef std::string (*GetInterfaceSSIDFunction)(const std::string& ifname);
24
guoweis7eb7ab52014-11-14 17:42:5625NET_EXPORT bool GetNetworkListImpl(
26 NetworkInterfaceList* networks,
27 int policy,
davidben1e912ea2016-04-20 19:17:0728 const std::unordered_set<int>& online_links,
guoweis7eb7ab52014-11-14 17:42:5629 const internal::AddressTrackerLinux::AddressMap& address_map,
30 GetInterfaceNameFunction get_interface_name);
31
meacerbc462ea2015-02-17 19:32:5332// 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.
37NET_EXPORT std::string GetWifiSSIDFromInterfaceListInternal(
38 const NetworkInterfaceList& interfaces,
39 internal::GetInterfaceSSIDFunction get_interface_ssid);
40
guoweis7eb7ab52014-11-14 17:42:5641} // namespace internal
42} // namespace net
43
eromanc69886a42015-06-03 18:19:5244#endif // NET_BASE_NETWORK_INTERFACES_LINUX_H_