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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? netbuf.h

?? 一個(gè)tcp/ip協(xié)議棧,帶有PPP、IP、TCP、UDP等協(xié)議
?? H
?? 第 1 頁 / 共 2 頁
字號:
/*****************************************************************************
* netbuf.h - Network Buffers header file.
*
* Copyright (c) 1998 Global Election Systems Inc.
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice and the following disclaimer are included verbatim in any 
* distributions. No written agreement, license, or royalty fee is required
* for any of the authorized uses.
*
* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
* REVISION HISTORY
*
* 98-01-30 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
*	Original based on BSD and ka9q mbufs.
******************************************************************************
* THEORY OF OPERATION
*
*	The network buffers (nBufs) form the basis for passing data between the
* protocols in the protocol stacks.  They are extensible in that they can be
* chained together when a data block is larger than the data area of a single
* buffer or if you need to prepend or append data that won't fit on the
* beginning or end (respectively) of a buffer.  This avoids expensive copy
* operations at the expense of consuming more memory.
*
*	This buffer structure is based on the mbuf structure in the BSD network
* codes except that it does not support clusters, types, or flags which were
* not needed in this stack.  Also, these are designed to be allocated from a
* static array rather than being malloc'd to avoid the overhead of heap memory
* management.  This design is for use in real-time embedded systems where the
* operating parameters are known beforehand and performance is critical.
*
*	To set up this buffer system, set the buffer size NBUFSZ in the header
* file and MAXNBUFS in the program file.  NBUFSZ should be set so that
* the link layer packets fit in a single buffer (normally).  You can monitor
* the minFreeBufs variable to ensure that your setting of MAXNBUFS is
* appropriate for your system.
*
*	Note that the prepend operation frees the current nBuf chain if it fails
* while the append operation does not.  This assumes that a prepend failure
* is catastrophic (if you can't add a header, you can't send it) while an
* append failure may mean that you send what you've got and try again.
*****************************************************************************/

#ifndef NETBUF_H
#define NETBUF_H


/*************************
*** PUBLIC DEFINITIONS ***
*************************/
/* 
 * By making NBUFSZ large enough to contain the largest mtu of all the
 * interfaces, no packet need ever be split across buffers.
 */
#if ETHER_SUPPORT
#define NBUFSZ 1580				/* Max data size of an nBuf. */
#else
#define NBUFSZ 128				/* Max data size of an nBuf. */
#endif

/************************
*** PUBLIC DATA TYPES ***
************************/
/* The network buffer structure. */
typedef struct NBuf_s {
	struct	NBuf_s *nextBuf;	/* Next buffer in chain. */
	struct	NBuf_s *nextChain;	/* Next chain in queue. */
	char *	data;				/* Location of data. */
	u_int	len;				/* Bytes (octets) of data in this nBuf. */
	u_int	chainLen;			/* Total bytes in this chain - valid on top only. */
	u_long	sortOrder;			/* Sort order value for sorted queues. */
	char	body[NBUFSZ];		/* Data area of the nBuf. */
} NBuf;

/* The chain queue header structure. */
typedef struct NBufQHdr_s {
	NBuf	*qHead;				/* The first nBuf chain in the queue. */
	NBuf	*qTail;				/* The last nBuf chain in the queue. */
	u_int	qLen;				/* The number of chains in the queue. */
} NBufQHdr;

/* Network buffer statistics. */
typedef struct NBufStats_s {
	DiagStat headLine;			/* Headline text. */
	DiagStat curFreeBufs;		/* The current number of free nBufs. */
	DiagStat minFreeBufs;		/* The minimum number of free nBufs during operation. */
	DiagStat maxFreeBufs;		/* The maximum number of free nBufs during operation. */
	DiagStat maxChainLen;		/* Size of largest chain (from nChainLen). */
	DiagStat endRec;
} NBufStats;


/*****************************
*** PUBLIC DATA STRUCTURES ***
*****************************/
extern NBuf *topNBuf;
#if STATS_SUPPORT > 0
extern NBufStats nBufStats;
#else
extern u_int curFreeBufs;
#endif


/***********************
*** PUBLIC FUNCTIONS ***
***********************/
/* Initialize the memory buffer sub-system. */
void nBufInit (void);

/* nBUFTOPTR - Return nBuf's data pointer casted to type t. */
#define	nBUFTOPTR(n, t)	((t)((n)->data))

#if STATS_SUPPORT > 0
/* nBUFSFREE - Return the number of free buffers. */
#define nBUFSFREE() nBufStats.curFreeBufs.val
#else
#define nBUFSFREE() curFreeBufs
#endif

/*
 * nGET - Allocate an nBuf off the free list.
 * Return n pointing to new nBuf on success, n set to NULL on failure.
 */
