| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // MessageHandler interface. | 201 // MessageHandler interface. |
| 202 void OnMessage(Message* msg) override; | 202 void OnMessage(Message* msg) override; |
| 203 bool started() { return start_count_ > 0; } | 203 bool started() { return start_count_ > 0; } |
| 204 | 204 |
| 205 // Sets the network ignore list, which is empty by default. Any network on the | 205 // Sets the network ignore list, which is empty by default. Any network on the |
| 206 // ignore list will be filtered from network enumeration results. | 206 // ignore list will be filtered from network enumeration results. |
| 207 void set_network_ignore_list(const std::vector<std::string>& list) { | 207 void set_network_ignore_list(const std::vector<std::string>& list) { |
| 208 network_ignore_list_ = list; | 208 network_ignore_list_ = list; |
| 209 } | 209 } |
| 210 | 210 |
| 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_; } | |
| 222 | |
| 223 #if defined(WEBRTC_LINUX) | 211 #if defined(WEBRTC_LINUX) |
| 224 // Sets the flag for ignoring non-default routes. | 212 // Sets the flag for ignoring non-default routes. |
| 225 void set_ignore_non_default_routes(bool value) { | 213 void set_ignore_non_default_routes(bool value) { |
| 226 ignore_non_default_routes_ = true; | 214 ignore_non_default_routes_ = true; |
| 227 } | 215 } |
| 228 #endif | 216 #endif |
| 229 | 217 |
| 230 protected: | 218 protected: |
| 231 #if defined(WEBRTC_POSIX) | 219 #if defined(WEBRTC_POSIX) |
| 232 // Separated from CreateNetworks for tests. | 220 // Separated from CreateNetworks for tests. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 259 | 247 |
| 260 // Updates the networks and reschedules the next update. | 248 // Updates the networks and reschedules the next update. |
| 261 void UpdateNetworksContinually(); | 249 void UpdateNetworksContinually(); |
| 262 // Only updates the networks; does not reschedule the next update. | 250 // Only updates the networks; does not reschedule the next update. |
| 263 void UpdateNetworksOnce(); | 251 void UpdateNetworksOnce(); |
| 264 | 252 |
| 265 Thread* thread_; | 253 Thread* thread_; |
| 266 bool sent_first_update_; | 254 bool sent_first_update_; |
| 267 int start_count_; | 255 int start_count_; |
| 268 std::vector<std::string> network_ignore_list_; | 256 std::vector<std::string> network_ignore_list_; |
| 269 int network_ignore_mask_; | |
| 270 bool ignore_non_default_routes_; | 257 bool ignore_non_default_routes_; |
| 271 scoped_ptr<NetworkMonitorInterface> network_monitor_; | 258 scoped_ptr<NetworkMonitorInterface> network_monitor_; |
| 272 }; | 259 }; |
| 273 | 260 |
| 274 // Represents a Unix-type network interface, with a name and single address. | 261 // Represents a Unix-type network interface, with a name and single address. |
| 275 class Network { | 262 class Network { |
| 276 public: | 263 public: |
| 277 Network(const std::string& name, | 264 Network(const std::string& name, |
| 278 const std::string& description, | 265 const std::string& description, |
| 279 const IPAddress& prefix, | 266 const IPAddress& prefix, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 bool ignored_; | 361 bool ignored_; |
| 375 AdapterType type_; | 362 AdapterType type_; |
| 376 int preference_; | 363 int preference_; |
| 377 | 364 |
| 378 friend class NetworkManager; | 365 friend class NetworkManager; |
| 379 }; | 366 }; |
| 380 | 367 |
| 381 } // namespace rtc | 368 } // namespace rtc |
| 382 | 369 |
| 383 #endif // WEBRTC_BASE_NETWORK_H_ | 370 #endif // WEBRTC_BASE_NETWORK_H_ |
| OLD | NEW |