Annotation of libwww/Library/src/HTChannl.html, revision 2.1
2.1 ! frystyk 1: <HTML>
! 2: <HEAD>
! 3: <TITLE>W3C Reference Library libwww Channel Interface</TITLE>
! 4: <!-- Changed by: Henrik Frystyk Nielsen, 8-Apr-1996 -->
! 5: <NEXTID N="z18">
! 6: </HEAD>
! 7: <BODY>
! 8:
! 9: <H1>Manages Read and Write to and from the Network</H1>
! 10:
! 11: <PRE>
! 12: /*
! 13: ** (c) COPYRIGHT MIT 1995.
! 14: ** Please first read the full copyright statement in the file COPYRIGH.
! 15: */
! 16: </PRE>
! 17:
! 18: A channel contains information about sockets and their input and
! 19: output streams. A <CODE>channel</CODE> represents the front end for
! 20: receiving data. The definition of a channel describes how we are to
! 21: read the data coming in on a socket, for example. A channel represents
! 22: the first part of how to get handle incoming data in the Library:
! 23:
! 24: <UL>
! 25: <LI>Reading data on a channel
! 26: <LI>Defining a target for incoming data
! 27: <LI>Defining a protocol state machine that can handle the data
! 28: </UL>
! 29:
! 30: This module is implemented by <A HREF="HTChannl.c">HTChannl.c</A>, and
! 31: it is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
! 32: Reference Library</A>.
! 33:
! 34: <PRE>
! 35: #ifndef HTCHANNL_H
! 36: #define HTCHANNL_H
! 37:
! 38: typedef enum _HTChannelMode {
! 39: HT_CH_SINGLE = 0, /* One single request at a time */
! 40: HT_CH_BATCH = 1, /* Use batch requests */
! 41: HT_CH_INTERLEAVED = 2 /* Can we interleave requests? */
! 42: } HTChannelMode;
! 43:
! 44: typedef struct _HTChannel HTChannel;
! 45:
! 46: #include <A HREF="HTTrans.html">"HTTrans.h"</A>
! 47: #include <A HREF="HTReq.html">"HTReq.h"</A>
! 48: #include <A HREF="HTNet.html">"HTNet.h"</A>
! 49: #include <A HREF="HTIOStream.html">"HTIOStream.h"</A>
! 50: </PRE>
! 51:
! 52: <H2>The HTChannel Object</H2>
! 53:
! 54: A channel can be in a certain <CODE>mode</CODE> which determines how
! 55: it behaves. The set of modes is defined as:
! 56:
! 57: <H3>Creating a Channel Object</H3>
! 58:
! 59: The following methods can be used to instantiate objects of a
! 60: particular channel mode:
! 61:
! 62: <PRE>
! 63: extern HTChannel * HTChannel_new (HTNet * net, BOOL active);
! 64: </PRE>
! 65:
! 66: <H3>Deleting a Channel Object</H3>
! 67:
! 68: <PRE>
! 69: extern BOOL HTChannel_delete (HTChannel * channel);
! 70: extern BOOL HTCannel_deleteAll (void);
! 71: </PRE>
! 72:
! 73: <H3>Control the Channel Mode</H3>
! 74:
! 75: Set and get the mode of a channel. A channel may change mode in the
! 76: middle of a connection. We also return whether the channel is active
! 77: or passive.
! 78:
! 79: <PRE>
! 80: extern HTChannelMode HTChannel_mode (HTChannel * channel, BOOL * active);
! 81:
! 82: extern BOOL HTChannel_setMode (HTChannel * channel, HTChannelMode mode);
! 83: </PRE>
! 84:
! 85: <H3>Search for a Channel</H3>
! 86:
! 87: Look for a channel object if we for some reason should have lost it
! 88:
! 89: <PRE>
! 90: extern HTChannel * HTChannel_find (SOCKET sockfd);
! 91: </PRE>
! 92:
! 93: <H3>Is Channel Idle?</H3>
! 94:
! 95: Check whether a channel is idle meaning if it is ready for a new
! 96: request which depends on the mode of the channel. If the channel is
! 97: idle, i.e. ready for use then return YES else NO.
! 98:
! 99: <PRE>
! 100: extern BOOL HTChannel_idle (HTChannel * channel);
! 101: </PRE>
! 102:
! 103: <H3>Get Socket for a Channel</H3>
! 104:
! 105: <PRE>
! 106: extern SOCKET HTChannel_socket (HTChannel * channel);
! 107: </PRE>
! 108:
! 109: <H3>Semaphores</H3>
! 110:
! 111: Adjust the semaphore on a channel.
! 112:
! 113: <PRE>
! 114: extern void HTChannel_upSemaphore (HTChannel * channel);
! 115: extern void HTChannel_downSemaphore (HTChannel * channel);
! 116: </PRE>
! 117:
! 118: <H3>Create Input and Output Streams</H3>
! 119:
! 120: You create the input stream and bind it to the channel using the
! 121: following methods. Please read the description in the <A
! 122: HREF="HTIOStream.html">HTIOStream module</A> on the parameters
! 123: <EM>target</EM>, <EM>param</EM>, and <EM>mode</EM>. Both methods
! 124: return YES if OK, else NO.
! 125:
! 126: <PRE>
! 127: extern BOOL HTChannel_setInput (HTChannel * ch,
! 128: HTInputStream * input, HTChannelMode mode);
! 129:
! 130: extern BOOL HTChannel_setOutput (HTChannel * ch,
! 131: HTOutputStream * output, HTChannelMode mode);
! 132:
! 133: extern HTInputStream * HTChannel_input (HTChannel * ch);
! 134: extern HTOutputStream * HTChannel_output (HTChannel * ch);
! 135:
! 136: </PRE>
! 137:
! 138: <PRE>
! 139: #endif /* HTCHANNL */
! 140: </PRE>
! 141:
! 142: <HR>
! 143: <ADDRESS>
! 144: @(#) $Id: Date Author State $
! 145: </ADDRESS>
! 146: </BODY>
! 147: </HTML>
Webmaster