#if STATS_SUPPORT > 0
#define	nGET(n) { \
	OS_ENTER_CRITICAL(); \
	if (((n) = topNBuf) != NULL) { \
		topNBuf = (n)->nextBuf; \
		(n)->nextBuf = NULL; \
		(n)->nextChain = NULL; \
		(n)->data = (n)->body; \
		(n)->len = 0; \
		(n)->chainLen = 0; \
		if (--nBufStats.curFreeBufs.val < nBufStats.minFreeBufs.val) \
			nBufStats.minFreeBufs.val = nBufStats.curFreeBufs.val; \
	} \
	OS_EXIT_CRITICAL(); \
}
#else
#define	nGET(n) { \
	OS_ENTER_CRITICAL(); \
	if (((n) = topNBuf) != NULL) { \
		topNBuf = (n)->nextBuf; \
		(n)->nextBuf = NULL; \
		(n)->nextChain = NULL; \
		(n)->data = (n)->body; \
		(n)->len = 0; \
		(n)->chainLen = 0; \
		--curFreeBufs; \
	} \
	OS_EXIT_CRITICAL(); \
}
#endif

/*
 * nFREE - Free a single nBuf and place the successor, if any, in out.
 * The value of n is invalid but unchanged.  If the buffer is already
 * free (nextChain references self), do nothing.
 *
 * nFree - Free a single nBuf and associated external storage.
 * Return the next nBuf in the chain, if any.
 *
 * nFreeChain - Free all nBufs in a chain.  
 * Return the next chain in the queue, if any.
 */
#if STATS_SUPPORT > 0

#define	nFREE(n, out) { \
	OS_ENTER_CRITICAL(); \
	if (n) { \
        if ((n)->nextChain == (n)) { \
			panic("nFREE"); \
        } else { \
			if (((out) = (n)->nextBuf) != NULL) \
				(out)->nextChain = (n)->nextChain; \
			(n)->nextBuf = topNBuf; \
			topNBuf = (n); \
			nBufStats.curFreeBufs.val++; \
		} \
    } else (out) = NULL; \
	OS_EXIT_CRITICAL(); \
}

#else

#define	nFREE(n, out) { \
	OS_ENTER_CRITICAL(); \
	if (n) { \
		if ((n)->nextChain == (n)) \
			panic("nFREE"); \
		else { \
			if (((out) = (n)->nextBuf) != NULL) \
				(out)->nextChain = (n)->nextChain; \
			(n)->nextBuf = topNBuf; \
			topNBuf = (n); \
			curFreeBufs++; \
		} \
	} else (out) = NULL; \
	OS_EXIT_CRITICAL(); \
}

#endif

NBuf *nFree(NBuf *n);
NBuf *nFreeChain(NBuf *n);

/*
 * nALIGN - Position the data pointer of a new nBuf so that it is len bytes
 * away from the end of the data area.
 */
#define	nALIGN(n, len) ((n)->data = (n)->body + NBUFSZ - (len))

/*
 * nADVANCE - Advance the data pointer of a new nBuf so that it is len bytes
 * away from the beginning of the data area.
 */
#define nADVANCE(n, len) ((n)->data = (n)->body + (len))

/*
 * nLEADINGSPACE - Return the amount of space available before the current
 * start of data in an nBuf.
 */
#define	nLEADINGSPACE(n) ((n)->len > 0 ? (n)->data - (n)->body : NBUFSZ)
	    
/*
 * nTRAILINGSPACE - Return the amount of space available after the end of data
 * in an nBuf.
 */
#define	nTRAILINGSPACE(n) (NBUFSZ - (u_int)((n)->data - (n)->body) - (n)->len)

