Annotation of libwww/Library/src/HTProt.html, revision 2.1

2.1     ! frystyk     1: <HTML>
        !             2: <HEAD>
        !             3: <TITLE>Access Scheme Manager</TITLE>
        !             4: <!-- Changed by: Henrik Frystyk Nielsen,  7-Jul-1995 -->
        !             5: <NEXTID N="z11">
        !             6: </HEAD>
        !             7: <BODY>
        !             8: 
        !             9: <H1>Access Scheme Manager</H1>
        !            10: 
        !            11: <PRE>
        !            12: /*
        !            13: **     (c) COPYRIGHT MIT 1995.
        !            14: **     Please first read the full copyright statement in the file COPYRIGH.
        !            15: */
        !            16: </PRE>
        !            17: 
        !            18: This module keeps a list of valid protocol (naming scheme) specifiers
        !            19: with associated access code. New access protocols may be registered at
        !            20: any time.<P>
        !            21: 
        !            22: This module is implemented by <A HREF="HTProt.c">HTProt.c</A>, and it
        !            23: is a part of the <A NAME="z10"
        !            24: HREF="http://www.w3.org/hypertext/WWW/Library/User/Guide/Guide.html">
        !            25: Library of Common Code</A>. <P>
        !            26: 
        !            27: <PRE>
        !            28: #ifndef HTPROT_H
        !            29: #define HTPROT_H
        !            30: 
        !            31: #include "HTAccess.h"
        !            32: #include "HTAnchor.h"
        !            33: </PRE>
        !            34: 
        !            35: An access scheme is defined by an HTProtocol structure which point to
        !            36: the routines for performing the various logical operations on an
        !            37: object: in HTTP terms, GET, PUT, and POST. The access schemes
        !            38: supported in the Library are initiated automaticly using the function
        !            39: <CODE>HTAccessInit()</CODE> <B>if not</B> defined
        !            40: <CODE>HT_NO_INIT</CODE> <P>
        !            41: 
        !            42: Each of these routine takes as a parameter a <A NAME="z2"
        !            43: HREF="HTAccess.html#z1">request structure</A> containing details of
        !            44: the request.  When the protocol class routine is called, the anchor
        !            45: element in the request is already valid (made valid by HTAccess).
        !            46: 
        !            47: <PRE>
        !            48: typedef enum _HTSocBlock {
        !            49:     SOC_BLOCK,
        !            50:     SOC_NON_BLOCK
        !            51: } HTSocBlock;
        !            52: 
        !            53: typedef struct _HTProtocol {
        !            54:     char *     name;
        !            55:     HTSocBlock block;  
        !            56:     int                (*load)         PARAMS((HTRequest *     request));
        !            57:     HTStream*  (*saveStream)   PARAMS((HTRequest *     request));
        !            58:     HTStream*  (*postStream)   PARAMS((HTRequest *     request,
        !            59:                                        HTParentAnchor* postTo));
        !            60: } HTProtocol;
        !            61: </PRE>
        !            62: 
        !            63: <H3>Add an Access Scheme</H3>
        !            64: 
        !            65: This functions registers a protocol module and binds it to a specific
        !            66: access acheme. For example HTTP.c is bound to http URLs.
        !            67: 
        !            68: <PRE>
        !            69: extern BOOL HTProtocol_add             PARAMS((HTProtocol * protocol));
        !            70: </PRE>
        !            71: 
        !            72: <H3>Get an Access Scheme</H3>
        !            73: 
        !            74: This function finds the access scheme that is bound to the anchor's
        !            75: type of URL. Returns YES if found, else NO
        !            76: 
        !            77: <PRE>
        !            78: extern BOOL HTProtocol_getScheme       PARAMS((HTParentAnchor * anchor));
        !            79: </PRE>
        !            80: 
        !            81: <H3>Remove ALL Registered Schemes</H3>
        !            82: 
        !            83: This is the garbage collection function. It is called by <A
        !            84: HREF="HTAccess.html#Library">HTLibTerminate</A>
        !            85: 
        !            86: <PRE>
        !            87: extern void HTProtocol_deleteAll       NOPARAMS;
        !            88: </PRE>
        !            89: 
        !            90: <H3>Is the Scheme using Blocking I/O?</H3>
        !            91: 
        !            92: A small function to make life easier. Returns <CODE>YES</CODE> or
        !            93: <CODE>NO</CODE>. If the Library is run in non-interactive mode then
        !            94: the function always returns YES;
        !            95: 
        !            96: <PRE>
        !            97: #define HTProtocol_isBlocking(me) \
        !            98:        ((me) &amp;&amp; ((me)->BlockingIO || \
        !            99:                ((me)->anchor &amp;&amp; (me)->anchor->protocol &amp;&amp; \
        !           100:                        ((HTProtocol*)((me)->anchor->protocol))->block==SOC_BLOCK)))
        !           101: </PRE>
        !           102: 
        !           103: <PRE>
        !           104: #endif /* HTPROT_H */
        !           105: </PRE>
        !           106: 
        !           107: End of Declaration
        !           108: 
        !           109: </BODY>
        !           110: </HTML>

Webmaster