Avoid making a lot of syscalls.
More...
|
bio_io_buffer_t | bio_make_buffer (const bio_buffer_options_t *options) |
| Create a new I/O buffer.
|
|
void | bio_destroy_buffer (bio_io_buffer_t buffer) |
| Destroy a buffer.
|
|
bio_io_buffer_t | bio_make_file_read_buffer (bio_file_t file, size_t size) |
| Create a read buffer for a file.
|
|
bio_io_buffer_t | bio_make_file_write_buffer (bio_file_t file, size_t size, bool fflush) |
| Create a write buffer for a file.
|
|
bio_io_buffer_t | bio_make_socket_read_buffer (bio_socket_t socket, size_t size) |
| Create a read buffer for a socket.
|
|
bio_io_buffer_t | bio_make_socket_write_buffer (bio_socket_t socket, size_t size) |
| Create a write buffer for a socket.
|
|
size_t | bio_buffered_read (bio_io_buffer_t buffer, void *in, size_t size, bio_error_t *error) |
| Read from a buffer.
|
|
size_t | bio_buffered_write (bio_io_buffer_t buffer, const void *out, size_t size, bio_error_t *error) |
| Write to a buffer.
|
|
bool | bio_flush_buffer (bio_io_buffer_t buffer, bio_error_t *error) |
| Flush all bufferred content.
|
|
static size_t | bio_buffered_read_exactly (bio_io_buffer_t buffer, void *in, size_t size, bio_error_t *error) |
| Helper to deal with short read.
|
|
static size_t | bio_buffered_write_exactly (bio_io_buffer_t buffer, const void *out, size_t size, bio_error_t *error) |
| Helper to deal with short write.
|
|
Avoid making a lot of syscalls.
This is useful for delimitor-based protocols such as HTTP. Program code can just read character by character from the buffer until a delimitor is encountered. Data will get pulled as a block into the buffer as needed instead of single bytes.
◆ bio_flush_fn_t
◆ bio_read_fn_t
◆ bio_write_fn_t
◆ bio_buffered_read()
◆ bio_buffered_read_exactly()
Helper to deal with short read.
◆ bio_buffered_write()
◆ bio_buffered_write_exactly()
Helper to deal with short write.
◆ bio_destroy_buffer()
Destroy a buffer.
Existing data in a write buffer will be flushed.
◆ bio_flush_buffer()
Flush all bufferred content.
◆ bio_make_buffer()
Create a new I/O buffer.
- Parameters
-
options | Options for this buffer |
- Returns
- A new buffer
◆ bio_make_file_read_buffer()
Create a read buffer for a file.
◆ bio_make_file_write_buffer()
Create a write buffer for a file.
- Parameters
-
file | A file |
size | Buffer size |
fflush | Whether to call fflush on flush |
- Returns
- A new io buffer
◆ bio_make_socket_read_buffer()
Create a read buffer for a socket.
◆ bio_make_socket_write_buffer()
Create a write buffer for a socket.