Annotation of libwww/Library/src/HTAccess.html, revision 2.45
2.9 timbl 1: <HTML>
2: <HEAD>
2.45 ! frystyk 3: <TITLE>Access manager for libwww</TITLE>
2.19 timbl 4: <NEXTID N="z11">
2.9 timbl 5: </HEAD>
2.5 timbl 6: <BODY>
2.39 frystyk 7:
2.33 frystyk 8: <H1>Access Manager</H1>
2.39 frystyk 9:
2.41 frystyk 10: <PRE>
11: /*
12: ** (c) COPYRIGHT CERN 1994.
13: ** Please first read the full copyright statement in the file COPYRIGH.
14: */
15: </PRE>
16:
2.39 frystyk 17: This module keeps a list of valid protocol (naming scheme) specifiers
18: with associated access code. It allows documents to be loaded given
19: various combinations of parameters. New access protocols may be
20: registered at any time.<P>
21:
22: <B>Note:</B> HTRequest defined and request parameter added to almost
23: all calls 18 Nov 1993.<P>
24:
25: This module is implemented by <A HREF="HTAccess.c">HTAccess.c</A>, and
26: it is a part of the <A NAME="z10"
27: HREF="http://info.cern.ch/hypertext/WWW/Library/User/Guide/Guide.html">Library
28: of Common Code</A>. <P>
29:
30: The module contains a lot of stuff but the main topics are:
31:
32: <UL>
2.41 frystyk 33: <LI><A HREF="#Library">Initializing and Terminating the Library</A>
2.39 frystyk 34: <LI><A HREF="#Methods">Management of access methods</A>
35: <LI><A HREF="#Addresses">A lot of hard coded addresses</A>
36: <LI><A HREF="#z1">The HTRequest structure</A>
37: <LI><A HREF="#z100">Management of the HTRequest structure</A>
38: <LI><A HREF="#LoadDoc">Functions for loading a document</A>
39: <LI><A HREF="#ClientHelp">Help functions for clients to get started</A>
40: <LI><A HREF="#PostDoc">Functions for posting a document</A>
41: <LI><A HREF="#ProtReg">Access Method Registration</H2></A>
42: </UL>
43:
2.33 frystyk 44:
45: <PRE>
46: #ifndef HTACCESS_H
1.1 timbl 47: #define HTACCESS_H
2.44 roeber 48:
2.16 luotonen 49: #include "HTList.h"
2.39 frystyk 50: #include "HTChunk.h"
2.35 frystyk 51: </PRE>
1.1 timbl 52:
2.35 frystyk 53: <B>Short Names</B>
54: <PRE>
1.1 timbl 55: #ifdef SHORT_NAMES
2.8 timbl 56: #define HTClientHost HTClHost
57: #define HTSearchAbsolute HTSeAbso
58: #define HTOutputStream HTOuStre
59: #define HTOutputFormat HTOuForm
1.1 timbl 60: #endif
2.33 frystyk 61: </PRE>
1.1 timbl 62:
2.36 frystyk 63: <H2>Flags which may be set to control this module</H2>
64:
65: <PRE>
66: extern char * HTSaveLocallyDir; /* Dir home for "save locally" files */
67: extern char * HTCacheDir; /* Cache dir, default NULL: no cache */
68: extern char * HTClientHost; /* Name or number of telnetting host */
69: extern FILE * HTlogfile; /* File to output one-liners to */
70: extern BOOL HTSecure; /* Disable security holes? */
71: extern char * HTImServer; /* If I'm cern_httpd */
72: extern BOOL HTImProxy; /* If I'm cern_httpd as a proxy */
73: extern BOOL HTForceReload; /* Force reload from cache or net */
74: </PRE>
75:
2.41 frystyk 76: <A NAME="Library"><H2>Initializing and Terminating the Library</H2></A>
77:
78: <IMG SRC="http://info.cern.ch/hypertext/WWW/Icons/32x32/warning.gif">
79: These two functions initiates memory and settings for the Library and
80: cleans up memory kept by the Library when about to exit the
81: application. It is highly recommended that they are used!
82:
83: <PRE>
84: extern BOOL HTLibInit NOPARAMS;
85: extern BOOL HTLibTerminate NOPARAMS;
86: </PRE>
87:
2.39 frystyk 88: <A NAME="Methods"><H2>Method Management</H2></A>
2.33 frystyk 89:
2.41 frystyk 90: These are the valid methods, see <A
2.39 frystyk 91: HREF="http://info.cern.ch/hypertext/WWW/Protocols/HTTP/Methods.html">HTTP
92: Methods</A>
2.33 frystyk 93:
94: <PRE>
2.16 luotonen 95: typedef enum {
96: METHOD_INVALID = 0,
97: METHOD_GET = 1,
98: METHOD_HEAD,
99: METHOD_POST,
100: METHOD_PUT,
101: METHOD_DELETE,
102: METHOD_CHECKOUT,
103: METHOD_CHECKIN,
104: METHOD_SHOWMETHOD,
105: METHOD_LINK,
106: METHOD_UNLINK,
107: MAX_METHODS
108: } HTMethod;
2.33 frystyk 109: </PRE>
110:
111: <H3>Get Method Enumeration</H3>
2.16 luotonen 112:
2.33 frystyk 113: Gives the enumeration value of the method as a function of the (char *) name.
2.16 luotonen 114:
2.33 frystyk 115: <PRE>
2.40 frystyk 116: extern HTMethod HTMethod_enum PARAMS((char * name));
2.16 luotonen 117: </PRE>
118:
2.33 frystyk 119: <H3>Get Method String</H3>
2.16 luotonen 120:
2.33 frystyk 121: The reverse of <I>HTMethod_enum()</I>
2.16 luotonen 122:
2.33 frystyk 123: <PRE>
2.40 frystyk 124: extern char * HTMethod_name PARAMS((HTMethod method));
2.33 frystyk 125: </PRE>
126:
127: <H3>Valid Methods</H3>
2.16 luotonen 128:
2.33 frystyk 129: This functions searches the list of valid methods for a given anchor, see
130: <A HREF="HTAnchor.html">HTAnchor module</A> If the method is found it returns
131: YES else NO.
2.16 luotonen 132:
2.33 frystyk 133: <PRE>
2.40 frystyk 134: extern BOOL HTMethod_inList PARAMS((HTMethod method,
2.16 luotonen 135: HTList * list));
136: </PRE>
2.33 frystyk 137:
2.35 frystyk 138: <HR>
139: <EM>This section might be move to the Access Authentication Module</EM>
140:
2.36 frystyk 141: <H4>Match Template Against Filename</H4>
2.16 luotonen 142: <PRE>
2.40 frystyk 143: /* extern HTAA_templateMatch()
2.16 luotonen 144: ** STRING COMPARISON FUNCTION FOR FILE NAMES
145: ** WITH ONE WILDCARD * IN THE TEMPLATE
146: ** NOTE:
147: ** This is essentially the same code as in HTRules.c, but it
148: ** cannot be used because it is embedded in between other code.
149: ** (In fact, HTRules.c should use this routine, but then this
150: ** routine would have to be more sophisticated... why is life
151: ** sometimes so hard...)
152: **
153: ** ON ENTRY:
2.37 frystyk 154: ** tmplate is a template string to match the file name
2.16 luotonen 155: ** agaist, may contain a single wildcard
156: ** character * which matches zero or more
157: ** arbitrary characters.
158: ** filename is the filename (or pathname) to be matched
159: ** agaist the template.
160: **
161: ** ON EXIT:
162: ** returns YES, if filename matches the template.
163: ** NO, otherwise.
164: */
2.40 frystyk 165: extern BOOL HTAA_templateMatch PARAMS((CONST char * tmplate,
2.16 luotonen 166: CONST char * filename));
2.35 frystyk 167: </PRE>
2.16 luotonen 168:
2.35 frystyk 169: <HR>
2.16 luotonen 170:
2.35 frystyk 171: The following have to be defined
2.10 timbl 172: in advance of the other include files
173: because of circular references.
2.33 frystyk 174: <PRE>
175: typedef struct _HTRequest HTRequest;
2.39 frystyk 176: typedef struct _HTNetInfo HTNetInfo;
2.10 timbl 177:
2.14 luotonen 178: /*
2.39 frystyk 179: ** Callback to a protocol module
2.14 luotonen 180: */
2.39 frystyk 181: typedef int (*HTLoadCallBack) PARAMS((HTRequest * req));
2.14 luotonen 182:
2.10 timbl 183: #include "HTAnchor.h"
184: #include <A
185: NAME="z3" HREF="HTFormat.html">"HTFormat.h"</A>
2.15 luotonen 186: #include "HTAAUtil.h" /* HTAAScheme, HTAAFailReason */
2.14 luotonen 187: #include "HTAABrow.h" /* HTAASetup */
2.33 frystyk 188: </PRE>
2.10 timbl 189:
2.39 frystyk 190: <A NAME="Addresses"><H2>Default WWW Addresses</H2></A>
2.10 timbl 191:
2.33 frystyk 192: These control the home page selection. To mess with these for normal browses
2.6 timbl 193: is asking for user confusion.
2.33 frystyk 194: <PRE>
195: #define LOGICAL_DEFAULT "WWW_HOME" /* Defined to be the home page */
1.1 timbl 196:
2.6 timbl 197: #ifndef PERSONAL_DEFAULT
2.33 frystyk 198: #define PERSONAL_DEFAULT "WWW/default.html" /* in home directory */
2.6 timbl 199: #endif
2.33 frystyk 200:
2.6 timbl 201: #ifndef LOCAL_DEFAULT_FILE
1.1 timbl 202: #define LOCAL_DEFAULT_FILE "/usr/local/lib/WWW/default.html"
2.6 timbl 203: #endif
2.33 frystyk 204:
205: /* If one telnets to an access point it will look in this file for home page */
2.7 timbl 206: #ifndef REMOTE_POINTER
2.33 frystyk 207: #define REMOTE_POINTER "/etc/www-remote.url" /* can't be file */
2.7 timbl 208: #endif
2.33 frystyk 209:
2.7 timbl 210: /* and if that fails it will use this. */
2.6 timbl 211: #ifndef REMOTE_ADDRESS
2.33 frystyk 212: #define REMOTE_ADDRESS "http://info.cern.ch/remote.html" /* can't be file */
1.1 timbl 213: #endif
214:
2.33 frystyk 215: /* If run from telnet daemon and no -l specified, use this file: */
1.1 timbl 216: #ifndef DEFAULT_LOGFILE
217: #define DEFAULT_LOGFILE "/usr/adm/www-log/www-log"
218: #endif
219:
2.33 frystyk 220: /* If the home page isn't found, use this file: */
1.1 timbl 221: #ifndef LAST_RESORT
2.6 timbl 222: #define LAST_RESORT "http://info.cern.ch/default.html"
1.1 timbl 223: #endif
224:
2.33 frystyk 225: /* This is the default cache directory: */
2.23 frystyk 226: #ifndef CACHE_HOME_DIR
227: #define CACHE_HOME_DIR "/tmp/"
228: #endif
229:
2.33 frystyk 230: /* The default directory for "save locally" and "save and execute" files: */
2.23 frystyk 231: #ifndef SAVE_LOCALLY_HOME_DIR
232: #define SAVE_LOCALLY_HOME_DIR "/tmp/"
233: #endif
2.33 frystyk 234: </PRE>
2.10 timbl 235:
2.34 frystyk 236: <H2><A NAME="HTNetInfo">Protocol Specific Information</A></H2>
237:
2.45 ! frystyk 238: This structure contains information about socket number, input buffer
! 239: for reading from the network etc. The structure is used through out
! 240: the protocol modules and is the refenrence point for introducing multi
! 241: threaded execution into the library, see specifications on <A
! 242: HREF="http://info.cern.ch/hypertext/WWW/Library/User/Features/multithread.html">Multiple
! 243: Threads</A>.
2.34 frystyk 244:
245: <PRE>
2.39 frystyk 246: struct _HTNetInfo {
2.45 ! frystyk 247: SOCKFD sockfd; /* Socket descripter */
2.39 frystyk 248: SockA sock_addr; /* SockA is defined in tcp.h */
2.36 frystyk 249: HTInputSocket * isoc; /* Input buffer */
2.39 frystyk 250: HTStream * target; /* Output stream */
251: HTChunk * transmit; /* Line to be send */
2.36 frystyk 252: int addressCount; /* Attempts if multi-homed host */
2.39 frystyk 253: time_t connecttime; /* Used on multihomed hosts */
2.36 frystyk 254: struct _HTRequest * request; /* Link back to request structure */
2.39 frystyk 255: };
2.34 frystyk 256: </PRE>
257:
2.36 frystyk 258: <EM><B>Note:</B> The AddressCount varaible is used to count the number
259: of attempt to connect to a multi-homed host so we know when to stop
260: trying new IP-addresses.</EM>
261:
2.9 timbl 262: <H2><A
263: NAME="z1">The Request structure</A></H2>When a request is handled, all kinds
264: of things about it need to be passed
265: along. These are all put into a
2.31 frystyk 266: HTRequest structure. <P>
267:
2.35 frystyk 268: <B>Note 1:</B> There is also a <A NAME="z4" HREF="HTFormat.html#z17">global list of converters</A> <P>
269: <B>Note 2:</B> If you reuse the request structure for more than one
2.33 frystyk 270: request then make sure that the request is re-initialized, so that no `old'
271: data is reused, see <A HREF="#z100">functions to manipulate HTRequest
272: Structure</A>. The library handles its own internal information from request
2.39 frystyk 273: to request but the information set by the caller is untouched. <P>
2.31 frystyk 274:
2.39 frystyk 275: The elements of the request structure are as follows.
276:
277: <PRE>
278: struct _HTRequest {
279: </PRE>
2.19 timbl 280:
281: <H3>Set by the caller of HTaccess:</H3>
282:
2.39 frystyk 283: <PRE>
284: <A HREF="#Methods">HTMethod</A> method;
285: </PRE>
286:
287: An enum used to specify the HTTP <A NAME="z7"
288: HREF="../../Protocols/HTTP/Methods.html">method</A> used. The default
289: value is <CODE>GET</CODE>
290:
291: <PRE>
292: HTList * conversions;
293: </PRE>
294:
295: NULL, or a list of conversions which the format manager can do in
296: order to fulfill the request. It typically points to a list set up an
297: initialisation time for example by <A HREF="HTInit.html">HTInit().</A>
298:
299: <PRE>
300: HTList * encodings;
301: </PRE>
302:
303: The list of encodings acceptable in the output stream.
304:
305: <PRE>
306: HTList * languages;
307: </PRE>
308:
309: The list of (human) language values acceptable in the response. The default
310: is all languages.
311:
312: <PRE>
313: BOOL (*<A NAME="z9"> callback</A> ) PARAMS((struct _HTRequest* request,
314: void *param));
315: </PRE>
316:
317: A function to be called back in the event that a file has been saved
318: to disk by HTSaveAndCallBack for example.
319:
320: <PRE>
321: void * context;
322: </PRE>
323:
324: An arbitrary pointer passed to HTAccess and passed back as a parameter
325: to the <A NAME="z10" HREF="#z9">callback</A> .
326:
327: <PRE>
328: HTStream* output_stream;
329: </PRE>
330:
331: The output stream to be used to put data down to as they come in from the
332: network. The default value is <CODE>NULL</CODE> which means that the stream
333: goes to the user (display).
2.45 ! frystyk 334:
! 335: <PRE>
! 336: HTStream* output_flush;
! 337: </PRE>
! 338:
! 339: All object bodies sent from the server with status codes different
! 340: from <CODE>200 OK</CODE> will be put down this stream. This can be
! 341: used as a debug window etc. If the value is NULL (default) then the
! 342: stream used is <A HREF="HTFormat.html#BlackHole">HTBlackHole</A>.
2.39 frystyk 343:
344: <PRE>
345: HTAtom * output_format;
346: </PRE>
347:
348: The output format of the stream. This can be used to get unconverted
349: data etc. from the library. If <CODE>NULL</CODE>, then WWW_PRESENT is
350: default value.
351:
352: <PRE>
2.43 frystyk 353: BOOL BlockingIO;
354: </PRE>
355:
356: This flag can be set to override if a protocol module is registered as
357: using non-blocking IO.
358:
359: <PRE>
2.39 frystyk 360: HTParentAnchor *parentAnchor;
361: </PRE>
362:
363: If this parameter is set then a `Referer: <parent address> is
364: generated in the request to the server, see <A
365: HREF="http://info.cern.ch/hypertext/WWW/Protocols/HTTP/HTRQ_Headers.html#z14">
366: Referer field in a HTTP Request</A>
367:
368: <H3>Set by HTAccess</H3>
369:
370: None of the bits below may be looked at by a client application except
371: in the callback routine, when the anchor may be picked out.
372:
373: <PRE>
374: HTParentAnchor* anchor;
375: </PRE>
376:
377: The anchor for the object in question. Set immediately by HTAcesss.
378: Used by the protocol and parsing modules. Valid thoughout the access.
379:
380: <PRE>
381: HTChildAnchor * childAnchor; /* For element within the object */
382: </PRE>
383:
384: The anchor for the sub object if any. The object builder should
385: ensure that htis is selected, highlighted, etc when the object is
386: loaded.
387:
388: <PRE>
389: void * using_cache;
390: </PRE>
391:
392: Pointer to cache element if cache hit
2.19 timbl 393:
2.25 luotonen 394: <H3>Error Diagnostics</H3>
395: <PRE>
2.30 frystyk 396: BOOL error_block; /* YES if stream has been used */
2.29 luotonen 397: HTList * error_stack; /* List of errors */
2.25 luotonen 398:
2.34 frystyk 399: </PRE>
400: <H3>Library Side</H3>
401: <PRE>
402: HTNetInfo * net_info; /* Information about socket etc. */
2.36 frystyk 403: int redirections; /* Number of redirections */
2.25 luotonen 404: </PRE>
2.39 frystyk 405:
406: <H3>Temporary until we get a good MIME parser</H3>
407: <PRE>
408: char * redirect; /* Location or URI */
409: char * WWWAAScheme; /* WWW-Authenticate scheme */
410: char * WWWAARealm; /* WWW-Authenticate realm */
411: char * WWWprotection; /* WWW-Protection-Template */
412: </PRE>
413:
2.21 luotonen 414: <H3>Server Side</H3>
415: <PRE>
416: HTAtom * content_type; /* Content-Type: */
2.18 luotonen 417: HTAtom * content_language;/* Language */
418: HTAtom * content_encoding;/* Encoding */
2.16 luotonen 419: int content_length; /* Content-Length: */
2.21 luotonen 420: HTInputSocket * isoc; /* InputSocket object for reading */
2.14 luotonen 421: char * authorization; /* Authorization: field */
422: HTAAScheme scheme; /* Authentication scheme used */
2.19 timbl 423: </PRE>
2.21 luotonen 424: <H3>Client Side</H3>
2.19 timbl 425: <PRE>
2.14 luotonen 426: HTList * valid_schemes; /* Valid auth.schemes */
427: HTAssocList ** scheme_specifics;/* Scheme-specific parameters */
2.39 frystyk 428: char * authenticate; /* WWW-authenticate: field */
2.14 luotonen 429: char * prot_template; /* WWW-Protection-Template: field */
430: HTAASetup * setup; /* Doc protection info */
431: HTAARealm * realm; /* Password realm */
432: char * dialog_msg; /* Authentication prompt (client) */
2.10 timbl 433: };
2.9 timbl 434:
2.31 frystyk 435: </PRE>
436:
437: <H2><A NAME="z100">Functions to Manipulate a HTRequest Structure</A></H2>
438:
439: Just to make things easier especially for clients, here are some functions to
440: manipulate the request structure:
441:
442: <H3>Create blank request</H3>This request has defaults in -- in
2.9 timbl 443: most cases it will need some information
444: added before being passed to HTAccess,
445: but it will work as is for a simple
446: request.
2.14 luotonen 447: <PRE>
2.40 frystyk 448: extern HTRequest * HTRequest_new NOPARAMS;
2.31 frystyk 449: </PRE>
2.14 luotonen 450:
2.31 frystyk 451: <H3>Delete request structure</H3>Frees also conversion list hanging
2.19 timbl 452: from req->conversions.
2.14 luotonen 453: <PRE>
2.40 frystyk 454: extern void HTRequest_delete PARAMS((HTRequest * req));
2.31 frystyk 455: </PRE>
1.1 timbl 456:
2.31 frystyk 457: <H3>Clear a request structure</H3>
458: Clears a request structure so that it can be reused. The only thing that differs from using free/new is that the list of conversions is kept.
459: <PRE>
460: extern void HTRequest_clear PARAMS((HTRequest * req));
461: </PRE>
2.9 timbl 462:
2.39 frystyk 463: <A NAME="LoadDoc"><H2>Functions for Loading a Document</H2></A>
464:
465: There are several different ways of loading a document. However, the
466: major difference between them is whether the document is referenced by
467:
468: <UL>
469: <LI><A HREF="#Relative">Relative URI</A>
470: <LI><A HREF="#Absolute">Absolute URI</A>
471: <LI><A HREF="#Anchor">Anchor element</A> or
472: <LI>Contains keywords for <A HREF="#RelSearch">searching an relative URI</A>
473: <LI>Contains keywords for <A HREF="#AbsSearch">searching an absolute URI</A>
474: </UL>
475:
476: <B>NOTE:</B> From release 3.0 of the Library, the return codes from
477: the loading functions are no mode <CODE>BOOL</CODE>, that is
478: <CODE>YES</CODE> or <CODE>NO</CODE>. Insted they have been replaced
479: with the following set of return codes defined in the <A
480: HREF="HTUtils.html#ReturnCodes">Utility module</A>:
481:
2.5 timbl 482: <DL>
2.39 frystyk 483: <DT>HT_WOULD_BLOCK
484: <DD>An I/O operation would block
485:
486: <DT>HT_ERROR
487: <DD>Error has occured
488:
489: <DT>HT_LOADED
490: <DD>Success
491:
492: <DT>HT_NO_DATA
493: <DD>Success, but no document loaded. This might be the situation when a
494: telnet sesssion is started etc.
2.5 timbl 495: </DL>
496:
2.39 frystyk 497: However, a general rule about the return codes is that <B>ERRORS</B>
498: have a <EM>negative</EM> value whereas <B>SUCCESS</B> has a
499: <EM>positive</EM> value. <P>
1.1 timbl 500:
2.39 frystyk 501: There are also some functions to help the client getting started with
502: <A HREF="#ClientHelp">the first URI</A>.
1.1 timbl 503:
2.39 frystyk 504: <A NAME="Relative"><H3>Load a document from relative name</H3></A>
1.1 timbl 505:
2.39 frystyk 506: <PRE>
507: extern int HTLoadRelative PARAMS((CONST char * relative_name,
508: HTParentAnchor* here,
509: HTRequest * request));
2.5 timbl 510: </PRE>
2.39 frystyk 511:
512: <A NAME="Absolute"></A><H3>Load a document from absolute name</H3>
1.1 timbl 513:
2.5 timbl 514: <PRE>
2.39 frystyk 515: extern int HTLoadAbsolute PARAMS((CONST char * addr,
516: HTRequest * request));
2.5 timbl 517: </PRE>
2.39 frystyk 518:
519: <H3>Load a document from absolute name to a stream</H3>
520:
2.5 timbl 521: <PRE>
2.39 frystyk 522: extern int HTLoadToStream PARAMS((CONST char * addr,
523: BOOL filter,
524: HTRequest * request));
2.5 timbl 525: </PRE>
1.1 timbl 526:
2.39 frystyk 527: <A NAME="Anchor"><H3>Load if necessary, and select an anchor</H3></A>
1.1 timbl 528:
2.39 frystyk 529: The anchor parameter may be a child anchor. The anchor in the request
530: is set to the parent anchor. The recursive function keeps the error
531: stack in the request structure so that no information is lost having
532: more than one call. See also <A HREF="#BindAnchor">HTBindAnchor()</A>.
1.1 timbl 533:
2.39 frystyk 534: <PRE>
2.41 frystyk 535: extern int HTLoadAnchor PARAMS((HTAnchor * a,
536: HTRequest * request));
2.39 frystyk 537: extern int HTLoadAnchorRecursive PARAMS((HTAnchor * a,
538: HTRequest * request));
2.5 timbl 539: </PRE>
540:
2.39 frystyk 541: <H3>Load a Document</H3>
542:
2.41 frystyk 543: These are two internal routines fro loading a document which has an
544: address AND a matching anchor. (The public routines are called with
545: one OR the other.) This is recursively called from file load module
546: to try ftp (though this will be obsolete in the next major
547: release).<P>
1.1 timbl 548:
2.39 frystyk 549: If <CODE>keep_error_stack</CODE> is YES then the error (or info) stack
550: is not cleared from the previous call.
1.1 timbl 551:
2.39 frystyk 552: <PRE>
2.41 frystyk 553: extern int HTLoad PARAMS((HTRequest * request,
554: BOOL keep_error_stack));
555: </PRE>
556:
557: <PRE>
558: extern BOOL HTLoadTerminate PARAMS((HTRequest * request, int status));
2.5 timbl 559: </PRE>
560:
2.39 frystyk 561: <A NAME="RelSearch"><H3>Search Using Relative URI</H3></A>
562:
563: Performs a search on word given by the user. Adds the search words to
564: the end of the current address and attempts to open the new address.
565:
2.5 timbl 566: <PRE>
2.39 frystyk 567: extern int HTSearch PARAMS((CONST char * keywords,
568: HTParentAnchor* here,
569: HTRequest * request));
2.5 timbl 570: </PRE>
2.39 frystyk 571:
572: <A NAME="AbsSearch"><H3>Search using Absolute URI</H3></A>
573:
574: Performs a keyword search on word given by the user. Adds the keyword
575: to the end of the current address and attempts to open the new
576: address.
2.5 timbl 577:
2.33 frystyk 578: <PRE>
2.40 frystyk 579: extern int HTSearchAbsolute PARAMS((CONST char * keywords,
2.39 frystyk 580: CONST char * indexname,
581: HTRequest * request));
2.5 timbl 582: </PRE>
2.24 luotonen 583:
2.39 frystyk 584:
585: <A NAME="ClientHelp"><H2>Help Function for Clients to get started</H2></A>
586:
587: These function helps the client to load the first document. They are
588: not mandatory to use - but they make life easier!
589:
590: <A NAME="BindAnchor"><H3>Bind an anchor to a request structure without
591: loading</H3></A>
2.24 luotonen 592:
593: <PRE>
2.39 frystyk 594: extern BOOL HTBindAnchor PARAMS((HTAnchor *anchor, HTRequest *request));
2.24 luotonen 595: </PRE>
596:
2.39 frystyk 597: <A NAME="HomePage"><H3>Generate the Anchor for the Home Page</H3></A>
2.24 luotonen 598:
2.39 frystyk 599: As it involves file access, this should only be done once when the
600: program first runs. This is a default algorithm using the
601: <CODE>WWW_HOME</CODE> environment variable.
2.20 frystyk 602:
603: <PRE>
2.40 frystyk 604: extern HTParentAnchor * HTHomeAnchor NOPARAMS;
2.39 frystyk 605: </PRE>
606:
607: <H3>Find Related Name</H3>
608:
609: Creates a local file URI that can be used as a relative name when
610: calling HTParse() to expand a relative file name to an absolute
611: one. <P>
612:
613: The code for this routine originates from the Linemode browser and was
614: moved here by howcome@dxcern.cern.ch in order for all clients to take
615: advantage. <P>
616:
2.20 frystyk 617: <PRE>
2.39 frystyk 618: extern char * HTFindRelatedName NOPARAMS;
619: </PRE>
620:
621: <A NAME="PostDoc"><H2>Functions for Posting a Document</H2></A>
622:
623: This is not quite finished yet but more to come!
2.20 frystyk 624:
2.39 frystyk 625: <H3>Get a Save Stream</H3>
2.20 frystyk 626:
2.39 frystyk 627: <H4>On Entry,</H4>
2.5 timbl 628: <DL>
2.9 timbl 629: <DT>request->anchor
630: <DD> is valid anchor which
631: has previously beeing loaded
2.5 timbl 632: </DL>
633:
2.39 frystyk 634: <H4>On exit,</H4>
2.5 timbl 635: <DL>
636: <DT>returns
2.6 timbl 637: <DD> 0 if error else a stream
638: to save the object to.
2.5 timbl 639: </DL>
640:
641: <PRE>
2.40 frystyk 642: extern HTStream * HTSaveStream PARAMS((HTRequest * request));
2.39 frystyk 643: </PRE>
2.5 timbl 644:
1.1 timbl 645:
2.39 frystyk 646: <A NAME="ProtReg"><H2>Access Method Registration</H2></A>
1.1 timbl 647:
2.39 frystyk 648: An access method is defined by an HTProtocol structure which point to
649: the routines for performing the various logical operations on an
650: object: in HTTP terms, GET, PUT, and POST. The access methods
651: supported in the Library are initiated automaticly using the private
652: function <CODE>HTAccessInit()</CODE> <B>if not</B> defined
653: <CODE>NO_INIT</CODE> <P>
654:
655: Each of these routine takes as a parameter a <A NAME="z2"
656: HREF="#z1">request structure</A> containing details of the request.
657: When the protocol class routine is called, the anchor element in the
658: request is already valid (made valid by HTAccess).
659:
660: <PRE>
661: typedef enum _HTSocBlock {
662: SOC_BLOCK,
2.42 frystyk 663: SOC_NON_BLOCK
2.39 frystyk 664: } HTSocBlock;
665:
666: typedef struct _HTProtocol {
667: char * name;
668: HTSocBlock block;
669: int (*load) PARAMS((HTRequest * request));
670: HTStream* (*saveStream) PARAMS((HTRequest * request));
671: HTStream* (*postStream) PARAMS((HTRequest * request,
672: HTParentAnchor* postTo));
673: } HTProtocol;
1.1 timbl 674:
2.40 frystyk 675: extern BOOL HTRegisterProtocol PARAMS((HTProtocol * protocol));
2.42 frystyk 676: extern void HTDisposeProtocols NOPARAMS;
2.5 timbl 677: </PRE>
1.1 timbl 678:
2.39 frystyk 679: <H3>Uses Protocol Blocking IO</H3>
1.1 timbl 680:
2.39 frystyk 681: A small function to make life easier. Returns <CODE>YES</CODE> or
2.42 frystyk 682: <CODE>NO</CODE>. If the Library is run in NON-INTERACTIVE MODE then
683: the function always returns YES;
2.38 howcome 684:
685: <PRE>
2.40 frystyk 686: extern BOOL HTProtocolBlocking PARAMS((HTRequest * request));
2.38 howcome 687: </PRE>
688:
2.39 frystyk 689: end
2.25 luotonen 690:
691: <PRE>
1.1 timbl 692: #endif /* HTACCESS_H */
2.25 luotonen 693: </PRE>
694: end of HTAccess
695: </BODY>
2.9 timbl 696: </HTML>
Webmaster