~ubuntu-branches/ubuntu/jaunty/irda-utils/jaunty-proposed

« back to all changes in this revision

Viewing changes to irdadump/netbuf.h

  • Committer: Bazaar Package Importer
  • Author(s): Sivan Greenberg
  • Date: 2006-12-07 18:32:56 UTC
  • mfrom: (2.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20061207183256-tmlir0kv8t5vavnd
Tags: 0.9.18-5ubuntu1
* Merged with Debian unstable.
Remaining changes:
* findchip/smc.c,
  findchip/nsc.c,
  findchip/winbond.c:
  + Include sys/io.h instead of asm/io.h to fix FTBFS on i386
* debian/control,
  debian/irda-utils.init:
  + read -d doesn't work with dash. Run with bash and depend on it.
    Thanks to Alexander Schremmer for noticing.
* Remove stop script symlinks from rc0 and rc6.
* Autoconfiguration support (Debian #324404)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*********************************************************************
 
2
 *                
 
3
 * Filename:      gnetbuf.h
 
4
 * Version:       
 
5
 * Description:   
 
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>
 
13
 * 
 
14
 *     Copyright (c) 1999 Dag Brattli, All Rights Reserved.
 
15
 *      
 
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.
 
20
 *  
 
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.
 
24
 *     
 
25
 *     This code is very inspired by skbuff.h, and this is how it work:
 
26
 *
 
27
 *     |<------------ truesize ----------------->|
 
28
 *      ------------------------------------------
 
29
 *     | headroom |       len       | tailroom   |
 
30
 *      ------------------------------------------
 
31
 *     ^          ^                 ^            ^
 
32
 *     |          |                 |            |
 
33
 *    head       data              tail         end
 
34
 *
 
35
 ********************************************************************/
 
36
 
 
37
#ifndef G_NETBUF_H
 
38
#define G_NETBUF_H
 
39
 
 
40
#include <glib.h>
 
41
 
 
42
typedef struct _GNetBuf GNetBuf;
 
43
 
 
44
struct _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 */
 
51
};
 
52
 
 
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);
 
66
 
 
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; }
 
69
 
 
70
#endif
 
71
 
 
72
 
 
73