OLD | NEW |
1 // Copyright (c) 2011 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 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // handle degenerate cases here. Returns true on success, false if it isn't a | 87 // handle degenerate cases here. Returns true on success, false if it isn't a |
88 // valid file URL. On failure, *file_path will be empty. | 88 // valid file URL. On failure, *file_path will be empty. |
89 NET_EXPORT bool FileURLToFilePath(const GURL& url, FilePath* file_path); | 89 NET_EXPORT bool FileURLToFilePath(const GURL& url, FilePath* file_path); |
90 | 90 |
91 // Splits an input of the form <host>[":"<port>] into its consitituent parts. | 91 // Splits an input of the form <host>[":"<port>] into its consitituent parts. |
92 // Saves the result into |*host| and |*port|. If the input did not have | 92 // Saves the result into |*host| and |*port|. If the input did not have |
93 // the optional port, sets |*port| to -1. | 93 // the optional port, sets |*port| to -1. |
94 // Returns true if the parsing was successful, false otherwise. | 94 // Returns true if the parsing was successful, false otherwise. |
95 // The returned host is NOT canonicalized, and may be invalid. If <host> is | 95 // The returned host is NOT canonicalized, and may be invalid. If <host> is |
96 // an IPv6 literal address, the returned host includes the square brackets. | 96 // an IPv6 literal address, the returned host includes the square brackets. |
97 NET_EXPORT_PRIVATE bool ParseHostAndPort( | 97 NET_EXPORT bool ParseHostAndPort( |
98 std::string::const_iterator host_and_port_begin, | 98 std::string::const_iterator host_and_port_begin, |
99 std::string::const_iterator host_and_port_end, | 99 std::string::const_iterator host_and_port_end, |
100 std::string* host, | 100 std::string* host, |
101 int* port); | 101 int* port); |
102 NET_EXPORT_PRIVATE bool ParseHostAndPort( | 102 NET_EXPORT bool ParseHostAndPort( |
103 const std::string& host_and_port, | 103 const std::string& host_and_port, |
104 std::string* host, | 104 std::string* host, |
105 int* port); | 105 int* port); |
106 | 106 |
107 // Returns a host:port string for the given URL. | 107 // Returns a host:port string for the given URL. |
108 NET_EXPORT std::string GetHostAndPort(const GURL& url); | 108 NET_EXPORT std::string GetHostAndPort(const GURL& url); |
109 | 109 |
110 // Returns a host[:port] string for the given URL, where the port is omitted | 110 // Returns a host[:port] string for the given URL, where the port is omitted |
111 // if it is the default for the URL's scheme. | 111 // if it is the default for the URL's scheme. |
112 NET_EXPORT_PRIVATE std::string GetHostAndOptionalPort(const GURL& url); | 112 NET_EXPORT_PRIVATE std::string GetHostAndOptionalPort(const GURL& url); |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 | 505 |
506 // Returns list of network interfaces except loopback interface. If an | 506 // Returns list of network interfaces except loopback interface. If an |
507 // interface has more than one address, a separate entry is added to | 507 // interface has more than one address, a separate entry is added to |
508 // the list for each address. | 508 // the list for each address. |
509 // Can be called only on a thread that allows IO. | 509 // Can be called only on a thread that allows IO. |
510 NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks); | 510 NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks); |
511 | 511 |
512 } // namespace net | 512 } // namespace net |
513 | 513 |
514 #endif // NET_BASE_NET_UTIL_H_ | 514 #endif // NET_BASE_NET_UTIL_H_ |
OLD | NEW |