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