2011-05-14 17:15:04 +00:00
|
|
|
#ifndef __TINC_BUFFER_H__
|
|
|
|
#define __TINC_BUFFER_H__
|
|
|
|
|
|
|
|
typedef struct buffer_t {
|
|
|
|
char *data;
|
2015-06-29 13:52:14 +00:00
|
|
|
size_t maxlen;
|
|
|
|
size_t len;
|
|
|
|
unsigned int offset;
|
2011-05-14 17:15:04 +00:00
|
|
|
} buffer_t;
|
|
|
|
|
2015-06-29 13:52:14 +00:00
|
|
|
extern void buffer_compact(buffer_t *buffer, size_t maxsize);
|
|
|
|
extern char *buffer_prepare(buffer_t *buffer, size_t size);
|
|
|
|
extern void buffer_add(buffer_t *buffer, const char *data, size_t size);
|
2011-05-14 17:15:04 +00:00
|
|
|
extern char *buffer_readline(buffer_t *buffer);
|
2015-06-29 13:52:14 +00:00
|
|
|
extern char *buffer_read(buffer_t *buffer, size_t size);
|
2011-05-14 17:15:04 +00:00
|
|
|
extern void buffer_clear(buffer_t *buffer);
|
|
|
|
|
|
|
|
#endif
|