/*
 * nPREPEND - Prepend plen bytes to nBuf n and load data from s if non-null.
 * Note that plen must be <= NBUFSZ.
 * If a new nBuf must be allocated but if allocation fails, the original nBuf chain
 * is freed and n is set to NULL.  Otherwise n is set to the new top of the chain.
 * Note that the chain length is updated but the chain is assumed to not be in
 * a queue.
 *
 * nPrepend - Same as above except return the new nBuf chain on success, NULL

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产宾馆实践打屁股91| 欧美不卡在线视频| 日韩欧美电影一二三| 国产精品视频yy9299一区| 亚洲一区二区在线免费观看视频 | 美女视频黄免费的久久 | 91污在线观看| 久久久美女艺术照精彩视频福利播放| 亚洲精品日日夜夜| 国产老妇另类xxxxx| 777色狠狠一区二区三区| 亚洲欧洲美洲综合色网| 国产一区二区三区av电影| 欧美在线你懂得| 中文字幕日韩欧美一区二区三区| 国产制服丝袜一区| 日韩一区二区三区精品视频 | 日日夜夜一区二区| 色综合一区二区三区| 日本一区二区成人| 国产乱人伦精品一区二区在线观看| 欧美午夜宅男影院| 洋洋成人永久网站入口| 95精品视频在线| 中文字幕日韩av资源站| 高清视频一区二区| 中文字幕乱码亚洲精品一区| 国产一区二区三区四| 精品久久久网站| 精品一区二区三区免费视频| 欧美精品久久久久久久多人混战 | 亚洲人精品一区| 成人a级免费电影| 国产精品久久久久精k8| 成人av午夜电影| 日韩伦理免费电影| 日本丶国产丶欧美色综合| 亚洲黄一区二区三区| 欧美最猛性xxxxx直播| 亚洲主播在线观看| 欧美精品亚洲二区| 久久精品国产久精国产| 久久影院午夜片一区| 国产精品1024久久| 成人欧美一区二区三区| 欧美影片第一页| 青青草97国产精品免费观看| 精品国产乱码久久久久久蜜臀| 国产一区二区三区av电影| 日本一区二区三区高清不卡 | 日韩理论片在线| 色噜噜狠狠成人中文综合| 婷婷夜色潮精品综合在线| 欧美va在线播放| 成人av资源在线观看| 亚洲高清视频中文字幕| 日韩天堂在线观看| 成人精品一区二区三区四区| 亚洲精品中文字幕在线观看| 91精品国产欧美一区二区18| 国产精品一二三区在线| 亚洲女同女同女同女同女同69| 欧美日韩亚洲另类| 国产一区二区三区国产| 亚洲欧美日韩国产手机在线 | 欧洲精品在线观看| 美国十次综合导航| √…a在线天堂一区| 欧美久久久久久久久中文字幕| 国产精品一品视频| 亚洲激情在线激情| 337p粉嫩大胆噜噜噜噜噜91av| 91麻豆免费看| 国产乱码字幕精品高清av| 亚洲黄色免费网站| 精品av久久707| 欧美影视一区在线| 成人免费视频app| 美日韩一区二区| 亚洲精品成人精品456| 久久这里只有精品视频网| 91国偷自产一区二区三区观看 | av不卡在线观看| 久久草av在线| 亚洲高清视频在线| 日韩一区中文字幕| 国产日韩一级二级三级| 日韩一区二区三区四区五区六区| va亚洲va日韩不卡在线观看| 韩国v欧美v日本v亚洲v| 亚洲1区2区3区视频| 国产精品网友自拍| 欧美精品一区二区三区在线播放| 欧美三级电影网| 91女神在线视频| 高清久久久久久| 国产精品99久久久| 精品在线视频一区| 奇米影视一区二区三区小说| 亚洲香蕉伊在人在线观| 自拍偷在线精品自拍偷无码专区 | 精品欧美一区二区在线观看| 精品视频免费看| 欧美性视频一区二区三区| 91在线你懂得| 91在线视频观看| 97精品国产露脸对白| 国产suv精品一区二区三区| 久久99精品国产| 久久精品国产精品亚洲综合| 日本免费新一区视频| 日本一区中文字幕| 奇米影视一区二区三区小说| 天天综合天天综合色| 午夜在线成人av| 视频一区二区不卡| 日韩av中文字幕一区二区| 日韩在线观看一区二区| 一二三区精品视频| 亚洲制服丝袜一区| 香蕉加勒比综合久久| 日韩精品国产精品| 久久国产尿小便嘘嘘尿| 精品综合免费视频观看| 国产精品资源在线| 99久久精品国产网站| 在线观看国产91| 555www色欧美视频| 日韩欧美国产高清| 久久久九九九九| 国产精品丝袜一区| 亚洲精品欧美在线| 午夜欧美大尺度福利影院在线看| 日韩av电影免费观看高清完整版在线观看| 日韩精彩视频在线观看| 久久机这里只有精品| 成人国产精品免费网站| 欧美午夜精品久久久久久孕妇| 欧美乱妇20p| 欧美不卡视频一区| 久久午夜羞羞影院免费观看| 国产精品网站在线| 天堂影院一区二区| 国产剧情在线观看一区二区| 91视频国产资源| 日韩精品综合一本久道在线视频| 日本一区二区在线不卡| 亚洲一区成人在线| 黄一区二区三区| 色哟哟一区二区在线观看| 日韩一区国产二区欧美三区| 欧美激情中文字幕一区二区| 亚洲一区影音先锋| 精品亚洲国产成人av制服丝袜| 成人精品视频.| 欧美乱妇一区二区三区不卡视频| 久久精品日产第一区二区三区高清版| 樱桃视频在线观看一区| 蜜桃久久av一区| 99视频在线观看一区三区| 欧美一区二区三区思思人| 国产精品欧美综合在线| 蜜桃一区二区三区在线| 色哟哟日韩精品| 日韩精品一二三| 成人app在线观看| 欧美电影精品一区二区| 尤物视频一区二区| 国产米奇在线777精品观看| 欧美日韩一区久久| 国产精品全国免费观看高清| 欧美bbbbb| 欧美三级电影一区| 中文字幕亚洲精品在线观看| 国产一区久久久| 欧美一区二区三区在线| 亚洲国产精品一区二区久久恐怖片| 国产精品66部| 亚洲精品在线一区二区| 午夜伊人狠狠久久| 色先锋aa成人| 一区精品在线播放| 国产sm精品调教视频网站| 欧美第一区第二区| 日韩激情在线观看| 欧美日韩国产成人在线免费| 亚洲精品免费在线| 91色.com| 亚洲人成精品久久久久久 | 日本不卡一区二区三区| 在线免费亚洲电影| 亚洲精品视频一区| 一本久道久久综合中文字幕| 国产精品毛片a∨一区二区三区| 国产精品中文有码| 久久久久青草大香线综合精品| 精品在线视频一区| 久久综合久久鬼色| 国产精品一二三在| 国产精品免费视频网站|