istream-sized.h revision c3c423426093ffc01fa9967573a9b9e39f42c461
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen /* Stream's current v_offset */
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen /* How many more bytes are being added within this read() */
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen /* What's the original wanted size. */
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen /* TRUE if we're at EOF now */
2ed2459dbd183bb371da4a0aecb2d2b74ae7c815Timo Sirainentypedef const char *
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainenistream_sized_callback_t(const struct istream_sized_error_data *data,
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen/* Assume that input stream is exactly the given size. If the stream is too
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen small, fail with stream_errno=EPIPE. If stream is too large, fail with
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen stream_errno=EINVAL. */
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainenstruct istream *i_stream_create_sized(struct istream *input, uoff_t size);
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainenstruct istream *i_stream_create_sized_range(struct istream *input,
9e9f0cf3cc3ce546e8a433990c92dd9be6665df6Timo Sirainen/* Same as i_stream_create_sized(), but set the error message via the
5cdd1691e5185ecfe424f5de7b6f697813b88ba2Timo Siraineni_stream_create_sized_with_callback(struct istream *input, uoff_t size,
7b85f7d35b2192bdff734d7d2891630bc30b2518Timo Sirainen#define i_stream_create_sized_with_callback(input, size, error_callback, context) \
7b85f7d35b2192bdff734d7d2891630bc30b2518Timo Sirainen i_stream_create_sized_with_callback(input, size + \
7b85f7d35b2192bdff734d7d2891630bc30b2518Timo Sirainen const char *(*)(const struct istream_sized_error_data *, typeof(context))), \