Botan  1.11.15
src/lib/filters/comp_filter.h
Go to the documentation of this file.
00001 /*
00002 * Filter interface for compression
00003 * (C) 2014 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_COMPRESSION_FILTER_H__
00009 #define BOTAN_COMPRESSION_FILTER_H__
00010 
00011 #include <botan/filter.h>
00012 
00013 namespace Botan {
00014 
00015 class Transform;
00016 class Compressor_Transform;
00017 
00018 /**
00019 * Filter interface for compression/decompression
00020 */
00021 class BOTAN_DLL Compression_Decompression_Filter : public Filter
00022    {
00023    public:
00024       void start_msg() override;
00025       void write(const byte input[], size_t input_length) override;
00026       void end_msg() override;
00027 
00028       std::string name() const override;
00029 
00030    protected:
00031       Compression_Decompression_Filter(Transform* t);
00032 
00033       void flush();
00034    private:
00035       std::unique_ptr<Compressor_Transform> m_transform;
00036       secure_vector<byte> m_buffer;
00037    };
00038 
00039 class BOTAN_DLL Compression_Filter : public Compression_Decompression_Filter
00040    {
00041    public:
00042       Compression_Filter(const std::string& type, size_t level); // compression
00043 
00044       using Compression_Decompression_Filter::flush;
00045    };
00046 
00047 class Decompression_Filter : public Compression_Decompression_Filter
00048    {
00049    public:
00050       Decompression_Filter(const std::string& type);
00051    };
00052 
00053 }
00054 
00055 #endif