OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_BASE_NETWORK_H_ | 11 #ifndef WEBRTC_BASE_NETWORK_H_ |
12 #define WEBRTC_BASE_NETWORK_H_ | 12 #define WEBRTC_BASE_NETWORK_H_ |
13 | 13 |
14 #include <deque> | 14 #include <deque> |
15 #include <map> | 15 #include <map> |
16 #include <string> | 16 #include <string> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/base/basictypes.h" | 19 #include "webrtc/base/basictypes.h" |
20 #include "webrtc/base/ipaddress.h" | 20 #include "webrtc/base/ipaddress.h" |
| 21 #include "webrtc/base/networkmonitor.h" |
21 #include "webrtc/base/messagehandler.h" | 22 #include "webrtc/base/messagehandler.h" |
22 #include "webrtc/base/scoped_ptr.h" | 23 #include "webrtc/base/scoped_ptr.h" |
23 #include "webrtc/base/sigslot.h" | 24 #include "webrtc/base/sigslot.h" |
24 | 25 |
25 #if defined(WEBRTC_POSIX) | 26 #if defined(WEBRTC_POSIX) |
26 struct ifaddrs; | 27 struct ifaddrs; |
27 #endif // defined(WEBRTC_POSIX) | 28 #endif // defined(WEBRTC_POSIX) |
28 | 29 |
29 namespace rtc { | 30 namespace rtc { |
30 | 31 |
31 extern const char kPublicIPv4Host[]; | 32 extern const char kPublicIPv4Host[]; |
32 extern const char kPublicIPv6Host[]; | 33 extern const char kPublicIPv6Host[]; |
33 | 34 |
34 class IfAddrsConverter; | 35 class IfAddrsConverter; |
35 class Network; | 36 class Network; |
36 class NetworkMonitorInterface; | 37 class NetworkMonitorInterface; |
37 class Thread; | 38 class Thread; |
38 | 39 |
39 enum AdapterType { | |
40 // This enum resembles the one in Chromium net::ConnectionType. | |
41 ADAPTER_TYPE_UNKNOWN = 0, | |
42 ADAPTER_TYPE_ETHERNET = 1 << 0, | |
43 ADAPTER_TYPE_WIFI = 1 << 1, | |
44 ADAPTER_TYPE_CELLULAR = 1 << 2, | |
45 ADAPTER_TYPE_VPN = 1 << 3, | |
46 ADAPTER_TYPE_LOOPBACK = 1 << 4 | |
47 }; | |
48 | 40 |
49 // By default, ignore loopback interfaces on the host. | 41 // By default, ignore loopback interfaces on the host. |
50 const int kDefaultNetworkIgnoreMask = ADAPTER_TYPE_LOOPBACK; | 42 const int kDefaultNetworkIgnoreMask = ADAPTER_TYPE_LOOPBACK; |
51 | 43 |
52 // Makes a string key for this network. Used in the network manager's maps. | 44 // Makes a string key for this network. Used in the network manager's maps. |
53 // Network objects are keyed on interface name, network prefix and the | 45 // Network objects are keyed on interface name, network prefix and the |
54 // length of that prefix. | 46 // length of that prefix. |
55 std::string MakeNetworkKey(const std::string& name, const IPAddress& prefix, | 47 std::string MakeNetworkKey(const std::string& name, const IPAddress& prefix, |
56 int prefix_length); | 48 int prefix_length); |
57 | 49 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 AdapterType type_; | 360 AdapterType type_; |
369 int preference_; | 361 int preference_; |
370 bool active_ = true; | 362 bool active_ = true; |
371 | 363 |
372 friend class NetworkManager; | 364 friend class NetworkManager; |
373 }; | 365 }; |
374 | 366 |
375 } // namespace rtc | 367 } // namespace rtc |
376 | 368 |
377 #endif // WEBRTC_BASE_NETWORK_H_ | 369 #endif // WEBRTC_BASE_NETWORK_H_ |
OLD | NEW |