12#ifndef OPENVPN_COMPRESS_LZO_H
13#define OPENVPN_COMPRESS_LZO_H
18#include "lzo/lzoutil.h"
37 const bool support_swap_arg,
43 OVPN_LOG_INFO(
"LZO init swap=" << support_swap_arg <<
" asym=" << asym_arg);
49 if (::lzo_init() != LZO_E_OK)
50 throw lzo_init_failed();
53 const char *
name()
const override
105 if (zlen < buf.
size())
154 return len + len / 8 + 128 + 3;
void init(const size_t capacity, const BufferFlags flags=BufAllocFlags::NO_FLAGS)
Initializes the buffer with the specified capacity and flags.
void swap(BufferAllocatedType< T_ > &other)
Swaps the contents of this BufferAllocatedType object with another BufferAllocatedType object.
CompressLZO(const Frame::Ptr &frame, const SessionStats::Ptr &stats, const bool support_swap_arg, const bool asym_arg)
BufferAllocated lzo_workspace
static void init_static()
void decompress_work(BufferAllocated &buf)
void compress(BufferAllocated &buf, const bool hint) override
size_t lzo_extra_buffer(const size_t len)
OPENVPN_SIMPLE_EXCEPTION(lzo_init_failed)
const char * name() const override
void decompress(BufferAllocated &buf) override
void do_swap(Buffer &buf, unsigned char op)
void error(BufferAllocated &buf)
void do_unswap(Buffer &buf)
const T * c_data() const
Returns a const pointer to the start of the buffer.
size_t max_size() const
Return the maximum allowable size value in T objects given the current offset (without considering re...
size_t size() const
Returns the size of the buffer in T objects.
T * data()
Get a mutable pointer to the start of the array.
T pop_front()
Removes and returns the first element from the buffer.
void push_front(const T &value)
Append a T object to the array, with possible resize.
void set_size(const size_t size)
After an external method, operating on the array as a mutable unsigned char buffer,...
#define OVPN_LOG_INFO(args)
#define OVPN_LOG_VERBOSE(args)
constexpr BufferFlags ARRAY(1u<< 3)
if enabled, use as array