Botan 2.19.1
Crypto and TLS for C&
Public Member Functions | Static Public Member Functions | List of all members
Botan::Compression_Algorithm Class Referenceabstract

#include <compression.h>

Inheritance diagram for Botan::Compression_Algorithm:
Botan::Stream_Compression Botan::Bzip2_Compression Botan::Deflate_Compression Botan::Gzip_Compression Botan::LZMA_Compression Botan::Zlib_Compression

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_Algorithmcreate (const std::string &algo_spec)
static std::unique_ptr< Compression_Algorithmcreate_or_throw (const std::string &algo_spec)

Detailed Description

Interface for a compression algorithm.

Definition at line 20 of file compression.h.

Constructor & Destructor Documentation

◆ ~Compression_Algorithm()

virtual Botan::Compression_Algorithm::~Compression_Algorithm ( )

Member Function Documentation

◆ clear()

virtual void Botan::Compression_Algorithm::clear ( )
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.

◆ create()

std::unique_ptr< Compression_Algorithm > Botan::Compression_Algorithm::create ( const std::string &  algo_spec)

Create an instance based on a name, or return null if the algo combination cannot be found.

Definition at line 54 of file compression.cpp.

55 {
56 std::unique_ptr<Compression_Algorithm> compressor(make_compressor(algo));
57 return compressor;
58 }
Compression_Algorithm * make_compressor(const std::string &name)
Definition: compression.cpp:27

References Botan::make_compressor().

Referenced by create_or_throw().

◆ create_or_throw()

std::unique_ptr< Compression_Algorithm > Botan::Compression_Algorithm::create_or_throw ( const std::string &  algo_spec)

Create an instance based on a name

algo_specalgorithm name Throws Lookup_Error if not found.

Definition at line 62 of file compression.cpp.

63 {
64 if(auto compressor = Compression_Algorithm::create(algo))
65 {
66 return compressor;
67 }
68 throw Lookup_Error("Compression", algo, "");
69 }
static std::unique_ptr< Compression_Algorithm > create(const std::string &algo_spec)
Definition: compression.cpp:54

References create().

◆ finish()

virtual void Botan::Compression_Algorithm::finish ( secure_vector< uint8_t > &  final_block,
size_t  offset = 0 
pure virtual

Finish compressing

final_blockin/out parameter
offsetan offset into final_block to begin processing

Implemented in Botan::Stream_Compression.

◆ name()

virtual std::string Botan::Compression_Algorithm::name ( ) const
pure virtual

◆ start()

virtual void Botan::Compression_Algorithm::start ( size_t  comp_level = 0)
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.

If 0 or a value out of range is provided, a compression algorithm specific default is used.

◆ update()

virtual void Botan::Compression_Algorithm::update ( secure_vector< uint8_t > &  buf,
size_t  offset = 0,
bool  flush = false 
pure virtual

Process some data.

bufin/out parameter which will possibly be resized or swapped
offsetan offset into blocks to begin processing
flushif true the compressor will be told to flush state

Implemented in Botan::Stream_Compression.

The documentation for this class was generated from the following files: