Annotation of libwww/Library/src/HTChannl.html, revision 2.6.2.1
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:
40: #include <A HREF="HTTrans.html">"HTTrans.h"</A>
41: #include <A HREF="HTReq.html">"HTReq.h"</A>
42: #include <A HREF="HTNet.html">"HTNet.h"</A>
2.6 frystyk 43: #include <A HREF="HTHost.html">"HTHost.h"</A>
2.1 frystyk 44: #include <A HREF="HTIOStream.html">"HTIOStream.h"</A>
45: </PRE>
2.2 frystyk 46: <H2>
47: The Channel Object
48: </H2>
49: <P>
2.6 frystyk 50: The channel object contains an input and an output stream for a particular
51: connection.
2.2 frystyk 52: <H3>
2.6 frystyk 53: Creation and Deletion of Channel Objects
2.2 frystyk 54: </H3>
2.1 frystyk 55: <PRE>
2.6.2.1 ! eric 56: extern HTChannel * HTChannel_new (SOCKET sockfd, BOOL active);
2.1 frystyk 57: </PRE>
2.2 frystyk 58: <H3>
59: Deleting a Channel Object
60: </H3>
2.1 frystyk 61: <PRE>
2.3 eric 62: extern BOOL HTChannel_delete (HTChannel * channel, int status);
2.5 frystyk 63: extern BOOL HTChannel_deleteAll (void);
2.1 frystyk 64: </PRE>
2.2 frystyk 65: <H3>
66: Search for a Channel
67: </H3>
68: <P>
2.1 frystyk 69: Look for a channel object if we for some reason should have lost it
70: <PRE>
71: extern HTChannel * HTChannel_find (SOCKET sockfd);
72: </PRE>
2.2 frystyk 73: <H3>
74: Get Transport Descriptor for Channel
75: </H3>
76: <P>
77: A transport descriptor can be either a ANSI C file descriptor or a BSD socket.
78: As it is difficult for the channel to know which one is used by a specific
79: transport, we leave this to the caller to figure out. This is probably not
80: the best way of doing it.
2.6.2.1 ! eric 81: <PRE>
! 82: extern SOCKET HTChannel_socket (HTChannel * channel);
! 83: extern void HTChannel_setSocket (HTChannel * channel, SOCKET socket);
2.2 frystyk 84: extern FILE * HTChannel_file (HTChannel * channel);
2.6 frystyk 85: </PRE>
86: <H3>
87: The Host Object
88: </H3>
89: <P>
90: The Channel object also keeps a link to the <A HREF="HTHost.html">host
91: object</A> so that we have a link to the persistent connection repository.
92: <PRE>extern BOOL HTChannel_setHost (HTChannel * ch, HTHost * host);
93: extern HTHost * HTChannel_host (HTChannel * ch);
2.2 frystyk 94: </PRE>
95: <H3>
96: Semaphores
97: </H3>
98: <P>
99: Adjust the semaphore on a channel. As many <A HREF="HTNet.html">Net objects
100: </A>can point to the same channel we need to keep count of them so that we
101: know if we can delete a channel or if it is still in use. We do this by having
102: a simple semaphore associated with each channel object
2.1 frystyk 103: <PRE>
2.4 frystyk 104: extern void HTChannel_upSemaphore (HTChannel * channel);
2.1 frystyk 105: extern void HTChannel_downSemaphore (HTChannel * channel);
2.4 frystyk 106: extern void HTChannel_setSemaphore (HTChannel * channel, int semaphore);
2.1 frystyk 107: </PRE>
2.2 frystyk 108: <H3>
109: Create Input and Output Streams
110: </H3>
111: <P>
112: You create the input stream and bind it to the channel using the following
113: methods. Please read the description in the
114: <A HREF="HTIOStream.html">HTIOStream module</A> on the parameters
115: <EM>target</EM>, <EM>param</EM>, and <EM>mode</EM>. The input and output
116: stream are instances created by the <A HREF="HTTrans.html">Transport
117: object</A>. The Transport Object defines the creation methods for the inout
118: and output streams and the Channel object contains the actualy stream objects.
2.1 frystyk 119: <PRE>
2.6 frystyk 120: extern BOOL HTChannel_setInput (HTChannel * ch, HTInputStream * input);
2.2 frystyk 121: extern HTInputStream * HTChannel_input (HTChannel * ch);
122:
2.6 frystyk 123: extern BOOL HTChannel_setOutput (HTChannel * ch, HTOutputStream * output);
2.1 frystyk 124: extern HTOutputStream * HTChannel_output (HTChannel * ch);
125: </PRE>
126: <PRE>
127: #endif /* HTCHANNL */
128: </PRE>
2.2 frystyk 129: <P>
130: <HR>
2.1 frystyk 131: <ADDRESS>
2.6.2.1 ! eric 132: @(#) $Id: HTChannl.html,v 2.6 1996/08/19 18:30:20 frystyk Exp $
2.1 frystyk 133: </ADDRESS>
2.2 frystyk 134: </BODY></HTML>
Webmaster