libosmovty 1.10.0.58-6cd7a
Osmocom VTY library
|
Buffering of output and input. More...
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stddef.h>
#include <sys/uio.h>
#include <osmocom/core/talloc.h>
#include <osmocom/vty/buffer.h>
#include <osmocom/vty/vty.h>
Data Structures | |
struct | buffer |
struct | buffer_data |
Macros | |
#define | BUFFER_SIZE_DEFAULT 4096 |
#define | BUFFER_DATA_FREE(D) talloc_free((D)) |
#define | MAX_CHUNKS 16 |
#define | MAX_FLUSH 131072 |
Functions | |
struct buffer * | buffer_new (void *ctx, size_t size) |
void | buffer_free (struct buffer *b) |
char * | buffer_getstr (struct buffer *b) |
int | buffer_empty (struct buffer *b) |
void | buffer_reset (struct buffer *b) |
static struct buffer_data * | buffer_add (struct buffer *b) |
void | buffer_put (struct buffer *b, const void *p, size_t size) |
void | buffer_putc (struct buffer *b, unsigned char c) |
void | buffer_putstr (struct buffer *b, const char *c) |
buffer_status_t | buffer_flush_all (struct buffer *b, int fd) |
buffer_status_t | buffer_flush_available (struct buffer *b, int fd) |
buffer_status_t | buffer_write (struct buffer *b, int fd, const void *p, size_t size) |
Buffering of output and input.
#define BUFFER_DATA_FREE | ( | D | ) | talloc_free((D)) |
#define BUFFER_SIZE_DEFAULT 4096 |
#define MAX_CHUNKS 16 |
#define MAX_FLUSH 131072 |
|
static |
References buffer_data::cp, data, buffer::head, buffer_data::next, buffer::size, buffer_data::sp, and buffer::tail.
Referenced by buffer_put().
int buffer_empty | ( | struct buffer * | b | ) |
References buffer::head.
buffer_status_t buffer_flush_all | ( | struct buffer * | b, |
int | fd | ||
) |
References BUFFER_EMPTY, buffer_flush_available(), BUFFER_PENDING, fd, buffer::head, and buffer_data::sp.
Referenced by client_data(), vty_close(), and vty_flush().
buffer_status_t buffer_flush_available | ( | struct buffer * | b, |
int | fd | ||
) |
References BUFFER_DATA_FREE, BUFFER_EMPTY, BUFFER_ERROR, BUFFER_PENDING, buffer_data::cp, buffer_data::data, ERRNO_IO_RETRY, fd, buffer::head, MAX_CHUNKS, MAX_FLUSH, buffer_data::next, buffer_data::sp, and buffer::tail.
Referenced by buffer_flush_all(), and buffer_write().
void buffer_free | ( | struct buffer * | b | ) |
References buffer_reset().
Referenced by vty_close(), and vty_new().
char * buffer_getstr | ( | struct buffer * | b | ) |
References data, buffer::head, and tall_vty_ctx.
struct buffer * buffer_new | ( | void * | ctx, |
size_t | size | ||
) |
References BUFFER_SIZE_DEFAULT, and buffer::size.
Referenced by vty_new().
void buffer_put | ( | struct buffer * | b, |
const void * | p, | ||
size_t | size | ||
) |
References buffer_add(), data, buffer::size, and buffer::tail.
Referenced by buffer_putc(), buffer_putstr(), buffer_write(), vty_out_newline(), vty_out_va(), and vty_write().
void buffer_putc | ( | struct buffer * | b, |
unsigned char | c | ||
) |
References buffer_put(), and c.
void buffer_putstr | ( | struct buffer * | b, |
const char * | c | ||
) |
References buffer_put(), and c.
void buffer_reset | ( | struct buffer * | b | ) |
References BUFFER_DATA_FREE, data, buffer::head, buffer_data::next, and buffer::tail.
Referenced by buffer_free(), vty_buffer_reset(), vty_read(), and vty_reset().
buffer_status_t buffer_write | ( | struct buffer * | b, |
int | fd, | ||
const void * | p, | ||
size_t | size | ||
) |
References BUFFER_EMPTY, BUFFER_ERROR, buffer_flush_available(), BUFFER_PENDING, buffer_put(), ERRNO_IO_RETRY, fd, and buffer::head.