KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
Loading...
Searching...
No Matches
Data Fields
KlCompress Struct Reference

#include <compress.h>

Data Fields

int(* compress )(KlCompress *self, const char *in, size_t in_len, char **out, size_t *out_len, KlAllocator *alloc)
 Single-shot: compress entire buffer into *out.
 
int(* feed )(KlCompress *self, const char *data, size_t len, int flush, int(*emit)(void *ctx, const char *data, size_t len), void *emit_ctx)
 Streaming: feed input, emit compressed output via callback.
 
const char *(* encoding )(KlCompress *self)
 Content-Encoding value, e.g. "gzip", "deflate", "zstd".
 
void(* reset )(KlCompress *self)
 Reset for reuse (may be NULL if not reusable).
 
void(* destroy )(KlCompress *self)
 Free all resources.
 

Field Documentation

◆ compress

int(* KlCompress::compress) (KlCompress *self, const char *in, size_t in_len, char **out, size_t *out_len, KlAllocator *alloc)

Single-shot: compress entire buffer into *out.

Allocates output via alloc. Caller owns *out and must kl_free(alloc, *out, *out_len).

Parameters
selfCompression session.
inInput data.
in_lenInput length.
outReceives allocated compressed output.
out_lenReceives compressed output length.
allocAllocator for output buffer.
Returns
0 on success, -1 on error.

◆ feed

int(* KlCompress::feed) (KlCompress *self, const char *data, size_t len, int flush, int(*emit)(void *ctx, const char *data, size_t len), void *emit_ctx)

Streaming: feed input, emit compressed output via callback.

Parameters
selfCompression session.
dataInput data (NULL when flush=1 for final).
lenInput length (0 when flush=1 for final).
flush0 for intermediate chunks, 1 for final flush + trailer.
emitCallback to receive compressed output chunks.
emit_ctxContext passed to emit callback.
Returns
0 on success, -1 on error.

◆ encoding

const char *(* KlCompress::encoding) (KlCompress *self)

Content-Encoding value, e.g. "gzip", "deflate", "zstd".

Returns
Static string, never NULL.

◆ reset

void(* KlCompress::reset) (KlCompress *self)

Reset for reuse (may be NULL if not reusable).

◆ destroy

void(* KlCompress::destroy) (KlCompress *self)

Free all resources.


The documentation for this struct was generated from the following file: