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

📄 mbuf.h

📁 vxworks 6.x 的全部头文件
💻 H
📖 第 1 页 / 共 2 页
字号:
                                                                           \                    (m) = netTupleGet(_pNetDpool, i < SIMCLSIZE ? SIMCLSIZE : i, \				      (how & M_NOWAIT), (type),             \				      ((how & M_CLOSEFIT) ? FALSE : TRUE)); \		    if ((m) != NULL)                                        \		        (m)->m_flags |= M_PKTHDR;                           \                    }/* Following change is to eliminate Diab compiler warning 1606 */    #define	MGETHDR(m, how, type)	                                        \                    {                                                   \                    (m) = netTupleGet (_pNetDpool, SIMCLSIZE,           \				       (how & M_NOWAIT), (type),             \				       ((how & M_CLOSEFIT) ? FALSE : TRUE)); \		    if ((m) != NULL)                                        \		        (m)->m_flags |= M_PKTHDR;                           \                    }#define	MCLGET1(m, size, how)                                           \                    {                                                   \                      char *    pClBuf;                                 \		      CL_POOL_ID pClPool;                               \                                                                        \                      if ((m)->m_flags & M_EXT)                         \			{                                  	  	\	  		  netClFree((m)->pClBlk->pNetPool,              \			            (UCHAR *)(m)->pClBlk->clNode.pClBuf);        \                          (m)->m_flags &= ~M_EXT;                       \			}                                               \                                                                        \                      if ((pClPool = netClPoolIdGet(_pNetDpool,         \                                                   (size),              \						   TRUE)) != NULL)      \             		  {                                             \                          if ((pClBuf = netClusterGet(_pNetDpool,       \				  		     pClPool)) != NULL) \			      {                                         \			      netClBlkJoin((m)->m_ext,                  \                                           pClBuf,                      \                                           (size),                      \					   0,0,0,0);                    \                              netMblkClJoin((m), (m)->m_ext);           \			      }                                         \                          }                                             \                    } #define MCLGET(m, how) MCLGET1(m, MCLBYTES, how)/* * MFREE(struct mbuf *m, struct mbuf *n) * Free a single mbuf and associated external storage. * Place the successor, if any, in n. * * we do need to check non-first mbuf for m_aux, since some of existing * code does not call M_PREPEND properly. * (example: call to bpf_mtap from drivers) */#define	MFREE(m, n) (n) = netMblkClFree((m))/* * Copy mbuf pkthdr from "from" to "to". * from must have M_PKTHDR set, and to must be empty. * aux pointer will be moved to `to'. */#define	M_COPY_PKTHDR(to, from)                                         \                    {                                                   \                      struct mbuf *_mfrom = (from);		        \	              struct mbuf *_mto = (to);	                        \                      _mto->mBlkHdr.reserved = _mfrom->mBlkHdr.reserved;\                      _mto->mBlkHdr.offset1 = _mfrom->mBlkHdr.offset1;	\                      _mto->m_flags = _mfrom->m_flags;   	        \	              _mto->m_pkthdr = _mfrom->m_pkthdr;                \                      _mfrom->m_pkthdr.aux = (struct mbuf *)NULL;       \		    }/* * Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place * an object of the specified size at the end of the mbuf, longword aligned. */#define	M_ALIGN(m, len) ((m)->m_data +=                                   \			 ((m)->m_extSize - (len)) &~ (sizeof(long) - 1))/* * As above, for mbufs allocated with m_gethdr/MGETHDR * or initialized by M_COPY_PKTHDR. */#define	MH_ALIGN(m, len) (M_ALIGN((m),(len))) /* * Check if we can write to an mbuf. */#define M_WRITABLE(m) ((m)->m_extRefCnt == 1)/* For M_LEADINGSPACE and M_TRAILINGSPACE the  * M_WRITABLE() is a conservative safety measure. *//* * Compute the amount of space available * before the current start of data in an mbuf. */#define	M_LEADINGSPACE(m) \  (M_WRITABLE(m) ? ((m)->m_data - (m)->m_extBuf) : 0)/* * Compute the amount of space available * after the end of data in an mbuf. */#define	M_TRAILINGSPACE(m) \  (M_WRITABLE(m) ? ((m)->m_extBuf + (m)->m_extSize - \                    (m)->m_data - (m)->m_len) \                    : 0)/* * Arrange to prepend space of size plen to mbuf m. * If a new mbuf must be allocated, how specifies whether to wait. * If how is M_DONTWAIT and allocation fails, the original mbuf chain * is freed and m is set to NULL. */#ifndef	STANDALONE_AGENT#define	M_PREPEND(m, plen, how)                                         \                    {                                                   \                    if (M_LEADINGSPACE(m) >= (plen))   			\		      { 		                                \                        (m)->m_data -= (plen);       		     	\		        (m)->m_len += (plen); 			        \	              }    					        \                    else                                                \                      (m) = m_prepend((m), (plen), (how)); 		\	            if ((m) && (m)->m_flags & M_PKTHDR) 		\		      (m)->m_pkthdr.len += (plen);                      \    	            }#else	/* STANDALONE_AGENT *//* * for standalone agent, the M_PREPEND routine does no try to allocate * a new buffer (there is no available). Anyway, this is not needed since * all the WDB packets can be stored in one buffer. */#define	M_PREPEND(m, plen, how)					\    { 								\	if (M_LEADINGSPACE(m) >= (plen)) { 			\		(m)->m_data -= (plen); 				\		(m)->m_len += (plen); 				\	} else 							\		(m) = NULL;			 		\	if ((m) && (m)->m_flags & M_PKTHDR) 			\		(m)->m_pkthdr.len += (plen); 			\    }#endif	/* STANDALONE_AGENT *//* change mbuf to new type */#define	MCHTYPE(m, t) (_pNetDpool->mBlkStat.types[(m)->m_type]--;       \                       _pNetDpool->mBlkStat.types[(t)]++;               \                       (m)->m_type = (t))/* compatibility with 4.3 *//* * pkthdr.aux type tags. */struct mauxtag {	int	af;	int	type;	void*	p;};/* * Some packet tags to identify different mbuf annotations. * * Eventually, these annotations will end up in an appropriate chain * (struct m_tag or similar, e.g. as in NetBSD) properly managed by * the mbuf handling routines. * * As a temporary and low impact solution to replace the even uglier * approach used so far in some parts of the network stack (which relies * on global variables), these annotations are stored in MT_TAG * mbufs (or lookalikes) prepended to the actual mbuf chain. * *	m_type	= MT_TAG *	m_flags	= m_tag_id *	m_next	= next buffer in chain. * * BE VERY CAREFUL not to pass these blocks to the mbuf handling routines. * */#define	m_tag_id	m_flags/* Packet tag types -- first ones are from NetBSD */#define	PACKET_TAG_NONE				0  /* Nadda */#define	PACKET_TAG_IPSEC_IN_DONE		1  /* IPsec applied, in */#define	PACKET_TAG_IPSEC_OUT_DONE		2  /* IPsec applied, out */#define	PACKET_TAG_IPSEC_IN_CRYPTO_DONE		3  /* NIC IPsec crypto done */#define	PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED	4  /* NIC IPsec crypto req'ed */#define	PACKET_TAG_IPSEC_IN_COULD_DO_CRYPTO	5  /* NIC notifies IPsec */#define	PACKET_TAG_IPSEC_PENDING_TDB		6  /* Reminder to do IPsec */#define	PACKET_TAG_BRIDGE			7  /* Bridge processing done */#define	PACKET_TAG_GIF				8  /* GIF processing done */#define	PACKET_TAG_GRE				9  /* GRE processing done */#define	PACKET_TAG_IN_PACKET_CHECKSUM		10 /* NIC checksumming done */#define	PACKET_TAG_ENCAP			11 /* Encap.  processing */#define	PACKET_TAG_IPSEC_SOCKET			12 /* IPSEC socket ref */#define	PACKET_TAG_IPSEC_HISTORY		13 /* IPSEC history */#define	PACKET_TAG_IPV6_INPUT			14 /* IPV6 input processing *//* Packet tags used in the FreeBSD network stack * We don't support dummynet or divert, they are included for consistency */#define	PACKET_TAG_DUMMYNET			15 /* dummynet info */#define	PACKET_TAG_IPFW				16 /* ipfw classification */#define	PACKET_TAG_DIVERT			17 /* divert info */#define	PACKET_TAG_IPFORWARD			18 /* ipforward info */#define	PACKET_TAG_MAX				19#ifdef VIRTUAL_STACKtypedef struct memList    {    SLIST_ENTRY(memList) next;    char *               allocatedMem;    } MEM_LIST;#endif /* VIRTUAL_STACK */#ifndef VIRTUAL_STACKextern	int		 max_linkhdr;	/* largest link-level header */extern	int		 max_protohdr;	/* largest protocol header */extern	int		 max_hdr;	/* largest link+protocol header */#endif /* ! VIRTUAL_STACK */void	m_adj (struct mbuf *, int);void	m_cat (struct mbuf *,struct mbuf *);void	m_copyback (struct mbuf *, int, int, caddr_t);void	m_copydata (struct mbuf *,int,int,caddr_t);struct	mbuf *m_copypacket (struct mbuf *, int);struct	mbuf *m_devget (char *, int, int, struct ifnet *,    void (*copy)(char *, caddr_t, u_int));/* Removed m_dup as it wasn't being used */struct	mbuf *m_free (struct mbuf *);void	m_freem (struct mbuf *);struct	mbuf *m_get (int, int);struct	mbuf *m_getclr (int, int);struct	mbuf *m_gethdr (int, int);struct	mbuf *m_getm (struct mbuf *, int, int, int);struct	mbuf *m_prepend (struct mbuf *,int,int);struct	mbuf *m_pulldown (struct mbuf *, int, int, int *);struct	mbuf *m_pullup (struct mbuf *, int);struct	mbuf *m_split (struct mbuf *,int,int);struct	mbuf *m_aux_add2 (struct mbuf *, int, int, void *);struct	mbuf *m_aux_find2 (struct mbuf *, int, int, void *);struct	mbuf *m_aux_add (struct mbuf *, int, int);struct	mbuf *m_aux_find (struct mbuf *, int, int);void	m_aux_delete (struct mbuf *, struct mbuf *);struct	mbuf *m_copym (struct mbuf *, int, int, int);/* Make m_freem() and m_free() macros for better performance */#define m_freem(m) (netMblkClChainFree (m))#define m_free(m) (netMblkClFree (m))/* Make m_copydata(), m_copypacket(), and m_copym() macros also */#define m_copydata(m, off, len, cp) \    ((void)(netMblkOffsetToBufCopy((m), (off), (cp), (len), 0)))#define m_copym(m, off0, len, wait) \    (netMblkChainDup(_pNetDpool, (m), (off0), (len), (wait)))#define m_copypacket(m, how) \    (netMblkChainDup(_pNetDpool, (m), 0, M_COPYALL, (how)))#define	m_copy(m, o, l)	m_copym((m), (o), (l), M_DONTWAIT)#endif /* _WRS_KERNEL */#ifdef __cplusplus}#endif#endif /* __INCNewMbufh */

⌨️ 快捷键说明

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