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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // IP address information. |host_info| must not be NULL. | 165 // IP address information. |host_info| must not be NULL. |
166 NET_EXPORT std::string CanonicalizeHost(const std::string& host, | 166 NET_EXPORT std::string CanonicalizeHost(const std::string& host, |
167 url_canon::CanonHostInfo* host_info); | 167 url_canon::CanonHostInfo* host_info); |
168 | 168 |
169 // Returns true if |host| is not an IP address and is compliant with a set of | 169 // Returns true if |host| is not an IP address and is compliant with a set of |
170 // rules based on RFC 1738 and tweaked to be compatible with the real world. | 170 // rules based on RFC 1738 and tweaked to be compatible with the real world. |
171 // The rules are: | 171 // The rules are: |
172 // * One or more components separated by '.' | 172 // * One or more components separated by '.' |
173 // * Each component begins with an alphanumeric character or '-' | 173 // * Each component begins with an alphanumeric character or '-' |
174 // * Each component contains only alphanumeric characters and '-' or '_' | 174 // * Each component contains only alphanumeric characters and '-' or '_' |
175 // * Each component ends with an alphanumeric character | 175 // * Each component ends with an alphanumeric character or '-' |
176 // * The last component begins with an alphabetic character | 176 // * The last component begins with an alphabetic character |
177 // * Optional trailing dot after last component (means "treat as FQDN") | 177 // * Optional trailing dot after last component (means "treat as FQDN") |
178 // If |desired_tld| is non-NULL, the host will only be considered invalid if | 178 // If |desired_tld| is non-NULL, the host will only be considered invalid if |
179 // appending it as a trailing component still results in an invalid host. This | 179 // appending it as a trailing component still results in an invalid host. This |
180 // helps us avoid marking as "invalid" user attempts to open "www.401k.com" by | 180 // helps us avoid marking as "invalid" user attempts to open "www.401k.com" by |
181 // typing 4-0-1-k-<ctrl>+<enter>. | 181 // typing 4-0-1-k-<ctrl>+<enter>. |
182 // | 182 // |
183 // NOTE: You should only pass in hosts that have been returned from | 183 // NOTE: You should only pass in hosts that have been returned from |
184 // CanonicalizeHost(), or you may not get accurate results. | 184 // CanonicalizeHost(), or you may not get accurate results. |
185 NET_EXPORT bool IsCanonicalizedHostCompliant(const std::string& host, | 185 NET_EXPORT bool IsCanonicalizedHostCompliant(const std::string& host, |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 | 451 |
452 // Returns list of network interfaces except loopback interface. If an | 452 // Returns list of network interfaces except loopback interface. If an |
453 // interface has more than one address, a separate entry is added to | 453 // interface has more than one address, a separate entry is added to |
454 // the list for each address. | 454 // the list for each address. |
455 // Can be called only on a thread that allows IO. | 455 // Can be called only on a thread that allows IO. |
456 NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks); | 456 NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks); |
457 | 457 |
458 } // namespace net | 458 } // namespace net |
459 | 459 |
460 #endif // NET_BASE_NET_UTIL_H_ | 460 #endif // NET_BASE_NET_UTIL_H_ |
OLD | NEW |