OSUOSL/Nero are experiencing Internet connectivity problems. This affects us as we're hosted with OSUOSL. We apologize for the inconvenience.

refbuf.h 875 Bytes
Newer Older
Jack Moffitt's avatar
Jack Moffitt committed
1 2 3 4 5 6 7 8 9 10
/* refbuf.h
**
** reference counting data buffer
**
*/
#ifndef __REFBUF_H__
#define __REFBUF_H__

typedef struct _refbuf_tag
{
11 12
    char *data;
    long len;
Jack Moffitt's avatar
Jack Moffitt committed
13

14
    unsigned long _count;
Jack Moffitt's avatar
Jack Moffitt committed
15 16 17 18
} refbuf_t;

typedef struct _refbuf_queue_tag
{
19
    refbuf_t *refbuf;
20
    long total_length;
21 22
    
    struct _refbuf_queue_tag *next;
Jack Moffitt's avatar
Jack Moffitt committed
23 24 25 26 27 28 29 30 31 32 33 34
} refbuf_queue_t;

void refbuf_initialize(void);
void refbuf_shutdown(void);

refbuf_t *refbuf_new(unsigned long size);
void refbuf_addref(refbuf_t *self);
void refbuf_release(refbuf_t *self);

void refbuf_queue_add(refbuf_queue_t **queue, refbuf_t *refbuf);
refbuf_t *refbuf_queue_remove(refbuf_queue_t **queue);
void refbuf_queue_insert(refbuf_queue_t **queue, refbuf_t *refbuf);
35 36

/* Size in buffers */
Jack Moffitt's avatar
Jack Moffitt committed
37
int refbuf_queue_size(refbuf_queue_t **queue);
38 39
/* Size in bytes */
int refbuf_queue_length(refbuf_queue_t **queue);
Jack Moffitt's avatar
Jack Moffitt committed
40 41 42 43 44 45 46 47 48 49

#endif  /* __REFBUF_H__ */