12#ifndef OPENVPN_COMPRESS_LZ4_H
13#define OPENVPN_COMPRESS_LZ4_H
37 if (!numeric_util::is_safe_conversion<const int>(prepRes))
41 auto payload_size =
static_cast<const int>(prepRes);
44 const int decomp_size = LZ4_decompress_safe((
const char *)buf.
c_data(),
72 const unsigned int comp_size = LZ4_compress_default((
const char *)buf.
c_data(),
78 if (comp_size < buf.
size())
102 return len + len / 256 + 17;
104 return len + len / 255 + 16;
126 const char *
name()
const override
185 const char *
name()
const override
void swap(BufferAllocatedType< T_ > &other)
Swaps the contents of this BufferAllocatedType object with another BufferAllocatedType object.
CompressLZ4Base(const Frame::Ptr &frame, const SessionStats::Ptr &stats)
bool do_decompress(BufferAllocated &buf)
bool do_compress(BufferAllocated &buf)
size_t lz4_extra_buffer(const size_t len)
void compress(BufferAllocated &buf, const bool hint) override
CompressLZ4(const Frame::Ptr &frame, const SessionStats::Ptr &stats, const bool asym_arg)
const char * name() const override
void decompress(BufferAllocated &buf) override
const char * name() const override
void compress(BufferAllocated &buf, const bool hint) override
CompressLZ4v2(const Frame::Ptr &frame, const SessionStats::Ptr &stats, const bool asym_arg)
void decompress(BufferAllocated &buf) override
void do_swap(Buffer &buf, unsigned char op)
void error(BufferAllocated &buf)
void do_unswap(Buffer &buf)
void v2_push(Buffer &buf, unsigned char value)
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 capacity() const
Returns the capacity (raw size) of the allocated buffer in T objects.
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 set_size(const size_t size)
After an external method, operating on the array as a mutable unsigned char buffer,...
size_t prepare(const unsigned int context, Buffer &buf) const
#define OVPN_LOG_INFO(args)
#define OVPN_LOG_VERBOSE(args)