meta: add compress module for (de)compressing data
This commit is contained in:
0
compress/include/blue/compress.h
Normal file
0
compress/include/blue/compress.h
Normal file
33
compress/include/blue/compress/compressor.h
Normal file
33
compress/include/blue/compress/compressor.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef BLUELIB_COMPRESS_COMPRESSOR_H_
|
||||
#define BLUELIB_COMPRESS_COMPRESSOR_H_
|
||||
|
||||
#include <blue/core/misc.h>
|
||||
#include <blue/core/status.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
struct b_ringbuffer;
|
||||
struct b_compression_function;
|
||||
|
||||
typedef struct b_compressor b_compressor;
|
||||
|
||||
typedef enum b_compressor_mode {
|
||||
B_COMPRESSOR_MODE_COMPRESS,
|
||||
B_COMPRESSOR_MODE_DECOMPRESS,
|
||||
} b_compressor_mode;
|
||||
|
||||
BLUE_API b_status b_compressor_create(
|
||||
const struct b_compression_function *func, b_compressor_mode mode,
|
||||
struct b_ringbuffer *inbuf, struct b_ringbuffer *outbuf,
|
||||
b_compressor **out);
|
||||
BLUE_API b_status b_compressor_destroy(b_compressor *compressor);
|
||||
|
||||
BLUE_API b_status b_compressor_get_buffer_size(
|
||||
const b_compressor *compressor, size_t *inbuf_size, size_t *outbuf_size);
|
||||
|
||||
BLUE_API b_status b_compressor_compress(b_compressor *compressor);
|
||||
BLUE_API b_status b_compressor_compress_end(b_compressor *compressor);
|
||||
BLUE_API b_status b_compressor_decompress(b_compressor *compressor);
|
||||
BLUE_API b_status b_compressor_reset(b_compressor *compressor);
|
||||
BLUE_API bool b_compressor_eof(const b_compressor *compressor);
|
||||
|
||||
#endif
|
||||
0
compress/include/blue/compress/cstream.h
Normal file
0
compress/include/blue/compress/cstream.h
Normal file
22
compress/include/blue/compress/function.h
Normal file
22
compress/include/blue/compress/function.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef BLUELIB_COMPRESS_FUNCTION_H_
|
||||
#define BLUELIB_COMPRESS_FUNCTION_H_
|
||||
|
||||
#include <blue/core/misc.h>
|
||||
#include <blue/core/status.h>
|
||||
|
||||
enum b_compressor_mode;
|
||||
|
||||
typedef struct b_compression_function b_compression_function;
|
||||
|
||||
typedef enum b_compression_function_id {
|
||||
B_COMPRESSOR_FUNCTION_NONE = 0,
|
||||
B_COMPRESSOR_FUNCTION_ZSTD,
|
||||
} b_compression_function_id;
|
||||
|
||||
BLUE_API const b_compression_function *b_compression_function_get_by_id(
|
||||
b_compression_function_id id);
|
||||
BLUE_API b_status b_compression_function_get_buffer_size(
|
||||
const b_compression_function *func, enum b_compressor_mode mode,
|
||||
size_t *inbuf_size, size_t *outbuf_size);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user