summaryrefslogtreecommitdiff
path: root/include/buffer.h
blob: 0d52e7255419aa195775caedfaf3542ff397994b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef _BUFFER_H_
#define _BUFFER_H_

struct buffer {
	unsigned char *data;
	unsigned int size;
	unsigned int cur_size;
};

struct buffer *buffer_create(unsigned int size);
void buffer_destroy(struct buffer *b);

int buffer_add(struct buffer *b, void *data, unsigned int size);
void buffer_flush(struct buffer *b, 
		  void (*cb)(void *buffer_data, 
		  void *data),
		  void *data);
unsigned int buffer_size(const struct buffer *b);

#endif