summaryrefslogtreecommitdiffstats
path: root/src/buffio.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffio.h')
-rw-r--r--src/buffio.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/buffio.h b/src/buffio.h
new file mode 100644
index 0000000..461bff9
--- /dev/null
+++ b/src/buffio.h
@@ -0,0 +1,31 @@
+#ifndef foobuffiohfoo
+#define foobuffiohfoo
+
+struct buffio {
+ int fd;
+
+ uint8_t *input_buf;
+ size_t input_index, input_length;
+
+ uint8_t *output_buf;
+ size_t output_index, output_length;
+
+ int b_read_cb, b_write_cb;
+
+ void *user;
+ void (*eof_cb) (struct buffio *b, void *user);
+ void (*output_cb) (struct buffio *b, void *user);
+ void (*input_cb) (struct buffio *b, void *user);
+};
+
+struct buffio buffio_new(int fd);
+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);
+
+int buffio_command(struct buffio *b, const char *c);
+void buffio_flush_input(struct buffio *b);
+int buffio_find_input(struct buffio *b, const char *c);
+
+#endif