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

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

?? htmuxch.c

?? www工具包. 這是W3C官方支持的www支撐庫. 其中提供通用目的的客戶端的WebAPI: complete HTTP/1.1 (with caching, pipelining, PUT, POS
?? C
字號:
/***	MUX CHANNEL, SESSION AND PROTOCOL MANAGEMENT****	(c) COPYRIGHT MIT 1995.**	Please first read the full copyright statement in the file COPYRIGH.**	@(#) $Id: HTMuxCh.c,v 2.4 1999/02/22 22:10:11 frystyk Exp $****	Handles a MUX Channel with sessions and protocols**** Authors**	HFN	Henrik Frystyk Nielsen <frystyk@w3.org>**** HISTORY:**	Oct 96 HFN	Written*//* Library Include files */#include "wwwsys.h"#include "WWWUtil.h"#include "WWWCore.h"#include "WWWTrans.h"#include "WWWStream.h"#include "HTMuxTx.h"#include "HTMuxHeader.h"#include "HTDemux.h"#include "HTMuxCh.h"					 /* Implemented here */#define MAX_SESSIONS	0xFF	   			 /* Max 256 sessions */#define SID_BASE	2#define RECEIVER_OFFSET	0			   /* Client control session */#define SENDER_OFFSET	1			   /* Server control session */struct _HTStream {    const HTStreamClass *	isa;    /* ... */};struct _HTOutputStream {    const HTOutputStreamClass *	isa;    /* ... */};#define PUTBLOCK(b,l) (*me->isa->put_block)(me,(b),(l))struct _HTMuxProtocol {    HTAtom *	       	name;    HTProtocolId	pid;};struct _HTMuxSession {    HTMuxSessionId	sid;    HTProtocolId	pid;    HTNet *		net;    /* State */    HTMuxClose		close;			  /* State of the connection */    int			credit;				 /* Available credit */    int			fragment;			    /* Fragment size */    int			read;	               /* Data read sine last credit */    /* Input */    HTStream *		buffer;			/* If we have to buffer data */    BOOL		buffering;};struct _HTMuxChannel {    int			hash;    HTHost *		host;    int			max_sid;		/* A la max_sockfd in select */    HTNet *		net;    HTList *		protocols;              /* List of defined protocols */    HTMuxSession *	sessions[MAX_SESSIONS];};PRIVATE HTList	** muxchs = NULL;		       /* List of mux muxchs *//* ------------------------------------------------------------------------- */PRIVATE HTMuxSession * session_new (void){    HTMuxSession * me;    if ((me = (HTMuxSession *) HT_CALLOC(1, sizeof(HTMuxSession))) == NULL)	HT_OUTOFMEM("HTMuxSession_new");    me->credit = DEFAULT_CREDIT;    return me;}PRIVATE BOOL session_delete (HTMuxSession * session){    if (session) {	HT_FREE(session);	return YES;    }    return NO;}PUBLIC HTMuxSession * HTMuxSession_register (HTMuxChannel * muxch,					     HTMuxSessionId sid, HTProtocolId pid){    if (muxch) {	HTMuxSession * session = muxch->sessions[sid];	if (session == NULL) {	    session = session_new();	    session->sid = sid;	    session->pid = pid;	    muxch->sessions[sid] = session;	    HTTRACE(MUX_TRACE, "Mux Channel. Registered session %d on channel %p\n" _ 			sid _ muxch);	}	return session;    }    HTTRACE(MUX_TRACE, "Mux Channel. Can't register new session\n");    return NULL;}PUBLIC HTMuxSessionId HTMuxSession_accept (HTMuxChannel * muxch, HTNet * net,					   HTProtocolId pid){    if (muxch && net) {	HTMuxSession * session;	HTMuxSessionId sid = SID_BASE + RECEIVER_OFFSET;	for (; sid<MAX_SESSIONS; sid+=2) {	    if ((session = muxch->sessions[sid]) &&		session->net == NULL && session->pid == pid) {		HTTRACE(MUX_TRACE, "Mux Channel. Accepting session %d on channel %p\n" _ 			    sid _ muxch);		return sid;	    }	}    }    HTTRACE(MUX_TRACE, "Mux Channel. Can't accept new session\n");    return INVSID;}PUBLIC HTMuxSessionId HTMuxSession_connect (HTMuxChannel * muxch, HTNet * net,					    HTProtocolId pid){    if (muxch && net) {	HTMuxSessionId sid = SID_BASE + SENDER_OFFSET;	for (; sid<MAX_SESSIONS; sid+=2) {	    if (muxch->sessions[sid] == NULL) {		HTMuxSession * session = session_new();		session->sid = sid;		session->pid = pid;		session->net = net;				muxch->sessions[sid] = session;		HTTRACE(MUX_TRACE, "Mux Channel. Creating session %d on channel %p\n" _ 			    sid _ muxch);		return sid;	    }	}    }    HTTRACE(MUX_TRACE, "Mux Channel. Can't create new session\n");    return INVSID;}PUBLIC int HTMuxSession_close (HTMuxChannel * muxch, HTMuxSessionId sid){    if (muxch) {	HTMuxSession * session = muxch->sessions[sid];	HTMuxSession_setClose(muxch, session, MUX_S_END_WRITE);	return YES;    }    return NO;}PUBLIC HTMuxSessionId HTMuxSession_id (HTMuxSession * session){    return session ? session->sid : INVSID;}PUBLIC HTProtocolId HTMuxSession_pid (HTMuxSession * session){    return session ? session->pid : INVPID;}PUBLIC HTNet * HTMuxSession_net (HTMuxSession * session){    return session ? session->net : NULL;}PUBLIC BOOL HTMuxSession_setClose (HTMuxChannel * muxch,				   HTMuxSession * session, HTMuxClose close){    if (muxch && session) {	session->close |= close;	/*	**  If both directions are closed down then we can put the session	**  to sleep.	*/	if (session->close == MUX_S_END) {	    HTTRACE(MUX_TRACE, "Mux Channel. Closing session %d on channel %p\n" _ 			session->sid _ muxch);	    muxch->sessions[session->sid] = NULL;	    session_delete(session);	}	return YES;    }    return NO;}PUBLIC int  HTMuxSession_credit (HTMuxSession * session){    return session ? session->credit : -1;}PUBLIC BOOL HTMuxSession_setCredit (HTMuxChannel * muxch,				    HTMuxSessionId sid, int credit){    HTMuxSession * session;    if (muxch && (session = muxch->sessions[sid])) {	session->credit = credit;	return YES;    }    return NO;}PUBLIC int  HTMuxSession_fragment (HTMuxSession * session){    return session ? session->fragment : -1;}PUBLIC BOOL HTMuxSession_setFragment (HTMuxChannel * muxch,				      HTMuxSessionId sid, int fragment){    HTMuxSession * session;    if (muxch && (session = muxch->sessions[sid])) {	session->fragment = fragment;	return YES;    }    return NO;}/***  Tries really hard to get rid of the data.**  Returns:**	-1 Error**	 0 Buffered the data**       1 Got rid of the data*/PUBLIC int HTMuxSession_disposeData (HTMuxSession * me, const char * buf, int len){    HTTRACE(MUX_TRACE, "Mux Channel. Writing %d bytes to session %p\n" _ len _ me);    /*    **  There are two situations that can occur: Either we have an accepted session    **  with a Net object or we have an unaccepted session with no Net object. In    **  the former case we try to get rid of the data by pushing it directly to the    **  read stream of the Net object. In the latter case we buffer as much as we    **  can.    */    if (me) {		HTNet * net;	HTStream * sink;	int status;	if ((net = me->net) && (sink = HTNet_readStream(net))) {	    /*	    **  Look first to see if we have old data that we can dispose down	    **  the sink. We keep the buffer stream so that we can reuse it later.	    */	    if (me->buffer && me->buffering) {		if ((*me->buffer->isa->flush)(me->buffer) == HT_OK) {		    HTTRACE(MUX_TRACE, "Mux Channel. Flushed buffered data\n");		    me->buffering = NO;		} else if ((*me->buffer->isa->put_block)(me->buffer, buf, len) >= 0) {		    HTTRACE(MUX_TRACE, "Mux Channel. Buffer accepted data\n");		    return 0;		}		HTTRACE(MUX_TRACE, "Mux Channel. Can't buffer data\n");		return (-1);		    	    }	    /*	    **  See if we can get rid of the new data. If not then try to buffer it.	    **  If this also fails then we reset the channel. A positive return code	    **  from the stream means that we got rid of the data successfully.	    */	    if ((status = (*sink->isa->put_block)(sink, buf, len)) >= 0) {		HTTRACE(MUX_TRACE, "Mux Channel. Stream returned %d\n" _ status);				/*		**  If we get back a HT_LOADED then we have all the data we need		**  and we can terminate the request		*/		if (status == HT_LOADED) {		    HTNet_execute (net, HTEvent_END);		    return 0;		}		/*		**  Decide whether we should send a credit message		**  MORE TO COME		*/		me->read += len;		if (me->read >= DEFAULT_CREDIT / 2) {		    me->read = 0;		    return 1;		}		return 0;	    }	}	/*	**  The stream is not ready and we try to buffer the data in	**  the meantime.	*/	if (!me->buffer) {	    me->buffer = HTPipeBuffer(sink, DEFAULT_CREDIT);	    me->buffering = YES;	}	status = (*me->buffer->isa->put_block)(me->buffer, buf, len);	if (status >= 0) {	    HTTRACE(MUX_TRACE, "Mux Channel. Buffer accepted data\n");	    return 0;	}	HTTRACE(MUX_TRACE, "Mux Channel. Buffer returned %d\n" _ status);    }    return (-1);}/* ------------------------------------------------------------------------- */PRIVATE BOOL channel_delete (HTMuxChannel * ch){    if (ch) {	HT_FREE(ch);	return YES;    }    return NO;}PUBLIC HTMuxChannel * HTMuxChannel_new (HTHost * host){    if (host) {	HTMuxChannel * me = NULL;	/* Create new object */	if ((me = (HTMuxChannel *) HT_CALLOC(1, sizeof(HTMuxChannel))) == NULL)	    HT_OUTOFMEM("HTMuxChannel_new");	me->hash = HTHost_hash(host);	me->host = host;	/*	**  Make sure that we are in interleave mode	*/	HTHost_setMode(host, HT_TP_INTERLEAVE);	/*	**  Get a special MUX Net object that we keep to our selves. We don't	**  associate a request object as the Net object lives longer.	*/	me->net = HTNet_new(NULL);	HTNet_setReadStream(me->net, HTDemux_new(host, me));	/* Insert into hash table */	if (!muxchs) {	    if ((muxchs=(HTList **) HT_CALLOC(HOST_HASH_SIZE, sizeof(HTList *))) == NULL)		HT_OUTOFMEM("HTMuxChannel_new");	}	if (!muxchs[me->hash]) muxchs[me->hash] = HTList_new();	HTList_addObject(muxchs[me->hash], (void *) me);	HTTRACE(MUX_TRACE, "Mux Channel. %p created with hash %d\n" _ me _ me->hash);	return me;    }    return NULL;}PUBLIC HTMuxChannel * HTMuxChannel_find (HTHost * host){    if (muxchs) {	int hash = HTHost_hash(host);	HTList * list = muxchs[hash];	if (list) {	    HTMuxChannel * pres = NULL;	    while ((pres = (HTMuxChannel *) HTList_nextObject(list)))		if (pres->host == host) return pres;	}    }    return NULL;}PUBLIC BOOL HTMuxChannel_delete (HTMuxChannel * me){    if (me) {	HTList * list = NULL;	HTTRACE(MUX_TRACE, "Mux Channel. Deleting %p\n" _ me);	if (muxchs && (list = muxchs[me->hash])) {	    HTList_removeObject(list, (void *) me);	    channel_delete(me);	    return YES;	}    }    return NO;}PUBLIC BOOL HTMuxChannel_deleteAll (void){    if (muxchs) {	HTList * cur;	int cnt;	for (cnt=0; cnt<HOST_HASH_SIZE; cnt++) {	    if ((cur = muxchs[cnt])) { 		HTMuxChannel * pres;		while ((pres = (HTMuxChannel *) HTList_nextObject(cur)))		    channel_delete(pres);	    }	    HTList_delete(muxchs[cnt]);	}	HT_FREE(muxchs);    }    return YES;}PUBLIC HTNet * HTMuxChannel_net (HTMuxChannel * me){    return me ? me->net : NULL;}PUBLIC HTMuxSession * HTMuxChannel_findSession (HTMuxChannel * me, HTMuxSessionId sid){    return (me) ? me->sessions[sid] : NULL;}#if 0PRIVATE HTMuxSession * HTMuxChannel_findSessionFromNet (HTMuxChannel * me, HTNet * net){    if (me && net) {	int cnt = 0;	HTMuxSession **session = me->sessions;	while (cnt<MAX_SESSIONS) {	    if (**session->net == net) return *session;	    session++, cnt++;	}	        }    return NULL;}#endifPUBLIC HTHost * HTMuxChannel_host (HTMuxChannel * muxch){    return muxch ? muxch->host : NULL;}PUBLIC int HTMuxChannel_sendControl (HTMuxChannel * muxch, HTMuxSessionId sid,				     HTMuxHeader opcode, int value,				     const void * param, int param_size){    if (muxch && muxch->host) {	HTOutputStream * me = HTChannel_output(HTHost_channel(muxch->host));	HTMuxHeader header[2];	switch (opcode) {	case MUX_STRING:	    if (param && param_size) {		header[0] = HT_WORDSWAP(MUX_CONTROL | MUX_LONG_LENGTH | MUX_SET_LEN(value));		header[1] = HT_WORDSWAP(param_size);		PUTBLOCK((const char *) header, 8);		PUTBLOCK((const char *) param, MUX_LONG_ALIGN(param_size));	    }	    break;	case MUX_STACK:	    if (param && param_size) {		header[0] = HT_WORDSWAP(MUX_CONTROL | MUX_LONG_LENGTH | MUX_SET_LEN(value));		header[1] = HT_WORDSWAP(param_size);		PUTBLOCK((const char *) header, 8);		PUTBLOCK((const char *) param, MUX_LONG_ALIGN(param_size));	    }	    break;	case MUX_FRAGMENT:	    header[0] = HT_WORDSWAP(MUX_CONTROL | MUX_SET_SID(sid) | MUX_SET_LEN(value));	    PUTBLOCK((const char *) header, 4);	    break;	case MUX_CREDIT:	    header[0] = HT_WORDSWAP(MUX_CONTROL | MUX_LONG_LENGTH | MUX_SET_SID(sid));	    header[1] = HT_WORDSWAP(value);	    PUTBLOCK((const char *) header, 8);	    break;	default:	    HTTRACE(MUX_TRACE, "Mux Channel. UNKNOWN OPCODE %d\n" _ opcode);	    return HT_ERROR;	}	/* Flush for now */#if 1	return (*me->isa->flush)(me);#else	return HT_OK;#endif    }    return HT_ERROR;}/* ------------------------------------------------------------------------- */PUBLIC BOOL HTMuxProtocol_add (HTMuxChannel * muxch,			       HTProtocolId pid, const char * protocol){    if (muxch && protocol) {		HTMuxProtocol * ms;	if ((ms = (HTMuxProtocol *) HT_CALLOC(1, sizeof(HTMuxProtocol))) == NULL)	    HT_OUTOFMEM("HTMuxProtocol_new");	ms->name = HTAtom_caseFor(protocol);	ms->pid = pid;	if (!muxch->protocols) muxch->protocols = HTList_new();	return HTList_addObject(muxch->protocols, ms);    }    return NO;}PUBLIC BOOL HTMuxProtocol_delete (HTMuxChannel * muxch, HTProtocolId pid){    if (muxch && muxch->protocols) {	HTList * cur = muxch->protocols;	HTMuxProtocol * pres;	while ((pres = (HTMuxProtocol *) HTList_nextObject(cur))) {	    if (pres->pid == pid) {		HTList_removeObject(muxch->protocols, pres);		HT_FREE(pres);		return YES;	    }	}    }    return NO;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美色窝79yyyycom| 中文av一区二区| 国产专区综合网| 日本一二三四高清不卡| 99国产精品国产精品毛片| 亚洲欧美日韩国产综合| 欧美国产视频在线| 一本大道久久a久久综合| 午夜精品成人在线| 精品美女在线观看| 成人av小说网| 亚洲综合激情网| 日韩亚洲欧美一区| 国产成人在线免费观看| 亚洲精品第1页| 日韩欧美一区二区免费| 成人一区在线观看| 夜夜嗨av一区二区三区中文字幕 | 成人h动漫精品一区二区| 亚洲日本青草视频在线怡红院| 欧美在线视频你懂得| 奇米影视在线99精品| 亚洲欧洲成人精品av97| 欧美性受极品xxxx喷水| 日韩福利视频网| 日本一区二区三区在线观看| 久久久久久久久蜜桃| 日本一区二区三区免费乱视频| kk眼镜猥琐国模调教系列一区二区| 一区二区三区美女视频| 日韩欧美国产一区在线观看| eeuss鲁片一区二区三区| 丝袜脚交一区二区| 国产精品拍天天在线| 制服丝袜在线91| 成人av电影免费观看| 日韩专区欧美专区| 国产精品第四页| 91精品麻豆日日躁夜夜躁| 成人午夜av电影| 五月天丁香久久| 中文字幕av一区二区三区 | 99热国产精品| 奇米四色…亚洲| 综合网在线视频| 日韩欧美一区在线观看| 91天堂素人约啪| 久久91精品国产91久久小草| 亚洲精品ww久久久久久p站 | 国产日韩av一区| 欧美精品欧美精品系列| 成人av片在线观看| 久久精品国产一区二区| 一区二区在线观看av| 国产欧美精品国产国产专区| 777xxx欧美| 色94色欧美sute亚洲13| 粉嫩在线一区二区三区视频| 秋霞午夜av一区二区三区| 国产麻豆精品久久一二三| 丝袜美腿亚洲综合| 亚洲男女一区二区三区| 久久久五月婷婷| 欧美人妇做爰xxxⅹ性高电影 | 色94色欧美sute亚洲线路一久| 韩国成人福利片在线播放| 午夜久久久久久久久| 综合激情成人伊人| 国产日产欧产精品推荐色| 日韩三级精品电影久久久| 在线精品亚洲一区二区不卡| youjizz国产精品| 国内精品在线播放| 天堂久久一区二区三区| 一区二区高清在线| 亚洲欧洲日韩av| 国产精品无人区| 久久伊人蜜桃av一区二区| 51精品视频一区二区三区| 日本电影欧美片| 99re这里只有精品6| 国产不卡免费视频| 狠狠色丁香九九婷婷综合五月| 日韩精品亚洲一区| 五月天国产精品| 亚洲一区二区美女| 亚洲精品视频免费看| 国产精品成人午夜| 中文av一区特黄| 亚洲国产精品成人综合色在线婷婷| 精品国产污污免费网站入口 | 亚洲免费视频成人| 成人欧美一区二区三区| 国产精品免费av| 国产日产欧美一区二区三区 | 国产日韩一级二级三级| 欧美tickling挠脚心丨vk| 日韩欧美中文一区二区| 777久久久精品| 91精品国产品国语在线不卡 | 欧美日韩精品三区| 欧美三级日韩在线| 欧美无乱码久久久免费午夜一区 | 精品99999| 久久亚洲一区二区三区四区| 日韩欧美视频一区| 精品国精品自拍自在线| 精品福利av导航| 久久亚洲春色中文字幕久久久| 久久久久久一二三区| 国产欧美日韩在线看| 国产精品视频yy9299一区| ㊣最新国产の精品bt伙计久久| 一区在线播放视频| 亚洲美女在线一区| 亚洲尤物视频在线| 日韩电影在线观看网站| 麻豆免费精品视频| 国产精品综合网| 成人免费视频视频| 色狠狠色噜噜噜综合网| 欧美日韩极品在线观看一区| 欧美一区二区高清| 日本va欧美va瓶| 久久电影网电视剧免费观看| 国产精品夜夜嗨| bt欧美亚洲午夜电影天堂| 91福利在线看| 欧美电影在线免费观看| 精品国产精品一区二区夜夜嗨| 国产无遮挡一区二区三区毛片日本| 国产精品美女www爽爽爽| 一区二区三区四区乱视频| 日韩黄色免费网站| 国产精品一区二区久久精品爱涩| 成人福利电影精品一区二区在线观看| 91婷婷韩国欧美一区二区| 欧美日韩国产综合一区二区三区| 在线播放日韩导航| 久久久久久久国产精品影院| 日本一区二区高清| 依依成人精品视频| 日本中文一区二区三区| 国产成人av一区二区| 色哟哟国产精品免费观看| 欧美巨大另类极品videosbest | 亚洲在线视频网站| 久久99热这里只有精品| 成人精品视频一区二区三区| 在线国产电影不卡| 日韩精品中文字幕一区二区三区| 国产欧美日韩不卡| 亚洲第一久久影院| 国产又黄又大久久| 色哟哟一区二区三区| 精品欧美久久久| 亚洲人吸女人奶水| 裸体歌舞表演一区二区| 成人动漫中文字幕| 欧美一区二区三区男人的天堂| 国产精品久久久一本精品| 午夜激情久久久| 国产69精品一区二区亚洲孕妇| 欧美亚洲一区二区在线| 欧美成人一区二区三区在线观看| 国产精品久久久久久久久免费樱桃 | www.一区二区| 日韩一区二区在线看片| 中文字幕亚洲在| 蜜乳av一区二区三区| 色综合久久88色综合天天| 精品福利一区二区三区| 一区二区三区高清不卡| 国产精品1区2区3区在线观看| 欧美日韩一区二区三区免费看| 久久免费的精品国产v∧| 亚洲自拍都市欧美小说| 国产夫妻精品视频| 67194成人在线观看| 国产精品久久精品日日| 日本 国产 欧美色综合| 91在线免费视频观看| 精品国内二区三区| 亚洲电影视频在线| 懂色av一区二区夜夜嗨| 欧美一级理论性理论a| 一区二区三区四区高清精品免费观看| 国产二区国产一区在线观看| 欧美乱妇一区二区三区不卡视频| 国产精品电影院| 国产精品99久| 日韩视频免费观看高清在线视频| 亚洲老妇xxxxxx| 成人免费av在线| 精品国产网站在线观看| 婷婷开心激情综合| 亚洲天堂2016| 国产高清一区日本| 欧美xxx久久| 日韩二区三区四区|