From d24a3f265ec4344b5502ec57df3cf8358f6f1499 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 5 Jan 2004 22:24:10 +0000 Subject: many changes git-svn-id: file:///home/lennart/svn/public/ivam2/trunk@14 dbf6933d-3bce-0310-9bcc-ed052ba35b35 --- src/buffio.h | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/buffio.h') diff --git a/src/buffio.h b/src/buffio.h index a41ec76..fff2514 100644 --- a/src/buffio.h +++ b/src/buffio.h @@ -7,7 +7,8 @@ enum buffio_sched_cb { BUFFIO_SCHED_CB_IDLE = 0, BUFFIO_SCHED_CB_INPUT_READY = 1, - BUFFIO_SCHED_CB_OUTPUT_EMPTY = 2, + BUFFIO_SCHED_CB_OUTPUT_REQUEST = 2, + BUFFIO_SCHED_CB_OUTPUT_EMPTY = 32, BUFFIO_SCHED_CB_EOF = 4, BUFFIO_SCHED_CB_EPIPE = 8, BUFFIO_SCHED_CB_ERROR = 16 @@ -18,19 +19,20 @@ struct buffio { int ofd; uint8_t *input_buf; - size_t input_max_length, input_index, input_length, input_watermark; + size_t input_max_length, input_index, input_length, input_range; uint8_t *output_buf; - size_t output_max_length, output_index, output_length, output_watermark; + size_t output_max_length, output_index, output_length, output_range; int b_read_cb, b_write_cb; void *user; - int readable; - int writable; + int readable, writable; + int prebuf; int (*input_ready_cb) (struct buffio *b, void *user); + int (*output_request_cb) (struct buffio *b, void *user); int (*output_empty_cb) (struct buffio *b, void *user); int (*eof_cb) (struct buffio *b, void *user); int (*epipe_cb) (struct buffio *b, void *user); @@ -47,20 +49,20 @@ struct buffio { struct buffio* buffio_new(int ifd, int ofd); void buffio_free(struct buffio *b); -int buffio_write(struct buffio *b, const uint8_t *d, size_t l); -int buffio_print(struct buffio *b, const char *s); +void buffio_write(struct buffio *b, const uint8_t *d, size_t l); +void buffio_print(struct buffio *b, const char *s); void buffio_flush_input(struct buffio *b); void buffio_flush_output(struct buffio *b); -int buffio_command(struct buffio *b, const char *c); +void buffio_command(struct buffio *b, const char *c); int buffio_find_input(struct buffio *b, const char *c); char *buffio_read_line(struct buffio *b, char *c, size_t l); void buffio_dump(struct buffio *b); -void buffio_set_input_watermark(struct buffio *b, ssize_t w); -void buffio_set_output_watermark(struct buffio *b, ssize_t w); +void buffio_set_input_range(struct buffio *b, ssize_t w); +void buffio_set_output_range(struct buffio *b, ssize_t w); const uint8_t* buffio_read_ptr(struct buffio *b, size_t *l); void buffio_read_ptr_inc(struct buffio *b, size_t l); @@ -72,6 +74,8 @@ void buffio_close_input_fd(struct buffio *b); void buffio_close_output_fd(struct buffio *b); int buffio_output_is_empty(struct buffio *b); +int buffio_input_is_full(struct buffio *b); + void buffio_dump_lines(struct buffio *b); void buffio_set_fds(struct buffio *b, int ifd, int ofd); @@ -80,4 +84,6 @@ void buffio_set_delay_usec(struct buffio *b, unsigned long usec, unsigned long l int buffio_can_write(struct buffio *b, size_t l); +void buffio_set_prebuf(struct buffio *b, int p); + #endif -- cgit