buffer.h File Reference

Buffering to output and input. More...

`#include <sys/types.h>`

Go to the source code of this file.

## Enumerations

enum | buffer_status_t { BUFFER_ERROR = -1 , BUFFER_EMPTY = 0 , BUFFER_PENDING = 1 }

## Functions

struct buffer * | buffer_new (void *ctx, size_t)
void | buffer_reset (struct buffer *)
void | buffer_free (struct buffer *)
void | buffer_put (struct buffer *, const void *, size_t)
void | buffer_putc (struct buffer *, unsigned char)
void | buffer_putstr (struct buffer *, const char *)
char * | buffer_getstr (struct buffer *)
int | buffer_empty (struct buffer *)
buffer_status_t | buffer_write (struct buffer *, int fd, const void *, size_t)
buffer_status_t | buffer_flush_available (struct buffer *, int fd)
buffer_status_t | buffer_flush_all (struct buffer *, int fd)
buffer_status_t | buffer_flush_window (struct buffer *, int fd, int width, int height, int erase, int no_more)

## Detailed Description

Buffering to output and input.

## Enumeration Type Documentation

## buffer_status_t

enum buffer_status_t

Enumerator
BUFFER_ERROR |
BUFFER_EMPTY |
BUFFER_PENDING |

## Function Documentation

## buffer_empty()

int buffer_empty | ( | struct buffer * | b | ) |

References buffer::head.

## buffer_flush_all()

buffer_status_t buffer_flush_all | ( | struct buffer * | b,
|  | int | fd
| ) |  |

References BUFFER_EMPTY, buffer_flush_available(), BUFFER_PENDING, buffer::head, and buffer_data::sp.

Referenced by client_data(), and vty_close().

## buffer_flush_available()

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, buffer::head, MAX_CHUNKS, MAX_FLUSH, buffer_data::next, buffer_data::sp, and buffer::tail.

Referenced by buffer_flush_all(), and buffer_write().

## buffer_flush_window()

buffer_status_t buffer_flush_window | ( | struct buffer * | ,
|  | int | fd,
|  | int | width,
|  | int | height,
|  | int | erase,
|  | int | no_more
| ) |  |

## buffer_free()

void buffer_free | ( | struct buffer * | b | ) |

References buffer_reset().

Referenced by vty_close(), and vty_new().

## buffer_getstr()

char* buffer_getstr | ( | struct buffer * | b | ) |

References data, buffer::head, and tall_vty_ctx.

## buffer_new()

struct buffer* buffer_new | ( | void * | ctx,
|  | size_t | size
| ) |  |

References BUFFER_SIZE_DEFAULT, and buffer::size.

Referenced by vty_new().

## buffer_put()

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().

## buffer_putc()

void buffer_putc | ( | struct buffer * | b,
|  | unsigned char | c
| ) |  |

References buffer_put(), and c.

## buffer_putstr()

void buffer_putstr | ( | struct buffer * | b,
|  | const char * | c
| ) |  |

References buffer_put(), and c.

## buffer_reset()

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_write()

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, and buffer::head.