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

2.1       frystyk     1: <HTML>
                      2: <HEAD>
2.16      eric        3:   <!-- Changed by: Henrik Frystyk Nielsen, 26-Mar-1996 -->
                      4:   <NEXTID N="z11">
2.18      frystyk     5:   <TITLE>W3C Reference Library libwww Protocol Class</TITLE>
2.1       frystyk     6: </HEAD>
                      7: <BODY>
2.16      eric        8: <H1>
2.18      frystyk     9:   The Protocol Class
2.16      eric       10: </H1>
2.1       frystyk    11: <PRE>
                     12: /*
                     13: **     (c) COPYRIGHT MIT 1995.
                     14: **     Please first read the full copyright statement in the file COPYRIGH.
                     15: */
                     16: </PRE>
2.16      eric       17: <P>
2.18      frystyk    18: The Protocol class defines an application level protocol (HTTP, FTP, Gopher,
                     19: etc.) to be used by libwww. Please note that access to the local file system
                     20: also is considered to be an appliaction level protocol treated identically
                     21: to for example the HTTP protocol. The Protocol class does only know about
                     22: the application layer protocol and it relies on the
                     23: <A HREF="HTTrans.html">Transport Class</A> to do the actualt communication
                     24: with the network, the local file system etc. The protocol class defines an
                     25: access method for botg a client and a server. A typical client application
                     26: would probably only want to use the client method and a server only the server
                     27: method. However, any application can use both which allows it to seemlessly
                     28: to change between server and client profile as needed.
                     29: <P>
                     30: <B>Note</B>: The library <B>core</B> does not define any default application
                     31: layer protocols - they are all considered part of the application. The library
                     32: comes with a default set of protocols including the ones mentioned above
2.20      frystyk    33: which can be initiated using the function <CODE>HTProtocolInit()</CODE> in
2.18      frystyk    34: <A HREF="HTInit.html">HTInit module</A>
2.16      eric       35: <P>
                     36: This module is implemented by <A HREF="HTProt.c">HTProt.c</A>, and it is
                     37: a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C Reference
                     38: Library</A>.
2.1       frystyk    39: <PRE>
                     40: #ifndef HTPROT_H
                     41: #define HTPROT_H
                     42: 
2.20.2.2! frystyk    43: typedef struct _HTProtocol HTProtocol;
        !            44: typedef u_short HTProtocolId;
        !            45: 
2.5       frystyk    46: #include "HTReq.h"
2.1       frystyk    47: #include "HTAnchor.h"
2.16      eric       48: #include "HTEvent.h"
2.15      frystyk    49: #include "HTTrans.h"
2.1       frystyk    50: </PRE>
2.16      eric       51: <P>
                     52: An access scheme module takes as a parameter a socket (which is an invalid
                     53: socket the first time the function is called), a
                     54: <A HREF="HTReqMan.html">request structure</A> containing details of the request,
                     55: and the action by which the (valid) socket was selected in the event loop.
                     56: When the protocol class routine is called, the anchor element in the request
                     57: is already valid (made valid by HTAccess).
2.18      frystyk    58: <H2>
                     59:   Creation and Deletion Methods
                     60: </H2>
2.16      eric       61: <H3>
2.18      frystyk    62:   Add an Protocol
2.16      eric       63: </H3>
                     64: <P>
                     65: This functions registers a protocol module and binds it to a specific access
2.18      frystyk    66: acheme (the part before the first colon in a URL). For example, the HTTP
                     67: &nbsp;client module is bound to http URLs. The callback function is the function
                     68: to be called for loading. 
2.1       frystyk    69: <PRE>
2.20.2.2! frystyk    70: typedef int HTProtCallback (SOCKET, HTRequest *);
        !            71: 
2.13      frystyk    72: extern BOOL HTProtocol_add (const char *               name,
2.15      frystyk    73:                            const char *        transport,
2.20.2.2! frystyk    74:                            HTProtocolId        port,
2.12      frystyk    75:                            BOOL                preemptive,
2.20.2.1  eric       76:                            HTProtCallback *    client,
                     77:                            HTProtCallback *    server);
