diff options
Diffstat (limited to 'src/libnetdata/circular_buffer/circular_buffer.h')
-rw-r--r-- | src/libnetdata/circular_buffer/circular_buffer.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libnetdata/circular_buffer/circular_buffer.h b/src/libnetdata/circular_buffer/circular_buffer.h new file mode 100644 index 000000000..9d29a84d7 --- /dev/null +++ b/src/libnetdata/circular_buffer/circular_buffer.h @@ -0,0 +1,20 @@ +#ifndef CIRCULAR_BUFFER_H +#define CIRCULAR_BUFFER_H 1 + +#include <string.h> + +struct circular_buffer { + size_t size, write, read, max_size; + size_t *statistics; + char *data; +}; + +struct circular_buffer *cbuffer_new(size_t initial, size_t max, size_t *statistics); +void cbuffer_free(struct circular_buffer *buf); +int cbuffer_add_unsafe(struct circular_buffer *buf, const char *d, size_t d_len); +void cbuffer_remove_unsafe(struct circular_buffer *buf, size_t num); +size_t cbuffer_next_unsafe(struct circular_buffer *buf, char **start); +size_t cbuffer_available_size_unsafe(struct circular_buffer *buf); +void cbuffer_flush(struct circular_buffer*buf); + +#endif |