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

2.1       frystyk     1: <HTML>
                      2: <HEAD>
2.14      frystyk     3: <TITLE>W3C Reference Library libwww PROTOCOLS</TITLE>
2.15    ! frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen, 26-Mar-1996 -->
2.1       frystyk     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
2.7       frystyk    23: is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
                     24: Reference Library</A>. <P>
2.1       frystyk    25: 
                     26: <PRE>
                     27: #ifndef HTPROT_H
                     28: #define HTPROT_H
                     29: 
2.5       frystyk    30: #include "HTReq.h"
2.1       frystyk    31: #include "HTAnchor.h"
2.5       frystyk    32: #include "HTEvntrg.h"
2.15    ! frystyk    33: #include "HTTrans.h"
2.1       frystyk    34: </PRE>
                     35: 
2.5       frystyk    36: After the new architecture based on call back functions managed by an
                     37: eventloop and protocol state machines, the protocol structure has been
                     38: modified to reflect this call back structure. The
2.9       frystyk    39: <CODE>HTEventCallback</CODE> is defined in <A
2.5       frystyk    40: HREF="HTEvntrg.html">HTEvntrg module</A>. <P>
                     41: 
2.8       frystyk    42: All the access schemes supported in the Library can be initiated using
                     43: the function <CODE>HTAccessInit()</CODE> in <A
                     44: HREF="HTInit.html">HTInit module</A><P>
2.5       frystyk    45: 
                     46: An access scheme module takes as a parameter a socket (which is an
                     47: invalid socket the first time the function is called), a <A
2.6       frystyk    48: HREF="HTReqMan.html">request structure</A> containing details of the
2.5       frystyk    49: request, and the action by which the (valid) socket was selected in
                     50: the event loop.  When the protocol class routine is called, the anchor
2.1       frystyk    51: element in the request is already valid (made valid by HTAccess).
                     52: 
                     53: <PRE>
2.5       frystyk    54: typedef struct _HTProtocol HTProtocol;
2.1       frystyk    55: </PRE>
                     56: 
                     57: <H3>Add an Access Scheme</H3>
                     58: 
                     59: This functions registers a protocol module and binds it to a specific
2.5       frystyk    60: access acheme. For example HTTP.c is bound to http URLs. The call back
                     61: function is the function to be called for loading. The reason why it
                     62: is of type HTEventCallback is that it then can be used directly in the
2.12      frystyk    63: event loop when used in non-preemptive mode.
2.1       frystyk    64: 
                     65: <PRE>
2.13      frystyk    66: extern BOOL HTProtocol_add (const char *               name,
2.15    ! frystyk    67:                            const char *        transport,
2.12      frystyk    68:                            BOOL                preemptive,
2.11      frystyk    69:                            HTEventCallback *   client,
                     70:                            HTEventCallback *   server);
2.1       frystyk    71: </PRE>
                     72: 
2.5       frystyk    73: <H3>Delete an Access Scheme</H3>
                     74: 
                     75: This functions deletes a registered protocol module so that it can not
                     76: be used for accessing a resource anymore.
                     77: 
                     78: <PRE>
2.13      frystyk    79: extern BOOL HTProtocol_delete (const char * name);
2.5       frystyk    80: </PRE>
                     81: 
                     82: <H3>Remove ALL Registered Schemes</H3>
                     83: 
                     84: This is the garbage collection function. It is called by <A
2.7       frystyk    85: HREF="HTAccess.html#Library">HTLibTerminate()</A>
2.5       frystyk    86: 
                     87: <PRE>
                     88: extern BOOL HTProtocol_deleteAll (void);
                     89: </PRE>
                     90: 
2.11      frystyk    91: <H3>Find a Protocol Object</H3>
2.1       frystyk    92: 
2.11      frystyk    93: You can search the list of registered protocol objects as a function
                     94: of the access acheme. If an access scheme is found then the protocol
                     95: object is returned.
2.1       frystyk    96: 
                     97: <PRE>
2.13      frystyk    98: extern HTProtocol * HTProtocol_find (HTRequest * request, const char * access);
2.1       frystyk    99: </PRE>
                    100: 
2.11      frystyk   101: <H3>Get the callback functions</H3>
2.1       frystyk   102: 
2.11      frystyk   103: You can get the callback functions registered together with a protocol
                    104: object using the following methods.
2.1       frystyk   105: 
                    106: <PRE>
2.11      frystyk   107: extern HTEventCallback * HTProtocol_client (HTProtocol * protocol);
                    108: extern HTEventCallback * HTProtocol_server (HTProtocol * protocol);
2.1       frystyk   109: </PRE>
                    110: 
2.12      frystyk   111: <H3>Is Access Scheme Preemptive</H3>
2.1       frystyk   112: 
2.5       frystyk   113: Returns YES if the implementation of the access scheme supports
2.12      frystyk   114: preemptive access only.
2.1       frystyk   115: 
                    116: <PRE>
2.12      frystyk   117: extern BOOL HTProtocol_preemptive (HTProtocol * protocol);
2.1       frystyk   118: </PRE>
                    119: 
2.15    ! frystyk   120: <H3>Get and Set the Transport</H3>
        !           121: 
2.1       frystyk   122: <PRE>
2.15    ! frystyk   123: extern BOOL HTProtocol_setTransport (HTProtocol * protoccol,
        !           124:                                     const char * transport);
        !           125: extern const char * HTProtocol_transport (HTProtocol * protocol);
        !           126: </PRE>
        !           127: 
        !           128: <PRE>
2.1       frystyk   129: #endif /* HTPROT_H */
                    130: </PRE>
                    131: 
2.15    ! frystyk   132: <HR>
        !           133: <ADDRESS>
        !           134: @(#) $Id: Date Author State $
        !           135: </ADDRESS>
2.1       frystyk   136: </BODY>
                    137: </HTML>

Webmaster