2 * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 * Distributed under the terms of the MIT License.
23 // flags for create_ring_buffer_etc()
24 #define RING_BUFFER_INIT_FROM_BUFFER 0x01
31 struct ring_buffer
*create_ring_buffer(size_t size
);
32 struct ring_buffer
*create_ring_buffer_etc(void *memory
, size_t size
,
34 void delete_ring_buffer(struct ring_buffer
*buffer
);
36 void ring_buffer_clear(struct ring_buffer
*buffer
);
37 size_t ring_buffer_readable(struct ring_buffer
*buffer
);
38 size_t ring_buffer_writable(struct ring_buffer
*buffer
);
39 void ring_buffer_flush(struct ring_buffer
*buffer
, size_t bytes
);
40 size_t ring_buffer_read(struct ring_buffer
*buffer
, uint8
*data
, ssize_t length
);
41 size_t ring_buffer_write(struct ring_buffer
*buffer
, const uint8
*data
, ssize_t length
);
42 ssize_t
ring_buffer_user_read(struct ring_buffer
*buffer
, uint8
*data
, ssize_t length
);
43 ssize_t
ring_buffer_user_write(struct ring_buffer
*buffer
, const uint8
*data
, ssize_t length
);
44 size_t ring_buffer_peek(struct ring_buffer
*buffer
, size_t offset
, void *data
,
46 int32
ring_buffer_get_vecs(struct ring_buffer
*buffer
, struct iovec
*vecs
);
53 #endif /* RING_BUFFER_H */