Annotation of libwww/Library/src/HTChannl.html, revision 2.6.2.3
2.1 frystyk 1: <HTML>
2: <HEAD>
2.6 frystyk 3: <TITLE>W3C Reference Library libwww Channel Interface</TITLE>
2.1 frystyk 4: </HEAD>
5: <BODY>
2.2 frystyk 6: <H1>
7: The Channel 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: A channel contains information about sockets and their input and output streams.
17: A <CODE>channel</CODE> represents the front end for receiving data towards
18: the underlying transport. The definition of a channel describes how we are
19: to read the data coming in on a socket, for example. In other words - a channel
20: represents the first part of how to get handle incoming data in the Library:
21: <P>
2.1 frystyk 22: <UL>
2.2 frystyk 23: <LI>
24: Reading data on a channel
25: <LI>
26: Defining a target for incoming data
27: <LI>
28: Defining a protocol state machine that can handle the data
2.1 frystyk 29: </UL>
2.2 frystyk 30: <P>
31: This module is implemented by <A HREF="HTChannl.c">HTChannl.c</A>, and it
32: is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C Reference
33: Library</A>.
2.1 frystyk 34: <PRE>
35: #ifndef HTCHANNL_H
36: #define HTCHANNL_H
37:
38: typedef struct _HTChannel HTChannel;
39:
2.6 frystyk 40: #include <A HREF="HTHost.html">"HTHost.h"</A>
2.1 frystyk 41: #include <A HREF="HTIOStream.html">"HTIOStream.h"</A>
42: </PRE>
2.2 frystyk 43: <H2>
44: The Channel Object
45: </H2>
46: <P>
2.6 frystyk 47: The channel object contains an input and an output stream for a particular
48: connection.
2.2 frystyk 49: <H3>
2.6 frystyk 50: Creation and Deletion of Channel Objects
2.2 frystyk 51: </H3>
2.1 frystyk 52: <PRE>
2.6.2.1 eric 53: extern HTChannel * HTChannel_new (SOCKET sockfd, BOOL active);
2.1 frystyk 54: </PRE>
2.2 frystyk 55: <H3>
56: Deleting a Channel Object
57: </H3>
2.1 frystyk 58: <PRE>
2.3 eric 59: extern BOOL HTChannel_delete (HTChannel * channel, int status);
2.5 frystyk 60: extern BOOL HTChannel_deleteAll (void);
2.1 frystyk 61: </PRE>
2.2 frystyk 62: <H3>
63: Search for a Channel
64: </H3>
65: <P>
2.1 frystyk 66: Look for a channel object if we for some reason should have lost it
67: <PRE>
68: extern HTChannel * HTChannel_find (SOCKET sockfd);
69: </PRE>
2.2 frystyk 70: <H3>
71: Get Transport Descriptor for Channel
72: </H3>
73: <P>
74: A transport descriptor can be either a ANSI C file descriptor or a BSD socket.
75: As it is difficult for the channel to know which one is used by a specific
76: transport, we leave this to the caller to figure out. This is probably not
77: the best way of doing it.
2.6.2.1 eric 78: <PRE>
79: extern SOCKET HTChannel_socket (HTChannel * channel);
80: extern void HTChannel_setSocket (HTChannel * channel, SOCKET socket);
2.2 frystyk 81: extern FILE * HTChannel_file (HTChannel * channel);
2.6 frystyk 82: </PRE>
83: <H3>
84: The Host Object
85: </H3>
86: <P>
87: The Channel object also keeps a link to the <A HREF="HTHost.html">host
88: object</A> so that we have a link to the persistent connection repository.
89: <PRE>extern BOOL HTChannel_setHost (HTChannel * ch, HTHost * host);
90: extern HTHost * HTChannel_host (HTChannel * ch);
2.2 frystyk 91: </PRE>
92: <H3>
93: Semaphores
94: </H3>
95: <P>
96: Adjust the semaphore on a channel. As many <A HREF="HTNet.html">Net objects
97: </A>can point to the same channel we need to keep count of them so that we
98: know if we can delete a channel or if it is still in use. We do this by having
99: a simple semaphore associated with each channel object
2.1 frystyk 100: <PRE>
2.4 frystyk 101: extern void HTChannel_upSemaphore (HTChannel * channel);
2.1 frystyk 102: extern void HTChannel_downSemaphore (HTChannel * channel);
2.4 frystyk 103: extern void HTChannel_setSemaphore (HTChannel * channel, int semaphore);
2.1 frystyk 104: </PRE>
2.2 frystyk 105: <H3>
106: Create Input and Output Streams
107: </H3>
108: <P>
109: You create the input stream and bind it to the channel using the following
110: methods. Please read the description in the
111: <A HREF="HTIOStream.html">HTIOStream module</A> on the parameters
112: <EM>target</EM>, <EM>param</EM>, and <EM>mode</EM>. The input and output
113: stream are instances created by the <A HREF="HTTrans.html">Transport
114: object</A>. The Transport Object defines the creation methods for the inout
115: and output streams and the Channel object contains the actualy stream objects.
2.1 frystyk 116: <PRE>
2.6 frystyk 117: extern BOOL HTChannel_setInput (HTChannel * ch, HTInputStream * input);
2.2 frystyk 118: extern HTInputStream * HTChannel_input (HTChannel * ch);
119:
2.6 frystyk 120: extern BOOL HTChannel_setOutput (HTChannel * ch, HTOutputStream * output);
2.1 frystyk 121: extern HTOutputStream * HTChannel_output (HTChannel * ch);
2.6.2.3 ! eric 122:
! 123: extern HTInputStream * HTChannel_getChannelIStream (HTChannel * ch);
! 124: extern HTOutputStream * HTChannel_getChannelOStream (HTChannel * ch);
2.1 frystyk 125: </PRE>
126: <PRE>
127: #endif /* HTCHANNL */
128: </PRE>
2.2 frystyk 129: <P>
130: <HR>
2.1 frystyk 131: <ADDRESS>
2.6.2.3 ! eric 132: @(#) $Id: HTChannl.html,v 2.6.2.2 1996/11/02 20:10:18 frystyk Exp $
2.1 frystyk 133: </ADDRESS>
2.2 frystyk 134: </BODY></HTML>
Webmaster