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

refbuf.h 1.34 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
/* Icecast
 *
 * This program is distributed under the GNU General Public License, version 2.
 * A copy of this license is included with this source.
 *
 * Copyright 2000-2004, Jack Moffitt <jack@xiph.org, 
 *                      Michael Smith <msmith@xiph.org>,
 *                      oddsock <oddsock@xiph.org>,
 *                      Karl Heyes <karl@xiph.org>
 *                      and others (see AUTHORS for details).
 */

Jack Moffitt's avatar
Jack Moffitt committed
13 14 15 16 17 18 19 20 21 22
/* refbuf.h
**
** reference counting data buffer
**
*/
#ifndef __REFBUF_H__
#define __REFBUF_H__

typedef struct _refbuf_tag
{
23 24
    char *data;
    long len;
Jack Moffitt's avatar
Jack Moffitt committed
25

26
    unsigned long _count;
Jack Moffitt's avatar
Jack Moffitt committed
27 28 29 30
} refbuf_t;

typedef struct _refbuf_queue_tag
{
31
    refbuf_t *refbuf;
32
    long total_length;
33 34
    
    struct _refbuf_queue_tag *next;
Jack Moffitt's avatar
Jack Moffitt committed
35 36 37 38 39 40 41 42 43 44 45 46
} 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);
47 48

/* Size in buffers */
Jack Moffitt's avatar
Jack Moffitt committed
49
int refbuf_queue_size(refbuf_queue_t **queue);
50 51
/* Size in bytes */
int refbuf_queue_length(refbuf_queue_t **queue);
52
refbuf_t * refbuf_queue_get(refbuf_queue_t **queue, int item);
Jack Moffitt's avatar
Jack Moffitt committed
53 54 55 56 57 58 59 60 61 62

#endif  /* __REFBUF_H__ */