| 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 16 matching lines...) Expand all Loading... |
| 27 #include <Iphlpapi.h> | 27 #include <Iphlpapi.h> |
| 28 #elif !defined(__native_client__) | 28 #elif !defined(__native_client__) |
| 29 #include "webrtc/base/ifaddrs_converter.h" | 29 #include "webrtc/base/ifaddrs_converter.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 #include <stdio.h> | 32 #include <stdio.h> |
| 33 | 33 |
| 34 #include <algorithm> | 34 #include <algorithm> |
| 35 #include <memory> | 35 #include <memory> |
| 36 | 36 |
| 37 #include "webrtc/base/checks.h" |
| 37 #include "webrtc/base/logging.h" | 38 #include "webrtc/base/logging.h" |
| 38 #include "webrtc/base/networkmonitor.h" | 39 #include "webrtc/base/networkmonitor.h" |
| 39 #include "webrtc/base/socket.h" // includes something that makes windows happy | 40 #include "webrtc/base/socket.h" // includes something that makes windows happy |
| 40 #include "webrtc/base/stream.h" | 41 #include "webrtc/base/stream.h" |
| 41 #include "webrtc/base/stringencode.h" | 42 #include "webrtc/base/stringencode.h" |
| 42 #include "webrtc/base/thread.h" | 43 #include "webrtc/base/thread.h" |
| 43 | 44 |
| 44 namespace rtc { | 45 namespace rtc { |
| 45 namespace { | 46 namespace { |
| 46 | 47 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 401 |
| 401 void BasicNetworkManager::OnNetworksChanged() { | 402 void BasicNetworkManager::OnNetworksChanged() { |
| 402 LOG(LS_INFO) << "Network change was observed"; | 403 LOG(LS_INFO) << "Network change was observed"; |
| 403 UpdateNetworksOnce(); | 404 UpdateNetworksOnce(); |
| 404 } | 405 } |
| 405 | 406 |
| 406 #if defined(__native_client__) | 407 #if defined(__native_client__) |
| 407 | 408 |
| 408 bool BasicNetworkManager::CreateNetworks(bool include_ignored, | 409 bool BasicNetworkManager::CreateNetworks(bool include_ignored, |
| 409 NetworkList* networks) const { | 410 NetworkList* networks) const { |
| 410 ASSERT(false); | 411 RTC_NOTREACHED(); |
| 411 LOG(LS_WARNING) << "BasicNetworkManager doesn't work on NaCl yet"; | 412 LOG(LS_WARNING) << "BasicNetworkManager doesn't work on NaCl yet"; |
| 412 return false; | 413 return false; |
| 413 } | 414 } |
| 414 | 415 |
| 415 #elif defined(WEBRTC_POSIX) | 416 #elif defined(WEBRTC_POSIX) |
| 416 void BasicNetworkManager::ConvertIfAddrs(struct ifaddrs* interfaces, | 417 void BasicNetworkManager::ConvertIfAddrs(struct ifaddrs* interfaces, |
| 417 IfAddrsConverter* ifaddrs_converter, | 418 IfAddrsConverter* ifaddrs_converter, |
| 418 bool include_ignored, | 419 bool include_ignored, |
| 419 NetworkList* networks) const { | 420 NetworkList* networks) const { |
| 420 NetworkMap current_networks; | 421 NetworkMap current_networks; |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 switch (msg->message_id) { | 779 switch (msg->message_id) { |
| 779 case kUpdateNetworksMessage: { | 780 case kUpdateNetworksMessage: { |
| 780 UpdateNetworksContinually(); | 781 UpdateNetworksContinually(); |
| 781 break; | 782 break; |
| 782 } | 783 } |
| 783 case kSignalNetworksMessage: { | 784 case kSignalNetworksMessage: { |
| 784 SignalNetworksChanged(); | 785 SignalNetworksChanged(); |
| 785 break; | 786 break; |
| 786 } | 787 } |
| 787 default: | 788 default: |
| 788 ASSERT(false); | 789 RTC_NOTREACHED(); |
| 789 } | 790 } |
| 790 } | 791 } |
| 791 | 792 |
| 792 AdapterType BasicNetworkManager::GetAdapterTypeFromName( | 793 AdapterType BasicNetworkManager::GetAdapterTypeFromName( |
| 793 const char* network_name) const { | 794 const char* network_name) const { |
| 794 // If there is a network_monitor, use it to get the adapter type. | 795 // If there is a network_monitor, use it to get the adapter type. |
| 795 // Otherwise, get the adapter type based on a few name matching rules. | 796 // Otherwise, get the adapter type based on a few name matching rules. |
| 796 if (network_monitor_) { | 797 if (network_monitor_) { |
| 797 AdapterType type = network_monitor_->GetAdapterType(network_name); | 798 AdapterType type = network_monitor_->GetAdapterType(network_name); |
| 798 if (type != ADAPTER_TYPE_UNKNOWN) { | 799 if (type != ADAPTER_TYPE_UNKNOWN) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 std::stringstream ss; | 982 std::stringstream ss; |
| 982 // Print out the first space-terminated token of the network desc, plus | 983 // Print out the first space-terminated token of the network desc, plus |
| 983 // the IP address. | 984 // the IP address. |
| 984 ss << "Net[" << description_.substr(0, description_.find(' ')) | 985 ss << "Net[" << description_.substr(0, description_.find(' ')) |
| 985 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ | 986 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ |
| 986 << ":" << AdapterTypeToString(type_) << "]"; | 987 << ":" << AdapterTypeToString(type_) << "]"; |
| 987 return ss.str(); | 988 return ss.str(); |
| 988 } | 989 } |
| 989 | 990 |
| 990 } // namespace rtc | 991 } // namespace rtc |
| OLD | NEW |