⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mbuf.h

📁 vxworks 6.x 的全部头文件
💻 H
📖 第 1 页 / 共 2 页
字号:
/* mbuf.h - mbuf header file *//* Copyright 2001-2005 Wind River Systems, Inc. *//* * Copyright (c) 1982, 1986, 1988, 1993 *	The Regents of the University of California.  All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: *	This product includes software developed by the University of *	California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND 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 REGENTS OR 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. * *	@(#)mbuf.h	8.5 (Berkeley) 2/19/95 * $FreeBSD: src/sys/sys/mbuf.h,v 1.44.2.26 2004/06/17 00:08:21 fjoe Exp $ *//*modification history--------------------02k,15sep05,kch  Added CSUM_PTAGGED for 802.1P priority-tagged frame support                 (SPR #112513).02j,07sep05,kch  Removed CSUM_NOVLAN (SPR #112068).02i,01sep05,sar  Add M_WRITEABLE check to M_LEADINGSPACE and                 M_TRAILINGSPACE to ensure we don't overwrite                 part of a buffer that we shouldn't.02h,28jul05,dlk  Added CSUM_VLAN and CSUM_NOVLAN.02g,12jul05,vvv  merged M_NOTIFICATION from kame-20050404-freebsd41102f,17jun05,dlk  Make m_copym(), m_copypacket(), and m_copydata() macros also.02e,16may05,dlk  Make m_freem() and m_free() macros for better performance.02d,22apr05,kch  Fixed diab compilation error for MCLGET1() macro.02c,07feb05,vvv  _KERNEL cleanup02b,24jan05,vvv  osdep.h cleanup02a,20jan05,sar  Removal of unused m_dup routine.01z,23aug04,rp   merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE01y,01jul04,vvv  fixed warnings01x,28may04,niq  Merging from base6 label POST_ITER5_FRZ16_REBASE (ver                 /main/vdt/base6_itn5_networking-int/1)01w,05feb04,wap  Make M_COPY_PKTHDR() preserve extra fields in mBlkHdr01v,06jan04,vvv  removed dtom, modified allocation macros to not store mbuf		 back-pointer (SPR #88742)01u,20nov03,niq  Remove copyright_wrs.h file inclusion01t,04nov03,rlm  Ran batch header path update for header re-org.01s,03nov03,rlm  Removed wrn/coreip/ prefix from #includes for header re-org.01r,27oct03,cdw  update include statements post header re-org.01q,18aug03,nee  Merging from ACCORDION_BASE6_MERGE_BASELINE. Only                 virtualixation related changes are being merged in.01p,09jul03,syy  Back out the previous fix to SPR#8874201o,06jun03,pas  fix M_LEADINGSPACE to account for hidden back-ptr (SPR#88742)01n,14may03,vvv  make routines available when _KERNEL is not defined01m,01may03,spm  Tornado 2.2 CP1 merge (from ver 01n,21mar02,vvv:                 TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB)01l,15apr03,syy  Fixed Diab compiler warnings01k,01feb03,pas  merge from FreeBSD 4.7 - added packet tags01j,30sep02,sar  Add M_SECURE_PKT to the list of mflags01i,23aug02,ann  extended MGETHDR1 and MGET1 to recognize bestfit and closefit01h,20jun02,ann  redefined MGET1/MGETHDR1/MCLGET101g,07jun02,pas  new version of MGET/MGETHDR/MCLGET takes size argument01f,29apr02,deg  back to old netBufLib01e,22mar02,deg  MFREE auxiliary chain freeing removed (moved to _mBlkFree())01d,06feb02,ham  changed for tornado build.01c,05feb02,deg  bugfix in MCLGET()01b,11dec01,ppp  correcting m_pktdat01a,08sep01,qli  fixed mtod01a,09aug01,deg  written.*/#ifndef __INCNewMbufh#define __INCNewMbufh#ifdef __cplusplusextern "C" {#endif#ifdef _WRS_KERNEL#include <netBufLib.h>#ifdef VIRTUAL_STACK#include <sys/queue.h>#endif /* VIRTUAL_STACK *//* * Note that any file which uses _pNetDpool or _pNetSysPool, either directly * or via the macros (MGET1 etc) MUST include vsNetCore.h for Virtual Stack. */#ifndef VIRTUAL_STACKextern NET_POOL_ID   _pNetDpool;		/* network data pool */extern NET_POOL_ID	 _pNetSysPool;		/* network system pool */#endif /* ! VIRTUAL_STACK */extern M_CL_CONFIG       pktMblkClBlkDesc;	/* mBlk, clBlk configuration */extern CL_DESC 	         pktClDescTbl [];	/* cluster configuration */extern UINT		 pktClDescTblNumEnt;    /* no. elements in the table */extern M_CL_CONFIG       sysMblkClBlkDesc;	/* mBlk, clBlk configuration */extern CL_DESC 	         sysClDescTbl [];	/* cluster configuration */extern UINT		 sysClDescTblNumEnt;    /* no. elements in the table *//* * Mbufs are of a single size, MSIZE (machine/param.h), which * includes overhead.  An mbuf may add a single "mbuf cluster" of size * MCLBYTES (also in machine/param.h), which has no additional overhead * and is used instead of the internal data area; this is done when * at least MINCLSIZE of data must be stored. */#define SIMCLSIZE      128       /* cluster size to simulate mbuf data space */#define MCLBYTES       2048      /* mbuf cluster size */#define	MLEN	       SIMCLSIZE#define	MHLEN	       MLEN#define	MINCLSIZE      (MHLEN + 1) /* smallest amount to put in cluster *//* * Macro for type conversion * mtod(m, t) -	convert mbuf pointer to data pointer of correct type */#define	mtod(m, t)    ((t)((m)->m_data))/* Clarinet defs */#define mbuf            mBlk#define	m_next		mBlkHdr.mNext#define	m_len		mBlkHdr.mLen#define	m_data		mBlkHdr.mData#define	m_type		mBlkHdr.mType#define	m_flags		mBlkHdr.mFlags#define	m_nextpkt	mBlkHdr.mNextPkt#define	m_act		m_nextpkt#define	m_pkthdr	mBlkPktHdr#define	m_ext		pClBlk#define m_hdr           mHdr#define mh_next         mNext#define mh_nextpkt      mNextPkt#define mh_data         mData#define mh_len          mLen#define mh_type         mType#define mh_flags        mFlags#define m_extBuf	m_ext->clNode.pClBuf#define m_extSize	m_ext->clSize#define m_extRefCnt	m_ext->clRefCnt#define m_extFreeRtn	m_ext->pClFreeRtn#define m_extArg1	m_ext->clFreeArg1#define m_extArg2	m_ext->clFreeArg2#define m_extArg3	m_ext->clFreeArg3/* * It is not possible to port m_ext.ext_buf and m_ext.ext_free * Change your code : * m_ext.ext_buf to m_extBuf * m_ext.ext_free to m_extFreeRtn */#define	m_pktdat	m_ext->clNode.pClBuf#define	m_dat		m_ext->clNode.pClBuf#define	M_PROTO1	0x0008	/* protocol-specific */#define	M_PROTO2	0x0010	/* protocol-specific */#define	M_PROTO3	0x0020	/* protocol-specific */#define	M_PROTO4	0x0040	/* protocol-specific *//* The M_PROTO5 flag has been removed to allow the bit to be * used as the SECURE_PKT bit.  The define has been left in * as part of the history of the file and should be removed * in the future. * sar */#if 0#define	M_PROTO5	0x0080	/* protocol-specific */#endif  #define M_SECURE_PKT    0x0080  /* For use by Wind River IPSec product */#define	M_FRAG		0x0400	/* packet is a fragment of a larger packet */#define	M_FIRSTFRAG	0x0800	/* packet is first fragment */#define	M_LASTFRAG	0x1000	/* packet is last fragment */#define M_NOTIFICATION	0x8000	/* notification event *//* flags copied when copying m_pkthdr */#define	M_COPYFLAGS	(M_PKTHDR|M_EOR|M_PROTO1|M_PROTO1|M_PROTO2|M_PROTO3 | \			    M_PROTO4|M_SECURE_PKT|M_BCAST|M_MCAST|M_FRAG)/* flags indicating hw checksum support and sw checksum requirements */#define CSUM_IP			0x0001		/* will csum IP */#define CSUM_TCP		0x0002		/* will csum TCP */#define CSUM_UDP		0x0004		/* will csum UDP */#define CSUM_IP_FRAGS		0x0008		/* will csum IP fragments */#define CSUM_FRAGMENT		0x0010		/* will do IP fragmentation */#define CSUM_TCP_SEG		0x0020		/* will segment TCP/IPv4 */#define CSUM_TCPv6		0x0040		/* will csum TCP/IPv6 */#define CSUM_UDPv6		0x0080		/* will csum UDP/IPv6 */#define CSUM_TCPv6_SEG		0x0100		/* will csum TCP/IPv6 */#define CSUM_VLAN		0x0200		/* insert or extracted VLAN */#define CSUM_PTAGGED		0x0400          /* send priority-tagged frame */#define CSUM_IP_CHECKED		0x1000		/* did csum IP */#define CSUM_IP_VALID		0x2000		/*   ... the csum is valid */#define CSUM_DATA_VALID		0x4000		/* csum_data field is valid */#define CSUM_PSEUDO_HDR		0x8000		/* csum_data has pseudo hdr */#define CSUM_DELAY_DATA		(CSUM_TCP | CSUM_UDP)#define CSUM_DELAY_IP		(CSUM_IP)	/* XXX add ipv6 here too? */#define CSUM_DELAY_DATA6        (CSUM_TCPv6 | CSUM_UDPv6)#define CSUM_RESULTS            (CSUM_IP_CHECKED | CSUM_IP_VALID | \                                 CSUM_DATA_VALID | CSUM_PSEUDO_HDR)#define CSUM_IP_HDRLEN(pMblk) ((pMblk)->mBlkHdr.offset1)#define CSUM_XPORT_HDRLEN(pMblk) \        (((pMblk)->mBlkPktHdr.csum_data & 0xff00) >> 8)#define CSUM_XPORT_CSUM_OFF(pMblk) ((pMblk)->mBlkPktHdr.csum_data & 0xff)/* malloc flags (sys/malloc.h) */#define	M_NOWAIT       M_DONTWAIT  #define	M_WAITOK       M_WAIT      #define M_CLOSEFIT     0x02/* * mbuf allocation/deallocation macros: * *	MGET(struct mbuf *m, int how, int type) * allocates an mbuf and initializes it to contain internal data. * *	MGETHDR(struct mbuf *m, int how, int type) * allocates an mbuf and initializes it to contain a packet header * and internal data. *//* Clarinet: This one gets an mbuf with attached cluster, to replace * the MGET()/MCLGET() paired calls.  This should save some time by * avoiding allocating a 128-byte cluster, freeing it, allocating a * larger cluster, and joining it to the clBlk. */#define	MGET1(m, size, how, type)                                          \                    {                                                      \                    (m) = netTupleGet (_pNetDpool, size < SIMCLSIZE ? SIMCLSIZE : size, \				       (how & M_NOWAIT), (type),           \				       ((how & M_CLOSEFIT) ?               \                                        FALSE : TRUE));                    \                    }/* Following change is to eliminate Diab compiler warning 1606 */    #define	MGET(m, how, type)	                                           \                    {                                                      \                    (m) = netTupleGet (_pNetDpool, SIMCLSIZE,              \				       (how & M_NOWAIT), (type),           \				       ((how & M_CLOSEFIT) ?               \                                        FALSE : TRUE));                    \                    }#define	MGETHDR1(m, size, how, type)                                       \                    {                                                      \		    int i = size;                                          \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -