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