]> sjero.net Git - wget/blob - src/convert.h
Updated config.guess, config.sub, install.sh.
[wget] / src / convert.h
1 /* Declarations for convert.c
2    Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
3
4 This file is part of GNU Wget.
5
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.
10
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.
15
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/>.
18
19 Additional permission under GNU GPL version 3 section 7
20
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.  */
29
30 #ifndef CONVERT_H
31 #define CONVERT_H
32
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;
37
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. */
45 };
46
47 struct url;
48
49 /* A structure that defines the whereabouts of a URL, i.e. its
50    position in an HTML document, etc.  */
51
52 struct urlpos {
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) */
57
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;
61
62   /* Information about the original link: */
63
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 */
71
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. */
75
76   /* Conversion requirements: */
77   enum convert_options convert; /* is conversion required? */
78
79   /* URL's position in the buffer. */
80   int pos, size;
81
82   struct urlpos *next;          /* next list element */
83 };
84
85 /* downloaded_file() takes a parameter of this type and returns this type. */
86 typedef enum
87 {
88   /* Return enumerators: */
89   FILE_NOT_ALREADY_DOWNLOADED = 0,
90
91   /* Return / parameter enumerators: */
92   FILE_DOWNLOADED_NORMALLY,
93   FILE_DOWNLOADED_AND_HTML_EXTENSION_ADDED,
94
95   /* Parameter enumerators: */
96   CHECK_FOR_FILE
97 } downloaded_file_t;
98
99 downloaded_file_t downloaded_file (downloaded_file_t, const char *);
100
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);
108
109 char *html_quote_string (const char *);
110
111 #endif /* CONVERT_H */