1 /* This module implements a custom input stream that can be set to give IO error 2 * at specific point. */ 3 4 #ifndef FLAKYSTREAM_H 5 #define FLAKYSTREAM_H 6 7 #include <pb_decode.h> 8 9 typedef struct { 10 pb_istream_t stream; 11 const uint8_t *buffer; 12 size_t position; 13 size_t msglen; 14 size_t fail_after; 15 } flakystream_t; 16 17 void flakystream_init(flakystream_t *stream, const uint8_t *buffer, size_t msglen, size_t fail_after); 18 19 #endif 20