2 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
4 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
6 * Redistribution and use in source and binary forms are permitted
7 * provided that the above copyright notice and this paragraph are
8 * duplicated in all such forms and that any documentation,
9 * advertising materials, and other materials related to such
10 * distribution and use acknowledge that the software was developed
11 * by the Internet Initiative Japan. The name of the
12 * IIJ may not be used to endorse or promote products derived
13 * from this software without specific prior written permission.
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
24 size_t m_size; /* size allocated (excluding header) */
25 short m_offset; /* offset from header end to start position */
26 size_t m_len; /* available byte count in buffer */
27 short m_type; /* MB_* below */
28 struct mbuf *m_next; /* link to next mbuf */
29 struct mbuf *m_nextpkt; /* link to next packet */
30 /* buffer space is malloc()d directly after the header */
39 #define MBUF_CTOP(bp) \
40 ((bp) ? (u_char *)((bp)+1) + (bp)->m_offset : NULL)
42 #define CONST_MBUF_CTOP(bp) \
43 ((bp) ? (const u_char *)((bp)+1) + (bp)->m_offset : NULL)
54 #define MB_ICOMPDOUT 9
56 #define MB_COMPDOUT 11
62 #define MB_PROTOOUT 17
70 #define MB_ASYNCOUT 25
84 #define MB_MAX MB_UNKNOWN
86 #define M_MAXLEN (4096 - sizeof(struct mbuf))
90 extern int m_length(struct mbuf *);
91 extern struct mbuf *m_get(size_t, int);
92 extern struct mbuf *m_free(struct mbuf *);
93 extern void m_freem(struct mbuf *);
94 extern void mbuf_Write(struct mbuf *, const void *, size_t);
95 extern struct mbuf *mbuf_Read(struct mbuf *, void *, size_t);
96 extern size_t mbuf_View(struct mbuf *, void *, size_t);
97 extern struct mbuf *m_prepend(struct mbuf *, const void *, size_t, size_t);
98 extern struct mbuf *m_adj(struct mbuf *, ssize_t);
99 extern struct mbuf *m_pullup(struct mbuf *);
100 extern void m_settype(struct mbuf *, int);
101 extern struct mbuf *m_append(struct mbuf *, const void *, size_t);
103 extern int mbuf_Show(struct cmdargs const *);
105 extern void m_enqueue(struct mqueue *, struct mbuf *);
106 extern struct mbuf *m_dequeue(struct mqueue *);