#ifndef _MBUF_H_
#define _MBUF_H_
-#define m_freem m_free
-
-
#define MINCSIZE 4096 /* Amount to increase mbuf if too small */
/*
* Macros for type conversion
* mtod(m,t) - convert mbuf pointer to data pointer of correct type
- * dtom(x) - convert data pointer within mbuf to mbuf pointer (XXX)
*/
#define mtod(m,t) ((t)(m)->m_data)
-/* #define dtom(x) ((struct mbuf *)((int)(x) & ~(M_SIZE-1))) */
/* XXX About mbufs for slirp:
* Only one mbuf is ever used in a chain, for each "cell" of data.
struct mbuf {
struct m_hdr m_hdr;
+ Slirp *slirp;
+ bool arp_requested;
+ uint64_t expiration_date;
+ /* start of dynamic buffer area, must be last element */
union M_dat {
char m_dat_[1]; /* ANSI don't like 0 sized arrays */
char *m_ext_;
#define M_DOFREE 0x08 /* when m_free is called on the mbuf, free()
* it rather than putting it on the free list */
-/*
- * Mbuf statistics. XXX
- */
-
-struct mbstat {
- int mbs_alloced; /* Number of mbufs allocated */
-
-};
-
-extern struct mbstat mbstat;
-extern int mbuf_alloced;
-extern struct mbuf m_freelist, m_usedlist;
-extern int mbuf_max;
-
-void m_init _P((void));
-struct mbuf * m_get _P((void));
-void m_free _P((struct mbuf *));
-void m_cat _P((register struct mbuf *, register struct mbuf *));
-void m_inc _P((struct mbuf *, int));
-void m_adj _P((struct mbuf *, int));
-int m_copy _P((struct mbuf *, struct mbuf *, int, int));
-struct mbuf * dtom _P((void *));
+void m_init(Slirp *);
+void m_cleanup(Slirp *slirp);
+struct mbuf * m_get(Slirp *);
+void m_free(struct mbuf *);
+void m_cat(register struct mbuf *, register struct mbuf *);
+void m_inc(struct mbuf *, int);
+void m_adj(struct mbuf *, int);
+int m_copy(struct mbuf *, struct mbuf *, int, int);
+struct mbuf * dtom(Slirp *, void *);
+
+static inline void ifs_init(struct mbuf *ifm)
+{
+ ifm->ifs_next = ifm->ifs_prev = ifm;
+}
#endif