--- /dev/null
+#ifndef _INPUT_H
+#define _INPUT_H 1
+
+#include <stdint.h>
+#include <sys/types.h>
+
+// A function to read bytes from some input source. The bytes should be
+// already unstuffed (and thus without markers).
+// A return value of -1 indicates error, a return value of 0 indicates EOF.
+typedef ssize_t (input_func_t)(void*, uint8_t*, size_t);
+
+// Same as input_func_t, although it expects raw bytes, ie. with markers
+// and all.
+typedef ssize_t (raw_input_func_t)(void*, uint8_t*, size_t);
+
+void reliable_read(raw_input_func_t* input_func, void* userdata, uint8_t* buf, size_t len);
+uint16_t read_length(raw_input_func_t* input_func, void* userdata);
+
+#endif /* !defined(_INPUT_H) */