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 // A subset of IP address attributes which are actionable by | |
|
pauljensen
2014/09/19 14:56:53
by->by the
(I recommended this in my last review)
guoweis2
2014/09/19 16:55:30
Sorry, missed the. Done.
| |
| 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 // Temporary address is dynamic by nature and will not carry MAC | |
|
pauljensen
2014/09/19 14:56:53
carry -> contain
Could we mention this is for IPv6
guoweis2
2014/09/19 16:55:30
Done.
| |
| 448 // address. | |
| 449 IP_ADDRESS_ATTRIBUTE_TEMPORARY = 1 << 0, | |
| 450 | |
| 451 // Temporary address could become deprecated once the preferred | |
|
pauljensen
2014/09/19 14:56:53
Either "Temporary" -> "A temporary"
or "address co
guoweis2
2014/09/19 16:55:30
Done.
| |
| 452 // lifetime is reached. It is still valid but shouldn't be used to | |
| 453 // create new connection. | |
|
pauljensen
2014/09/19 14:56:53
connection -> connections
guoweis2
2014/09/19 16:55:30
Done.
| |
| 454 IP_ADDRESS_ATTRIBUTE_DEPRECATED = 1 << 1, | |
| 455 }; | |
| 456 | |
| 441 // struct that is used by GetNetworkList() to represent a network | 457 // struct that is used by GetNetworkList() to represent a network |
| 442 // interface. | 458 // interface. |
| 443 struct NET_EXPORT NetworkInterface { | 459 struct NET_EXPORT NetworkInterface { |
| 444 NetworkInterface(); | 460 NetworkInterface(); |
| 461 | |
|
pauljensen
2014/09/19 14:56:53
needless whitespace change
guoweis2
2014/09/19 16:55:30
Done. Also removed one before ~NetworkInterface()
| |
| 445 NetworkInterface(const std::string& name, | 462 NetworkInterface(const std::string& name, |
| 446 const std::string& friendly_name, | 463 const std::string& friendly_name, |
| 447 uint32 interface_index, | 464 uint32 interface_index, |
| 448 NetworkChangeNotifier::ConnectionType type, | 465 NetworkChangeNotifier::ConnectionType type, |
| 449 const IPAddressNumber& address, | 466 const IPAddressNumber& address, |
| 450 uint32 network_prefix); | 467 uint32 network_prefix, |
| 468 int ip_address_attributes); | |
| 469 | |
| 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 |