a49d1c2ca3c134c0c62b37a94936c78e9849e044Timo Sirainen Dovecot's LZ4 compressed files contain:
a49d1c2ca3c134c0c62b37a94936c78e9849e044Timo Sirainen IOSTREAM_LZ4_HEADER
a49d1c2ca3c134c0c62b37a94936c78e9849e044Timo Sirainen n x (4 byte big-endian: compressed chunk length, compressed chunk)
a49d1c2ca3c134c0c62b37a94936c78e9849e044Timo Sirainen#define IOSTREAM_LZ4_MAGIC "Dovecot-LZ4\x0d\x2a\x9b\xc5"
a49d1c2ca3c134c0c62b37a94936c78e9849e044Timo Sirainen#define IOSTREAM_LZ4_MAGIC_LEN (sizeof(IOSTREAM_LZ4_MAGIC)-1)
a49d1c2ca3c134c0c62b37a94936c78e9849e044Timo Sirainen /* OSTREAM_LZ4_CHUNK_SIZE in big-endian */
a49d1c2ca3c134c0c62b37a94936c78e9849e044Timo Sirainen/* How large chunks we're buffering into memory before compressing them */
a49d1c2ca3c134c0c62b37a94936c78e9849e044Timo Sirainen/* How large chunks we allow in input data before returning a failure.
a49d1c2ca3c134c0c62b37a94936c78e9849e044Timo Sirainen This must be at least OSTREAM_LZ4_CHUNK_SIZE, but for future compatibility
a49d1c2ca3c134c0c62b37a94936c78e9849e044Timo Sirainen should be somewhat higher (but not too high to avoid wasting memory for
a49d1c2ca3c134c0c62b37a94936c78e9849e044Timo Sirainen corrupted files). */
a49d1c2ca3c134c0c62b37a94936c78e9849e044Timo Sirainen#define IOSTREAM_LZ4_CHUNK_PREFIX_LEN 4 /* big-endian size of chunk */