Botan 3.6.1
Crypto and TLS for C&
|
#include <compression.h>
Public Member Functions | |
virtual void | clear ()=0 |
virtual void | finish (secure_vector< uint8_t > &final_block, size_t offset=0)=0 |
virtual std::string | name () const =0 |
virtual void | start (size_t comp_level=0)=0 |
virtual void | update (secure_vector< uint8_t > &buf, size_t offset=0, bool flush=false)=0 |
virtual | ~Compression_Algorithm ()=default |
Static Public Member Functions | |
static std::unique_ptr< Compression_Algorithm > | create (std::string_view algo_spec) |
static std::unique_ptr< Compression_Algorithm > | create_or_throw (std::string_view algo_spec) |
Interface for a compression algorithm.
Definition at line 20 of file compression.h.
|
virtualdefault |
|
pure virtual |
Reset the state and abort the current message; start can be called again to process a new message.
Implemented in Botan::Stream_Compression.
|
static |
Create an instance based on a name, or return null if the algo combination cannot be found.
Definition at line 29 of file compression.cpp.
References BOTAN_UNUSED, and name().
Referenced by create_or_throw(), and Botan::make_compressor().
|
static |
Create an instance based on a name
algo_spec | algorithm name Throws Lookup_Error if not found. |
Definition at line 59 of file compression.cpp.
References create().
|
pure virtual |
Finish compressing
The buf
and offset
parameters are treated as in update(). It is acceptable to call start() followed by finish() with the entire message, without any intervening call to update().
final_block | in/out parameter |
offset | an offset into final_block to begin processing |
Implemented in Botan::Stream_Compression.
|
pure virtual |
Implemented in Botan::Bzip2_Compression, Botan::Deflate_Compression, Botan::Gzip_Compression, Botan::LZMA_Compression, and Botan::Zlib_Compression.
Referenced by create().
|
pure virtual |
Begin compressing. Most compression algorithms offer a tunable time/compression tradeoff parameter generally represented by an integer in the range of 1 to 9. Higher values typically imply better compression and more memory and/or CPU time consumed by the compression process.
If 0 or a value out of range is provided, a compression algorithm specific default is used.
comp_level | the desired level of compression (typically from 1 to 9) |
|
pure virtual |
Process some data.
The leading offset
bytes of buf
are ignored and remain untouched; this can be useful for ignoring packet headers. If flush
is true, the compression state is flushed, allowing the decompressor to recover the entire message up to this point without having to see the rest of the compressed stream.
buf | in/out parameter which will possibly be resized or swapped |
offset | an offset into blocks to begin processing |
flush | if true the compressor will be told to flush state |
Implemented in Botan::Stream_Compression.