Annotation of libwww/Library/src/HTAccess.html, revision 2.8
2.5 timbl 1: <HEADER>
2.6 timbl 2: <TITLE>HTAccess: Access manager for libwww</TITLE>
2.5 timbl 3: <NEXTID N="1">
4: </HEADER>
5: <BODY>
6: <H1>Access Manager</H1>This module keeps a list of valid
7: protocol (naming scheme) specifiers
8: with associated access code. It
9: allows documents to be loaded given
10: various combinations of parameters.
11: New access protocols may be registered
12: at any time.<P>
13: Part of the <A
2.6 timbl 14: NAME=z0 HREF="Overview.html">libwww library</A> .
2.5 timbl 15: <PRE>#ifndef HTACCESS_H
1.1 timbl 16: #define HTACCESS_H
17:
18: /* Definition uses:
19: */
20: #include "HTUtils.h"
21: #include "tcp.h"
22: #include "HTAnchor.h"
23: #include "HTFormat.h"
24:
25: #ifdef SHORT_NAMES
2.8 ! timbl 26: #define HTClientHost HTClHost
! 27: #define HTSearchAbsolute HTSeAbso
! 28: #define HTOutputStream HTOuStre
! 29: #define HTOutputFormat HTOuForm
1.1 timbl 30: #endif
31:
32: /* Return codes from load routines:
33: **
34: ** These codes may be returned by the protocol modules,
35: ** and by the HTLoad routines.
36: ** In general, positive codes are OK and negative ones are bad.
37: */
38:
39: #define HT_NO_DATA -9999 /* return code: OK but no data was loaded */
40: /* Typically, other app started or forked */
41:
2.5 timbl 42: </PRE>
2.6 timbl 43: <H2>Default Addresses</H2>These control the home page selection.
2.8 ! timbl 44: To mess with these for normal browses
2.6 timbl 45: is asking for user confusion.
46: <PRE>#define LOGICAL_DEFAULT "WWW_HOME" /* Defined to be the home page */
1.1 timbl 47:
2.6 timbl 48: #ifndef PERSONAL_DEFAULT
49: #define PERSONAL_DEFAULT "WWW/default.html" /* in home directory */
50: #endif
51: #ifndef LOCAL_DEFAULT_FILE
1.1 timbl 52: #define LOCAL_DEFAULT_FILE "/usr/local/lib/WWW/default.html"
2.6 timbl 53: #endif
2.7 timbl 54: /* If one telnets to a www access point,
55: it will look in this file for home page */
56: #ifndef REMOTE_POINTER
57: #define REMOTE_POINTER "/etc/www-remote.url" /* can't be file */
58: #endif
59: /* and if that fails it will use this. */
2.6 timbl 60: #ifndef REMOTE_ADDRESS
1.1 timbl 61: #define REMOTE_ADDRESS "http://info.cern.ch/remote.html" /* can't be file */
62: #endif
63:
64: /* If run from telnet daemon and no -l specified, use this file:
65: */
66: #ifndef DEFAULT_LOGFILE
67: #define DEFAULT_LOGFILE "/usr/adm/www-log/www-log"
68: #endif
69:
70: /* If the home page isn't found, use this file:
71: */
72: #ifndef LAST_RESORT
2.6 timbl 73: #define LAST_RESORT "http://info.cern.ch/default.html"
1.1 timbl 74: #endif
75:
76:
2.5 timbl 77: </PRE>
78: <H2>Flags which may be set to control
79: this module</H2>
80: <PRE>extern int HTDiag; /* Flag: load source as plain text */
1.1 timbl 81: extern char * HTClientHost; /* Name or number of telnetting host */
82: extern FILE * logfile; /* File to output one-liners to */
2.7 timbl 83: extern BOOL HTSecure; /* Disable security holes? */
1.1 timbl 84: extern HTStream* HTOutputStream; /* For non-interactive, set this */
85: extern HTFormat HTOutputFormat; /* To convert on load, set this */
86:
87:
88:
2.5 timbl 89: </PRE>
90: <H2>Load a document from relative name</H2>
91: <H3>On Entry,</H3>
92: <DL>
93: <DT>relative_name
2.6 timbl 94: <DD> The relative address
2.5 timbl 95: of the file to be accessed.
96: <DT>here
2.6 timbl 97: <DD> The anchor of the object being
2.5 timbl 98: searched
99: </DL>
100:
101: <H3>On Exit,</H3>
102: <DL>
103: <DT>returns YES
2.6 timbl 104: <DD> Success in opening
2.5 timbl 105: file
106: <DT>NO
2.6 timbl 107: <DD> Failure
2.5 timbl 108: </DL>
1.1 timbl 109:
2.5 timbl 110: <PRE>extern BOOL HTLoadRelative PARAMS((
1.1 timbl 111: CONST char * relative_name,
112: HTParentAnchor * here));
113:
114:
2.5 timbl 115: </PRE>
116: <H2>Load a document from absolute name</H2>
117: <H3>On Entry,</H3>
118: <DL>
119: <DT>addr
2.6 timbl 120: <DD> The absolute address of the
121: document to be accessed.
2.5 timbl 122: <DT>filter
2.6 timbl 123: <DD> if YES, treat document as
124: HTML
2.5 timbl 125: </DL>
1.1 timbl 126:
2.5 timbl 127: <PRE>
128: </PRE>
129: <H3>On Exit,</H3>
130: <PRE>
131: </PRE>
132: <DL>
133: <DT>returns YES
2.6 timbl 134: <DD> Success in opening document
2.5 timbl 135: <DT>NO
2.6 timbl 136: <DD> Failure
2.5 timbl 137: </DL>
1.1 timbl 138:
2.5 timbl 139: <PRE>extern BOOL HTLoadAbsolute PARAMS((CONST char * addr));
1.1 timbl 140:
141:
2.5 timbl 142: </PRE>
143: <H2>Load a document from absolute name
144: to a stream</H2>
145: <H3>On Entry,</H3>
146: <DL>
147: <DT>addr
2.6 timbl 148: <DD> The absolute address of the
149: document to be accessed.
2.5 timbl 150: <DT>filter
2.6 timbl 151: <DD> if YES, treat document as
152: HTML
2.5 timbl 153: </DL>
154:
155: <H3>On Exit,</H3>
156: <DL>
157: <DT>returns YES
2.6 timbl 158: <DD> Success in opening document
2.5 timbl 159: <DT>NO
2.6 timbl 160: <DD> Failure
2.5 timbl 161: </DL>
162: Note: This is equivalent to HTLoadDocument
163: <PRE>extern BOOL HTLoadToStream PARAMS((CONST char * addr, BOOL filter,
1.1 timbl 164: HTStream * sink));
165:
166:
2.5 timbl 167: </PRE>
168: <H2>Load if necessary, and select an
169: anchor</H2>
170: <H3>On Entry,</H3>
171: <DL>
172: <DT>destination
173: <DD> The child or
174: parenet anchor to be loaded.
175: </DL>
176:
177: <PRE>
178: </PRE>
179: <H3>On Exit,</H3>
180: <PRE>
181: </PRE>
182: <DL>
183: <DT>returns YES
2.6 timbl 184: <DD> Success
2.5 timbl 185: <DT>returns NO
2.6 timbl 186: <DD> Failure
2.5 timbl 187: </DL>
188:
189: <PRE>
190:
1.1 timbl 191:
192: extern BOOL HTLoadAnchor PARAMS((HTAnchor * destination));
193:
194:
2.5 timbl 195: </PRE>
196: <H2>Make a stream for Saving object back</H2>
197: <H3>On Entry,</H3>
198: <DL>
199: <DT>anchor
2.6 timbl 200: <DD> is valid anchor which has
201: previously beeing loaded
2.5 timbl 202: </DL>
203:
204: <H3>On exit,</H3>
205: <DL>
206: <DT>returns
2.6 timbl 207: <DD> 0 if error else a stream
208: to save the object to.
2.5 timbl 209: </DL>
210:
211: <PRE>
212:
1.1 timbl 213: extern HTStream * HTSaveStream PARAMS((HTParentAnchor * anchor));
214:
215:
2.5 timbl 216: </PRE>
217: <H2>Search</H2>Performs a search on word given by
218: the user. Adds the search words to
219: the end of the current address and
220: attempts to open the new address.
221: <H3>On Entry,</H3>
222: <DL>
223: <DT>*keywords
2.6 timbl 224: <DD> space-separated keyword
2.5 timbl 225: list or similar search list
226: <DT>here
2.6 timbl 227: <DD> The anchor of the object being
2.5 timbl 228: searched
229: </DL>
1.1 timbl 230:
2.5 timbl 231: <PRE>extern BOOL HTSearch PARAMS((CONST char * keywords, HTParentAnchor* here));
1.1 timbl 232:
233:
2.5 timbl 234: </PRE>
235: <H2>Search Given Indexname</H2>Performs a keyword search on word
236: given by the user. Adds the keyword
237: to the end of the current address
238: and attempts to open the new address.
239: <H3>On Entry,</H3>
240: <DL>
241: <DT>*keywords
2.6 timbl 242: <DD> space-separated keyword
2.5 timbl 243: list or similar search list
244: <DT>*indexname
2.6 timbl 245: <DD> is name of object search
2.5 timbl 246: is to be done on.
247: </DL>
1.1 timbl 248:
2.5 timbl 249: <PRE>extern BOOL HTSearchAbsolute PARAMS((
1.1 timbl 250: CONST char * keywords,
251: CONST char * indexname));
252:
253:
2.5 timbl 254: </PRE>
255: <H2>Register an access method</H2>
256: <PRE>
1.1 timbl 257: typedef struct _HTProtocol {
258: char * name;
259:
260: int (*load)PARAMS((
261: CONST char * full_address,
262: HTParentAnchor * anchor,
263: HTFormat format_out,
264: HTStream* sink));
265:
266: HTStream* (*saveStream)PARAMS((HTParentAnchor * anchor));
267:
268: } HTProtocol;
269:
270: extern BOOL HTRegisterProtocol PARAMS((HTProtocol * protocol));
271:
272:
2.5 timbl 273: </PRE>
274: <H2>Generate the anchor for the home
275: page</H2>
276: <PRE>
277: </PRE>As it involves file access, this
278: should only be done once when the
279: program first runs. This is a default
280: algorithm -- browser don't HAVE to
281: use this.
282: <PRE>extern HTParentAnchor * HTHomeAnchor NOPARAMS;
1.1 timbl 283:
284: #endif /* HTACCESS_H */
2.6 timbl 285: </PRE>end of HTAccess</A></BODY>
Webmaster