Annotation of libwww/Library/src/HTTrans.html, revision 2.6
2.1 frystyk 1: <HTML>
2: <HEAD>
2.6 ! frystyk 3: <TITLE>W3C Sample Code Library libwww Transport Class</TITLE>
2.1 frystyk 4: </HEAD>
5: <BODY>
2.2 frystyk 6: <H1>
7: The Transport Class
8: </H1>
2.1 frystyk 9: <PRE>
10: /*
11: ** (c) COPYRIGHT MIT 1995.
12: ** Please first read the full copyright statement in the file COPYRIGH.
13: */
14: </PRE>
2.2 frystyk 15: <P>
16: The Transport Class defines a transport as used by the
17: <A HREF="HTChannl.html">HTChannel class</A> to communicate with the network,
18: the local file system etc. New transport objects may be registered at any
19: time. This allows the application to easily hook in its own transport layers.
20: The purpose of the HTTransport object is to contain transport dependent methods
21: for opening and closing a connection to the transport and also to get an
22: input stream and an output strean for reading and writing to the transport
23: respectively.
24: <P>
25: <B>Note</B>: The library <B>core</B> does not define any default transport
26: objects - they are all considered part of the application. The library comes
27: with a default set of transports which can be initiated using the function
28: <CODE>HTTransportInit()</CODE> in <A HREF="HTInit.html">HTInit module</A>
29: <P>
30: This module is implemented by <A HREF="HTTrans.c">HTTrans.c</A>, and it is
2.6 ! frystyk 31: a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C Sample Code
2.2 frystyk 32: Library</A>.
2.1 frystyk 33: <PRE>
34: #ifndef HTTRANS_H
35: #define HTTRANS_H
36: </PRE>
2.2 frystyk 37: <H2>
38: Creation and Deletion Methods
39: </H2>
40: <P>
41: All transport interfaces are registered dynamically in libwww. This means
42: that libwww is independent of the transport being used (for example TCP)
43: and you can therefore use libwww in any context you like. You have to specify
44: a set of parameters in order for libwww to be able to use it. The transport
45: class is defined as follows:
2.1 frystyk 46: <PRE>
47: typedef struct _HTTransport HTTransport;
48:
2.4 frystyk 49: typedef enum _HTTransportMode {
50: HT_TP_SINGLE = 0, /* One single request at a time */
51: HT_TP_PIPELINE = 1, /* Use pipelined requests */
52: HT_TP_INTERLEAVE = 2 /* Can we interleave requests? */
53: } HTTransportMode;
54:
2.1 frystyk 55: #include "HTIOStream.h"
2.5 frystyk 56: #include "HTReq.h"
2.1 frystyk 57: </PRE>
2.2 frystyk 58: <H3>
59: Add a Transport
60: </H3>
61: <P>
62: A new transport can be registered at any time in the Library. You must specify
63: a name ad the supported channel mode that the transport supports. Then you
64: must also register two creation methods of an input and an output stream
65: respectively. You can find the definition of the I/O streams in the
66: <A HREF="HTIOStream.html">HTIOStream module</A>.
2.1 frystyk 67: <PRE>
68: extern BOOL HTTransport_add (const char * name,
2.4 frystyk 69: HTTransportMode mode,
2.1 frystyk 70: HTInput_new * get_input,
71: HTOutput_new * get_output);
72: </PRE>
2.2 frystyk 73: <H3>
74: Delete a Transport
75: </H3>
76: <P>
77: This functions deletes a registered protocol module so that it can not be
78: used for accessing a resource anymore.
2.1 frystyk 79: <PRE>
80: extern BOOL HTTransport_delete (const char * name);
81: </PRE>
2.2 frystyk 82: <H3>
83: Remove ALL Registered Transports
84: </H3>
85: <P>
86: This is the garbage collection function. It is called by
2.3 frystyk 87: <A HREF="HTLib.html">HTLibTerminate()</A>
2.1 frystyk 88: <PRE>
89: extern BOOL HTTransport_deleteAll (void);
90: </PRE>
2.2 frystyk 91: <H2>
92: Transport Class Methods
93: </H2>
94: <H3>
95: Find a Transport Protocol Object
96: </H3>
97: <P>
98: You can search the list of registered protocol objects as a function of the
99: access acheme. If an access scheme is found then the protocol object is returned.
2.1 frystyk 100: <PRE>
101: extern HTTransport * HTTransport_find (HTRequest * request, const char * name);
102: </PRE>
2.2 frystyk 103: <H3>
2.4 frystyk 104: Supported Transort Modes
2.2 frystyk 105: </H3>
106: <P>
2.4 frystyk 107: A transport object is registered with the flow control
108: mode that it supports. This mode describes whether we can issue multiple
109: requests at the same time.
2.1 frystyk 110: <PRE>
2.4 frystyk 111: extern HTTransportMode HTTransport_mode (HTTransport * tp);
112: extern BOOL HTTransport_setMode (HTTransport * tp, HTTransportMode mode);
2.1 frystyk 113: </PRE>
2.2 frystyk 114: <H3>
115: Input and Output Stream Creation Methods
116: </H3>
2.1 frystyk 117: <PRE>
118: struct _HTTransport {
119: char * name;
2.4 frystyk 120: HTTransportMode mode; /* Flow mode supported */
2.1 frystyk 121: HTInput_new * input_new; /* Input stream creation method */
122: HTOutput_new * output_new; /* Output stream creation method */
123: };
124: </PRE>
125: <PRE>
126: #endif /* HTTRANS_H */
127: </PRE>
2.2 frystyk 128: <P>
129: <HR>
2.1 frystyk 130: <ADDRESS>
2.6 ! frystyk 131: @(#) $Id: HTTrans.html,v 2.5 1996/11/30 23:32:00 frystyk Exp $
2.1 frystyk 132: </ADDRESS>
2.2 frystyk 133: </BODY></HTML>
Webmaster