Blame src/shared/ringbuf.h

Packit 34410b
/*
Packit 34410b
 *
Packit 34410b
 *  BlueZ - Bluetooth protocol stack for Linux
Packit 34410b
 *
Packit 34410b
 *  Copyright (C) 2012-2014  Intel Corporation. All rights reserved.
Packit 34410b
 *
Packit 34410b
 *
Packit 34410b
 *  This library is free software; you can redistribute it and/or
Packit 34410b
 *  modify it under the terms of the GNU Lesser General Public
Packit 34410b
 *  License as published by the Free Software Foundation; either
Packit 34410b
 *  version 2.1 of the License, or (at your option) any later version.
Packit 34410b
 *
Packit 34410b
 *  This library is distributed in the hope that it will be useful,
Packit 34410b
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 34410b
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 34410b
 *  Lesser General Public License for more details.
Packit 34410b
 *
Packit 34410b
 *  You should have received a copy of the GNU Lesser General Public
Packit 34410b
 *  License along with this library; if not, write to the Free Software
Packit 34410b
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
Packit 34410b
 *
Packit 34410b
 */
Packit 34410b
Packit 34410b
#include <stdlib.h>
Packit 34410b
#include <stdarg.h>
Packit 34410b
#include <stdbool.h>
Packit 34410b
Packit 34410b
typedef void (*ringbuf_tracing_func_t)(const void *buf, size_t count,
Packit 34410b
							void *user_data);
Packit 34410b
Packit 34410b
struct ringbuf;
Packit 34410b
Packit 34410b
struct ringbuf *ringbuf_new(size_t size);
Packit 34410b
void ringbuf_free(struct ringbuf *ringbuf);
Packit 34410b
Packit 34410b
bool ringbuf_set_input_tracing(struct ringbuf *ringbuf,
Packit 34410b
			ringbuf_tracing_func_t callback, void *user_data);
Packit 34410b
Packit 34410b
size_t ringbuf_capacity(struct ringbuf *ringbuf);
Packit 34410b
Packit 34410b
size_t ringbuf_len(struct ringbuf *ringbuf);
Packit 34410b
size_t ringbuf_drain(struct ringbuf *ringbuf, size_t count);
Packit 34410b
void *ringbuf_peek(struct ringbuf *ringbuf, size_t offset, size_t *len_nowrap);
Packit 34410b
ssize_t ringbuf_write(struct ringbuf *ringbuf, int fd);
Packit 34410b
Packit 34410b
size_t ringbuf_avail(struct ringbuf *ringbuf);
Packit 34410b
int ringbuf_printf(struct ringbuf *ringbuf, const char *format, ...)
Packit 34410b
					__attribute__((format(printf, 2, 3)));
Packit 34410b
int ringbuf_vprintf(struct ringbuf *ringbuf, const char *format, va_list ap);
Packit 34410b
ssize_t ringbuf_read(struct ringbuf *ringbuf, int fd);