Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: src/url_canon_ip.h

Issue 14090005: Modify the headers in src/ to forward to url/*.h (Closed) Base URL: http://google-url.googlecode.com/svn/trunk
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/url_canon_internal_file.h ('k') | src/url_canon_stdstring.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008, Google Inc. 1 // Copyright 2008, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 12 matching lines...) Expand all
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 #ifndef GOOGLEURL_SRC_URL_CANON_IP_H__ 30 #ifndef GOOGLEURL_SRC_URL_CANON_IP_H__
31 #define GOOGLEURL_SRC_URL_CANON_IP_H__ 31 #define GOOGLEURL_SRC_URL_CANON_IP_H__
32 32
33 #include "base/string16.h" 33 #include "url/url_canon_ip.h"
34 #include "googleurl/src/url_canon.h"
35 #include "googleurl/src/url_common.h"
36 #include "googleurl/src/url_parse.h"
37
38 namespace url_canon {
39
40 // Writes the given IPv4 address to |output|.
41 GURL_API void AppendIPv4Address(const unsigned char address[4],
42 CanonOutput* output);
43
44 // Writes the given IPv6 address to |output|.
45 GURL_API void AppendIPv6Address(const unsigned char address[16],
46 CanonOutput* output);
47
48 // Searches the host name for the portions of the IPv4 address. On success,
49 // each component will be placed into |components| and it will return true.
50 // It will return false if the host can not be separated as an IPv4 address
51 // or if there are any non-7-bit characters or other characters that can not
52 // be in an IP address. (This is important so we fail as early as possible for
53 // common non-IP hostnames.)
54 //
55 // Not all components may exist. If there are only 3 components, for example,
56 // the last one will have a length of -1 or 0 to indicate it does not exist.
57 //
58 // Note that many platform's inet_addr will ignore everything after a space
59 // in certain curcumstances if the stuff before the space looks like an IP
60 // address. IE6 is included in this. We do NOT handle this case. In many cases,
61 // the browser's canonicalization will get run before this which converts
62 // spaces to %20 (in the case of IE7) or rejects them (in the case of
63 // Mozilla), so this code path never gets hit. Our host canonicalization will
64 // notice these spaces and escape them, which will make IP address finding
65 // fail. This seems like better behavior than stripping after a space.
66 GURL_API bool FindIPv4Components(const char* spec,
67 const url_parse::Component& host,
68 url_parse::Component components[4]);
69 GURL_API bool FindIPv4Components(const char16* spec,
70 const url_parse::Component& host,
71 url_parse::Component components[4]);
72
73 // Converts an IPv4 address to a 32-bit number (network byte order).
74 //
75 // Possible return values:
76 // IPV4 - IPv4 address was successfully parsed.
77 // BROKEN - Input was formatted like an IPv4 address, but overflow occurred
78 // during parsing.
79 // NEUTRAL - Input couldn't possibly be interpreted as an IPv4 address.
80 // It might be an IPv6 address, or a hostname.
81 //
82 // On success, |num_ipv4_components| will be populated with the number of
83 // components in the IPv4 address.
84 GURL_API CanonHostInfo::Family IPv4AddressToNumber(
85 const char* spec,
86 const url_parse::Component& host,
87 unsigned char address[4],
88 int* num_ipv4_components);
89 GURL_API CanonHostInfo::Family IPv4AddressToNumber(
90 const char16* spec,
91 const url_parse::Component& host,
92 unsigned char address[4],
93 int* num_ipv4_components);
94
95 // Converts an IPv6 address to a 128-bit number (network byte order), returning
96 // true on success. False means that the input was not a valid IPv6 address.
97 //
98 // NOTE that |host| is expected to be surrounded by square brackets.
99 // i.e. "[::1]" rather than "::1".
100 GURL_API bool IPv6AddressToNumber(const char* spec,
101 const url_parse::Component& host,
102 unsigned char address[16]);
103 GURL_API bool IPv6AddressToNumber(const char16* spec,
104 const url_parse::Component& host,
105 unsigned char address[16]);
106
107 } // namespace url_canon
108 34
109 #endif // GOOGLEURL_SRC_URL_CANON_IP_H__ 35 #endif // GOOGLEURL_SRC_URL_CANON_IP_H__
OLDNEW
« no previous file with comments | « src/url_canon_internal_file.h ('k') | src/url_canon_stdstring.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698