?? htchannl.h
字號:
/* W3C Sample Code Library libwww Channel Interface! The Channel Class!*//*** (c) COPYRIGHT MIT 1995.** Please first read the full copyright statement in the file COPYRIGH.*//*A channel contains information about sockets and their input and output streams.A channel represents the front end for receiving data towardsthe underlying transport. The definition of a channel describes how we areto read the data coming in on a socket, for example. In other words - a channelrepresents the first part of how to get handle incoming data in the Library: o Reading data on a channel o Defining a target for incoming data o Defining a protocol state machine that can handle the data This module is implemented by HTChannl.c, and itis a part of the W3C Sample CodeLibrary.*/#ifndef HTCHANNL_H#define HTCHANNL_Htypedef struct _HTChannel HTChannel;#include "HTHost.h"#include "HTIOStream.h"/*. The Channel Object.The channel object contains an input and an output stream for a particularconnection.( Creation and Deletion of Channel Objects)Either the socket can be invalid (INVSOC) or the file descriptor canbe NULL but not both.*/extern HTChannel * HTChannel_new (SOCKET sockfd, FILE * fp, BOOL active);/*( Deleting a Channel Object)*/extern BOOL HTChannel_delete (HTChannel * channel, int status);extern BOOL HTChannel_deleteAll (void);extern BOOL HTChannel_safeDeleteAll (void);/*( Search for a Channel)Look for a channel object if we for some reason should have lost it*/extern HTChannel * HTChannel_find (SOCKET sockfd);/*( Get Transport Descriptor for Channel)A transport descriptor can be either a ANSI C file descriptor or a BSD socket.As it is difficult for the channel to know which one is used by a specifictransport, we leave this to the caller to figure out. This is probably notthe best way of doing it.*/extern SOCKET HTChannel_socket (HTChannel * channel);extern BOOL HTChannel_setSocket (HTChannel * channel, SOCKET socket);extern FILE * HTChannel_file (HTChannel * channel);extern BOOL HTChannel_setFile (HTChannel * channel, FILE * fp);/*( The Host Object)The Channel object also keeps a link to the hostobject so that we have a link to the persistent connection repository.*/extern BOOL HTChannel_setHost (HTChannel * ch, HTHost * host);extern HTHost * HTChannel_host (HTChannel * ch);/*( Semaphores)Adjust the semaphore on a channel. As many Net objectscan point to the same channel we need to keep count of them so that weknow if we can delete a channel or if it is still in use. We do this by havinga simple semaphore associated with each channel object*/extern void HTChannel_upSemaphore (HTChannel * channel);extern void HTChannel_downSemaphore (HTChannel * channel);extern void HTChannel_setSemaphore (HTChannel * channel, int semaphore);/*( Create Input and Output Streams)You create the input stream and bind it to the channel using the followingmethods. Please read the description in theHTIOStream module on the parameterstarget, param, and mode. The input and outputstream are instances created by the Transportobject. The Transport Object defines the creation methods for the inoutand output streams and the Channel object contains the actualy stream objects.*/extern BOOL HTChannel_setInput (HTChannel * ch, HTInputStream * input);extern HTInputStream * HTChannel_input (HTChannel * ch);extern BOOL HTChannel_deleteInput (HTChannel * channel, int status);extern BOOL HTChannel_setOutput (HTChannel * ch, HTOutputStream * output);extern HTOutputStream * HTChannel_output (HTChannel * ch);extern BOOL HTChannel_deleteOutput (HTChannel * channel, int status);extern HTInputStream * HTChannel_getChannelIStream (HTChannel * ch);extern HTOutputStream * HTChannel_getChannelOStream (HTChannel * ch);/**/#endif /* HTCHANNL *//* @(#) $Id: HTChannl.html,v 2.12 1999/07/07 15:43:28 frystyk Exp $*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -