| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| 11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 416 |
| 417 // Returns the value of |info's| port (in host byte ordering). | 417 // Returns the value of |info's| port (in host byte ordering). |
| 418 int GetPortFromAddrinfo(const struct addrinfo* info); | 418 int GetPortFromAddrinfo(const struct addrinfo* info); |
| 419 | 419 |
| 420 // Same except for struct sockaddr. | 420 // Same except for struct sockaddr. |
| 421 const uint16* GetPortFieldFromSockaddr(const struct sockaddr* address, | 421 const uint16* GetPortFieldFromSockaddr(const struct sockaddr* address, |
| 422 socklen_t address_len); | 422 socklen_t address_len); |
| 423 int GetPortFromSockaddr(const struct sockaddr* address, | 423 int GetPortFromSockaddr(const struct sockaddr* address, |
| 424 socklen_t address_len); | 424 socklen_t address_len); |
| 425 | 425 |
| 426 // Returns true if |host| is "localhost" or one of the IP-address |
| 427 // representations of the loopback address (IPv4 127.0.0.0/8 or IPv6 ::1). |
| 428 // |
| 429 // Note that this function does not check for IP addresses other than |
| 430 // the above being mapped back to the local machine, it only checks |
| 431 // for those exact IP addresses. |
| 432 bool IsLocalhost(const std::string& host); |
| 433 |
| 426 } // namespace net | 434 } // namespace net |
| 427 | 435 |
| 428 #endif // NET_BASE_NET_UTIL_H_ | 436 #endif // NET_BASE_NET_UTIL_H_ |
| OLD | NEW |