Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(730)

Side by Side Diff: webrtc/base/network.cc

Issue 1594673002: Get the adapter type information from Android OS. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/network.h ('k') | webrtc/base/network_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 434
435 int prefix_length = CountIPMaskBits(mask); 435 int prefix_length = CountIPMaskBits(mask);
436 prefix = TruncateIP(ip, prefix_length); 436 prefix = TruncateIP(ip, prefix_length);
437 std::string key = MakeNetworkKey(std::string(cursor->ifa_name), 437 std::string key = MakeNetworkKey(std::string(cursor->ifa_name),
438 prefix, prefix_length); 438 prefix, prefix_length);
439 auto existing_network = current_networks.find(key); 439 auto existing_network = current_networks.find(key);
440 if (existing_network == current_networks.end()) { 440 if (existing_network == current_networks.end()) {
441 AdapterType adapter_type = ADAPTER_TYPE_UNKNOWN; 441 AdapterType adapter_type = ADAPTER_TYPE_UNKNOWN;
442 if (cursor->ifa_flags & IFF_LOOPBACK) { 442 if (cursor->ifa_flags & IFF_LOOPBACK) {
443 adapter_type = ADAPTER_TYPE_LOOPBACK; 443 adapter_type = ADAPTER_TYPE_LOOPBACK;
444 } else if (network_monitor_) {
445 adapter_type = network_monitor_->GetAdapterType(cursor->ifa_name);
444 } 446 }
445 #if defined(WEBRTC_IOS) 447 #if defined(WEBRTC_IOS)
446 // Cell networks are pdp_ipN on iOS. 448 // Cell networks are pdp_ipN on iOS.
447 if (strncmp(cursor->ifa_name, "pdp_ip", 6) == 0) { 449 if (strncmp(cursor->ifa_name, "pdp_ip", 6) == 0) {
448 adapter_type = ADAPTER_TYPE_CELLULAR; 450 adapter_type = ADAPTER_TYPE_CELLULAR;
449 } 451 }
450 #endif 452 #endif
451 // TODO(phoglund): Need to recognize other types as well. 453 // TODO(phoglund): Need to recognize other types as well.
452 scoped_ptr<Network> network(new Network(cursor->ifa_name, 454 scoped_ptr<Network> network(new Network(cursor->ifa_name,
453 cursor->ifa_name, prefix, 455 cursor->ifa_name, prefix,
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 std::stringstream ss; 918 std::stringstream ss;
917 // Print out the first space-terminated token of the network desc, plus 919 // Print out the first space-terminated token of the network desc, plus
918 // the IP address. 920 // the IP address.
919 ss << "Net[" << description_.substr(0, description_.find(' ')) 921 ss << "Net[" << description_.substr(0, description_.find(' '))
920 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ 922 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_
921 << ":" << AdapterTypeToString(type_) << "]"; 923 << ":" << AdapterTypeToString(type_) << "]";
922 return ss.str(); 924 return ss.str();
923 } 925 }
924 926
925 } // namespace rtc 927 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/network.h ('k') | webrtc/base/network_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698