Debian Codegraph @

WWW/Library/Implementation/HTAccess.h

raw
1 /*
2 * $LynxId: HTAccess.h,v 1.22 2024/01/10 23:54:11 tom Exp $
3 * HTAccess: Access manager for libwww
4 * ACCESS MANAGER
5 *
6 * This module keeps a list of valid protocol (naming scheme) specifiers with
7 * associated access code. It allows documents to be loaded given various
8 * combinations of parameters. New access protocols may be registered at any
9 * time.
10 *
11 * Part of the libwww library .
12 *
13 */
14 #ifndef HTACCESS_H
15 #define HTACCESS_H
16
17 /* Definition uses:
18 */
19 #include <HTAnchor.h>
20 #include <HTFormat.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 extern char *use_this_url_instead;
26
27 extern int redirection_limit;
28 extern int redirection_attempts;
29
30 /* Return codes from load routines:
31 *
32 * These codes may be returned by the protocol modules,
33 * and by the HTLoad routines.
34 * In general, positive codes are OK and negative ones are bad.
35 */
36
37 /*
38
39 Default Addresses
40
41 These control the home page selection. To mess with these for normal browses is asking
42 for user confusion.
43
44 */
45 #define LOGICAL_DEFAULT "WWW_HOME" /* Defined to be the home page */
46
47 #ifndef PERSONAL_DEFAULT
48 #define PERSONAL_DEFAULT "WWW/default.html" /* in home directory */
49 #endif
50 #ifndef LOCAL_DEFAULT_FILE
51 #define LOCAL_DEFAULT_FILE "/usr/local/lib/WWW/default.html"
52 #endif
53 /* If one telnets to a www access point,
54 it will look in this file for home page */
55 #ifndef REMOTE_POINTER
56 #define REMOTE_POINTER "/etc/www-remote.url" /* can't be file */
57 #endif
58 /* and if that fails it will use this. */
59 #ifndef REMOTE_ADDRESS
60 #define REMOTE_ADDRESS "http://www.w3.org/remote.html" /* can't be file */
61 #endif
62
63 /* If run from telnet daemon and no -l specified, use this file:
64 */
65 #ifndef DEFAULT_LOGFILE
66 #define DEFAULT_LOGFILE "/usr/adm/www-log/www-log"
67 #endif
68
69 /* If the home page isn't found, use this file:
70 */
71 #ifndef LAST_RESORT
72 #define LAST_RESORT "http://www.w3.org/default.html"
73 #endif
74
75 /*
76
77 Flags which may be set to control this module
78
79 */
80 #ifdef NOT
81 extern int HTDiag; /* Flag: load source as plain text */
82 #endif /* NOT */
83 extern char *HTClientHost; /* Name or number of telnetting host */
84 extern FILE *HTlogfile; /* File to output one-liners to */
85 extern BOOL HTSecure; /* Disable security holes? */
86 extern BOOL HTPermitRedir; /* Special flag for getfile() */
87 extern HTStream *HTOutputStream; /* For non-interactive, set this */
88 extern HTFormat HTOutputFormat; /* To convert on load, set this */
89
90 /* Check for proxy override. override_proxy()
91 *
92 * Check the no_proxy environment variable to get the list
93 * of hosts for which proxy server is not consulted.
94 *
95 * no_proxy is a comma- or space-separated list of machine
96 * or domain names, with optional :port part. If no :port
97 * part is present, it applies to all ports on that domain.
98 *
99 * Example:
100 * no_proxy="cern.ch,some.domain:8001"
101 *
102 * Use "*" to override all proxy service:
103 * no_proxy="*"
104 */
105 extern BOOL override_proxy(const char *addr);
106
107 /*
108
109 Load a document from relative name
110
111 ON ENTRY,
112 relative_name The relative address of the file to be accessed.
113 here The anchor of the object being searched
114
115 ON EXIT,
116 returns YES Success in opening file
117 NO Failure
118
119 */
120 extern BOOL HTLoadRelative(const char *relative_name,
121 HTParentAnchor *here);
122
123 /*
124
125 Load a document from absolute name
126
127 ON ENTRY,
128 addr The absolute address of the document to be accessed.
129 filter_it if YES, treat document as HTML
130
131 ON EXIT,
132 returns YES Success in opening document
133 NO Failure
134
135 */
136 extern BOOL HTLoadAbsolute(const DocAddress *addr);
137
138 /*
139
140 Make a stream for Saving object back
141
142 ON ENTRY,
143 anchor is valid anchor which has previously been loaded
144
145 ON EXIT,
146 returns 0 if error else a stream to save the object to.
147
148 */
149 extern HTStream *HTSaveStream(HTParentAnchor *anchor);
150
151 /*
152
153 Search
154
155 Performs a search on word given by the user. Adds the search words to the end of the
156 current address and attempts to open the new address.
157
158 ON ENTRY,
159 *keywords space-separated keyword list or similar search list
160 here The anchor of the object being searched
161
162 */
163 extern BOOL HTSearch(const char *keywords, HTParentAnchor *here);
164
165 /*
166
167 Search Given Indexname
168
169 Performs a keyword search on word given by the user. Adds the keyword to the end of
170 the current address and attempts to open the new address.
171
172 ON ENTRY,
173 *keywords space-separated keyword list or similar search list
174 *indexname is name of object search is to be done on.
175
176 */
177 extern BOOL HTSearchAbsolute(const char *keywords,
178 char *indexname);
179
180 /*
181
182 Register an access method
183
184 */
185
186 typedef struct _HTProtocol {
187 const char *name;
188
189 int (*load) (const char *full_address,
190 HTParentAnchor *anchor,
191 HTFormat format_out,
192 HTStream *sink);
193
194 HTStream *(*saveStream) (HTParentAnchor *anchor);
195
196 } HTProtocol;
197
198 extern BOOL HTRegisterProtocol(HTProtocol * protocol);
199
200 /*
201
202 Generate the anchor for the home page
203
204 */
205
206 /*
207
208 As it involves file access, this should only be done once when the program first runs.
209 This is a default algorithm -- browser don't HAVE to use this.
210
211 */
212 extern HTParentAnchor *HTHomeAnchor(void);
213
214 /*
215
216 Return Host Name
217
218 */
219 extern const char *HTHostName(void);
220
221 /*
222
223 For registering protocols supported by Lynx
224
225 */
226 extern void LYRegisterLynxProtocols(void);
227
228 extern void LYUCPushAssumed(HTParentAnchor *anchor);
229 extern int LYUCPopAssumed(void);
230
231 extern BOOL using_proxy; /* Are we using an NNTP proxy? */
232
233 #ifdef __cplusplus
234 }
235 #endif
236 #endif /* HTACCESS_H */