Botan  2.8.0
Crypto and TLS for C++11
comp_filter.h
Go to the documentation of this file.
1 /*
2 * Filter interface for compression
3 * (C) 2014,2015,2016 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_COMPRESSION_FILTER_H_
9 #define BOTAN_COMPRESSION_FILTER_H_
10 
11 #include <botan/filter.h>
12 
13 namespace Botan {
14 
15 #if defined(BOTAN_HAS_COMPRESSION)
16 
17 class Compression_Algorithm;
18 class Decompression_Algorithm;
19 
20 /**
21 * Filter interface for compression
22 */
23 class BOTAN_PUBLIC_API(2,0) Compression_Filter final : public Filter
24  {
25  public:
26  void start_msg() override;
27  void write(const uint8_t input[], size_t input_length) override;
28  void end_msg() override;
29 
30  void flush();
31 
32  std::string name() const override;
33 
34  Compression_Filter(const std::string& type,
35  size_t compression_level,
36  size_t buffer_size = 4096);
37 
38  ~Compression_Filter();
39  private:
40  std::unique_ptr<Compression_Algorithm> m_comp;
41  size_t m_buffersize, m_level;
42  secure_vector<uint8_t> m_buffer;
43  };
44 
45 /**
46 * Filter interface for decompression
47 */
48 class BOTAN_PUBLIC_API(2,0) Decompression_Filter final : public Filter
49  {
50  public:
51  void start_msg() override;
52  void write(const uint8_t input[], size_t input_length) override;
53  void end_msg() override;
54 
55  std::string name() const override;
56 
57  Decompression_Filter(const std::string& type,
58  size_t buffer_size = 4096);
59 
60  ~Decompression_Filter();
61  private:
62  std::unique_ptr<Decompression_Algorithm> m_comp;
63  std::size_t m_buffersize;
64  secure_vector<uint8_t> m_buffer;
65  };
66 
67 #endif
68 
69 }
70 
71 #endif
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
MechanismType type
std::string name
Definition: alg_id.cpp:13