| 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 <memory> |
| 16 #include <string> | 17 #include <string> |
| 17 #include <vector> | 18 #include <vector> |
| 18 | 19 |
| 19 #include "webrtc/base/basictypes.h" | 20 #include "webrtc/base/basictypes.h" |
| 20 #include "webrtc/base/ipaddress.h" | 21 #include "webrtc/base/ipaddress.h" |
| 21 #include "webrtc/base/networkmonitor.h" | 22 #include "webrtc/base/networkmonitor.h" |
| 22 #include "webrtc/base/messagehandler.h" | 23 #include "webrtc/base/messagehandler.h" |
| 23 #include "webrtc/base/scoped_ptr.h" | |
| 24 #include "webrtc/base/sigslot.h" | 24 #include "webrtc/base/sigslot.h" |
| 25 | 25 |
| 26 #if defined(WEBRTC_POSIX) | 26 #if defined(WEBRTC_POSIX) |
| 27 struct ifaddrs; | 27 struct ifaddrs; |
| 28 #endif // defined(WEBRTC_POSIX) | 28 #endif // defined(WEBRTC_POSIX) |
| 29 | 29 |
| 30 namespace rtc { | 30 namespace rtc { |
| 31 | 31 |
| 32 extern const char kPublicIPv4Host[]; | 32 extern const char kPublicIPv4Host[]; |
| 33 extern const char kPublicIPv6Host[]; | 33 extern const char kPublicIPv6Host[]; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 Network* GetNetworkFromAddress(const rtc::IPAddress& ip) const; | 163 Network* GetNetworkFromAddress(const rtc::IPAddress& ip) const; |
| 164 | 164 |
| 165 EnumerationPermission enumeration_permission_; | 165 EnumerationPermission enumeration_permission_; |
| 166 | 166 |
| 167 NetworkList networks_; | 167 NetworkList networks_; |
| 168 int max_ipv6_networks_; | 168 int max_ipv6_networks_; |
| 169 | 169 |
| 170 NetworkMap networks_map_; | 170 NetworkMap networks_map_; |
| 171 bool ipv6_enabled_; | 171 bool ipv6_enabled_; |
| 172 | 172 |
| 173 rtc::scoped_ptr<rtc::Network> ipv4_any_address_network_; | 173 std::unique_ptr<rtc::Network> ipv4_any_address_network_; |
| 174 rtc::scoped_ptr<rtc::Network> ipv6_any_address_network_; | 174 std::unique_ptr<rtc::Network> ipv6_any_address_network_; |
| 175 | 175 |
| 176 IPAddress default_local_ipv4_address_; | 176 IPAddress default_local_ipv4_address_; |
| 177 IPAddress default_local_ipv6_address_; | 177 IPAddress default_local_ipv6_address_; |
| 178 // We use 16 bits to save the bandwidth consumption when sending the network | 178 // We use 16 bits to save the bandwidth consumption when sending the network |
| 179 // id over the Internet. It is OK that the 16-bit integer overflows to get a | 179 // id over the Internet. It is OK that the 16-bit integer overflows to get a |
| 180 // network id 0 because we only compare the network ids in the old and the new | 180 // network id 0 because we only compare the network ids in the old and the new |
| 181 // best connections in the transport channel. | 181 // best connections in the transport channel. |
| 182 uint16_t next_available_network_id_ = 1; | 182 uint16_t next_available_network_id_ = 1; |
| 183 }; | 183 }; |
| 184 | 184 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // Updates the networks and reschedules the next update. | 247 // Updates the networks and reschedules the next update. |
| 248 void UpdateNetworksContinually(); | 248 void UpdateNetworksContinually(); |
| 249 // Only updates the networks; does not reschedule the next update. | 249 // Only updates the networks; does not reschedule the next update. |
| 250 void UpdateNetworksOnce(); | 250 void UpdateNetworksOnce(); |
| 251 | 251 |
| 252 Thread* thread_; | 252 Thread* thread_; |
| 253 bool sent_first_update_; | 253 bool sent_first_update_; |
| 254 int start_count_; | 254 int start_count_; |
| 255 std::vector<std::string> network_ignore_list_; | 255 std::vector<std::string> network_ignore_list_; |
| 256 bool ignore_non_default_routes_; | 256 bool ignore_non_default_routes_; |
| 257 scoped_ptr<NetworkMonitorInterface> network_monitor_; | 257 std::unique_ptr<NetworkMonitorInterface> network_monitor_; |
| 258 }; | 258 }; |
| 259 | 259 |
| 260 // Represents a Unix-type network interface, with a name and single address. | 260 // Represents a Unix-type network interface, with a name and single address. |
| 261 class Network { | 261 class Network { |
| 262 public: | 262 public: |
| 263 Network(const std::string& name, | 263 Network(const std::string& name, |
| 264 const std::string& description, | 264 const std::string& description, |
| 265 const IPAddress& prefix, | 265 const IPAddress& prefix, |
| 266 int prefix_length); | 266 int prefix_length); |
| 267 | 267 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 int preference_; | 385 int preference_; |
| 386 bool active_ = true; | 386 bool active_ = true; |
| 387 uint16_t id_ = 0; | 387 uint16_t id_ = 0; |
| 388 | 388 |
| 389 friend class NetworkManager; | 389 friend class NetworkManager; |
| 390 }; | 390 }; |
| 391 | 391 |
| 392 } // namespace rtc | 392 } // namespace rtc |
| 393 | 393 |
| 394 #endif // WEBRTC_BASE_NETWORK_H_ | 394 #endif // WEBRTC_BASE_NETWORK_H_ |
| OLD | NEW |