2.1       frystyk    78: </PRE>
2.16      eric       79: <H3>
2.18      frystyk    80:   Delete a Protocol
2.16      eric       81: </H3>
                     82: <P>
                     83: This functions deletes a registered protocol module so that it can not be
                     84: used for accessing a resource anymore.
2.5       frystyk    85: <PRE>
2.13      frystyk    86: extern BOOL HTProtocol_delete (const char * name);
2.5       frystyk    87: </PRE>
2.16      eric       88: <H3>
2.18      frystyk    89:   Remove ALL Registered Protocols
2.16      eric       90: </H3>
                     91: <P>
                     92: This is the garbage collection function. It is called by
2.19      frystyk    93: <A HREF="HTLib.html">HTLibTerminate()</A>
2.5       frystyk    94: <PRE>
                     95: extern BOOL HTProtocol_deleteAll (void);
                     96: </PRE>
2.18      frystyk    97: <H2>
                     98:   Protocol Class Methods
                     99: </H2>
2.16      eric      100: <H3>
                    101:   Find a Protocol Object
                    102: </H3>
                    103: <P>
                    104: You can search the list of registered protocol objects as a function of the
                    105: access acheme. If an access scheme is found then the protocol object is returned.
2.1       frystyk   106: <PRE>
2.13      frystyk   107: extern HTProtocol * HTProtocol_find (HTRequest * request, const char * access);
2.1       frystyk   108: </PRE>
2.16      eric      109: <H3>
                    110:   Get the callback functions
                    111: </H3>
                    112: <P>
                    113: You can get the callback functions registered together with a protocol object
                    114: using the following methods.
2.1       frystyk   115: <PRE>
2.20.2.1  eric      116: extern HTProtCallback * HTProtocol_client (HTProtocol * protocol);
                    117: extern HTProtCallback * HTProtocol_server (HTProtocol * protocol);
                    118: </PRE>
                    119: <H3>
2.20.2.2! frystyk   120:   Get the default Protocol ID
2.20.2.1  eric      121: </H3>
                    122: <P>
2.20.2.2! frystyk   123: Each protocol is registered with a default protocol ID which is the default port number that this protocol is using. In the case of FTP it is 21, for HTTP, it is 80 and for NNTP it is 119.
2.20.2.1  eric      124: <PRE>
2.20.2.2! frystyk   125: extern HTProtocolId HTProtocol_id (HTProtocol * protocol);
2.1       frystyk   126: </PRE>
2.16      eric      127: <H3>
                    128:   Is Access Scheme Preemptive
                    129: </H3>
                    130: <P>
                    131: Returns YES if the implementation of the access scheme supports preemptive
                    132: access only.
2.1       frystyk   133: <PRE>
2.12      frystyk   134: extern BOOL HTProtocol_preemptive (HTProtocol * protocol);
2.1       frystyk   135: </PRE>
2.16      eric      136: <H3>
2.18      frystyk   137:   Binding to the Transport Class
2.16      eric      138: </H3>
2.18      frystyk   139: <P>
                    140: An application protocol is registered together with a
                    141: <A HREF="HTTrans.html">transport protocol </A>in order to communicate with
                    142: the thansport layer.
2.1       frystyk   143: <PRE>
2.15      frystyk   144: extern BOOL HTProtocol_setTransport (HTProtocol * protoccol,
                    145:                                     const char * transport);
                    146: extern const char * HTProtocol_transport (HTProtocol * protocol);
                    147: </PRE>
                    148: <PRE>
2.1       frystyk   149: #endif /* HTPROT_H */
                    150: </PRE>
2.16      eric      151: <P>
                    152:   <HR>
2.15      frystyk   153: <ADDRESS>
2.20.2.2! frystyk   154:   @(#) $Id: HTProt.html,v 2.20.2.1 1996/10/29 21:27:46 eric Exp $
2.15      frystyk   155: </ADDRESS>
2.16      eric      156: </BODY></HTML>

Webmaster