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 is actionable to | |
pauljensen
2014/09/18 14:29:54
is->are
to->by the?
Also add "Currently unimplemen
| |
442 // application layer. | |
443 enum IPAddressAttributes { | |
444 IP_ADDRESS_ATTRIBUTE_NONE = 0, | |
445 | |
446 // Temporary address is dynamic by nature and will not carry MAC | |
447 // address. | |
448 IP_ADDRESS_ATTRIBUTE_TEMPORARY = 1 << 0, | |
449 | |
450 // Temporary address could become deprecated once the preferred | |
451 // lifetime is reached. It is still valid but shouldn't be used to | |
452 // create new connection. | |
453 IP_ADDRESS_ATTRIBUTE_DEPRECATED = 1 << 1, | |
454 }; | |
455 | |
441 // struct that is used by GetNetworkList() to represent a network | 456 // struct that is used by GetNetworkList() to represent a network |
442 // interface. | 457 // interface. |
443 struct NET_EXPORT NetworkInterface { | 458 struct NET_EXPORT NetworkInterface { |
444 NetworkInterface(); | 459 NetworkInterface(); |
460 | |
445 NetworkInterface(const std::string& name, | 461 NetworkInterface(const std::string& name, |
pauljensen
2014/09/18 14:29:54
Dead?
| |
446 const std::string& friendly_name, | 462 const std::string& friendly_name, |
447 uint32 interface_index, | 463 uint32 interface_index, |
448 NetworkChangeNotifier::ConnectionType type, | 464 NetworkChangeNotifier::ConnectionType type, |
449 const IPAddressNumber& address, | 465 const IPAddressNumber& address, |
450 size_t network_prefix); | 466 size_t network_prefix); |
467 | |
468 NetworkInterface(const std::string& name, | |
469 const std::string& friendly_name, | |
470 uint32 interface_index, | |
471 NetworkChangeNotifier::ConnectionType type, | |
472 const IPAddressNumber& address, | |
473 size_t network_prefix, | |
474 int ip_address_attributes); | |
475 | |
451 ~NetworkInterface(); | 476 ~NetworkInterface(); |
452 | 477 |
453 std::string name; | 478 std::string name; |
454 std::string friendly_name; // Same as |name| on non-Windows. | 479 std::string friendly_name; // Same as |name| on non-Windows. |
455 uint32 interface_index; // Always 0 on Android. | 480 uint32 interface_index; // Always 0 on Android. |
456 NetworkChangeNotifier::ConnectionType type; | 481 NetworkChangeNotifier::ConnectionType type; |
457 IPAddressNumber address; | 482 IPAddressNumber address; |
458 size_t network_prefix; | 483 size_t network_prefix; |
484 int ip_address_attributes; // Combination of |IPAddressAttributes|. | |
459 }; | 485 }; |
460 | 486 |
461 typedef std::vector<NetworkInterface> NetworkInterfaceList; | 487 typedef std::vector<NetworkInterface> NetworkInterfaceList; |
462 | 488 |
463 // Policy settings to include/exclude network interfaces. | 489 // Policy settings to include/exclude network interfaces. |
464 enum HostAddressSelectionPolicy { | 490 enum HostAddressSelectionPolicy { |
465 INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x0, | 491 INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x0, |
466 EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x1, | 492 EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x1, |
467 // Include temp address only when interface has both permanent and | 493 // Include temp address only when interface has both permanent and |
468 // temp addresses. | 494 // temp addresses. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
531 DSCP_CS5 = 40, // Video | 557 DSCP_CS5 = 40, // Video |
532 DSCP_EF = 46, // Voice | 558 DSCP_EF = 46, // Voice |
533 DSCP_CS6 = 48, // Voice | 559 DSCP_CS6 = 48, // Voice |
534 DSCP_CS7 = 56, // Control messages | 560 DSCP_CS7 = 56, // Control messages |
535 DSCP_LAST = DSCP_CS7 | 561 DSCP_LAST = DSCP_CS7 |
536 }; | 562 }; |
537 | 563 |
538 } // namespace net | 564 } // namespace net |
539 | 565 |
540 #endif // NET_BASE_NET_UTIL_H_ | 566 #endif // NET_BASE_NET_UTIL_H_ |
OLD | NEW |