| 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 // A subset of IP address attributes which are actionable by the |
| 442 // application layer. Currently unimplemented for all hosts; |
| 443 // IP_ADDRESS_ATTRIBUTE_NONE is always returned. |
| 444 enum IPAddressAttributes { |
| 445 IP_ADDRESS_ATTRIBUTE_NONE = 0, |
| 446 |
| 447 // A temporary address is dynamic by nature and will not contain MAC |
| 448 // address. Presence of MAC address in IPv6 addresses can be used to |
| 449 // track an endpoint and cause privacy concern. Please refer to |
| 450 // RFC4941. |
| 451 IP_ADDRESS_ATTRIBUTE_TEMPORARY = 1 << 0, |
| 452 |
| 453 // A temporary address could become deprecated once the preferred |
| 454 // lifetime is reached. It is still valid but shouldn't be used to |
| 455 // create new connections. |
| 456 IP_ADDRESS_ATTRIBUTE_DEPRECATED = 1 << 1, |
| 457 }; |
| 458 |
| 441 // struct that is used by GetNetworkList() to represent a network | 459 // struct that is used by GetNetworkList() to represent a network |
| 442 // interface. | 460 // interface. |
| 443 struct NET_EXPORT NetworkInterface { | 461 struct NET_EXPORT NetworkInterface { |
| 444 NetworkInterface(); | 462 NetworkInterface(); |
| 445 NetworkInterface(const std::string& name, | 463 NetworkInterface(const std::string& name, |
| 446 const std::string& friendly_name, | 464 const std::string& friendly_name, |
| 447 uint32 interface_index, | 465 uint32 interface_index, |
| 448 NetworkChangeNotifier::ConnectionType type, | 466 NetworkChangeNotifier::ConnectionType type, |
| 449 const IPAddressNumber& address, | 467 const IPAddressNumber& address, |
| 450 uint32 network_prefix); | 468 uint32 network_prefix, |
| 469 int ip_address_attributes); |
| 451 ~NetworkInterface(); | 470 ~NetworkInterface(); |
| 452 | 471 |
| 453 std::string name; | 472 std::string name; |
| 454 std::string friendly_name; // Same as |name| on non-Windows. | 473 std::string friendly_name; // Same as |name| on non-Windows. |
| 455 uint32 interface_index; // Always 0 on Android. | 474 uint32 interface_index; // Always 0 on Android. |
| 456 NetworkChangeNotifier::ConnectionType type; | 475 NetworkChangeNotifier::ConnectionType type; |
| 457 IPAddressNumber address; | 476 IPAddressNumber address; |
| 458 uint32 network_prefix; | 477 uint32 network_prefix; |
| 478 int ip_address_attributes; // Combination of |IPAddressAttributes|. |
| 459 }; | 479 }; |
| 460 | 480 |
| 461 typedef std::vector<NetworkInterface> NetworkInterfaceList; | 481 typedef std::vector<NetworkInterface> NetworkInterfaceList; |
| 462 | 482 |
| 463 // Policy settings to include/exclude network interfaces. | 483 // Policy settings to include/exclude network interfaces. |
| 464 enum HostAddressSelectionPolicy { | 484 enum HostAddressSelectionPolicy { |
| 465 INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x0, | 485 INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x0, |
| 466 EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x1, | 486 EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x1, |
| 467 // Include temp address only when interface has both permanent and | 487 // Include temp address only when interface has both permanent and |
| 468 // temp addresses. | 488 // temp addresses. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 DSCP_CS5 = 40, // Video | 551 DSCP_CS5 = 40, // Video |
| 532 DSCP_EF = 46, // Voice | 552 DSCP_EF = 46, // Voice |
| 533 DSCP_CS6 = 48, // Voice | 553 DSCP_CS6 = 48, // Voice |
| 534 DSCP_CS7 = 56, // Control messages | 554 DSCP_CS7 = 56, // Control messages |
| 535 DSCP_LAST = DSCP_CS7 | 555 DSCP_LAST = DSCP_CS7 |
| 536 }; | 556 }; |
| 537 | 557 |
| 538 } // namespace net | 558 } // namespace net |
| 539 | 559 |
| 540 #endif // NET_BASE_NET_UTIL_H_ | 560 #endif // NET_BASE_NET_UTIL_H_ |
| OLD | NEW |