1
/*********************************************************************
6
* Status: Experimental.
7
* Author: Dag Brattli <dagb@cs.uit.no>
8
* Created at: Fri Mar 19 09:06:47 1999
9
* Modified at: Tue Sep 7 22:38:59 1999
10
* Modified by: Dag Brattli <dagb@cs.uit.no>
11
* Sources: skbuff.h by Alan Cox <iiitac@pyr.swan.ac.uk> and
12
* Florian La Roche <rzsfl@rz.uni-sb.de>
14
* Copyright (c) 1999 Dag Brattli, All Rights Reserved.
16
* This program is free software; you can redistribute it and/or
17
* modify it under the terms of the GNU General Public License as
18
* published by the Free Software Foundation; either version 2 of
19
* the License, or (at your option) any later version.
21
* Neither Dag Brattli nor University of Troms� admit liability nor
22
* provide warranty for any of this software. This material is
23
* provided "AS-IS" and at no charge.
25
* This code is very inspired by skbuff.h, and this is how it work:
27
* |<------------ truesize ----------------->|
28
* ------------------------------------------
29
* | headroom | len | tailroom |
30
* ------------------------------------------
35
********************************************************************/
42
typedef struct _GNetBuf GNetBuf;
45
guint8 *data; /* Pointer to the actual data */
46
guint8 *head; /* Pointer to start of buffer */
47
guint8 *tail; /* Pointer to end of data */
48
guint8 *end; /* Pointer to end of buffer */
49
guint len; /* Length of data */
50
guint truesize; /* Real size of the buffer */
53
GNetBuf *g_netbuf_new(guint len);
54
GNetBuf *g_netbuf_realloc(GNetBuf *buf, guint len);
55
void g_netbuf_free(GNetBuf *msg);
56
GNetBuf *g_netbuf_recycle(GNetBuf *msg);
57
guint8 *g_netbuf_put(GNetBuf *msg, guint len);
58
guint8 *g_netbuf_put_data(GNetBuf *msg, gint8 *data, guint len);
59
guint8 *g_netbuf_push(GNetBuf *msg, guint len);
60
guint8 *g_netbuf_pull(GNetBuf *msg, guint len);
61
void g_netbuf_reserve(GNetBuf *msg, guint len);
62
int g_netbuf_headroom(GNetBuf *msg);
63
int g_netbuf_tailroom(GNetBuf *msg);
64
void g_netbuf_set_size(GNetBuf *msg, guint len);
65
void g_netbuf_print(GNetBuf *msg);
67
static inline guint8 *g_netbuf_get_data(GNetBuf *msg) { return msg->data; }
68
static inline guint g_netbuf_get_len(GNetBuf *msg) { return msg->len; }