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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // MessageHandler interface. | 199 // MessageHandler interface. |
200 void OnMessage(Message* msg) override; | 200 void OnMessage(Message* msg) override; |
201 bool started() { return start_count_ > 0; } | 201 bool started() { return start_count_ > 0; } |
202 | 202 |
203 // Sets the network ignore list, which is empty by default. Any network on the | 203 // Sets the network ignore list, which is empty by default. Any network on the |
204 // ignore list will be filtered from network enumeration results. | 204 // ignore list will be filtered from network enumeration results. |
205 void set_network_ignore_list(const std::vector<std::string>& list) { | 205 void set_network_ignore_list(const std::vector<std::string>& list) { |
206 network_ignore_list_ = list; | 206 network_ignore_list_ = list; |
207 } | 207 } |
208 | 208 |
209 // Sets the network types to ignore. For instance, calling this with | |
210 // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and | |
211 // loopback interfaces. Set to kDefaultNetworkIgnoreMask by default. | |
212 void set_network_ignore_mask(int network_ignore_mask) { | |
213 // TODO(phoglund): implement support for other types than loopback. | |
214 // See https://code.google.com/p/webrtc/issues/detail?id=4288. | |
215 // Then remove set_network_ignore_list. | |
216 network_ignore_mask_ = network_ignore_mask; | |
217 } | |
218 | |
219 int network_ignore_mask() const { return network_ignore_mask_; } | |
220 | |
221 #if defined(WEBRTC_LINUX) | 209 #if defined(WEBRTC_LINUX) |
222 // Sets the flag for ignoring non-default routes. | 210 // Sets the flag for ignoring non-default routes. |
223 void set_ignore_non_default_routes(bool value) { | 211 void set_ignore_non_default_routes(bool value) { |
224 ignore_non_default_routes_ = true; | 212 ignore_non_default_routes_ = true; |
225 } | 213 } |
226 #endif | 214 #endif |
227 | 215 |
228 protected: | 216 protected: |
229 #if defined(WEBRTC_POSIX) | 217 #if defined(WEBRTC_POSIX) |
230 // Separated from CreateNetworks for tests. | 218 // Separated from CreateNetworks for tests. |
(...skipping 26 matching lines...) Expand all Loading... |
257 | 245 |
258 // Updates the networks and reschedules the next update. | 246 // Updates the networks and reschedules the next update. |
259 void UpdateNetworksContinually(); | 247 void UpdateNetworksContinually(); |
260 // Only updates the networks; does not reschedule the next update. | 248 // Only updates the networks; does not reschedule the next update. |
261 void UpdateNetworksOnce(); | 249 void UpdateNetworksOnce(); |
262 | 250 |
263 Thread* thread_; | 251 Thread* thread_; |
264 bool sent_first_update_; | 252 bool sent_first_update_; |
265 int start_count_; | 253 int start_count_; |
266 std::vector<std::string> network_ignore_list_; | 254 std::vector<std::string> network_ignore_list_; |
267 int network_ignore_mask_; | |
268 bool ignore_non_default_routes_; | 255 bool ignore_non_default_routes_; |
269 scoped_ptr<NetworkMonitorInterface> network_monitor_; | 256 scoped_ptr<NetworkMonitorInterface> network_monitor_; |
270 }; | 257 }; |
271 | 258 |
272 // Represents a Unix-type network interface, with a name and single address. | 259 // Represents a Unix-type network interface, with a name and single address. |
273 class Network { | 260 class Network { |
274 public: | 261 public: |
275 Network(const std::string& name, | 262 Network(const std::string& name, |
276 const std::string& description, | 263 const std::string& description, |
277 const IPAddress& prefix, | 264 const IPAddress& prefix, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 AdapterType type_; | 366 AdapterType type_; |
380 int preference_; | 367 int preference_; |
381 bool active_ = true; | 368 bool active_ = true; |
382 | 369 |
383 friend class NetworkManager; | 370 friend class NetworkManager; |
384 }; | 371 }; |
385 | 372 |
386 } // namespace rtc | 373 } // namespace rtc |
387 | 374 |
388 #endif // WEBRTC_BASE_NETWORK_H_ | 375 #endif // WEBRTC_BASE_NETWORK_H_ |
OLD | NEW |