KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
Loading...
Searching...
No Matches
decompress.h
Go to the documentation of this file.
1#ifndef KEEL_DECOMPRESS_H
2#define KEEL_DECOMPRESS_H
3
4#include <keel/allocator.h>
5#include <keel/compress.h>
6#include <stddef.h>
7
15
31 int (*decompress)(KlDecompress *self, const char *in, size_t in_len,
32 char **out, size_t *out_len, KlAllocator *alloc);
33
45 int (*dfeed)(KlDecompress *self, const char *data, size_t len, int flush,
46 int (*emit)(void *ctx, const char *data, size_t len),
47 void *emit_ctx);
48
53 const char *(*encoding)(KlDecompress *self);
54
56 void (*reset)(KlDecompress *self);
57
59 void (*destroy)(KlDecompress *self);
60};
61
71typedef KlDecompress *(*KlDecompressFactory)(KlCompressCtx *ctx,
72 KlAllocator *alloc);
73
84
96
111int kl_decompress_body(KlDecompressConfig *cfg, const char *in, size_t in_len,
112 char **out, size_t *out_len, KlAllocator *alloc);
113
126 KlAllocator *alloc);
127
140 const char *data, size_t len, int flush,
141 int (*emit)(void *ctx, const char *data,
142 size_t len),
143 void *emit_ctx);
144
153
154#endif /* KEEL_DECOMPRESS_H */
struct KlCompressCtx KlCompressCtx
Opaque per-server compression context (algorithm config, level). User-owned — KEEL never inspects or ...
Definition compress.h:67
int kl_decompress_body(KlDecompressConfig *cfg, const char *in, size_t in_len, char **out, size_t *out_len, KlAllocator *alloc)
Decompress a buffer body in one shot.
void kl_decompress_stream_free(KlDecompressStream *ds)
Free decompression stream resources.
int kl_decompress_stream_feed(KlDecompressStream *ds, const char *data, size_t len, int flush, int(*emit)(void *ctx, const char *data, size_t len), void *emit_ctx)
Feed compressed data through the decompression stream.
int kl_decompress_stream_init(KlDecompressStream *ds, KlDecompressConfig *cfg, KlAllocator *alloc)
Initialize a decompression stream.
KlDecompress *(* KlDecompressFactory)(KlCompressCtx *ctx, KlAllocator *alloc)
Factory creates a KlDecompress session from the shared context.
Definition decompress.h:71
Bring-your-own allocator vtable.
Definition allocator.h:12
Decompression configuration.
Definition decompress.h:79
KlDecompressFactory factory
Definition decompress.h:81
KlCompressCtx * ctx
Definition decompress.h:80
void(* ctx_destroy)(KlCompressCtx *ctx)
Definition decompress.h:82
Decompression stream handle.
Definition decompress.h:91
int error
Definition decompress.h:94
KlAllocator * alloc
Definition decompress.h:93
KlDecompress * decomp
Definition decompress.h:92
Definition decompress.h:16
void(* reset)(KlDecompress *self)
Reset for reuse (may be NULL if not reusable).
Definition decompress.h:56
int(* decompress)(KlDecompress *self, const char *in, size_t in_len, char **out, size_t *out_len, KlAllocator *alloc)
Single-shot: decompress entire buffer into *out.
Definition decompress.h:31
int(* dfeed)(KlDecompress *self, const char *data, size_t len, int flush, int(*emit)(void *ctx, const char *data, size_t len), void *emit_ctx)
Streaming: feed compressed input, emit decompressed output.
Definition decompress.h:45
void(* destroy)(KlDecompress *self)
Free all resources.
Definition decompress.h:59