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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 ScopedPortException(int port); | 413 ScopedPortException(int port); |
| 414 ~ScopedPortException(); | 414 ~ScopedPortException(); |
| 415 | 415 |
| 416 private: | 416 private: |
| 417 int port_; | 417 int port_; |
| 418 | 418 |
| 419 DISALLOW_COPY_AND_ASSIGN(ScopedPortException); | 419 DISALLOW_COPY_AND_ASSIGN(ScopedPortException); |
| 420 }; | 420 }; |
| 421 | 421 |
| 422 // These are used for UMA histograms. Any new values must be added to the end. | 422 // These are used for UMA histograms. Any new values must be added to the end. |
| 423 enum IPv6SupportStatus { | 423 enum IPv6SupportStatus { |
|
mmenke
2013/07/17 14:25:09
This isn't needed.
szym
2013/07/17 16:32:27
Done.
| |
| 424 IPV6_CANNOT_CREATE_SOCKETS, | 424 IPV6_CANNOT_CREATE_SOCKETS, |
| 425 IPV6_CAN_CREATE_SOCKETS, // Obsolete | 425 IPV6_CAN_CREATE_SOCKETS, // Obsolete |
| 426 IPV6_GETIFADDRS_FAILED, | 426 IPV6_GETIFADDRS_FAILED, |
| 427 IPV6_GLOBAL_ADDRESS_MISSING, | 427 IPV6_GLOBAL_ADDRESS_MISSING, |
| 428 IPV6_GLOBAL_ADDRESS_PRESENT, | 428 IPV6_GLOBAL_ADDRESS_PRESENT, |
| 429 IPV6_INTERFACE_ARRAY_TOO_SHORT, | 429 IPV6_INTERFACE_ARRAY_TOO_SHORT, |
| 430 IPV6_SUPPORT_MAX // Bounding value for enumeration. Also used for case | 430 IPV6_SUPPORT_MAX // Bounding value for enumeration. Also used for case |
| 431 // where detection is not supported. | 431 // where detection is not supported. |
| 432 }; | 432 }; |
| 433 | 433 |
| 434 // Encapsulates the results of an IPv6 probe. | 434 // Encapsulates the results of an IPv6 probe. |
| 435 struct NET_EXPORT IPv6SupportResult { | 435 struct NET_EXPORT IPv6SupportResult { |
|
mmenke
2013/07/17 14:25:09
Nor is this.
szym
2013/07/17 16:32:27
Done.
| |
| 436 IPv6SupportResult(bool ipv6_supported, | 436 IPv6SupportResult(bool ipv6_supported, |
| 437 IPv6SupportStatus ipv6_support_status, | 437 IPv6SupportStatus ipv6_support_status, |
| 438 int os_error); | 438 int os_error); |
| 439 | 439 |
| 440 // Serializes the results to a Value. Caller takes ownership of the returned | 440 // Serializes the results to a Value. Caller takes ownership of the returned |
| 441 // Value. | 441 // Value. |
| 442 base::Value* ToNetLogValue(NetLog::LogLevel log_level) const; | 442 base::Value* ToNetLogValue(NetLog::LogLevel log_level) const; |
| 443 | 443 |
| 444 bool ipv6_supported; | 444 bool ipv6_supported; |
| 445 // Set to IPV6_SUPPORT_MAX if detection isn't supported. | 445 // Set to IPV6_SUPPORT_MAX if detection isn't supported. |
| 446 IPv6SupportStatus ipv6_support_status; | 446 IPv6SupportStatus ipv6_support_status; |
| 447 | 447 |
| 448 // Error code from the OS, or zero if there was no error. | 448 // Error code from the OS, or zero if there was no error. |
| 449 int os_error; | 449 int os_error; |
| 450 }; | 450 }; |
| 451 | 451 |
| 452 // Perform a simplistic test to see if IPv6 is supported by trying to create an | |
| 453 // IPv6 socket. | |
| 454 // TODO(jar): Make test more in-depth as needed. | |
| 455 NET_EXPORT IPv6SupportResult TestIPv6Support(); | |
| 456 | |
| 457 // Returns true if it can determine that only loopback addresses are configured. | 452 // Returns true if it can determine that only loopback addresses are configured. |
| 458 // i.e. if only 127.0.0.1 and ::1 are routable. | 453 // i.e. if only 127.0.0.1 and ::1 are routable. |
| 459 // Also returns false if it cannot determine this. | 454 // Also returns false if it cannot determine this. |
| 460 bool HaveOnlyLoopbackAddresses(); | 455 bool HaveOnlyLoopbackAddresses(); |
| 461 | 456 |
| 462 // Returns AddressFamily of the address. | 457 // Returns AddressFamily of the address. |
| 463 NET_EXPORT_PRIVATE AddressFamily GetAddressFamily( | 458 NET_EXPORT_PRIVATE AddressFamily GetAddressFamily( |
| 464 const IPAddressNumber& address); | 459 const IPAddressNumber& address); |
| 465 | 460 |
| 466 // Parses an IP address literal (either IPv4 or IPv6) to its numeric value. | 461 // Parses an IP address literal (either IPv4 or IPv6) to its numeric value. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 WIFI_PHY_LAYER_PROTOCOL_UNKNOWN | 556 WIFI_PHY_LAYER_PROTOCOL_UNKNOWN |
| 562 }; | 557 }; |
| 563 | 558 |
| 564 // Characterize the PHY mode of the currently associated access point. | 559 // Characterize the PHY mode of the currently associated access point. |
| 565 // Currently only available on OS_WIN. | 560 // Currently only available on OS_WIN. |
| 566 NET_EXPORT WifiPHYLayerProtocol GetWifiPHYLayerProtocol(); | 561 NET_EXPORT WifiPHYLayerProtocol GetWifiPHYLayerProtocol(); |
| 567 | 562 |
| 568 } // namespace net | 563 } // namespace net |
| 569 | 564 |
| 570 #endif // NET_BASE_NET_UTIL_H_ | 565 #endif // NET_BASE_NET_UTIL_H_ |
| OLD | NEW |