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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // useful as binding to such interfaces allow default routing behavior like | 109 // useful as binding to such interfaces allow default routing behavior like |
110 // http traffic. | 110 // http traffic. |
111 // TODO(guoweis): remove this body when chromium implements this. | 111 // TODO(guoweis): remove this body when chromium implements this. |
112 virtual void GetAnyAddressNetworks(NetworkList* networks) {} | 112 virtual void GetAnyAddressNetworks(NetworkList* networks) {} |
113 | 113 |
114 bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const override; | 114 bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const override; |
115 | 115 |
116 // Dumps a list of networks available to LS_INFO. | 116 // Dumps a list of networks available to LS_INFO. |
117 virtual void DumpNetworks(bool include_ignored) {} | 117 virtual void DumpNetworks(bool include_ignored) {} |
118 | 118 |
| 119 // Sets the network types to ignore. For instance, calling this with |
| 120 // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and |
| 121 // loopback interfaces. |
| 122 // TODO(deadbeef): Make pure virtual once Chromium implements it. |
| 123 virtual void SetNetworkIgnoreMask(int network_ignore_mask) {} |
| 124 |
119 struct Stats { | 125 struct Stats { |
120 int ipv4_network_count; | 126 int ipv4_network_count; |
121 int ipv6_network_count; | 127 int ipv6_network_count; |
122 Stats() { | 128 Stats() { |
123 ipv4_network_count = 0; | 129 ipv4_network_count = 0; |
124 ipv6_network_count = 0; | 130 ipv6_network_count = 0; |
125 } | 131 } |
126 }; | 132 }; |
127 }; | 133 }; |
128 | 134 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 public: | 197 public: |
192 BasicNetworkManager(); | 198 BasicNetworkManager(); |
193 ~BasicNetworkManager() override; | 199 ~BasicNetworkManager() override; |
194 | 200 |
195 void StartUpdating() override; | 201 void StartUpdating() override; |
196 void StopUpdating() override; | 202 void StopUpdating() override; |
197 | 203 |
198 // Logs the available networks. | 204 // Logs the available networks. |
199 void DumpNetworks(bool include_ignored) override; | 205 void DumpNetworks(bool include_ignored) override; |
200 | 206 |
| 207 // Set to kDefaultNetworkIgnoreMask by default. |
| 208 void SetNetworkIgnoreMask(int network_ignore_mask) override { |
| 209 // TODO(phoglund): implement support for other types than loopback. |
| 210 // See https://code.google.com/p/webrtc/issues/detail?id=4288. |
| 211 // Then remove set_network_ignore_list. |
| 212 network_ignore_mask_ = network_ignore_mask; |
| 213 } |
| 214 |
201 // MessageHandler interface. | 215 // MessageHandler interface. |
202 void OnMessage(Message* msg) override; | 216 void OnMessage(Message* msg) override; |
203 bool started() { return start_count_ > 0; } | 217 bool started() { return start_count_ > 0; } |
204 | 218 |
205 // Sets the network ignore list, which is empty by default. Any network on the | 219 // Sets the network ignore list, which is empty by default. Any network on the |
206 // ignore list will be filtered from network enumeration results. | 220 // ignore list will be filtered from network enumeration results. |
207 void set_network_ignore_list(const std::vector<std::string>& list) { | 221 void set_network_ignore_list(const std::vector<std::string>& list) { |
208 network_ignore_list_ = list; | 222 network_ignore_list_ = list; |
209 } | 223 } |
210 | 224 |
211 // Sets the network types to ignore. For instance, calling this with | |
212 // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and | |
213 // loopback interfaces. Set to kDefaultNetworkIgnoreMask by default. | |
214 void set_network_ignore_mask(int network_ignore_mask) { | |
215 // TODO(phoglund): implement support for other types than loopback. | |
216 // See https://code.google.com/p/webrtc/issues/detail?id=4288. | |
217 // Then remove set_network_ignore_list. | |
218 network_ignore_mask_ = network_ignore_mask; | |
219 } | |
220 | |
221 int network_ignore_mask() const { return network_ignore_mask_; } | 225 int network_ignore_mask() const { return network_ignore_mask_; } |
222 | 226 |
223 #if defined(WEBRTC_LINUX) | 227 #if defined(WEBRTC_LINUX) |
224 // Sets the flag for ignoring non-default routes. | 228 // Sets the flag for ignoring non-default routes. |
225 void set_ignore_non_default_routes(bool value) { | 229 void set_ignore_non_default_routes(bool value) { |
226 ignore_non_default_routes_ = true; | 230 ignore_non_default_routes_ = true; |
227 } | 231 } |
228 #endif | 232 #endif |
229 | 233 |
230 protected: | 234 protected: |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 bool ignored_; | 378 bool ignored_; |
375 AdapterType type_; | 379 AdapterType type_; |
376 int preference_; | 380 int preference_; |
377 | 381 |
378 friend class NetworkManager; | 382 friend class NetworkManager; |
379 }; | 383 }; |
380 | 384 |
381 } // namespace rtc | 385 } // namespace rtc |
382 | 386 |
383 #endif // WEBRTC_BASE_NETWORK_H_ | 387 #endif // WEBRTC_BASE_NETWORK_H_ |
OLD | NEW |