~ubuntu-branches/ubuntu/maverick/audit/maverick

« back to all changes in this revision

Viewing changes to auparse/data_buf.h

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2007-06-29 13:05:14 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070629130514-z798cz4lebiahj5w
Tags: 1.5.4-0ubuntu1
* New upstream version.
* debian/patches/audit-1.5.1-dist.patch:
  * update so that it applies for 1.5.4.
* debian/control:
  * update Maintainer and XSBC-Original-Maintainer fields.
* debian/rules:
  * enable apparmor support: add --with-apparmor to configure options.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************/
 
2
/******************************** Documentation ******************************/
 
3
/*****************************************************************************/
 
4
 
 
5
/*****************************************************************************/
 
6
/******************************* Include Files *******************************/
 
7
/*****************************************************************************/
 
8
 
 
9
/*****************************************************************************/
 
10
/*********************************** Defines *********************************/
 
11
/*****************************************************************************/
 
12
 
 
13
#define DATABUF_FLAG_PRESERVE_HEAD (1 << 0)
 
14
 
 
15
 
 
16
/*****************************************************************************/
 
17
/******************************* Type Definitions ****************************/
 
18
/*****************************************************************************/
 
19
 
 
20
typedef struct Databuf {
 
21
    unsigned flags;
 
22
    size_t alloc_size;
 
23
    char *alloc_ptr;
 
24
    size_t offset;
 
25
    size_t len;
 
26
    size_t max_len;
 
27
} DataBuf;
 
28
 
 
29
/*****************************************************************************/
 
30
/*************************  External Global Variables  ***********************/
 
31
/*****************************************************************************/
 
32
 
 
33
/*****************************************************************************/
 
34
/*****************************  Inline Functions  ****************************/
 
35
/*****************************************************************************/
 
36
 
 
37
static inline char *databuf_beg(DataBuf *db)
 
38
{return (db->alloc_ptr == NULL) ? NULL : db->alloc_ptr+db->offset;}
 
39
 
 
40
static inline char *databuf_end(DataBuf *db)
 
41
{return (db->alloc_ptr == NULL) ? NULL : db->alloc_ptr+db->offset+db->len;}
 
42
 
 
43
static inline char *databuf_alloc_end(DataBuf *db)
 
44
{return (db->alloc_ptr == NULL) ? NULL : db->alloc_ptr+db->alloc_size;}
 
45
 
 
46
static inline int databuf_tail_size(DataBuf *db)
 
47
{return db->alloc_size - (db->offset+db->len);}
 
48
 
 
49
static inline int databuf_tail_available(DataBuf *db, size_t append_len)
 
50
{return append_len <= databuf_tail_size(db);}
 
51
 
 
52
static inline size_t databuf_free_size(DataBuf *db)
 
53
{return db->alloc_size-db->len;}
 
54
 
 
55
/*****************************************************************************/
 
56
/****************************  Exported Functions  ***************************/
 
57
/*****************************************************************************/
 
58
 
 
59
void databuf_print(DataBuf *db, int print_data, char *fmt, ...);
 
60
int databuf_init(DataBuf *db, size_t size, unsigned flags);
 
61
int databuf_free(DataBuf *db);
 
62
int databuf_append(DataBuf *db, const char *src, size_t src_size);
 
63
int databuf_advance(DataBuf *db, size_t advance);
 
64
int databuf_compress(DataBuf *db);
 
65
int databuf_reset(DataBuf *db);
 
66