git stults online alsa-signals / master ring_buffer.h
master

Tree @master (Download .tar.gz)

ring_buffer.h @masterraw · history · blame

#ifndef RING_BUFFER_H
#define RING_BUFFER_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdlib.h>
#include <string.h>
#include <sys/types.h>

typedef struct ring_buffer_t ring_buffer_t;

ring_buffer_t *ring_buffer_create      (size_t bytes);
				    
void           ring_buffer_destroy     (ring_buffer_t *rb);
				    
size_t         ring_buffer_read        (ring_buffer_t *rb, unsigned char *data, size_t bytes);
				    
size_t         ring_buffer_write       (ring_buffer_t *rb, unsigned char *data, size_t bytes);
				    
size_t         ring_buffer_size        (ring_buffer_t *rb);
				    
size_t         ring_buffer_read_avail  (ring_buffer_t *rb);

size_t         ring_buffer_write_avail (ring_buffer_t *rb);

void           ring_buffer_clear       (ring_buffer_t *rb);

#ifdef __cplusplus
}
#endif

#endif /* RING_BUFFER_H */