2020-03-12 09:10:33 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-3.0-or-later
|
2018-08-26 07:36:42 +08:00
|
|
|
* Copyright © 2016-2018 The TokTok team.
|
2017-01-14 23:46:31 +08:00
|
|
|
* Copyright © 2013 Tox project.
|
|
|
|
* Copyright © 2013 plutooo
|
|
|
|
*/
|
2018-09-10 03:54:05 +08:00
|
|
|
#ifndef C_TOXCORE_TOXAV_RING_BUFFER_H
|
|
|
|
#define C_TOXCORE_TOXAV_RING_BUFFER_H
|
2016-09-22 22:20:33 +08:00
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2018-07-04 02:14:36 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-09-22 22:20:33 +08:00
|
|
|
/* Ring buffer */
|
|
|
|
typedef struct RingBuffer RingBuffer;
|
|
|
|
bool rb_full(const RingBuffer *b);
|
|
|
|
bool rb_empty(const RingBuffer *b);
|
|
|
|
void *rb_write(RingBuffer *b, void *p);
|
|
|
|
bool rb_read(RingBuffer *b, void **p);
|
|
|
|
RingBuffer *rb_new(int size);
|
|
|
|
void rb_kill(RingBuffer *b);
|
|
|
|
uint16_t rb_size(const RingBuffer *b);
|
|
|
|
uint16_t rb_data(const RingBuffer *b, void **dest);
|
|
|
|
|
2018-07-04 02:14:36 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-09-10 03:54:05 +08:00
|
|
|
#endif // C_TOXCORE_TOXAV_RING_BUFFER_H
|