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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 AdapterType type = network_monitor_->GetAdapterType(network_name); | 798 AdapterType type = network_monitor_->GetAdapterType(network_name); |
799 if (type != ADAPTER_TYPE_UNKNOWN) { | 799 if (type != ADAPTER_TYPE_UNKNOWN) { |
800 return type; | 800 return type; |
801 } | 801 } |
802 } | 802 } |
803 #if defined(WEBRTC_IOS) | 803 #if defined(WEBRTC_IOS) |
804 // Cell networks are pdp_ipN on iOS. | 804 // Cell networks are pdp_ipN on iOS. |
805 if (strncmp(network_name, "pdp_ip", 6) == 0) { | 805 if (strncmp(network_name, "pdp_ip", 6) == 0) { |
806 return ADAPTER_TYPE_CELLULAR; | 806 return ADAPTER_TYPE_CELLULAR; |
807 } | 807 } |
| 808 if (strncmp(network_name, "en", 2) == 0) { |
| 809 // This may not be most accurate because sometimes Ethernet interface |
| 810 // name also starts with "en" but it is better than showing it as |
| 811 // "unknown" type. |
| 812 // TODO(honghaiz): Write a proper IOS network manager. |
| 813 return ADAPTER_TYPE_WIFI; |
| 814 } |
808 #elif defined(WEBRTC_ANDROID) | 815 #elif defined(WEBRTC_ANDROID) |
809 if (strncmp(network_name, "rmnet", 5) == 0 || | 816 if (strncmp(network_name, "rmnet", 5) == 0 || |
810 strncmp(network_name, "v4-rmnet", 8) == 0) { | 817 strncmp(network_name, "v4-rmnet", 8) == 0) { |
811 return ADAPTER_TYPE_CELLULAR; | 818 return ADAPTER_TYPE_CELLULAR; |
812 } | 819 } |
813 if (strncmp(network_name, "wlan", 4) == 0) { | 820 if (strncmp(network_name, "wlan", 4) == 0) { |
814 return ADAPTER_TYPE_WIFI; | 821 return ADAPTER_TYPE_WIFI; |
815 } | 822 } |
816 #endif | 823 #endif |
817 | 824 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 std::stringstream ss; | 976 std::stringstream ss; |
970 // Print out the first space-terminated token of the network desc, plus | 977 // Print out the first space-terminated token of the network desc, plus |
971 // the IP address. | 978 // the IP address. |
972 ss << "Net[" << description_.substr(0, description_.find(' ')) | 979 ss << "Net[" << description_.substr(0, description_.find(' ')) |
973 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ | 980 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ |
974 << ":" << AdapterTypeToString(type_) << "]"; | 981 << ":" << AdapterTypeToString(type_) << "]"; |
975 return ss.str(); | 982 return ss.str(); |
976 } | 983 } |
977 | 984 |
978 } // namespace rtc | 985 } // namespace rtc |
OLD | NEW |