Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_BASE_NET_UTIL_H_ | 5 #ifndef NET_BASE_NET_UTIL_H_ |
| 6 #define NET_BASE_NET_UTIL_H_ | 6 #define NET_BASE_NET_UTIL_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 socklen_t address_len); | 431 socklen_t address_len); |
| 432 | 432 |
| 433 // Returns true if |host| is one of the names (e.g. "localhost") or IP | 433 // Returns true if |host| is one of the names (e.g. "localhost") or IP |
| 434 // addresses (IPv4 127.0.0.0/8 or IPv6 ::1) that indicate a loopback. | 434 // addresses (IPv4 127.0.0.0/8 or IPv6 ::1) that indicate a loopback. |
| 435 // | 435 // |
| 436 // Note that this function does not check for IP addresses other than | 436 // Note that this function does not check for IP addresses other than |
| 437 // the above, although other IP addresses may point to the local | 437 // the above, although other IP addresses may point to the local |
| 438 // machine. | 438 // machine. |
| 439 NET_EXPORT_PRIVATE bool IsLocalhost(const std::string& host); | 439 NET_EXPORT_PRIVATE bool IsLocalhost(const std::string& host); |
| 440 | 440 |
| 441 // Only expose a subset of actionable IPv6 address flags to | |
| 442 // application layer. Addresses with flags which are not combination | |
| 443 // of listed below will be filtered out from GetNetworkList. | |
| 444 enum IPv6AddressFlag { | |
| 445 IPV6_ADDRESS_FLAG_NONE = 0x00, | |
| 446 // This enum follows the IFA definition in if_addr.h | |
|
Ryan Sleevi
2014/09/08 18:15:44
This doesn't really add value for non-Linux Users.
guoweis_webrtc
2014/09/12 23:55:21
Removed that line.
| |
| 447 IPV6_ADDRESS_FLAG_TEMPORARY = 0x01, | |
| 448 IPV6_ADDRESS_FLAG_DEPRECATED = 0x20, | |
| 449 IPV6_ADDRESS_FLAG_PERMANENT = 0x80, | |
|
Ryan Sleevi
2014/09/08 18:15:44
Why did you skip a bunch of flag values? Are you t
guoweis_webrtc
2014/09/12 23:55:21
Done.
| |
| 450 }; | |
| 451 | |
| 441 // struct that is used by GetNetworkList() to represent a network | 452 // struct that is used by GetNetworkList() to represent a network |
| 442 // interface. | 453 // interface. |
| 443 struct NET_EXPORT NetworkInterface { | 454 struct NET_EXPORT NetworkInterface { |
| 444 NetworkInterface(); | 455 NetworkInterface(); |
| 445 NetworkInterface(const std::string& name, | 456 NetworkInterface(const std::string& name, |
| 446 const std::string& friendly_name, | 457 const std::string& friendly_name, |
| 447 uint32 interface_index, | 458 uint32 interface_index, |
| 448 NetworkChangeNotifier::ConnectionType type, | 459 NetworkChangeNotifier::ConnectionType type, |
| 449 const IPAddressNumber& address, | 460 const IPAddressNumber& address, |
| 450 size_t network_prefix); | 461 size_t network_prefix); |
| 451 ~NetworkInterface(); | 462 ~NetworkInterface(); |
| 452 | 463 |
| 453 std::string name; | 464 std::string name; |
| 454 std::string friendly_name; // Same as |name| on non-Windows. | 465 std::string friendly_name; // Same as |name| on non-Windows. |
| 455 uint32 interface_index; // Always 0 on Android. | 466 uint32 interface_index; // Always 0 on Android. |
| 456 NetworkChangeNotifier::ConnectionType type; | 467 NetworkChangeNotifier::ConnectionType type; |
| 457 IPAddressNumber address; | 468 IPAddressNumber address; |
| 458 size_t network_prefix; | 469 size_t network_prefix; |
| 470 int ipv6_flags; | |
|
Ryan Sleevi
2014/09/08 18:15:44
Document
guoweis_webrtc
2014/09/12 23:55:21
I put a comment after the variable
// Combination
| |
| 459 }; | 471 }; |
| 460 | 472 |
| 461 typedef std::vector<NetworkInterface> NetworkInterfaceList; | 473 typedef std::vector<NetworkInterface> NetworkInterfaceList; |
| 462 | 474 |
| 463 // Policy settings to include/exclude network interfaces. | 475 // Policy settings to include/exclude network interfaces. |
| 464 enum HostAddressSelectionPolicy { | 476 enum HostAddressSelectionPolicy { |
| 465 INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x0, | 477 INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x0, |
| 466 EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x1, | 478 EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x1, |
| 467 // Include temp address only when interface has both permanent and | |
| 468 // temp addresses. | |
| 469 INCLUDE_ONLY_TEMP_IPV6_ADDRESS_IF_POSSIBLE = 0x2, | |
| 470 }; | 479 }; |
| 471 | 480 |
| 472 // Returns list of network interfaces except loopback interface. If an | 481 // Returns list of network interfaces except loopback interface. If an |
| 473 // interface has more than one address, a separate entry is added to | 482 // interface has more than one address, a separate entry is added to |
| 474 // the list for each address. | 483 // the list for each address. |
| 475 // Can be called only on a thread that allows IO. | 484 // Can be called only on a thread that allows IO. |
| 476 NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks, | 485 NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks, |
| 477 int policy); | 486 int policy); |
| 478 | 487 |
| 479 // General category of the IEEE 802.11 (wifi) physical layer operating mode. | 488 // General category of the IEEE 802.11 (wifi) physical layer operating mode. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 DSCP_CS5 = 40, // Video | 540 DSCP_CS5 = 40, // Video |
| 532 DSCP_EF = 46, // Voice | 541 DSCP_EF = 46, // Voice |
| 533 DSCP_CS6 = 48, // Voice | 542 DSCP_CS6 = 48, // Voice |
| 534 DSCP_CS7 = 56, // Control messages | 543 DSCP_CS7 = 56, // Control messages |
| 535 DSCP_LAST = DSCP_CS7 | 544 DSCP_LAST = DSCP_CS7 |
| 536 }; | 545 }; |
| 537 | 546 |
| 538 } // namespace net | 547 } // namespace net |
| 539 | 548 |
| 540 #endif // NET_BASE_NET_UTIL_H_ | 549 #endif // NET_BASE_NET_UTIL_H_ |
| OLD | NEW |