aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/compression/compression.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/compression/compression.h')
-rw-r--r--src/lib/compression/compression.h39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/lib/compression/compression.h b/src/lib/compression/compression.h
index 81b863dcf..db2722305 100644
--- a/src/lib/compression/compression.h
+++ b/src/lib/compression/compression.h
@@ -13,6 +13,9 @@
namespace Botan {
+/*
+* Interface for a compression algorithm.
+*/
class BOTAN_DLL Compression_Algorithm
{
public:
@@ -44,6 +47,9 @@ class BOTAN_DLL Compression_Algorithm
*/
virtual void finish(secure_vector<byte>& final_block, size_t offset = 0) = 0;
+ /**
+ * @return name of the compression algorithm
+ */
virtual std::string name() const = 0;
/**
@@ -55,22 +61,44 @@ class BOTAN_DLL Compression_Algorithm
virtual ~Compression_Algorithm() {}
};
+/*
+* Interface for a decompression algorithm.
+*/
class BOTAN_DLL Decompression_Algorithm
{
public:
typedef SCAN_Name Spec;
/**
- * Decompression does not support levels
+ * Begin decompressing.
+ * Decompression does not support levels, as compression does.
*/
virtual void start() = 0;
+ /**
+ * Process some data. Input must be in size update_granularity() byte blocks.
+ * @param blocks in/out parameter which will possibly be resized or swapped
+ * @param offset an offset into blocks to begin processing
+ */
virtual void update(secure_vector<byte>& buf, size_t offset = 0) = 0;
+ /**
+ * Finish decompressing
+ *
+ * @param final_block in/out parameter
+ * @param offset an offset into final_block to begin processing
+ */
virtual void finish(secure_vector<byte>& final_block, size_t offset = 0) = 0;
+ /**
+ * @return name of the decompression algorithm
+ */
virtual std::string name() const = 0;
+ /**
+ * Reset the state and abort the current message; start can be
+ * called again to process a new message.
+ */
virtual void clear() = 0;
virtual ~Decompression_Algorithm() {}
@@ -79,6 +107,9 @@ class BOTAN_DLL Decompression_Algorithm
BOTAN_DLL Compression_Algorithm* make_compressor(const std::string& type);
BOTAN_DLL Decompression_Algorithm* make_decompressor(const std::string& type);
+/**
+* FIXME add doc
+*/
class Compression_Stream
{
public:
@@ -99,6 +130,9 @@ class Compression_Stream
virtual bool run(u32bit flags) = 0;
};
+/**
+* FIXME add doc
+*/
class Stream_Compression : public Compression_Algorithm
{
public:
@@ -119,6 +153,9 @@ class Stream_Compression : public Compression_Algorithm
std::unique_ptr<Compression_Stream> m_stream;
};
+/**
+* FIXME add doc
+*/
class Stream_Decompression : public Decompression_Algorithm
{
public: