亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? htchannl.c

?? www工具包. 這是W3C官方支持的www支撐庫. 其中提供通用目的的客戶端的WebAPI: complete HTTP/1.1 (with caching, pipelining, PUT, POS
?? C
字號:
/***	CONTAINS STREAMS FOR READING AND WRITING TO AND FROM A TRANSPORT****	(c) COPYRIGHT MIT 1995.**	Please first read the full copyright statement in the file COPYRIGH.**	@(#) $Id: HTChannl.c,v 2.26 2000/06/23 14:27:34 kahan Exp $****** HISTORY:**	April 96  HFN	Written*//* Library Include files */#include "wwwsys.h"#include "WWWUtil.h"#include "HTAlert.h"#include "HTHost.h"#include "HTError.h"#ifdef HT_MUX#include "WWWMux.h"#endif#include "HTChannl.h"					 /* Implemented here */#define HASH(s)		((s) % (HT_M_HASH_SIZE))struct _HTInputStream {    const HTInputStreamClass *	isa;    HTChannel *			channel;};struct _HTOutputStream {    const HTOutputStreamClass *	isa;    HTChannel *			channel;};struct _HTChannel {    /* what media do we talk to? */    SOCKET		sockfd;					   /* Socket */    FILE *		fp;				  /* File descriptor */    /* what streams handle the IO */    HTInputStream *	input;				     /* Input stream */    HTOutputStream *	output;				    /* Output stream */    /* proxy streams to dereference the above streams */    HTInputStream	channelIStream;    HTOutputStream	channelOStream;    BOOL		active;			/* Active or passive channel */    int			semaphore;			   /* On channel use */    HTHost *		host;			       /* Zombie connections */};PRIVATE HTList	** channels = NULL;			 /* List of channels *//* ------------------------------------------------------------------------- *//***	Skinny stream objects to pass the IO requests to the channels current IO streams.**	This was needed because the channel's IO streams could go away after the IO streams**	were set up for multiple requests.*/PRIVATE int ChannelIStream_flush (HTInputStream * me){return me->channel->input ? (*me->channel->input->isa->flush)(me->channel->input) : HT_ERROR;}PRIVATE int ChannelIStream_free (HTInputStream * me){return me->channel->input ? (*me->channel->input->isa->_free)(me->channel->input) : HT_ERROR;}PRIVATE int ChannelIStream_abort (HTInputStream * me, HTList * e){return me->channel->input ? (*me->channel->input->isa->abort)(me->channel->input, e) : HT_ERROR;}PRIVATE int ChannelIStream_read (HTInputStream * me){return me->channel->input ? (*me->channel->input->isa->read)(me->channel->input) : HT_ERROR;}PRIVATE int ChannelIStream_close (HTInputStream * me){return me->channel->input ? (*me->channel->input->isa->close)(me->channel->input) : HT_ERROR;}PUBLIC int ChannelIStream_consumed (HTInputStream * me, size_t bytes){return me->channel->input ? (*me->channel->input->isa->consumed)(me->channel->input, bytes) : HT_ERROR;}PRIVATE const HTInputStreamClass ChannelIStreamIsa ={    "ChannelInput",    ChannelIStream_flush,    ChannelIStream_free,    ChannelIStream_abort,    ChannelIStream_read,    ChannelIStream_close,    ChannelIStream_consumed}; PRIVATE int ChannelOStream_flush (HTOutputStream * me){return me->channel->output ? (*me->channel->output->isa->flush)(me->channel->output) : HT_ERROR;}PRIVATE int ChannelOStream_free (HTOutputStream * me){return me->channel->output ? (*me->channel->output->isa->_free)(me->channel->output) : HT_ERROR;}PRIVATE int ChannelOStream_abort (HTOutputStream * me, HTList * e){return me->channel->output ? (*me->channel->output->isa->abort)(me->channel->output, e) : HT_ERROR;}PRIVATE int ChannelOStream_put_character (HTOutputStream * me, char c){return me->channel->output ? (*me->channel->output->isa->put_character)(me->channel->output, c) : HT_ERROR;}PRIVATE int ChannelOStream_put_string (HTOutputStream * me, const char * s){return me->channel->output ? (*me->channel->output->isa->put_string)(me->channel->output, s) : HT_ERROR;}PRIVATE int ChannelOStream_put_block (HTOutputStream * me, const char * buf, int len){return me->channel->output ? (*me->channel->output->isa->put_block)(me->channel->output, buf, len) : HT_ERROR;}PRIVATE int ChannelOStream_close (HTOutputStream * me){return me->channel->output ? (*me->channel->output->isa->close)(me->channel->output) : HT_ERROR;}PRIVATE const HTOutputStreamClass ChannelOStreamIsa ={    "ChannelOutput",    ChannelOStream_flush,    ChannelOStream_free,    ChannelOStream_abort,    ChannelOStream_put_character,    ChannelOStream_put_string,    ChannelOStream_put_block,    ChannelOStream_close,}; /* ------------------------------------------------------------------------- */PRIVATE void free_channel (HTChannel * ch){    if (ch) {	/* Close the input and output stream */	if (ch->input) {	    (*ch->input->isa->close)(ch->input);	    ch->input = NULL;	}	if (ch->output) {	    (*ch->output->isa->close)(ch->output);	    ch->output = NULL;	}	/* Close the socket */	if (ch->sockfd != INVSOC) {	    NETCLOSE(ch->sockfd);   	    HTNet_decreaseSocket();	    HTTRACE(PROT_TRACE, "Channel..... Deleted %p, socket %d\n" _ ch _ ch->sockfd);	    ch->sockfd = INVSOC;	}	/* Close the file */	if (ch->fp) {	    fclose(ch->fp);	    HTTRACE(PROT_TRACE, "Channel..... Deleted %p, file %p\n" _ ch _ ch->fp);	    ch->fp = NULL;	}	HT_FREE(ch);    }}/***	A channel is uniquely identified by a socket.**	Note that we don't create the input and output stream - they are **	created later.****	We only keep a hash on sockfd's as we don't have to look for channels**	for ANSI file descriptors.*/PUBLIC HTChannel * HTChannel_new (SOCKET sockfd, FILE * fp, BOOL active){    HTList * list = NULL;    HTChannel * ch = NULL;    int hash = sockfd < 0 ? 0 : HASH(sockfd);    HTTRACE(PROT_TRACE, "Channel..... Hash value is %d\n" _ hash);    if (!channels) {	if (!(channels = (HTList **) HT_CALLOC(HT_M_HASH_SIZE,sizeof(HTList*))))	    HT_OUTOFMEM("HTChannel_new");    }    if (!channels[hash]) channels[hash] = HTList_new();    list = channels[hash];    if ((ch = (HTChannel *) HT_CALLOC(1, sizeof(HTChannel))) == NULL)	HT_OUTOFMEM("HTChannel_new");	        ch->sockfd = sockfd;    ch->fp = fp;    ch->active = active;    ch->semaphore = 1;    ch->channelIStream.isa = &ChannelIStreamIsa;    ch->channelOStream.isa = &ChannelOStreamIsa;    ch->channelIStream.channel = ch;    ch->channelOStream.channel = ch;    HTList_addObject(list, (void *) ch);#ifdef HT_MUX	    /*	    **  Create a MUX channel and do a connect on this channel with a	    **  new session.	    */	    {		HTProtocol * protocol = HTNet_protocol(net);		HTMuxChannel * muxch = HTMuxChannel_new(me);		net->session = HTMuxSession_connect(muxch, net, HTProtocol_id(protocol));	    }#endif /* HT_MUX */    HTTRACE(PROT_TRACE, "Channel..... Added %p to list %p\n" _ ch _ list);    return ch;}/***	Look for a channel object if we for some reason should have lost it**	Returns NULL if nothing found*/PUBLIC HTChannel * HTChannel_find (SOCKET sockfd){    if (channels && sockfd != INVSOC) {	int hash = HASH(sockfd);	HTList * list = channels[hash];	if (list) {	    HTChannel * ch = NULL;	    while ((ch = (HTChannel *) HTList_nextObject(list)))		if (ch->sockfd == sockfd) return ch;	}    }    return NULL;}/***	When deleting a channel we first look at if there are no more requests**	using the channel (the semaphore is <= 0). Then, if the socket supports**	persistent connections then we register the channel in the Host cache**	and wait until the other end closes it or we get a time out on our side*/PUBLIC BOOL HTChannel_delete (HTChannel * channel, int status){    if (channel) {	HTTRACE(PROT_TRACE, "Channel..... Delete %p with semaphore %d, status %d\n" _ 		channel _ channel->semaphore _ status);	/*	**  We call the free methods on both the input stream and the output	**  stream so that we can free up the stream pipes. However, note that	**  this doesn't mean that we close the input stream and output stream	**  them selves - only the generic streams	*/	HTChannel_deleteInput(channel, status);	HTChannel_deleteOutput(channel, status);	/*	**  Check whether this channel is used by other objects or we can	**  delete it and free memory.	*/	if (channel->semaphore <= 0 && channels && (	    channel->sockfd != INVSOC || channel->fp != NULL)) {            int hash = HASH(channel->sockfd);	    HTList * list = channels[hash];	    if (list) {		HTList_removeObject(list, (void *) channel);		free_channel(channel);		return YES;	    }	} else	    HTChannel_downSemaphore(channel);    }    return NO;}/*	HTChannel_deleteAll**	-------------------**	Destroys all channels. This is called by HTLibTerminate(0*/PUBLIC BOOL HTChannel_deleteAll (void){    if (channels) {	HTList * cur;	int cnt;	for (cnt=0; cnt<HT_M_HASH_SIZE; cnt++) {	    if ((cur = channels[cnt])) { 		HTChannel * pres;		while ((pres = (HTChannel *) HTList_nextObject(cur)) != NULL)		    free_channel(pres);	    }	    HTList_delete(channels[cnt]);	}	HT_FREE(channels);    }    return YES;}/*      HTChannel_safeDeleteAll**      -------------------**      Destroys all channels. This is called by HTLibTerminate(0*/ PUBLIC BOOL HTChannel_safeDeleteAll (void){    if (channels) {        HTList * cur;        int cnt;        for (cnt=0; cnt<HT_M_HASH_SIZE; cnt++) {          if ((cur = channels[cnt])) {            HTChannel * pres;            while ((pres = (HTChannel *) HTList_nextObject(cur)) != NULL) {              HTChannel_delete (pres, HT_TIMEOUT);              cur = channels[cnt];            }	    HTList_delete (channels[cnt]);	    channels[cnt] = NULL;          }        }        return YES;    }    return NO;}/***	Return the socket associated with this channel*/PUBLIC SOCKET HTChannel_socket (HTChannel * channel){    return channel ? channel->sockfd : INVSOC;}PUBLIC BOOL HTChannel_setSocket (HTChannel * channel, SOCKET sockfd){    if (channel) {		/*	** As we use the socket number as the hash entry then we have to	** update the hash table as well.	*/	int old_hash = HASH(channel->sockfd);	int new_hash = sockfd < 0 ? 0 : HASH(sockfd);	HTList * list = channels[old_hash];	if (list) HTList_removeObject(list, channel);	if (!channels[new_hash]) channels[new_hash] = HTList_new();	list = channels[new_hash];	HTList_addObject(list, channel);	channel->sockfd = sockfd;	return YES;    }    return NO;}/***	Return the file descriptor associated with this channel*/PUBLIC FILE * HTChannel_file (HTChannel * channel){    return channel ? channel->fp : NULL;}PUBLIC BOOL HTChannel_setFile (HTChannel * channel, FILE * fp){    if (channel) {	channel->fp = fp;	return YES;    }    return NO;}/***	We keep the associated Host object in case we have a**	sleeping connection. */PUBLIC BOOL HTChannel_setHost (HTChannel * ch, HTHost * host){    if (ch) {	ch->host = host;	return YES;    }    return NO;}PUBLIC HTHost * HTChannel_host (HTChannel * ch){    return (ch ? ch->host : NULL);}/***	Increase the semaphore for this channel*/PUBLIC void HTChannel_upSemaphore (HTChannel * channel){    if (channel) {	channel->semaphore++;	HTTRACE(PROT_TRACE, "Channel..... Semaphore increased to %d for channel %p\n" _ 		    channel->semaphore _ channel);#ifdef HT_MUX		HTMuxChannel * muxch = HTMuxChannel_find(me);		HTProtocol * protocol = HTNet_protocol(net);		net->session = HTMuxSession_connect(muxch, net, HTProtocol_id(protocol));#endif /* HT_MUX */    }}/***	Decrease the semaphore for this channel*/PUBLIC void HTChannel_downSemaphore (HTChannel * channel){    if (channel) {	channel->semaphore--;	if (channel->semaphore <= 0) channel->semaphore = 0;	HTTRACE(PROT_TRACE, "Channel..... Semaphore decreased to %d for channel %p\n" _ 		    channel->semaphore _ channel);    }}/***	Explicitly set the semaphore for this channel*/PUBLIC void HTChannel_setSemaphore (HTChannel * channel, int semaphore){    if (channel) {	channel->semaphore = semaphore;	if (channel->semaphore <= 0) channel->semaphore = 0;	HTTRACE(PROT_TRACE, "Channel..... Semaphore set to %d for channel %p\n" _ 		    channel->semaphore _ channel);    }}/***	Create the input stream and bind it to the channel**	Please read the description in the HTIOStream module on the parameters*/PUBLIC BOOL HTChannel_setInput (HTChannel * ch, HTInputStream * input){    if (ch) {	ch->input = input;	return YES;    }    return NO;}PUBLIC HTInputStream * HTChannel_input (HTChannel * ch){    return ch ? ch->input : NULL;}PUBLIC BOOL HTChannel_deleteInput (HTChannel * channel, int status){	    if (channel && channel->input && status != HT_IGNORE) {	HTTRACE(PROT_TRACE,		"Channel..... Delete input stream %p from channel %p\n" _ 		channel->input _ channel);	if (status==HT_INTERRUPTED || status==HT_TIMEOUT)	    (*channel->input->isa->abort)(channel->input, NULL);	else	    (*channel->input->isa->_free)(channel->input);	return YES;    }    return NO;}/***	Create the output stream and bind it to the channel**	Please read the description in the HTIOStream module on the parameters*/PUBLIC BOOL HTChannel_setOutput (HTChannel * ch, HTOutputStream * output){    if (ch) {	ch->output = output;	return YES;    }    return NO;}PUBLIC HTOutputStream * HTChannel_output (HTChannel * ch){    return ch ? ch->output : NULL;}PUBLIC BOOL HTChannel_deleteOutput (HTChannel * channel, int status){	    if (channel && channel->output && status != HT_IGNORE) {	HTTRACE(PROT_TRACE,		"Channel..... Delete input stream %p from channel %p\n" _ 		channel->input _ channel);	if (status==HT_INTERRUPTED || status==HT_TIMEOUT)	    (*channel->output->isa->abort)(channel->output, NULL);	else	    (*channel->output->isa->_free)(channel->output);	return YES;    }    return NO;}PUBLIC HTInputStream * HTChannel_getChannelIStream (HTChannel * ch){    if (ch)	return &ch->channelIStream;    return NULL;}PUBLIC HTOutputStream * HTChannel_getChannelOStream (HTChannel * ch){    if (ch)	return &ch->channelOStream;    return NULL;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美调教femdomvk| 亚洲va欧美va天堂v国产综合| 久久激情五月婷婷| 精品久久久久一区| 粉嫩嫩av羞羞动漫久久久| 国产精品毛片大码女人| 91猫先生在线| 日韩黄色免费网站| 久久久激情视频| 成人18视频在线播放| 一区二区激情视频| 日韩欧美一区二区免费| 久久99久久久欧美国产| 国产欧美一区二区三区在线看蜜臀| 国产 欧美在线| 亚洲午夜久久久久中文字幕久| 欧美精品一卡二卡| 国产老女人精品毛片久久| 综合色天天鬼久久鬼色| 欧美日韩免费观看一区二区三区| 美女视频网站久久| 中文字幕精品—区二区四季| 在线观看日韩国产| 经典三级视频一区| 亚洲另类春色校园小说| 日韩精品最新网址| 91亚洲国产成人精品一区二区三| 日韩成人av影视| 综合婷婷亚洲小说| 久久午夜电影网| 欧美色电影在线| 福利一区福利二区| 免费观看一级欧美片| 国产精品久久国产精麻豆99网站| 欧美另类z0zxhd电影| 成人激情开心网| 六月丁香婷婷久久| 一区二区三区久久| 国产人成亚洲第一网站在线播放| 欧美久久婷婷综合色| www.在线成人| 国产精品一二三| 三级一区在线视频先锋| 国产精品高潮呻吟久久| 26uuu欧美| 欧美美女喷水视频| 91久久国产最好的精华液| 国产成都精品91一区二区三| 日韩激情一区二区| 亚洲成人av在线电影| 亚洲男人天堂av网| 国产精品美日韩| 一区二区三区四区在线播放| 久久精品网站免费观看| 日韩精品中午字幕| 欧美一区二区三区在线| 色欲综合视频天天天| av激情亚洲男人天堂| 国产精品一区二区不卡| 久草中文综合在线| 日本女人一区二区三区| 一区二区高清在线| 亚洲免费av在线| 综合色中文字幕| 综合色中文字幕| 亚洲品质自拍视频网站| 综合欧美一区二区三区| 亚洲三级电影网站| 亚洲美女区一区| 一区二区三区四区国产精品| 成人欧美一区二区三区视频网页| 久久久精品国产免费观看同学| 精品sm捆绑视频| 精品成人一区二区三区四区| 精品91自产拍在线观看一区| 欧美大片国产精品| 久久亚区不卡日本| 国产精品欧美久久久久无广告 | 色综合一区二区| eeuss国产一区二区三区| gogo大胆日本视频一区| 99久久精品免费| 色婷婷av一区二区三区大白胸| 99精品视频在线观看免费| 一本色道亚洲精品aⅴ| 在线一区二区视频| 欧美日韩在线电影| 91精品国产综合久久婷婷香蕉| 91精品国模一区二区三区| 欧美白人最猛性xxxxx69交| 久久综合九色综合97婷婷女人 | 蜜臀久久99精品久久久久久9| 午夜精品福利视频网站| 美腿丝袜亚洲综合| 国产一区二区三区四区五区入口| 国产曰批免费观看久久久| 成人av影视在线观看| 91美女片黄在线观看| 欧美绝品在线观看成人午夜影视| 日韩欧美不卡在线观看视频| 久久久久国产精品麻豆ai换脸| 国产精品久久久久永久免费观看 | 日韩国产精品久久久久久亚洲| 日韩黄色免费电影| 国产iv一区二区三区| 在线观看精品一区| 日韩欧美一区电影| 中文字幕中文字幕一区二区| 一区二区三区精品在线| 久久99日本精品| 色婷婷精品大在线视频| 日韩欧美三级在线| 亚洲欧洲日产国码二区| 日韩成人午夜精品| 99视频精品在线| 日韩欧美二区三区| 亚洲精品国产第一综合99久久| 麻豆精品精品国产自在97香蕉| 成人久久久精品乱码一区二区三区| 一区二区视频在线看| 日韩一区有码在线| 欧美电视剧免费全集观看| 日韩欧美一级精品久久| 中文字幕不卡一区| 日韩avvvv在线播放| 成人av片在线观看| 欧美一级欧美三级在线观看| 欧美国产精品专区| 亚洲成人免费在线| 顶级嫩模精品视频在线看| 欧美美女激情18p| 亚洲欧美激情小说另类| 激情综合五月婷婷| 91久久精品日日躁夜夜躁欧美| 久久久久久久精| 日韩精品一级中文字幕精品视频免费观看 | www.欧美色图| 久久午夜老司机| 免费成人av资源网| 欧美性淫爽ww久久久久无| 国产欧美一区二区精品婷婷| 日韩成人免费看| 欧美亚洲国产bt| 亚洲欧美日韩久久精品| 国产凹凸在线观看一区二区| 91麻豆精品国产自产在线| 亚洲婷婷综合色高清在线| 国产精品一二三| 精品国产乱码久久久久久老虎| 日韩—二三区免费观看av| 91福利视频网站| 最好看的中文字幕久久| av中文字幕不卡| 国产精品丝袜久久久久久app| 蜜臀av亚洲一区中文字幕| 欧美日韩精品久久久| 一区二区三区四区精品在线视频 | 国产在线精品一区二区不卡了| 在线播放国产精品二区一二区四区| 亚洲卡通动漫在线| 色综合久久中文综合久久97| 中文在线一区二区| 成人动漫精品一区二区| 欧美国产一区二区| 成人激情午夜影院| 国产精品电影一区二区| 成人app下载| 综合av第一页| 91福利在线播放| 五月婷婷激情综合网| 欧美一区二区视频在线观看 | 亚洲一区二区三区四区在线观看 | 欧美三级电影网站| 日韩黄色小视频| 精品成人私密视频| 成人一区在线观看| 亚洲欧美日韩国产综合在线| 欧美亚洲日本国产| 午夜电影久久久| 欧美一级一区二区| 国产成人综合精品三级| 亚洲欧美自拍偷拍| 欧美日韩久久久一区| 美女被吸乳得到大胸91| 国产欧美一区二区精品性色超碰| 成人av在线一区二区三区| 亚洲四区在线观看| 欧美精品久久一区二区三区| 精品一区二区久久久| 国产精品美女久久久久av爽李琼| 色婷婷精品久久二区二区蜜臀av| 亚洲福利国产精品| 精品国产髙清在线看国产毛片| 国产成人av一区二区三区在线| 一色桃子久久精品亚洲| 欧美美女黄视频| 国产91精品精华液一区二区三区 | 亚洲欧美国产高清| 91精品国产综合久久久久久久| 极品美女销魂一区二区三区|