]> mj.ucw.cz Git - netgrind.git/blob - netgrind/pkt.c
Initial revision
[netgrind.git] / netgrind / pkt.c
1 /*
2  *      Netgrind -- Packet Buffers
3  *
4  *      (c) 2003 Martin Mares <mj@ucw.cz>
5  *
6  *      This software may be freely distributed and used according to the terms
7  *      of the GNU General Public License.
8  */
9
10 #include "lib/lib.h"
11 #include "netgrind/pkt.h"
12
13 #include <stdlib.h>
14
15 struct pkt *pkt_new(uns preroom, uns postroom)
16 {
17   uns len = preroom + postroom;
18   struct pkt *p = xmalloc(sizeof(struct pkt) + len);
19   p->stop = p->data = p->buf + preroom;
20   p->ebuf = p->buf + len;
21   return p;
22 }
23
24 void pkt_free(struct pkt *p)
25 {
26   xfree(p);
27 }