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

Side by Side Diff: src/url_canon_ip.h

Issue 10919114: Expose functions to stringify IPv4 and IPv6 addresses (Closed) Base URL: http://git.chromium.org/external/google-url.git@master
Patch Set: moar Created 8 years, 3 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
« no previous file with comments | « no previous file | src/url_canon_ip.cc » ('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 19 matching lines...) Expand all
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 "base/string16.h"
34 #include "googleurl/src/url_canon.h" 34 #include "googleurl/src/url_canon.h"
35 #include "googleurl/src/url_common.h" 35 #include "googleurl/src/url_common.h"
36 #include "googleurl/src/url_parse.h" 36 #include "googleurl/src/url_parse.h"
37 37
38 namespace url_canon { 38 namespace url_canon {
39 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
40 // Searches the host name for the portions of the IPv4 address. On success, 48 // Searches the host name for the portions of the IPv4 address. On success,
41 // each component will be placed into |components| and it will return true. 49 // each component will be placed into |components| and it will return true.
42 // It will return false if the host can not be separated as an IPv4 address 50 // It will return false if the host can not be separated as an IPv4 address
43 // or if there are any non-7-bit characters or other characters that can not 51 // or if there are any non-7-bit characters or other characters that can not
44 // be in an IP address. (This is important so we fail as early as possible for 52 // be in an IP address. (This is important so we fail as early as possible for
45 // common non-IP hostnames.) 53 // common non-IP hostnames.)
46 // 54 //
47 // Not all components may exist. If there are only 3 components, for example, 55 // Not all components may exist. If there are only 3 components, for example,
48 // the last one will have a length of -1 or 0 to indicate it does not exist. 56 // the last one will have a length of -1 or 0 to indicate it does not exist.
49 // 57 //
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 GURL_API bool IPv6AddressToNumber(const char* spec, 100 GURL_API bool IPv6AddressToNumber(const char* spec,
93 const url_parse::Component& host, 101 const url_parse::Component& host,
94 unsigned char address[16]); 102 unsigned char address[16]);
95 GURL_API bool IPv6AddressToNumber(const char16* spec, 103 GURL_API bool IPv6AddressToNumber(const char16* spec,
96 const url_parse::Component& host, 104 const url_parse::Component& host,
97 unsigned char address[16]); 105 unsigned char address[16]);
98 106
99 } // namespace url_canon 107 } // namespace url_canon
100 108
101 #endif // GOOGLEURL_SRC_URL_CANON_IP_H__ 109 #endif // GOOGLEURL_SRC_URL_CANON_IP_H__
OLDNEW
« no previous file with comments | « no previous file | src/url_canon_ip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698