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