source: trunk/essentials/net-misc/wget/src/convert.h

Last change on this file was 3440, checked in by bird, 18 years ago

wget 1.10.2

File size: 3.8 KB
Line 
1/* Declarations for convert.c
2 Copyright (C) 2003 Free Software Foundation, Inc.
3
4This file is part of GNU Wget.
5
6GNU Wget is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11GNU Wget is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with Wget; if not, write to the Free Software
18Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20In addition, as a special exception, the Free Software Foundation
21gives permission to link the code of its release of Wget with the
22OpenSSL project's "OpenSSL" library (or with modified versions of it
23that use the same license as the "OpenSSL" library), and distribute
24the linked executables. You must obey the GNU General Public License
25in all respects for all of the code used other than "OpenSSL". If you
26modify this file, you may extend this exception to your version of the
27file, but you are not obligated to do so. If you do not wish to do
28so, delete this exception statement from your version. */
29
30#ifndef CONVERT_H
31#define CONVERT_H
32
33struct hash_table; /* forward decl */
34extern struct hash_table *downloaded_html_set;
35
36enum 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
45struct url;
46
47/* A structure that defines the whereabouts of a URL, i.e. its
48 position in an HTML document, etc. */
49
50struct 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. */
82typedef 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
95downloaded_file_t downloaded_file PARAMS ((downloaded_file_t, const char *));
96
97void register_download PARAMS ((const char *, const char *));
98void register_redirection PARAMS ((const char *, const char *));
99void register_html PARAMS ((const char *, const char *));
100void register_delete_file PARAMS ((const char *));
101void convert_all_links PARAMS ((void));
102void convert_cleanup PARAMS ((void));
103
104char *html_quote_string PARAMS ((const char *));
105
106#endif /* CONVERT_H */
Note: See TracBrowser for help on using the repository browser.