Kevin Marshall | 3e89fd73 | 2018-06-05 21:29:10 | [diff] [blame] | 1 | // 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 Wolter | d89b754 | 2019-01-24 11:01:21 | [diff] [blame] | 10 | #include "net/base/network_change_notifier.h" |
| 11 | |
Kevin Marshall | 3e89fd73 | 2018-06-05 21:29:10 | [diff] [blame] | 12 | namespace fuchsia { |
Sergey Ulanov | cac54719 | 2018-12-10 22:11:51 | [diff] [blame] | 13 | namespace net { |
| 14 | class IpAddress; |
| 15 | } |
Kevin Marshall | 3e89fd73 | 2018-06-05 21:29:10 | [diff] [blame] | 16 | namespace netstack { |
Kevin Marshall | 3e89fd73 | 2018-06-05 21:29:10 | [diff] [blame] | 17 | class NetInterface; |
| 18 | } // namespace netstack |
| 19 | } // namespace fuchsia |
| 20 | |
| 21 | namespace net { |
| 22 | |
| 23 | class IPAddress; |
| 24 | struct NetworkInterface; |
| 25 | |
| 26 | namespace internal { |
| 27 | |
Aidan Wolter | d89b754 | 2019-01-24 11:01:21 | [diff] [blame] | 28 | // Returns the //net ConnectionType for the supplied netstack interface |
| 29 | // description. Returns ConnectionType::CONNECTION_NONE if the interface is not |
| 30 | // "up". |
| 31 | NetworkChangeNotifier::ConnectionType ConvertConnectionType( |
| 32 | const fuchsia::netstack::NetInterface& iface); |
| 33 | |
Kevin Marshall | 3e89fd73 | 2018-06-05 21:29:10 | [diff] [blame] | 34 | // 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). |
| 38 | std::vector<NetworkInterface> NetInterfaceToNetworkInterfaces( |
| 39 | const fuchsia::netstack::NetInterface& iface_in); |
| 40 | |
| 41 | // Converts a Fuchsia IPv4/IPv6 address to a Chromium IPAddress. |
Sergey Ulanov | cac54719 | 2018-12-10 22:11:51 | [diff] [blame] | 42 | IPAddress FuchsiaIpAddressToIPAddress(const fuchsia::net::IpAddress& addr); |
Kevin Marshall | 3e89fd73 | 2018-06-05 21:29:10 | [diff] [blame] | 43 | |
| 44 | } // namespace internal |
| 45 | } // namespace net |
| 46 | |
| 47 | #endif // NET_BASE_NETWORK_INTERFACES_FUCHSIA_H_ |