]> git.sesse.net Git - fjl/blob - input.h
byte_source_read_marker() needs to refill.
[fjl] / input.h
1 #ifndef _INPUT_H
2 #define _INPUT_H 1
3
4 #include <stdint.h>
5 #include <sys/types.h>
6
7 // A function to read bytes from some input source. The bytes should be
8 // already unstuffed (and thus without markers).
9 // A return value of -1 indicates error, a return value of 0 indicates EOF.
10 typedef ssize_t (input_func_t)(void*, uint8_t*, size_t);
11
12 // Same as input_func_t, although it expects raw bytes, ie. with markers
13 // and all.
14 typedef ssize_t (raw_input_func_t)(void*, uint8_t*, size_t);
15
16 void reliable_read(raw_input_func_t* input_func, void* userdata, uint8_t* buf, size_t len);
17 uint16_t read_length(raw_input_func_t* input_func, void* userdata);
18
19 #endif /* !defined(_INPUT_H) */