| 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 public: | 412 public: |
| 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. | |
| 423 enum IPv6SupportStatus { | |
| 424 IPV6_CANNOT_CREATE_SOCKETS, | |
| 425 IPV6_CAN_CREATE_SOCKETS, // Obsolete | |
| 426 IPV6_GETIFADDRS_FAILED, | |
| 427 IPV6_GLOBAL_ADDRESS_MISSING, | |
| 428 IPV6_GLOBAL_ADDRESS_PRESENT, | |
| 429 IPV6_INTERFACE_ARRAY_TOO_SHORT, | |
| 430 IPV6_SUPPORT_MAX // Bounding value for enumeration. Also used for case | |
| 431 // where detection is not supported. | |
| 432 }; | |
| 433 | |
| 434 // Encapsulates the results of an IPv6 probe. | |
| 435 struct NET_EXPORT IPv6SupportResult { | |
| 436 IPv6SupportResult(bool ipv6_supported, | |
| 437 IPv6SupportStatus ipv6_support_status, | |
| 438 int os_error); | |
| 439 | |
| 440 // Serializes the results to a Value. Caller takes ownership of the returned | |
| 441 // Value. | |
| 442 base::Value* ToNetLogValue(NetLog::LogLevel log_level) const; | |
| 443 | |
| 444 bool ipv6_supported; | |
| 445 // Set to IPV6_SUPPORT_MAX if detection isn't supported. | |
| 446 IPv6SupportStatus ipv6_support_status; | |
| 447 | |
| 448 // Error code from the OS, or zero if there was no error. | |
| 449 int os_error; | |
| 450 }; | |
| 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. | 422 // 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. | 423 // i.e. if only 127.0.0.1 and ::1 are routable. |
| 459 // Also returns false if it cannot determine this. | 424 // Also returns false if it cannot determine this. |
| 460 bool HaveOnlyLoopbackAddresses(); | 425 bool HaveOnlyLoopbackAddresses(); |
| 461 | 426 |
| 462 // Returns AddressFamily of the address. | 427 // Returns AddressFamily of the address. |
| 463 NET_EXPORT_PRIVATE AddressFamily GetAddressFamily( | 428 NET_EXPORT_PRIVATE AddressFamily GetAddressFamily( |
| 464 const IPAddressNumber& address); | 429 const IPAddressNumber& address); |
| 465 | 430 |
| 466 // Parses an IP address literal (either IPv4 or IPv6) to its numeric value. | 431 // 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 | 526 WIFI_PHY_LAYER_PROTOCOL_UNKNOWN |
| 562 }; | 527 }; |
| 563 | 528 |
| 564 // Characterize the PHY mode of the currently associated access point. | 529 // Characterize the PHY mode of the currently associated access point. |
| 565 // Currently only available on OS_WIN. | 530 // Currently only available on OS_WIN. |
| 566 NET_EXPORT WifiPHYLayerProtocol GetWifiPHYLayerProtocol(); | 531 NET_EXPORT WifiPHYLayerProtocol GetWifiPHYLayerProtocol(); |
| 567 | 532 |
| 568 } // namespace net | 533 } // namespace net |
| 569 | 534 |
| 570 #endif // NET_BASE_NET_UTIL_H_ | 535 #endif // NET_BASE_NET_UTIL_H_ |
| OLD | NEW |