blob: 52d7d35a2c924e5dcfa6fcf808128dcfaa42e7ff [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_BASE_NETWORK_H_
12#define WEBRTC_BASE_NETWORK_H_
13
pbosc7c26a02017-01-02 08:42:32 -080014#include <stdint.h>
15
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000016#include <deque>
17#include <map>
jbauch555604a2016-04-26 03:13:22 -070018#include <memory>
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000019#include <string>
20#include <vector>
21
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000022#include "webrtc/base/ipaddress.h"
honghaiza7ad7c32016-02-02 12:54:14 -080023#include "webrtc/base/networkmonitor.h"
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000024#include "webrtc/base/messagehandler.h"
25#include "webrtc/base/sigslot.h"
26
27#if defined(WEBRTC_POSIX)
28struct ifaddrs;
29#endif // defined(WEBRTC_POSIX)
30
31namespace rtc {
32
Guo-wei Shieh9af97f82015-11-10 14:47:39 -080033extern const char kPublicIPv4Host[];
34extern const char kPublicIPv6Host[];
35
Guo-wei Shieh9faf1542015-12-28 14:06:55 -080036class IfAddrsConverter;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000037class Network;
honghaiz023f3ef2015-10-19 09:39:32 -070038class NetworkMonitorInterface;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000039class Thread;
40
Honghai Zhang351d77b2016-05-20 15:08:29 -070041static const uint16_t kNetworkCostMax = 999;
42static const uint16_t kNetworkCostHigh = 900;
43static const uint16_t kNetworkCostUnknown = 50;
44static const uint16_t kNetworkCostLow = 10;
45static const uint16_t kNetworkCostMin = 0;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000046
phoglund@webrtc.org006521d2015-02-12 09:23:59 +000047// By default, ignore loopback interfaces on the host.
48const int kDefaultNetworkIgnoreMask = ADAPTER_TYPE_LOOPBACK;
49
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000050// Makes a string key for this network. Used in the network manager's maps.
51// Network objects are keyed on interface name, network prefix and the
52// length of that prefix.
53std::string MakeNetworkKey(const std::string& name, const IPAddress& prefix,
54 int prefix_length);
55
Guo-wei Shieh9af97f82015-11-10 14:47:39 -080056class DefaultLocalAddressProvider {
57 public:
58 virtual ~DefaultLocalAddressProvider() = default;
59 // The default local address is the local address used in multi-homed endpoint
Guo-wei Shiehe03cab92015-11-11 11:11:19 -080060 // when the any address (0.0.0.0 or ::) is used as the local address. It's
61 // important to check the return value as a IP family may not be enabled.
Guo-wei Shieh9af97f82015-11-10 14:47:39 -080062 virtual bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const = 0;
63};
64
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000065// Generic network manager interface. It provides list of local
66// networks.
Taylor Brandstetterf8e65772016-06-27 17:20:15 -070067//
68// Every method of NetworkManager (including the destructor) must be called on
69// the same thread, except for the constructor which may be called on any
70// thread.
71//
72// This allows constructing a NetworkManager subclass on one thread and
73// passing it into an object that uses it on a different thread.
Guo-wei Shieh9af97f82015-11-10 14:47:39 -080074class NetworkManager : public DefaultLocalAddressProvider {
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000075 public:
76 typedef std::vector<Network*> NetworkList;
77
Guo-wei Shieh47872ec2015-08-19 10:32:46 -070078 // This enum indicates whether adapter enumeration is allowed.
79 enum EnumerationPermission {
guoweisea1012b2015-08-21 09:06:28 -070080 ENUMERATION_ALLOWED, // Adapter enumeration is allowed. Getting 0 network
81 // from GetNetworks means that there is no network
82 // available.
83 ENUMERATION_BLOCKED, // Adapter enumeration is disabled.
84 // GetAnyAddressNetworks() should be used instead.
Guo-wei Shieh47872ec2015-08-19 10:32:46 -070085 };
86
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000087 NetworkManager();
Guo-wei Shieh9af97f82015-11-10 14:47:39 -080088 ~NetworkManager() override;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000089
90 // Called when network list is updated.
91 sigslot::signal0<> SignalNetworksChanged;
92
93 // Indicates a failure when getting list of network interfaces.
94 sigslot::signal0<> SignalError;
95
Taylor Brandstetterf8e65772016-06-27 17:20:15 -070096 // This should be called on the NetworkManager's thread before the
97 // NetworkManager is used. Subclasses may override this if necessary.
98 virtual void Initialize() {}
99
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000100 // Start/Stop monitoring of network interfaces
phoglund@webrtc.org006521d2015-02-12 09:23:59 +0000101 // list. SignalNetworksChanged or SignalError is emitted immediately
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000102 // after StartUpdating() is called. After that SignalNetworksChanged
phoglund@webrtc.org006521d2015-02-12 09:23:59 +0000103 // is emitted whenever list of networks changes.
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000104 virtual void StartUpdating() = 0;
105 virtual void StopUpdating() = 0;
106
107 // Returns the current list of networks available on this machine.
Guo-wei Shieh47872ec2015-08-19 10:32:46 -0700108 // StartUpdating() must be called before this method is called.
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000109 // It makes sure that repeated calls return the same object for a
110 // given network, so that quality is tracked appropriately. Does not
111 // include ignored networks.
112 virtual void GetNetworks(NetworkList* networks) const = 0;
113
Guo-wei Shieh47872ec2015-08-19 10:32:46 -0700114 // return the current permission state of GetNetworks()
Guo-wei Shieh86cb9232015-08-19 10:57:53 -0700115 virtual EnumerationPermission enumeration_permission() const;
Guo-wei Shieh47872ec2015-08-19 10:32:46 -0700116
guoweis@webrtc.orgf358aea2015-02-18 18:44:01 +0000117 // "AnyAddressNetwork" is a network which only contains single "any address"
118 // IP address. (i.e. INADDR_ANY for IPv4 or in6addr_any for IPv6). This is
119 // useful as binding to such interfaces allow default routing behavior like
120 // http traffic.
guoweis@webrtc.org9dfe7aa2015-02-18 20:27:17 +0000121 // TODO(guoweis): remove this body when chromium implements this.
122 virtual void GetAnyAddressNetworks(NetworkList* networks) {}
guoweis@webrtc.orgf358aea2015-02-18 18:44:01 +0000123
honghaizdb8cf502015-12-21 13:08:46 -0800124 // Dumps the current list of networks in the network manager.
125 virtual void DumpNetworks() {}
Guo-wei Shieh9af97f82015-11-10 14:47:39 -0800126 bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const override;
127
guoweis@webrtc.orga094cac2015-01-28 19:34:05 +0000128 struct Stats {
129 int ipv4_network_count;
130 int ipv6_network_count;
131 Stats() {
132 ipv4_network_count = 0;
133 ipv6_network_count = 0;
134 }
135 };
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000136};
137
138// Base class for NetworkManager implementations.
139class NetworkManagerBase : public NetworkManager {
140 public:
141 NetworkManagerBase();
kwiberg@webrtc.org67186fe2015-03-09 22:21:53 +0000142 ~NetworkManagerBase() override;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000143
Honghai Zhang5622c5e2016-07-01 13:59:29 -0700144 void GetNetworks(NetworkList* networks) const override;
kwiberg@webrtc.org67186fe2015-03-09 22:21:53 +0000145 void GetAnyAddressNetworks(NetworkList* networks) override;
deadbeefe97389c2016-12-23 01:43:45 -0800146 // Defaults to true.
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000147 bool ipv6_enabled() const { return ipv6_enabled_; }
148 void set_ipv6_enabled(bool enabled) { ipv6_enabled_ = enabled; }
149
guoweis@webrtc.org2444d962015-01-30 00:09:28 +0000150 void set_max_ipv6_networks(int networks) { max_ipv6_networks_ = networks; }
151 int max_ipv6_networks() { return max_ipv6_networks_; }
152
Guo-wei Shieh47872ec2015-08-19 10:32:46 -0700153 EnumerationPermission enumeration_permission() const override;
154
Guo-wei Shieh9af97f82015-11-10 14:47:39 -0800155 bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const override;
156
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000157 protected:
158 typedef std::map<std::string, Network*> NetworkMap;
159 // Updates |networks_| with the networks listed in |list|. If
160 // |network_map_| already has a Network object for a network listed
161 // in the |list| then it is reused. Accept ownership of the Network
162 // objects in the |list|. |changed| will be set to true if there is
163 // any change in the network list.
164 void MergeNetworkList(const NetworkList& list, bool* changed);
165
guoweis@webrtc.orga094cac2015-01-28 19:34:05 +0000166 // |stats| will be populated even if |*changed| is false.
167 void MergeNetworkList(const NetworkList& list,
168 bool* changed,
169 NetworkManager::Stats* stats);
170
Guo-wei Shieh47872ec2015-08-19 10:32:46 -0700171 void set_enumeration_permission(EnumerationPermission state) {
172 enumeration_permission_ = state;
173 }
174
Guo-wei Shieh9af97f82015-11-10 14:47:39 -0800175 void set_default_local_addresses(const IPAddress& ipv4,
176 const IPAddress& ipv6);
177
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000178 private:
179 friend class NetworkTest;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000180
honghaizaf83fe62016-04-18 14:50:44 -0700181 Network* GetNetworkFromAddress(const rtc::IPAddress& ip) const;
182
Guo-wei Shieh47872ec2015-08-19 10:32:46 -0700183 EnumerationPermission enumeration_permission_;
184
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000185 NetworkList networks_;
guoweis@webrtc.org2444d962015-01-30 00:09:28 +0000186 int max_ipv6_networks_;
187
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000188 NetworkMap networks_map_;
189 bool ipv6_enabled_;
guoweis@webrtc.orgf358aea2015-02-18 18:44:01 +0000190
jbauch555604a2016-04-26 03:13:22 -0700191 std::unique_ptr<rtc::Network> ipv4_any_address_network_;
192 std::unique_ptr<rtc::Network> ipv6_any_address_network_;
Guo-wei Shieh9af97f82015-11-10 14:47:39 -0800193
194 IPAddress default_local_ipv4_address_;
195 IPAddress default_local_ipv6_address_;
honghaiza0c44ea2016-03-23 16:07:48 -0700196 // We use 16 bits to save the bandwidth consumption when sending the network
197 // id over the Internet. It is OK that the 16-bit integer overflows to get a
198 // network id 0 because we only compare the network ids in the old and the new
199 // best connections in the transport channel.
200 uint16_t next_available_network_id_ = 1;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000201};
202
203// Basic implementation of the NetworkManager interface that gets list
204// of networks using OS APIs.
205class BasicNetworkManager : public NetworkManagerBase,
honghaiz023f3ef2015-10-19 09:39:32 -0700206 public MessageHandler,
207 public sigslot::has_slots<> {
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000208 public:
209 BasicNetworkManager();
kwiberg@webrtc.org67186fe2015-03-09 22:21:53 +0000210 ~BasicNetworkManager() override;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000211
kwiberg@webrtc.org67186fe2015-03-09 22:21:53 +0000212 void StartUpdating() override;
213 void StopUpdating() override;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000214
honghaizdb8cf502015-12-21 13:08:46 -0800215 void DumpNetworks() override;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000216
217 // MessageHandler interface.
kwiberg@webrtc.org67186fe2015-03-09 22:21:53 +0000218 void OnMessage(Message* msg) override;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000219 bool started() { return start_count_ > 0; }
220
phoglund@webrtc.org006521d2015-02-12 09:23:59 +0000221 // Sets the network ignore list, which is empty by default. Any network on the
222 // ignore list will be filtered from network enumeration results.
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000223 void set_network_ignore_list(const std::vector<std::string>& list) {
224 network_ignore_list_ = list;
225 }
phoglund@webrtc.org006521d2015-02-12 09:23:59 +0000226
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000227#if defined(WEBRTC_LINUX)
228 // Sets the flag for ignoring non-default routes.
229 void set_ignore_non_default_routes(bool value) {
230 ignore_non_default_routes_ = true;
231 }
232#endif
233
234 protected:
235#if defined(WEBRTC_POSIX)
236 // Separated from CreateNetworks for tests.
237 void ConvertIfAddrs(ifaddrs* interfaces,
Guo-wei Shieh9faf1542015-12-28 14:06:55 -0800238 IfAddrsConverter* converter,
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000239 bool include_ignored,
240 NetworkList* networks) const;
241#endif // defined(WEBRTC_POSIX)
242
243 // Creates a network object for each network available on the machine.
244 bool CreateNetworks(bool include_ignored, NetworkList* networks) const;
245
guoweis@webrtc.orgb91d0f52015-03-17 14:43:20 +0000246 // Determines if a network should be ignored. This should only be determined
247 // based on the network's property instead of any individual IP.
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000248 bool IsIgnoredNetwork(const Network& network) const;
249
Guo-wei Shieh9af97f82015-11-10 14:47:39 -0800250 // This function connects a UDP socket to a public address and returns the
251 // local address associated it. Since it binds to the "any" address
252 // internally, it returns the default local address on a multi-homed endpoint.
253 IPAddress QueryDefaultLocalAddress(int family) const;
254
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000255 private:
256 friend class NetworkTest;
257
honghaiz023f3ef2015-10-19 09:39:32 -0700258 // Creates a network monitor and listens for network updates.
259 void StartNetworkMonitor();
260 // Stops and removes the network monitor.
261 void StopNetworkMonitor();
262 // Called when it receives updates from the network monitor.
263 void OnNetworksChanged();
264
265 // Updates the networks and reschedules the next update.
266 void UpdateNetworksContinually();
267 // Only updates the networks; does not reschedule the next update.
268 void UpdateNetworksOnce();
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000269
Honghai Zhang351d77b2016-05-20 15:08:29 -0700270 AdapterType GetAdapterTypeFromName(const char* network_name) const;
271
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000272 Thread* thread_;
273 bool sent_first_update_;
274 int start_count_;
275 std::vector<std::string> network_ignore_list_;
276 bool ignore_non_default_routes_;
jbauch555604a2016-04-26 03:13:22 -0700277 std::unique_ptr<NetworkMonitorInterface> network_monitor_;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000278};
279
280// Represents a Unix-type network interface, with a name and single address.
281class Network {
282 public:
Guo-wei Shieh9af97f82015-11-10 14:47:39 -0800283 Network(const std::string& name,
284 const std::string& description,
285 const IPAddress& prefix,
286 int prefix_length);
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000287
Guo-wei Shieh9af97f82015-11-10 14:47:39 -0800288 Network(const std::string& name,
289 const std::string& description,
290 const IPAddress& prefix,
291 int prefix_length,
292 AdapterType type);
kwiberg@webrtc.org67186fe2015-03-09 22:21:53 +0000293 ~Network();
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000294
Honghai Zhang351d77b2016-05-20 15:08:29 -0700295 sigslot::signal1<const Network*> SignalTypeChanged;
honghaize3c6c822016-02-17 13:00:28 -0800296
Guo-wei Shieh9af97f82015-11-10 14:47:39 -0800297 const DefaultLocalAddressProvider* default_local_address_provider() {
298 return default_local_address_provider_;
299 }
300 void set_default_local_address_provider(
301 const DefaultLocalAddressProvider* provider) {
302 default_local_address_provider_ = provider;
303 }
304
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000305 // Returns the name of the interface this network is associated wtih.
306 const std::string& name() const { return name_; }
307
308 // Returns the OS-assigned name for this network. This is useful for
309 // debugging but should not be sent over the wire (for privacy reasons).
310 const std::string& description() const { return description_; }
311
312 // Returns the prefix for this network.
313 const IPAddress& prefix() const { return prefix_; }
314 // Returns the length, in bits, of this network's prefix.
315 int prefix_length() const { return prefix_length_; }
316
317 // |key_| has unique value per network interface. Used in sorting network
318 // interfaces. Key is derived from interface name and it's prefix.
319 std::string key() const { return key_; }
320
aluebs@webrtc.org07dcf602015-02-27 18:42:22 +0000321 // Returns the Network's current idea of the 'best' IP it has.
322 // Or return an unset IP if this network has no active addresses.
323 // Here is the rule on how we mark the IPv6 address as ignorable for WebRTC.
324 // 1) return all global temporary dynamic and non-deprecrated ones.
325 // 2) if #1 not available, return global ones.
326 // 3) if #2 not available, use ULA ipv6 as last resort. (ULA stands
327 // for unique local address, which is not route-able in open
328 // internet but might be useful for a close WebRTC deployment.
329
330 // TODO(guoweis): rule #3 actually won't happen at current
331 // implementation. The reason being that ULA address starting with
332 // 0xfc 0r 0xfd will be grouped into its own Network. The result of
333 // that is WebRTC will have one extra Network to generate candidates
334 // but the lack of rule #3 shouldn't prevent turning on IPv6 since
335 // ULA should only be tried in a close deployment anyway.
336
337 // Note that when not specifying any flag, it's treated as case global
338 // IPv6 address
guoweis@webrtc.org369a6372014-09-17 22:37:29 +0000339 IPAddress GetBestIP() const;
340
341 // Keep the original function here for now.
342 // TODO(guoweis): Remove this when all callers are migrated to GetBestIP().
343 IPAddress ip() const { return GetBestIP(); }
guoweis@webrtc.orgfa603982014-09-09 23:42:40 +0000344
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000345 // Adds an active IP address to this network. Does not check for duplicates.
guoweis@webrtc.orgfa603982014-09-09 23:42:40 +0000346 void AddIP(const InterfaceAddress& ip) { ips_.push_back(ip); }
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000347
348 // Sets the network's IP address list. Returns true if new IP addresses were
349 // detected. Passing true to already_changed skips this check.
guoweis@webrtc.orgfa603982014-09-09 23:42:40 +0000350 bool SetIPs(const std::vector<InterfaceAddress>& ips, bool already_changed);
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000351 // Get the list of IP Addresses associated with this network.
guoweis@webrtc.orgfa603982014-09-09 23:42:40 +0000352 const std::vector<InterfaceAddress>& GetIPs() const { return ips_;}
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000353 // Clear the network's list of addresses.
354 void ClearIPs() { ips_.clear(); }
355
356 // Returns the scope-id of the network's address.
357 // Should only be relevant for link-local IPv6 addresses.
358 int scope_id() const { return scope_id_; }
359 void set_scope_id(int id) { scope_id_ = id; }
360
361 // Indicates whether this network should be ignored, perhaps because
362 // the IP is 0, or the interface is one we know is invalid.
363 bool ignored() const { return ignored_; }
364 void set_ignored(bool ignored) { ignored_ = ignored; }
365
366 AdapterType type() const { return type_; }
Honghai Zhang351d77b2016-05-20 15:08:29 -0700367 void set_type(AdapterType type) {
368 if (type_ == type) {
369 return;
370 }
371 type_ = type;
372 SignalTypeChanged(this);
373 }
honghaize2af9ef2016-03-03 08:27:47 -0800374
Honghai Zhang351d77b2016-05-20 15:08:29 -0700375 uint16_t GetCost() const {
376 switch (type_) {
377 case rtc::ADAPTER_TYPE_ETHERNET:
378 case rtc::ADAPTER_TYPE_LOOPBACK:
379 return kNetworkCostMin;
380 case rtc::ADAPTER_TYPE_WIFI:
381 case rtc::ADAPTER_TYPE_VPN:
382 return kNetworkCostLow;
383 case rtc::ADAPTER_TYPE_CELLULAR:
384 return kNetworkCostHigh;
385 default:
386 return kNetworkCostUnknown;
387 }
388 }
honghaiza0c44ea2016-03-23 16:07:48 -0700389 // A unique id assigned by the network manager, which may be signaled
390 // to the remote side in the candidate.
391 uint16_t id() const { return id_; }
392 void set_id(uint16_t id) { id_ = id; }
393
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000394 int preference() const { return preference_; }
395 void set_preference(int preference) { preference_ = preference; }
396
honghaizdb8cf502015-12-21 13:08:46 -0800397 // When we enumerate networks and find a previously-seen network is missing,
398 // we do not remove it (because it may be used elsewhere). Instead, we mark
399 // it inactive, so that we can detect network changes properly.
400 bool active() const { return active_; }
honghaize3c6c822016-02-17 13:00:28 -0800401 void set_active(bool active) {
Honghai Zhang5622c5e2016-07-01 13:59:29 -0700402 if (active_ != active) {
403 active_ = active;
honghaize3c6c822016-02-17 13:00:28 -0800404 }
405 }
honghaizdb8cf502015-12-21 13:08:46 -0800406
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000407 // Debugging description of this network
408 std::string ToString() const;
409
410 private:
Guo-wei Shieh9af97f82015-11-10 14:47:39 -0800411 const DefaultLocalAddressProvider* default_local_address_provider_ = nullptr;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000412 std::string name_;
413 std::string description_;
414 IPAddress prefix_;
415 int prefix_length_;
416 std::string key_;
guoweis@webrtc.orgfa603982014-09-09 23:42:40 +0000417 std::vector<InterfaceAddress> ips_;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000418 int scope_id_;
419 bool ignored_;
420 AdapterType type_;
421 int preference_;
honghaizdb8cf502015-12-21 13:08:46 -0800422 bool active_ = true;
honghaiza0c44ea2016-03-23 16:07:48 -0700423 uint16_t id_ = 0;
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000424
425 friend class NetworkManager;
426};
427
428} // namespace rtc
429
430#endif // WEBRTC_BASE_NETWORK_H_