40#define COMP_F_SWAP (1u << 2)
42#define COMP_F_ADVERTISE_STUBS_ONLY (1u << 3)
45#define COMP_F_ALLOW_STUB_ONLY (1u << 4)
47#define COMP_F_MIGRATE (1u << 5)
49#define COMP_F_ALLOW_ASYM (1u << 6)
51#define COMP_F_ALLOW_NOCOMP_ONLY (1u << 7)
54#define COMP_ALG_UNDEF 0
56#define COMP_ALG_STUB 1
58#define COMP_ALG_SNAPPY 3
63#define COMP_ALGV2_UNCOMPRESSED 10
64#define COMP_ALGV2_LZ4 11
105#define COMP_PREFIX_LEN 1
113#define LZO_COMPRESS_BYTE 0x66
114#define LZ4_COMPRESS_BYTE 0x69
115#define NO_COMPRESS_BYTE 0xFA
117#define NO_COMPRESS_BYTE_SWAP 0xFB
120#define COMP_ALGV2_INDICATOR_BYTE 0x50
121#define COMP_ALGV2_UNCOMPRESSED_BYTE 0
122#define COMP_ALGV2_LZ4_BYTE 1
123#define COMP_ALGV2_LZO_BYTE 2
124#define COMP_ALGV2_SNAPPY_BYTE 3
133#define COMP_EXTRA_BUFFER(len) ((len) / 6 + 128 + 3 + COMP_PREFIX_LEN)
138#define COMPRESS_THRESHOLD 100
141struct compress_context;
149 void (*compress_init)(
struct compress_context *compctx);
150 void (*compress_uninit)(
struct compress_context *compctx);
172union compress_workspace_union
175 struct lzo_compress_workspace lzo;
178 struct lz4_workspace lz4;
185struct compress_context
188 struct compress_alg alg;
189 union compress_workspace_union wu;
198extern const struct compress_alg comp_stub_alg;
199extern const struct compress_alg compv2_stub_alg;
203void comp_uninit(
struct compress_context *compctx);
205void comp_print_stats(
const struct compress_context *compctx,
struct status_output *so);
209void compv2_escape_data_ifneeded(
struct buffer *buf);
bool check_compression_settings_valid(struct compress_options *info, msglvl_t msglevel)
Checks if the compression settings are valid.
#define COMP_ALGV2_UNCOMPRESSED
#define COMP_ALG_STUB
support compression command byte and framing without actual compression
static bool comp_non_stub_enabled(const struct compress_options *info)
Data Channel Compression module header file.
Wrapper structure for dynamically allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
Packet geometry parameters.