38struct compress_context *
41 struct compress_context *compctx = NULL;
46 compctx->flags = opt->
flags;
47 compctx->alg = comp_stub_alg;
52 compctx->flags = opt->
flags;
53 compctx->alg = compv2_stub_alg;
59 compctx->flags = opt->
flags;
60 compctx->alg = lzo_alg;
67 compctx->flags = opt->
flags;
68 compctx->alg = lz4_alg;
73 compctx->flags = opt->
flags;
74 compctx->alg = lz4v2_alg;
80 (*compctx->alg.compress_init)(compctx);
90compv2_escape_data_ifneeded(
struct buffer *buf)
92 uint8_t *head =
BPTR(buf);
93 if (head[0] != COMP_ALGV2_INDICATOR_BYTE)
102 head[0] = COMP_ALGV2_INDICATOR_BYTE;
108comp_uninit(
struct compress_context *compctx)
112 (*compctx->alg.compress_uninit)(compctx);
118comp_print_stats(
const struct compress_context *compctx,
struct status_output *so)
140 bool lzo_avail =
false;
143#if defined(ENABLE_LZ4)
147#if defined(ENABLE_LZO)
173 msg(msglevel,
"Compression or compression stub framing is not allowed "
174 "since data-channel offloading is enabled.");
176 msg(msglevel,
"Compression or compression stub framing is not allowed "
177 "since OpenVPN was built without compression support.");
184 msg(msglevel,
"Compression is not allowed since allow-compression is "
185 "set to 'stub-only'");
191 msg(msglevel,
"OpenVPN is compiled without LZ4 support. Requested "
192 "compression cannot be enabled.");
199 msg(msglevel,
"OpenVPN is compiled without LZO support. Requested "
200 "compression cannot be enabled.");
bool buf_printf(struct buffer *buf, const char *format,...)
static uint8_t * buf_prepend(struct buffer *buf, int size)
#define ALLOC_OBJ_CLEAR(dptr, type)
bool check_compression_settings_valid(struct compress_options *info, int msglevel)
Checks if the compression settings are valid.
#define COMP_F_ALLOW_STUB_ONLY
Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY we still accept other compression...
#define COMP_ALG_LZ4
LZ4 algorithm.
#define COMP_F_ALLOW_NOCOMP_ONLY
Do not allow compression framing (breaks DCO)
#define COMP_ALGV2_UNCOMPRESSED
#define COMP_ALG_STUB
support compression command byte and framing without actual compression
#define COMP_ALG_LZO
LZO algorithm.
#define COMP_F_ADVERTISE_STUBS_ONLY
tell server that we only support compression stubs
static bool comp_non_stub_enabled(const struct compress_options *info)
void status_printf(struct status_output *so, const char *format,...)
Wrapper structure for dynamically allocated memory.