#ifndef _MBUF_H
   #define _MBUF_H

/* Basic message buffer structure */
struct mbuf {
	struct mbuf *next;	/* Links mbufs belonging to single packets */
	unsigned short size;	/* Size of associated data buffer */
	unsigned short left;
	unsigned short cnt;
	unsigned char *data;	/* Active working pointers */
};
#define	NULLBUF	(struct mbuf *)0

struct nbuf {
	struct nbuf *next;	/* Links mbufs belonging to single packets */
	struct nbuf *anext;
	struct nbuf *dup;
	int refcnt;
	char *data;		/* Active working pointers */
	unsigned short cnt;
	unsigned short size;	/* Size of associated data buffer */
};
#define	NULLNBUF (struct nbuf *)0
#define	NULLBUFP (struct nbuf **)0


/* In mbuf.c: */
unsigned short len_p (void *);
struct nbuf *ambufw(unsigned short);
struct nbuf *free_p(struct nbuf *);

void free_q (struct mbuf **);
int OUTBYTE(struct mbuf **, unsigned char);
int PUSHOUT(struct mbuf **, unsigned char);
int ADD_Buf(struct mbuf **, unsigned char *, int);
int INBYTE(struct mbuf **);
int PEEKBYTE(struct mbuf **);
int GET_Buf(struct mbuf **, unsigned char *, int);

#endif
