Annotation of libwww/Library/src/HTTrans.html, revision 2.9

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 &nbsp;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.7       frystyk    31: a part of the <A HREF="http://www.w3.org/Library/"> W3C Sample Code
2.2       frystyk    32: Library</A>.
2.1       frystyk    33: <PRE>
                     34: #ifndef HTTRANS_H
                     35: #define HTTRANS_H
2.9     ! vbancrof   36: 
        !            37: #ifdef __cplusplus
        !            38: extern "C" { 
        !            39: #endif 
2.1       frystyk    40: </PRE>
2.2       frystyk    41: <H2>
                     42:   Creation and Deletion Methods
                     43: </H2>
                     44: <P>
                     45: All transport interfaces are registered dynamically in libwww. This means
2.8       kahan      46: that libwww is independent of the transport being used (TCP, for example),
2.2       frystyk    47: and you can therefore use libwww in any context you like. You have to specify
                     48: a set of parameters in order for libwww to be able to use it. The transport
                     49: class is defined as follows:
2.1       frystyk    50: <PRE>
                     51: typedef struct _HTTransport HTTransport;
                     52: 
2.4       frystyk    53: typedef enum _HTTransportMode {
                     54:     HT_TP_SINGLE       = 0,            /* One single request at a time */
                     55:     HT_TP_PIPELINE     = 1,            /* Use pipelined requests */
                     56:     HT_TP_INTERLEAVE   = 2             /* Can we interleave requests? */
                     57: } HTTransportMode;
                     58: 
2.1       frystyk    59: #include "HTIOStream.h"
2.5       frystyk    60: #include "HTReq.h"
2.1       frystyk    61: </PRE>
2.2       frystyk    62: <H3>
                     63:   Add a Transport
                     64: </H3>
                     65: <P>
                     66: A new transport can be registered at any time in the Library. You must specify
                     67: a name ad the supported channel mode that the transport supports. Then you
                     68: must also register two creation methods of an input and an output stream
                     69: respectively. You can find the definition of the I/O streams in the
                     70: <A HREF="HTIOStream.html">HTIOStream module</A>.
2.1       frystyk    71: <PRE>
                     72: extern BOOL HTTransport_add (const char *              name,
2.4       frystyk    73:                             HTTransportMode            mode,
2.1       frystyk    74:                             HTInput_new *              get_input,
                     75:                             HTOutput_new *             get_output);
                     76: </PRE>
2.2       frystyk    77: <H3>
                     78:   Delete a Transport
                     79: </H3>
                     80: <P>
                     81: This functions deletes a registered protocol module so that it can not be
                     82: used for accessing a resource anymore.
2.1       frystyk    83: <PRE>
                     84: extern BOOL HTTransport_delete (const char * name);
                     85: </PRE>
2.2       frystyk    86: <H3>
                     87:   Remove ALL Registered Transports
                     88: </H3>
                     89: <P>
                     90: This is the garbage collection function. It is called by
2.3       frystyk    91: <A HREF="HTLib.html">HTLibTerminate()</A>
2.1       frystyk    92: <PRE>
                     93: extern BOOL HTTransport_deleteAll (void);
                     94: </PRE>
2.2       frystyk    95: <H2>
                     96:   Transport Class Methods
                     97: </H2>
                     98: <H3>
                     99:   Find a Transport Protocol Object
                    100: </H3>
                    101: <P>
                    102: You can search the list of registered protocol objects as a function of the
                    103: access acheme. If an access scheme is found then the protocol object is returned.
2.1       frystyk   104: <PRE>
                    105: extern HTTransport * HTTransport_find (HTRequest * request, const char * name);
                    106: </PRE>
2.2       frystyk   107: <H3>
2.4       frystyk   108:   Supported Transort Modes
2.2       frystyk   109: </H3>
                    110: <P>
2.4       frystyk   111: A transport object is registered with the flow control
                    112: mode that it supports. This mode describes whether we can issue multiple
                    113: requests at the same time.
2.1       frystyk   114: <PRE>
2.4       frystyk   115: extern HTTransportMode HTTransport_mode (HTTransport * tp);
                    116: extern BOOL HTTransport_setMode (HTTransport * tp, HTTransportMode mode);
2.1       frystyk   117: </PRE>
2.2       frystyk   118: <H3>
                    119:   Input and Output Stream Creation Methods
                    120: </H3>
2.1       frystyk   121: <PRE>
                    122: struct _HTTransport {
                    123:     char *             name;
2.4       frystyk   124:     HTTransportMode    mode;                         /* Flow mode supported */
2.1       frystyk   125:     HTInput_new *      input_new;           /* Input stream creation method */
                    126:     HTOutput_new *     output_new;         /* Output stream creation method */
                    127: };
                    128: </PRE>
                    129: <PRE>
2.9     ! vbancrof  130: #ifdef __cplusplus
        !           131: }
        !           132: #endif
        !           133: 
2.1       frystyk   134: #endif /* HTTRANS_H */
                    135: </PRE>
2.2       frystyk   136: <P>
                    137:   <HR>
2.1       frystyk   138: <ADDRESS>
2.9     ! vbancrof  139:   @(#) $Id: HTTrans.html,v 2.8 2000/07/04 15:11:35 kahan Exp $
2.1       frystyk   140: </ADDRESS>
2.2       frystyk   141: </BODY></HTML>

Webmaster