mbuf.h revision eda8b54d9b3e87c1108f18a1df7be9581b28f2e1
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * Copyright (c) 1982, 1986, 1988, 1993
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * The Regents of the University of California. All rights reserved.
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * Redistribution and use in source and binary forms, with or without
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * modification, are permitted provided that the following conditions
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * 1. Redistributions of source code must retain the above copyright
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * notice, this list of conditions and the following disclaimer.
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * 2. Redistributions in binary form must reproduce the above copyright
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * notice, this list of conditions and the following disclaimer in the
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * documentation and/or other materials provided with the distribution.
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * 3. All advertising materials mentioning features or use of this software
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * must display the following acknowledgement:
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * This product includes software developed by the University of
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * California, Berkeley and its contributors.
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * 4. Neither the name of the University nor the names of its contributors
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * may be used to endorse or promote products derived from this software
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * without specific prior written permission.
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
74804912a237136f06d0b49682a119577135902bvboxsync * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
9fb5c93ff4449e19077128c07c080acbed35ceeavboxsync * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * SUCH DAMAGE.
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * @(#)mbuf.h 8.3 (Berkeley) 1/21/94
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * mbuf.h,v 1.9 1994/11/14 13:54:20 bde Exp
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync#define MINCSIZE 4096 /* Amount to increase mbuf if too small */
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * Macros for type conversion
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * mtod(m,t) - convert mbuf pointer to data pointer of correct type
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * dtom(x) - convert data pointer within mbuf to mbuf pointer (XXX)
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync/* #define dtom(x) ((struct mbuf *)((int)(x) & ~(M_SIZE-1))) */
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync/* XXX About mbufs for slirp:
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * Only one mbuf is ever used in a chain, for each "cell" of data.
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * m_nextpkt points to the next packet, if fragmented.
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * If the data is too large, the M_EXT is used, and a larger block
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * is alloced. Therefore, m_free[m] must check for M_EXT and if set
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * free the m_ext. This is inefficient memory-wise, but who cares.
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync/* XXX should union some of these! */
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync/* header at beginning of each mbuf: */
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync struct mbuf *mh_nextpkt; /* Next packet in queue/record */
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync struct mbuf *mh_prevpkt; /* Flags aren't used in the output queue */
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync void *header; /*XXX: in real BSD sources this field lays in pkthdr structure*/
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * How much room is in the mbuf, from m_data to the end of the mbuf
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * How much free room there is
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync char m_dat_[1]; /* ANSI don't like 0 sized arrays */
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync#define M_EXT 0x01 /* m_ext points to more (malloced) data */
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync#define M_USEDLIST 0x04 /* XXX mbuf is on used list (for dtom()) */
e9a584ee0777ab2612e206eeec264ccb1a8ce333vboxsync#define M_DOFREE 0x08 /* when m_free is called on the mbuf, free()
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync * it rather than putting it on the free list */
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync#define M_FRAG 0x0800 /* packet is a fragment of a larger packet */
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync#define M_FIRSTFRAG 0x1000 /* paket is first fragment */
e62cb87bae732e9968199a3ad153cc94004b7182vboxsync#define M_LASTFRAG 0x2000 /* paket is last fragment */
315ad5b8dea4f6f933a01420cfb1e0fe19183c45vboxsync#endif /* VBOX_WITH_BSD_REASS */
e9a584ee0777ab2612e206eeec264ccb1a8ce333vboxsync * Mbuf statistics. XXX
e62cb87bae732e9968199a3ad153cc94004b7182vboxsyncvoid m_cat _P((PNATState, register struct mbuf *, register struct mbuf *));