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 10 #include "net/base/network_change_notifier.h" 11 12 namespace fuchsia { 13 namespace net { 14 class IpAddress; 15 } 16 namespace netstack { 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 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 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. 42 IPAddress FuchsiaIpAddressToIPAddress(const fuchsia::net::IpAddress& addr); 43 44 } // namespace internal 45 } // namespace net 46 47 #endif // NET_BASE_NETWORK_INTERFACES_FUCHSIA_H_ 48