| 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  342 // Maps the given AddressFamily to either AF_INET, AF_INET6 or AF_UNSPEC. |  344 // Maps the given AddressFamily to either AF_INET, AF_INET6 or AF_UNSPEC. | 
|  343 NET_EXPORT_PRIVATE int ConvertAddressFamily(AddressFamily address_family); |  345 NET_EXPORT_PRIVATE int ConvertAddressFamily(AddressFamily address_family); | 
|  344  |  346  | 
|  345 // Retuns the port field of the |sockaddr|. |  347 // Retuns the port field of the |sockaddr|. | 
|  346 const uint16_t* GetPortFieldFromSockaddr(const struct sockaddr* address, |  348 const uint16_t* GetPortFieldFromSockaddr(const struct sockaddr* address, | 
|  347                                          socklen_t address_len); |  349                                          socklen_t address_len); | 
|  348 // Returns the value of port in |sockaddr| (in host byte ordering). |  350 // Returns the value of port in |sockaddr| (in host byte ordering). | 
|  349 NET_EXPORT_PRIVATE int GetPortFromSockaddr(const struct sockaddr* address, |  351 NET_EXPORT_PRIVATE int GetPortFromSockaddr(const struct sockaddr* address, | 
|  350                                            socklen_t address_len); |  352                                            socklen_t address_len); | 
|  351  |  353  | 
|  352 // Returns true if |host| is one of the names (e.g. "localhost") or IP |  354 // Resolves a local hostname (such as "localhost" or "localhost6") into | 
|  353 // addresses (IPv4 127.0.0.0/8 or IPv6 ::1) that indicate a loopback. |  355 // IP endpoints with the given port. Returns true if |host| is a local | 
 |  356 // hostname and false otherwise. Special IPv6 names (e.g. "localhost6") | 
 |  357 // will resolve to an IPv6 address only, whereas other names will | 
 |  358 // resolve to both IPv4 and IPv6. | 
 |  359 NET_EXPORT_PRIVATE bool ResolveLocalHostname(const std::string& host, | 
 |  360                                              uint16_t port, | 
 |  361                                              AddressList* address_list); | 
 |  362  | 
 |  363 // Returns true if |host| is one of the local hostnames | 
 |  364 // (e.g. "localhost") or IP addresses (IPv4 127.0.0.0/8 or IPv6 ::1). | 
|  354 // |  365 // | 
|  355 // Note that this function does not check for IP addresses other than |  366 // Note that this function does not check for IP addresses other than | 
|  356 // the above, although other IP addresses may point to the local |  367 // the above, although other IP addresses may point to the local | 
|  357 // machine. |  368 // machine. | 
|  358 NET_EXPORT_PRIVATE bool IsLocalhost(const std::string& host); |  369 NET_EXPORT_PRIVATE bool IsLocalhost(const std::string& host); | 
|  359  |  370  | 
|  360 NET_EXPORT_PRIVATE bool IsLocalhostTLD(const std::string& host); |  371 NET_EXPORT_PRIVATE bool IsLocalhostTLD(const std::string& host); | 
|  361  |  372  | 
|  362 // Returns true if the url's host is a Google server. This should only be used |  373 // Returns true if the url's host is a Google server. This should only be used | 
|  363 // for histograms and shouldn't be used to affect behavior. |  374 // for histograms and shouldn't be used to affect behavior. | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  407   DSCP_CS5  = 40,  // Video |  418   DSCP_CS5  = 40,  // Video | 
|  408   DSCP_EF   = 46,  // Voice |  419   DSCP_EF   = 46,  // Voice | 
|  409   DSCP_CS6  = 48,  // Voice |  420   DSCP_CS6  = 48,  // Voice | 
|  410   DSCP_CS7  = 56,  // Control messages |  421   DSCP_CS7  = 56,  // Control messages | 
|  411   DSCP_LAST = DSCP_CS7 |  422   DSCP_LAST = DSCP_CS7 | 
|  412 }; |  423 }; | 
|  413  |  424  | 
|  414 }  // namespace net |  425 }  // namespace net | 
|  415  |  426  | 
|  416 #endif  // NET_BASE_NET_UTIL_H_ |  427 #endif  // NET_BASE_NET_UTIL_H_ | 
| OLD | NEW |