35#if defined(ENABLE_LZO)
45lzo_compress_init(
struct compress_context *compctx)
49 compctx->wu.lzo.wmem_size = LZO_WORKSPACE;
51 int lzo_status = lzo_init();
52 if (lzo_status != LZO_E_OK)
54 msg(
M_FATAL,
"Cannot initialize LZO compression library (lzo_init() returns %d)", lzo_status);
56 compctx->wu.lzo.wmem = (lzo_voidp) malloc(compctx->wu.lzo.wmem_size);
61lzo_compress_uninit(
struct compress_context *compctx)
63 free(compctx->wu.lzo.wmem);
64 compctx->wu.lzo.wmem = NULL;
69 struct compress_context *compctx,
73 *header = NO_COMPRESS_BYTE;
78 struct compress_context *compctx,
95 if (c == LZO_COMPRESS_BYTE)
98 err = LZO_DECOMPRESS(
BPTR(buf),
BLEN(buf),
BPTR(&work), &zlen,
99 compctx->wu.lzo.wmem);
111 compctx->pre_decompress += buf->
len;
112 compctx->post_decompress += work.
len;
116 else if (c == NO_COMPRESS_BYTE)
127const struct compress_alg lzo_alg = {
static bool buf_safe(const struct buffer *buf, size_t len)
static bool buf_advance(struct buffer *buf, int size)
static uint8_t * buf_prepend(struct buffer *buf, int size)
static void check_malloc_return(void *p)
#define buf_init(buf, offset)
Wrapper structure for dynamically allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
Packet geometry parameters.
int payload_size
the maximum size that a payload that our buffers can hold from either tun device or network link.
int headroom
the headroom in the buffer, this is choosen to allow all potential header to be added before the pack...