| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 // Parses an IP address literal (either IPv4 or IPv6) to its numeric value. | 417 // Parses an IP address literal (either IPv4 or IPv6) to its numeric value. |
| 418 // Returns true on success and fills |ip_number| with the numeric value. | 418 // Returns true on success and fills |ip_number| with the numeric value. |
| 419 NET_EXPORT_PRIVATE bool ParseIPLiteralToNumber(const std::string& ip_literal, | 419 NET_EXPORT_PRIVATE bool ParseIPLiteralToNumber(const std::string& ip_literal, |
| 420 IPAddressNumber* ip_number); | 420 IPAddressNumber* ip_number); |
| 421 | 421 |
| 422 // Converts an IPv4 address to an IPv4-mapped IPv6 address. | 422 // Converts an IPv4 address to an IPv4-mapped IPv6 address. |
| 423 // For example 192.168.0.1 would be converted to ::ffff:192.168.0.1. | 423 // For example 192.168.0.1 would be converted to ::ffff:192.168.0.1. |
| 424 NET_EXPORT_PRIVATE IPAddressNumber ConvertIPv4NumberToIPv6Number( | 424 NET_EXPORT_PRIVATE IPAddressNumber ConvertIPv4NumberToIPv6Number( |
| 425 const IPAddressNumber& ipv4_number); | 425 const IPAddressNumber& ipv4_number); |
| 426 | 426 |
| 427 // Returns true iff |address| is an IPv4-mapped IPv6 address. |
| 428 NET_EXPORT_PRIVATE bool IsIPv4Mapped(const IPAddressNumber& address); |
| 429 |
| 430 // Converts an IPv4-mapped IPv6 address to IPv4 address. Should only be called |
| 431 // on IPv4-mapped IPv6 addresses. |
| 432 NET_EXPORT_PRIVATE IPAddressNumber ConvertIPv4MappedToIPv4( |
| 433 const IPAddressNumber& address); |
| 434 |
| 427 // Parses an IP block specifier from CIDR notation to an | 435 // Parses an IP block specifier from CIDR notation to an |
| 428 // (IP address, prefix length) pair. Returns true on success and fills | 436 // (IP address, prefix length) pair. Returns true on success and fills |
| 429 // |*ip_number| with the numeric value of the IP address and sets | 437 // |*ip_number| with the numeric value of the IP address and sets |
| 430 // |*prefix_length_in_bits| with the length of the prefix. | 438 // |*prefix_length_in_bits| with the length of the prefix. |
| 431 // | 439 // |
| 432 // CIDR notation literals can use either IPv4 or IPv6 literals. Some examples: | 440 // CIDR notation literals can use either IPv4 or IPv6 literals. Some examples: |
| 433 // | 441 // |
| 434 // 10.10.3.1/20 | 442 // 10.10.3.1/20 |
| 435 // a:b:c::/46 | 443 // a:b:c::/46 |
| 436 // ::1/128 | 444 // ::1/128 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 | 490 |
| 483 // Returns list of network interfaces except loopback interface. If an | 491 // Returns list of network interfaces except loopback interface. If an |
| 484 // interface has more than one address, a separate entry is added to | 492 // interface has more than one address, a separate entry is added to |
| 485 // the list for each address. | 493 // the list for each address. |
| 486 // Can be called only on a thread that allows IO. | 494 // Can be called only on a thread that allows IO. |
| 487 NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks); | 495 NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks); |
| 488 | 496 |
| 489 } // namespace net | 497 } // namespace net |
| 490 | 498 |
| 491 #endif // NET_BASE_NET_UTIL_H_ | 499 #endif // NET_BASE_NET_UTIL_H_ |
| OLD | NEW |