Botan 2.19.5 Crypto and TLS for C&

Public Member Functions | Static Public Member Functions | List of all members
Botan::Deflate_Compression Class Referencefinal

`#include <zlib.h>`

Inheritance diagram for Botan::Deflate_Compression:

## Public Member Functions
void | clear () final override
void | finish (secure_vector< uint8_t > &buf, size_t offset) final override
std::string | name () const override
void | update (secure_vector< uint8_t > &buf, size_t offset, bool flush) final override

## Static Public Member Functions
static std::unique_ptr< Compression_Algorithm > | create (const std::string &algo_spec)
static std::unique_ptr< Compression_Algorithm > | create_or_throw (const std::string &algo_spec)

## Detailed Description

Deflate Compression

Definition at line 41 of file zlib.h.

## Member Function Documentation

## ◆ clear()

void Botan::Stream_Compression::clear | ( |  | ) |
| final override virtual inherited

Reset the state and abort the current message; start can be called again to process a new message.

Implements Botan::Compression_Algorithm.

Definition at line 50 of file compress_utils.cpp.

51 {
52 m_stream.reset();
53 }

Referenced by Botan::Stream_Compression::finish().

## ◆ create()

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

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 }
Botan::make_compressor
Compression_Algorithm * make_compressor(const std::string &name)
Definition: compression.cpp:27

References Botan::make_compressor().

Referenced by Botan::Compression_Algorithm::create_or_throw().

## ◆ create_or_throw()

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

Create an instance based on a name

Parameters

  algo_spec | algorithm 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 }
Botan::Compression_Algorithm::create
static std::unique_ptr< Compression_Algorithm > create(const std::string &algo_spec)
Definition: compression.cpp:54

References Botan::Compression_Algorithm::create().

## ◆ finish()

void Botan::Stream_Compression::finish | ( | secure_vector< uint8_t > & | final_block,
|  | size_t | offset
| ) |  |
| final override virtual inherited

Finish compressing

Parameters

  final_block | in/out parameter
  offset | an offset into final_block to begin processing

Implements Botan::Compression_Algorithm.

Definition at line 118 of file compress_utils.cpp.

119 {
120 BOTAN_ASSERT(m_stream, "Initialized");
121 process(buf, offset, m_stream->finish_flag());
122 clear();
123 }
BOTAN_ASSERT
#define BOTAN_ASSERT(expr, assertion_made)
Definition: assert.h:55
Botan::Stream_Compression::clear
void clear() final override
Definition: compress_utils.cpp:50

References BOTAN_ASSERT, and Botan::Stream_Compression::clear().

## ◆ name()

std::string Botan::Deflate_Compression::name | ( |  | ) | const
| inline override virtual

Returns
  name of the compression algorithm

Implements Botan::Compression_Algorithm.

Definition at line 44 of file zlib.h.

44{ return "Deflate_Compression"; }

## ◆ update()

void Botan::Stream_Compression::update | ( | secure_vector< uint8_t > & | buf,
|  | size_t | offset,
|  | bool | flush
| ) |  |
| final override virtual inherited

Process some data.

Parameters

  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

Implements Botan::Compression_Algorithm.

Definition at line 112 of file compress_utils.cpp.

113 {
114 BOTAN_ASSERT(m_stream, "Initialized");
115 process(buf, offset, flush ? m_stream->flush_flag() : m_stream->run_flag());
116 }

References BOTAN_ASSERT.

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

- src/lib/compression/zlib/zlib.h
- src/lib/compression/zlib/zlib.cpp