1 /* Declarations for convert.c
2 Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010, 2011 Free Software
5 This file is part of GNU Wget.
7 GNU Wget is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 GNU Wget is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Wget. If not, see <http://www.gnu.org/licenses/>.
20 Additional permission under GNU GPL version 3 section 7
22 If you modify this program, or any covered work, by linking or
23 combining it with the OpenSSL project's OpenSSL library (or a
24 modified version of that library), containing parts covered by the
25 terms of the OpenSSL or SSLeay licenses, the Free Software Foundation
26 grants you additional permission to convey the resulting work.
27 Corresponding Source for a non-source form of such a combination
28 shall include the source code for the parts of OpenSSL used as well
29 as that of the covered work. */
34 struct hash_table; /* forward decl */
35 extern struct hash_table *dl_url_file_map;
36 extern struct hash_table *downloaded_html_set;
37 extern struct hash_table *downloaded_css_set;
39 enum convert_options {
40 CO_NOCONVERT = 0, /* don't convert this URL */
41 CO_CONVERT_TO_RELATIVE, /* convert to relative, e.g. to
42 "../../otherdir/foo.gif" */
43 CO_CONVERT_TO_COMPLETE, /* convert to absolute, e.g. to
44 "http://orighost/somedir/bar.jpg". */
45 CO_NULLIFY_BASE /* change to empty string. */
50 /* A structure that defines the whereabouts of a URL, i.e. its
51 position in an HTML document, etc. */
54 struct url *url; /* the URL of the link, after it has
55 been merged with the base */
56 char *local_name; /* local file to which it was saved
57 (used by convert_links) */
59 /* reserved for special links such as <base href="..."> which are
60 used when converting links, but ignored when downloading. */
61 unsigned int ignore_when_downloading :1;
63 /* Information about the original link: */
65 unsigned int link_relative_p :1; /* the link was relative */
66 unsigned int link_complete_p :1; /* the link was complete (had host name) */
67 unsigned int link_base_p :1; /* the url came from <base href=...> */
68 unsigned int link_inline_p :1; /* needed to render the page */
69 unsigned int link_css_p :1; /* the url came from CSS */
70 unsigned int link_expect_html :1; /* expected to contain HTML */
71 unsigned int link_expect_css :1; /* expected to contain CSS */
73 unsigned int link_refresh_p :1; /* link was received from
74 <meta http-equiv=refresh content=...> */
75 int refresh_timeout; /* for reconstructing the refresh. */
77 /* Conversion requirements: */
78 enum convert_options convert; /* is conversion required? */
80 /* URL's position in the buffer. */
83 struct urlpos *next; /* next list element */
86 /* downloaded_file() takes a parameter of this type and returns this type. */
89 /* Return enumerators: */
90 FILE_NOT_ALREADY_DOWNLOADED = 0,
92 /* Return / parameter enumerators: */
93 FILE_DOWNLOADED_NORMALLY,
94 FILE_DOWNLOADED_AND_HTML_EXTENSION_ADDED,
96 /* Parameter enumerators: */
100 downloaded_file_t downloaded_file (downloaded_file_t, const char *);
102 void register_download (const char *, const char *);
103 void register_redirection (const char *, const char *);
104 void register_html (const char *);
105 void register_css (const char *);
106 void register_delete_file (const char *);
107 void convert_all_links (void);
108 void convert_cleanup (void);
110 char *html_quote_string (const char *);
112 #endif /* CONVERT_H */