1 | /* Declarations for convert.c
|
---|
2 | Copyright (C) 2003 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 2 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, write to the Free Software
|
---|
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
19 |
|
---|
20 | In addition, as a special exception, the Free Software Foundation
|
---|
21 | gives permission to link the code of its release of Wget with the
|
---|
22 | OpenSSL project's "OpenSSL" library (or with modified versions of it
|
---|
23 | that use the same license as the "OpenSSL" library), and distribute
|
---|
24 | the linked executables. You must obey the GNU General Public License
|
---|
25 | in all respects for all of the code used other than "OpenSSL". If you
|
---|
26 | modify this file, you may extend this exception to your version of the
|
---|
27 | file, but you are not obligated to do so. If you do not wish to do
|
---|
28 | so, delete this exception statement from your version. */
|
---|
29 |
|
---|
30 | #ifndef CONVERT_H
|
---|
31 | #define CONVERT_H
|
---|
32 |
|
---|
33 | struct hash_table; /* forward decl */
|
---|
34 | extern struct hash_table *downloaded_html_set;
|
---|
35 |
|
---|
36 | enum convert_options {
|
---|
37 | CO_NOCONVERT = 0, /* don't convert this URL */
|
---|
38 | CO_CONVERT_TO_RELATIVE, /* convert to relative, e.g. to
|
---|
39 | "../../otherdir/foo.gif" */
|
---|
40 | CO_CONVERT_TO_COMPLETE, /* convert to absolute, e.g. to
|
---|
41 | "http://orighost/somedir/bar.jpg". */
|
---|
42 | CO_NULLIFY_BASE /* change to empty string. */
|
---|
43 | };
|
---|
44 |
|
---|
45 | struct url;
|
---|
46 |
|
---|
47 | /* A structure that defines the whereabouts of a URL, i.e. its
|
---|
48 | position in an HTML document, etc. */
|
---|
49 |
|
---|
50 | struct urlpos {
|
---|
51 | struct url *url; /* the URL of the link, after it has
|
---|
52 | been merged with the base */
|
---|
53 | char *local_name; /* local file to which it was saved
|
---|
54 | (used by convert_links) */
|
---|
55 |
|
---|
56 | /* reserved for special links such as <base href="..."> which are
|
---|
57 | used when converting links, but ignored when downloading. */
|
---|
58 | unsigned int ignore_when_downloading :1;
|
---|
59 |
|
---|
60 | /* Information about the original link: */
|
---|
61 |
|
---|
62 | unsigned int link_relative_p :1; /* the link was relative */
|
---|
63 | unsigned int link_complete_p :1; /* the link was complete (had host name) */
|
---|
64 | unsigned int link_base_p :1; /* the url came from <base href=...> */
|
---|
65 | unsigned int link_inline_p :1; /* needed to render the page */
|
---|
66 | unsigned int link_expect_html :1; /* expected to contain HTML */
|
---|
67 |
|
---|
68 | unsigned int link_refresh_p :1; /* link was received from
|
---|
69 | <meta http-equiv=refresh content=...> */
|
---|
70 | int refresh_timeout; /* for reconstructing the refresh. */
|
---|
71 |
|
---|
72 | /* Conversion requirements: */
|
---|
73 | enum convert_options convert; /* is conversion required? */
|
---|
74 |
|
---|
75 | /* URL's position in the buffer. */
|
---|
76 | int pos, size;
|
---|
77 |
|
---|
78 | struct urlpos *next; /* next list element */
|
---|
79 | };
|
---|
80 |
|
---|
81 | /* downloaded_file() takes a parameter of this type and returns this type. */
|
---|
82 | typedef enum
|
---|
83 | {
|
---|
84 | /* Return enumerators: */
|
---|
85 | FILE_NOT_ALREADY_DOWNLOADED = 0,
|
---|
86 |
|
---|
87 | /* Return / parameter enumerators: */
|
---|
88 | FILE_DOWNLOADED_NORMALLY,
|
---|
89 | FILE_DOWNLOADED_AND_HTML_EXTENSION_ADDED,
|
---|
90 |
|
---|
91 | /* Parameter enumerators: */
|
---|
92 | CHECK_FOR_FILE
|
---|
93 | } downloaded_file_t;
|
---|
94 |
|
---|
95 | downloaded_file_t downloaded_file PARAMS ((downloaded_file_t, const char *));
|
---|
96 |
|
---|
97 | void register_download PARAMS ((const char *, const char *));
|
---|
98 | void register_redirection PARAMS ((const char *, const char *));
|
---|
99 | void register_html PARAMS ((const char *, const char *));
|
---|
100 | void register_delete_file PARAMS ((const char *));
|
---|
101 | void convert_all_links PARAMS ((void));
|
---|
102 | void convert_cleanup PARAMS ((void));
|
---|
103 |
|
---|
104 | char *html_quote_string PARAMS ((const char *));
|
---|
105 |
|
---|
106 | #endif /* CONVERT_H */
|
---|