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 24 matching lines...) Expand all Loading... | |
35 class Time; | 35 class Time; |
36 } | 36 } |
37 | 37 |
38 namespace url { | 38 namespace url { |
39 struct CanonHostInfo; | 39 struct CanonHostInfo; |
40 struct Parsed; | 40 struct Parsed; |
41 } | 41 } |
42 | 42 |
43 namespace net { | 43 namespace net { |
44 | 44 |
45 class AddressList; | |
46 | |
45 // This is a "forward declaration" to avoid including ip_address_number.h | 47 // This is a "forward declaration" to avoid including ip_address_number.h |
46 // Keep this in sync. | 48 // Keep this in sync. |
47 typedef std::vector<unsigned char> IPAddressNumber; | 49 typedef std::vector<unsigned char> IPAddressNumber; |
48 | 50 |
49 // Used by FormatUrl to specify handling of certain parts of the url. | 51 // Used by FormatUrl to specify handling of certain parts of the url. |
50 typedef uint32_t FormatUrlType; | 52 typedef uint32_t FormatUrlType; |
51 typedef uint32_t FormatUrlTypes; | 53 typedef uint32_t FormatUrlTypes; |
52 | 54 |
53 #if defined(OS_WIN) | 55 #if defined(OS_WIN) |
54 // Bluetooth address size. Windows Bluetooth is supported via winsock. | 56 // Bluetooth address size. Windows Bluetooth is supported via winsock. |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
347 // Maps the given AddressFamily to either AF_INET, AF_INET6 or AF_UNSPEC. | 349 // Maps the given AddressFamily to either AF_INET, AF_INET6 or AF_UNSPEC. |
348 NET_EXPORT_PRIVATE int ConvertAddressFamily(AddressFamily address_family); | 350 NET_EXPORT_PRIVATE int ConvertAddressFamily(AddressFamily address_family); |
349 | 351 |
350 // Retuns the port field of the |sockaddr|. | 352 // Retuns the port field of the |sockaddr|. |
351 const uint16_t* GetPortFieldFromSockaddr(const struct sockaddr* address, | 353 const uint16_t* GetPortFieldFromSockaddr(const struct sockaddr* address, |
352 socklen_t address_len); | 354 socklen_t address_len); |
353 // Returns the value of port in |sockaddr| (in host byte ordering). | 355 // Returns the value of port in |sockaddr| (in host byte ordering). |
354 NET_EXPORT_PRIVATE int GetPortFromSockaddr(const struct sockaddr* address, | 356 NET_EXPORT_PRIVATE int GetPortFromSockaddr(const struct sockaddr* address, |
355 socklen_t address_len); | 357 socklen_t address_len); |
356 | 358 |
359 // Resolves a localhost name (such as "localhost" or "localhost6") into | |
360 // IP endpoints with the given port. Returns true if |host| is one of | |
361 // the names that indicate a loopback and false otherwise. Special IPv6 | |
Ryan Sleevi
2015/06/12 01:00:04
Documentation: You seem to mix localhost with loop
estark
2015/06/12 05:59:46
Done.
| |
362 // names (e.g. "localhost6") will resolve to an IPv6 address only, | |
363 // whereas other names will resolve to both IPv4 and IPv6. | |
364 NET_EXPORT_PRIVATE bool ResolveLocalHostname(const std::string& host, | |
365 uint16_t port, | |
366 AddressList* address_list); | |
367 | |
357 // Returns true if |host| is one of the names (e.g. "localhost") or IP | 368 // Returns true if |host| is one of the names (e.g. "localhost") or IP |
358 // addresses (IPv4 127.0.0.0/8 or IPv6 ::1) that indicate a loopback. | 369 // addresses (IPv4 127.0.0.0/8 or IPv6 ::1) that indicate a loopback. |
359 // | 370 // |
360 // Note that this function does not check for IP addresses other than | 371 // Note that this function does not check for IP addresses other than |
361 // the above, although other IP addresses may point to the local | 372 // the above, although other IP addresses may point to the local |
362 // machine. | 373 // machine. |
363 NET_EXPORT_PRIVATE bool IsLocalhost(const std::string& host); | 374 NET_EXPORT_PRIVATE bool IsLocalhost(const std::string& host); |
364 | 375 |
365 NET_EXPORT_PRIVATE bool IsLocalhostTLD(const std::string& host); | 376 NET_EXPORT_PRIVATE bool IsLocalhostTLD(const std::string& host); |
366 | 377 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
412 DSCP_CS5 = 40, // Video | 423 DSCP_CS5 = 40, // Video |
413 DSCP_EF = 46, // Voice | 424 DSCP_EF = 46, // Voice |
414 DSCP_CS6 = 48, // Voice | 425 DSCP_CS6 = 48, // Voice |
415 DSCP_CS7 = 56, // Control messages | 426 DSCP_CS7 = 56, // Control messages |
416 DSCP_LAST = DSCP_CS7 | 427 DSCP_LAST = DSCP_CS7 |
417 }; | 428 }; |
418 | 429 |
419 } // namespace net | 430 } // namespace net |
420 | 431 |
421 #endif // NET_BASE_NET_UTIL_H_ | 432 #endif // NET_BASE_NET_UTIL_H_ |
OLD | NEW |