Annotation of libwww/Library/src/HTProt.html, revision 2.20.2.1
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.5 frystyk 43: #include "HTReq.h"
2.1 frystyk 44: #include "HTAnchor.h"
2.16 eric 45: #include "HTEvent.h"
2.15 frystyk 46: #include "HTTrans.h"
2.1 frystyk 47: </PRE>
2.16 eric 48: <P>
49: An access scheme module takes as a parameter a socket (which is an invalid
50: socket the first time the function is called), a
51: <A HREF="HTReqMan.html">request structure</A> containing details of the request,
52: and the action by which the (valid) socket was selected in the event loop.
53: When the protocol class routine is called, the anchor element in the request
54: is already valid (made valid by HTAccess).
2.1 frystyk 55: <PRE>
2.5 frystyk 56: typedef struct _HTProtocol HTProtocol;
2.20.2.1! eric 57: typedef int HTProtCallback (SOCKET, HTRequest *);
2.1 frystyk 58: </PRE>
2.18 frystyk 59: <H2>
60: Creation and Deletion Methods
61: </H2>
2.16 eric 62: <H3>
2.18 frystyk 63: Add an Protocol
2.16 eric 64: </H3>
65: <P>
66: This functions registers a protocol module and binds it to a specific access
2.18 frystyk 67: acheme (the part before the first colon in a URL). For example, the HTTP
68: client module is bound to http URLs. The callback function is the function
69: to be called for loading.
2.1 frystyk 70: <PRE>
2.13 frystyk 71: extern BOOL HTProtocol_add (const char * name,
2.15 frystyk 72: const char * transport,
2.20.2.1! eric 73: u_short port,
2.12 frystyk 74: BOOL preemptive,
2.20.2.1! eric 75: HTProtCallback * client,
! 76: HTProtCallback * server);
2.1 frystyk 77: </PRE>
2.16 eric 78: <H3>
2.18 frystyk 79: Delete a Protocol
2.16 eric 80: </H3>
81: <P>
82: This functions deletes a registered protocol module so that it can not be
83: used for accessing a resource anymore.
2.5 frystyk 84: <PRE>
2.13 frystyk 85: extern BOOL HTProtocol_delete (const char * name);
2.5 frystyk 86: </PRE>
2.16 eric 87: <H3>
2.18 frystyk 88: Remove ALL Registered Protocols
2.16 eric 89: </H3>
90: <P>
91: This is the garbage collection function. It is called by
2.19 frystyk 92: <A HREF="HTLib.html">HTLibTerminate()</A>
2.5 frystyk 93: <PRE>
94: extern BOOL HTProtocol_deleteAll (void);
95: </PRE>
2.18 frystyk 96: <H2>
97: Protocol Class Methods
98: </H2>
2.16 eric 99: <H3>
100: Find a Protocol Object
101: </H3>
102: <P>
103: You can search the list of registered protocol objects as a function of the
104: access acheme. If an access scheme is found then the protocol object is returned.
2.1 frystyk 105: <PRE>
2.13 frystyk 106: extern HTProtocol * HTProtocol_find (HTRequest * request, const char * access);
2.1 frystyk 107: </PRE>
2.16 eric 108: <H3>
109: Get the callback functions
110: </H3>
111: <P>
112: You can get the callback functions registered together with a protocol object
113: using the following methods.
2.1 frystyk 114: <PRE>
2.20.2.1! eric 115: extern HTProtCallback * HTProtocol_client (HTProtocol * protocol);
! 116: extern HTProtCallback * HTProtocol_server (HTProtocol * protocol);
! 117: </PRE>
! 118: <H3>
! 119: Get the default port
! 120: </H3>
! 121: <P>
! 122: Each protocol is registered with a default port
! 123: <PRE>
! 124: extern u_short HTProtocol_port (HTProtocol * protocol);
2.1 frystyk 125: </PRE>
2.16 eric 126: <H3>
127: Is Access Scheme Preemptive
128: </H3>
129: <P>
130: Returns YES if the implementation of the access scheme supports preemptive
131: access only.
2.1 frystyk 132: <PRE>
2.12 frystyk 133: extern BOOL HTProtocol_preemptive (HTProtocol * protocol);
2.1 frystyk 134: </PRE>
2.16 eric 135: <H3>
2.18 frystyk 136: Binding to the Transport Class
2.16 eric 137: </H3>
2.18 frystyk 138: <P>
139: An application protocol is registered together with a
140: <A HREF="HTTrans.html">transport protocol </A>in order to communicate with
141: the thansport layer.
2.1 frystyk 142: <PRE>
2.15 frystyk 143: extern BOOL HTProtocol_setTransport (HTProtocol * protoccol,
144: const char * transport);
145: extern const char * HTProtocol_transport (HTProtocol * protocol);
146: </PRE>
147: <PRE>
2.1 frystyk 148: #endif /* HTPROT_H */
149: </PRE>
2.16 eric 150: <P>
151: <HR>
2.15 frystyk 152: <ADDRESS>
2.20.2.1! eric 153: @(#) $Id: HTProt.html,v 2.20 1996/07/04 18:40:25 frystyk Exp $
2.15 frystyk 154: </ADDRESS>
2.16 eric 155: </BODY></HTML>
Webmaster