Annotation of libwww/Library/src/HTProt.html, revision 2.20
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.1 frystyk 57: </PRE>
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: 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.13 frystyk 70: extern BOOL HTProtocol_add (const char * name,
2.15 frystyk 71: const char * transport,
2.12 frystyk 72: BOOL preemptive,
2.11 frystyk 73: HTEventCallback * client,
74: HTEventCallback * server);
2.1 frystyk 75: </PRE>
2.16 eric 76: <H3>
2.18 frystyk 77: Delete a Protocol
2.16 eric 78: </H3>
79: <P>
80: This functions deletes a registered protocol module so that it can not be
81: used for accessing a resource anymore.
2.5 frystyk 82: <PRE>
2.13 frystyk 83: extern BOOL HTProtocol_delete (const char * name);
2.5 frystyk 84: </PRE>
2.16 eric 85: <H3>
2.18 frystyk 86: Remove ALL Registered Protocols
2.16 eric 87: </H3>
88: <P>
89: This is the garbage collection function. It is called by
2.19 frystyk 90: <A HREF="HTLib.html">HTLibTerminate()</A>
2.5 frystyk 91: <PRE>
92: extern BOOL HTProtocol_deleteAll (void);
93: </PRE>
2.18 frystyk 94: <H2>
95: Protocol Class Methods
96: </H2>
2.16 eric 97: <H3>
98: Find a Protocol Object
99: </H3>
100: <P>
101: You can search the list of registered protocol objects as a function of the
102: access acheme. If an access scheme is found then the protocol object is returned.
2.1 frystyk 103: <PRE>
2.13 frystyk 104: extern HTProtocol * HTProtocol_find (HTRequest * request, const char * access);
2.1 frystyk 105: </PRE>
2.16 eric 106: <H3>
107: Get the callback functions
108: </H3>
109: <P>
110: You can get the callback functions registered together with a protocol object
111: using the following methods.
2.1 frystyk 112: <PRE>
2.11 frystyk 113: extern HTEventCallback * HTProtocol_client (HTProtocol * protocol);
114: extern HTEventCallback * HTProtocol_server (HTProtocol * protocol);
2.1 frystyk 115: </PRE>
2.16 eric 116: <H3>
117: Is Access Scheme Preemptive
118: </H3>
119: <P>
120: Returns YES if the implementation of the access scheme supports preemptive
121: access only.
2.1 frystyk 122: <PRE>
2.12 frystyk 123: extern BOOL HTProtocol_preemptive (HTProtocol * protocol);
2.1 frystyk 124: </PRE>
2.16 eric 125: <H3>
2.18 frystyk 126: Binding to the Transport Class
2.16 eric 127: </H3>
2.18 frystyk 128: <P>
129: An application protocol is registered together with a
130: <A HREF="HTTrans.html">transport protocol </A>in order to communicate with
131: the thansport layer.
2.1 frystyk 132: <PRE>
2.15 frystyk 133: extern BOOL HTProtocol_setTransport (HTProtocol * protoccol,
134: const char * transport);
135: extern const char * HTProtocol_transport (HTProtocol * protocol);
136: </PRE>
137: <PRE>
2.1 frystyk 138: #endif /* HTPROT_H */
139: </PRE>
2.16 eric 140: <P>
141: <HR>
2.15 frystyk 142: <ADDRESS>
2.20 ! frystyk 143: @(#) $Id: HTProt.html,v 2.19 1996/06/28 16:31:22 frystyk Exp $
2.15 frystyk 144: </ADDRESS>
2.16 eric 145: </BODY></HTML>
Webmaster