#./fio-stl/162 deflate.h
13 public symbols.
#Types
#fio_deflate_s
struct fio_deflate_sOpaque streaming deflate/inflate state.
Symbol type: type
#Functions
#fio_deflate_decompress
size_t fio_deflate_decompress(void *out, size_t out_len, const void *in, size_t in_len)Decompresses raw DEFLATE data (no zlib/gzip headers).
Returns:
- On success: decompressed byte count (<= out_len).
- On buffer too small: the REQUIRED buffer size (> out_len).
- On corrupt/invalid data: 0.
- When out==NULL or out_len==0: performs a full decode pass counting output bytes and returns the required size (0 if data is corrupt). This allows callers to query the decompressed size without allocating.
Symbol type: function
#fio_deflate_decompress_bound
inline size_t fio_deflate_decompress_bound(size_t in_len)Conservative upper bound on decompressed size.
Symbol type: function
#fio_deflate_compress
size_t fio_deflate_compress(void *out, size_t out_len, const void *in, size_t in_len, int level)Compresses data using raw DEFLATE (no zlib/gzip headers).
Returns compressed length on success, 0 on error. level: 0=store, 1-3=fast, 4-6=normal, 7-9=best compression.
Symbol type: function
#fio_deflate_compress_bound
inline size_t fio_deflate_compress_bound(size_t in_len)Upper bound on compressed output size.
Symbol type: function
#fio_gzip_compress
size_t fio_gzip_compress(void *out, size_t out_len, const void *in, size_t in_len, int level)Compresses data with gzip wrapper (for HTTP Content-Encoding).
Returns total output length on success, 0 on error.
Symbol type: function
#fio_gzip_decompress
size_t fio_gzip_decompress(void *out, size_t out_len, const void *in, size_t in_len)Decompresses gzip data.
Returns:
- On success: decompressed byte count (<= out_len).
- On buffer too small: the REQUIRED buffer size (> out_len).
- On corrupt/invalid data: 0.
- When out==NULL or out_len==0: returns required size (0 if corrupt).
Symbol type: function
#fio_deflate_new
fio_deflate_s *fio_deflate_new(int level, int is_compress)Creates a new streaming deflate/inflate state.
level: compression level 1-9 (ignored for decompression).
is_compress: non-zero for compression, 0 for decompression.
Returns NULL on allocation failure.
Symbol type: function
#fio_deflate_new_takeover
fio_deflate_s *fio_deflate_new_takeover(int level, int is_compress)Creates a streaming state with context takeover (cross-message history
over the last 32KB). Allocates the window (+ compressor hash) inside the
context's own block — the documented per-context cost (~160KB compressor,
~32KB decompressor). fio_deflate_new (no-takeover) is the cheap default
and the only mode the WebSocket layer negotiates.
Symbol type: function
#fio_deflate_free
void fio_deflate_free(fio_deflate_s *s)Frees a streaming deflate/inflate state.
Symbol type: function
#fio_deflate_destroy
void fio_deflate_destroy(fio_deflate_s *s)Resets a deflate streaming context (keeps allocated memory, clears state). Frees the input buffer when it grew past 64KB, keeping persistent per-connection state bounded (no-takeover design).
Symbol type: function
#fio_deflate_window_bits_set
void fio_deflate_window_bits_set(fio_deflate_s *s, int bits)Clamps compressor match distances to 2^bits (8..15, default 15).
Used to honor server_max_window_bits from RFC 7692 negotiation.
Symbol type: function
#fio_deflate_push
size_t fio_deflate_push(fio_deflate_s *s, void *out, size_t out_len, const void *in, size_t in_len, int flush)Streaming compress/decompress (no-takeover: each flushed message is an independent deflate stream — there is no cross-message history mode).
Processes in_len bytes from in, writing output to out (max out_len).
flush: 0=normal, 1=sync_flush (for WebSocket frame boundaries).
Decompression returns:
- Decompressed byte count on success (<= out_len).
- Required buffer size when buffer too small (> out_len). Internal buffer is preserved for retry with a larger output buffer.
- 0 on corrupt/invalid data or allocation failure.
Symbol type: function