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) |
11 #include <windows.h> | 11 #include <windows.h> |
12 #include <ws2tcpip.h> | 12 #include <ws2tcpip.h> |
13 #elif defined(OS_POSIX) | 13 #elif defined(OS_POSIX) |
14 #include <sys/types.h> | 14 #include <sys/types.h> |
15 #include <sys/socket.h> | 15 #include <sys/socket.h> |
16 #endif | 16 #endif |
17 | 17 |
18 #include <list> | 18 #include <list> |
19 #include <string> | 19 #include <string> |
20 #include <set> | 20 #include <set> |
21 #include <vector> | 21 #include <vector> |
22 | 22 |
23 #include "base/basictypes.h" | 23 #include "base/basictypes.h" |
24 #include "base/string16.h" | 24 #include "base/string16.h" |
| 25 #include "net/base/address_family.h" |
25 #include "net/base/escape.h" | 26 #include "net/base/escape.h" |
26 #include "net/base/net_export.h" | 27 #include "net/base/net_export.h" |
27 #include "net/base/net_log.h" | 28 #include "net/base/net_log.h" |
28 | 29 |
29 class GURL; | 30 class GURL; |
30 | 31 |
31 namespace base { | 32 namespace base { |
32 class FilePath; | 33 class FilePath; |
33 class Time; | 34 class Time; |
34 } | 35 } |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 // Perform a simplistic test to see if IPv6 is supported by trying to create an | 452 // Perform a simplistic test to see if IPv6 is supported by trying to create an |
452 // IPv6 socket. | 453 // IPv6 socket. |
453 // TODO(jar): Make test more in-depth as needed. | 454 // TODO(jar): Make test more in-depth as needed. |
454 NET_EXPORT IPv6SupportResult TestIPv6Support(); | 455 NET_EXPORT IPv6SupportResult TestIPv6Support(); |
455 | 456 |
456 // Returns true if it can determine that only loopback addresses are configured. | 457 // Returns true if it can determine that only loopback addresses are configured. |
457 // i.e. if only 127.0.0.1 and ::1 are routable. | 458 // i.e. if only 127.0.0.1 and ::1 are routable. |
458 // Also returns false if it cannot determine this. | 459 // Also returns false if it cannot determine this. |
459 bool HaveOnlyLoopbackAddresses(); | 460 bool HaveOnlyLoopbackAddresses(); |
460 | 461 |
| 462 // Returns AddressFamily of the address. |
| 463 NET_EXPORT_PRIVATE AddressFamily GetAddressFamily( |
| 464 const IPAddressNumber& address); |
| 465 |
461 // Parses an IP address literal (either IPv4 or IPv6) to its numeric value. | 466 // Parses an IP address literal (either IPv4 or IPv6) to its numeric value. |
462 // Returns true on success and fills |ip_number| with the numeric value. | 467 // Returns true on success and fills |ip_number| with the numeric value. |
463 NET_EXPORT_PRIVATE bool ParseIPLiteralToNumber(const std::string& ip_literal, | 468 NET_EXPORT_PRIVATE bool ParseIPLiteralToNumber(const std::string& ip_literal, |
464 IPAddressNumber* ip_number); | 469 IPAddressNumber* ip_number); |
465 | 470 |
466 // Converts an IPv4 address to an IPv4-mapped IPv6 address. | 471 // Converts an IPv4 address to an IPv4-mapped IPv6 address. |
467 // For example 192.168.0.1 would be converted to ::ffff:192.168.0.1. | 472 // For example 192.168.0.1 would be converted to ::ffff:192.168.0.1. |
468 NET_EXPORT_PRIVATE IPAddressNumber ConvertIPv4NumberToIPv6Number( | 473 NET_EXPORT_PRIVATE IPAddressNumber ConvertIPv4NumberToIPv6Number( |
469 const IPAddressNumber& ipv4_number); | 474 const IPAddressNumber& ipv4_number); |
470 | 475 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 WIFI_PHY_LAYER_PROTOCOL_UNKNOWN | 561 WIFI_PHY_LAYER_PROTOCOL_UNKNOWN |
557 }; | 562 }; |
558 | 563 |
559 // Characterize the PHY mode of the currently associated access point. | 564 // Characterize the PHY mode of the currently associated access point. |
560 // Currently only available on OS_WIN. | 565 // Currently only available on OS_WIN. |
561 NET_EXPORT WifiPHYLayerProtocol GetWifiPHYLayerProtocol(); | 566 NET_EXPORT WifiPHYLayerProtocol GetWifiPHYLayerProtocol(); |
562 | 567 |
563 } // namespace net | 568 } // namespace net |
564 | 569 |
565 #endif // NET_BASE_NET_UTIL_H_ | 570 #endif // NET_BASE_NET_UTIL_H_ |
OLD | NEW |