39 struct compress_context *
42 struct compress_context *compctx = NULL;
47 compctx->flags = opt->
flags;
48 compctx->alg = comp_stub_alg;
53 compctx->flags = opt->
flags;
54 compctx->alg = compv2_stub_alg;
60 compctx->flags = opt->
flags;
61 compctx->alg = lzo_alg;
68 compctx->flags = opt->
flags;
69 compctx->alg = lz4_alg;
74 compctx->flags = opt->
flags;
75 compctx->alg = lz4v2_alg;
81 (*compctx->alg.compress_init)(compctx);
91 compv2_escape_data_ifneeded(
struct buffer *buf)
93 uint8_t *head =
BPTR(buf);
94 if (head[0] != COMP_ALGV2_INDICATOR_BYTE)
103 head[0] = COMP_ALGV2_INDICATOR_BYTE;
109 comp_uninit(
struct compress_context *compctx)
113 (*compctx->alg.compress_uninit)(compctx);
119 comp_print_stats(
const struct compress_context *compctx,
struct status_output *so)
141 bool lzo_avail =
false;
144 #if defined(ENABLE_LZ4)
148 #if defined(ENABLE_LZO)
174 msg(msglevel,
"Compression or compression stub framing is not allowed "
175 "since data-channel offloading is enabled.");
177 msg(msglevel,
"Compression or compression stub framing is not allowed "
178 "since OpenVPN was built without compression support.");
185 msg(msglevel,
"Compression is not allowed since allow-compression is "
186 "set to 'stub-only'");
192 msg(msglevel,
"OpenVPN is compiled without LZ4 support. Requested "
193 "compression cannot be enabled.");
200 msg(msglevel,
"OpenVPN is compiled without LZO support. Requested "
201 "compression cannot be enabled.");