blob: b9dcf9cb8e4925455f17dd62bf86ad3367004801 [file] [log] [blame]
Kevin Marshall3e89fd732018-06-05 21:29:101// Copyright 2018 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
5#ifndef NET_BASE_NETWORK_INTERFACES_FUCHSIA_H_
6#define NET_BASE_NETWORK_INTERFACES_FUCHSIA_H_
7
8#include <vector>
9
Aidan Wolterd89b7542019-01-24 11:01:2110#include "net/base/network_change_notifier.h"
11
Kevin Marshall3e89fd732018-06-05 21:29:1012namespace fuchsia {
Sergey Ulanovcac547192018-12-10 22:11:5113namespace net {
14class IpAddress;
15}
Kevin Marshall3e89fd732018-06-05 21:29:1016namespace netstack {
Kevin Marshall3e89fd732018-06-05 21:29:1017class NetInterface;
18} // namespace netstack
19} // namespace fuchsia
20
21namespace net {
22
23class IPAddress;
24struct NetworkInterface;
25
26namespace internal {
27
Aidan Wolterd89b7542019-01-24 11:01:2128// Returns the //net ConnectionType for the supplied netstack interface
29// description. Returns ConnectionType::CONNECTION_NONE if the interface is not
30// "up".
31NetworkChangeNotifier::ConnectionType ConvertConnectionType(
32 const fuchsia::netstack::NetInterface& iface);
33
Kevin Marshall3e89fd732018-06-05 21:29:1034// Converts a Fuchsia Netstack NetInterface object to NetworkInterface objects.
35// Interfaces with more than one IPv6 address will yield multiple
36// NetworkInterface objects, with friendly names to distinguish the different
37// IPs (e.g. "wlan" with three IPv6 IPs yields wlan-0, wlan-1, wlan-2).
38std::vector<NetworkInterface> NetInterfaceToNetworkInterfaces(
39 const fuchsia::netstack::NetInterface& iface_in);
40
41// Converts a Fuchsia IPv4/IPv6 address to a Chromium IPAddress.
Sergey Ulanovcac547192018-12-10 22:11:5142IPAddress FuchsiaIpAddressToIPAddress(const fuchsia::net::IpAddress& addr);
Kevin Marshall3e89fd732018-06-05 21:29:1043
44} // namespace internal
45} // namespace net
46
47#endif // NET_BASE_NETWORK_INTERFACES_FUCHSIA_H_