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 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // Makes a string key for this network. Used in the network manager's maps. | 51 // Makes a string key for this network. Used in the network manager's maps. |
52 // Network objects are keyed on interface name, network prefix and the | 52 // Network objects are keyed on interface name, network prefix and the |
53 // length of that prefix. | 53 // length of that prefix. |
54 std::string MakeNetworkKey(const std::string& name, const IPAddress& prefix, | 54 std::string MakeNetworkKey(const std::string& name, const IPAddress& prefix, |
55 int prefix_length); | 55 int prefix_length); |
56 | 56 |
57 class DefaultLocalAddressProvider { | 57 class DefaultLocalAddressProvider { |
58 public: | 58 public: |
59 virtual ~DefaultLocalAddressProvider() = default; | 59 virtual ~DefaultLocalAddressProvider() = default; |
60 // The default local address is the local address used in multi-homed endpoint | 60 // The default local address is the local address used in multi-homed endpoint |
61 // when the any address (0.0.0.0 or ::) is used as the local address. | 61 // when the any address (0.0.0.0 or ::) is used as the local address. It's |
| 62 // important to check the return value as a IP family may not be enabled. |
62 virtual bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const = 0; | 63 virtual bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const = 0; |
63 }; | 64 }; |
64 | 65 |
65 // Generic network manager interface. It provides list of local | 66 // Generic network manager interface. It provides list of local |
66 // networks. | 67 // networks. |
67 class NetworkManager : public DefaultLocalAddressProvider { | 68 class NetworkManager : public DefaultLocalAddressProvider { |
68 public: | 69 public: |
69 typedef std::vector<Network*> NetworkList; | 70 typedef std::vector<Network*> NetworkList; |
70 | 71 |
71 // This enum indicates whether adapter enumeration is allowed. | 72 // This enum indicates whether adapter enumeration is allowed. |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 bool ignored_; | 374 bool ignored_; |
374 AdapterType type_; | 375 AdapterType type_; |
375 int preference_; | 376 int preference_; |
376 | 377 |
377 friend class NetworkManager; | 378 friend class NetworkManager; |
378 }; | 379 }; |
379 | 380 |
380 } // namespace rtc | 381 } // namespace rtc |
381 | 382 |
382 #endif // WEBRTC_BASE_NETWORK_H_ | 383 #endif // WEBRTC_BASE_NETWORK_H_ |
OLD | NEW |