Fabcoin Core  0.16.2
P2P Digital Currency
zlib.h
Go to the documentation of this file.
1 #ifndef CRYPTOPP_ZLIB_H
2 #define CRYPTOPP_ZLIB_H
3 
4 #include "cryptlib.h"
5 #include "adler32.h"
6 #include "zdeflate.h"
7 #include "zinflate.h"
8 
10 
11 class ZlibCompressor : public Deflator
13 {
14 public:
15  ZlibCompressor(BufferedTransformation *attachment=NULL, unsigned int deflateLevel=DEFAULT_DEFLATE_LEVEL, unsigned int log2WindowSize=DEFAULT_LOG2_WINDOW_SIZE, bool detectUncompressible=true)
16  : Deflator(attachment, deflateLevel, log2WindowSize, detectUncompressible) {}
18  : Deflator(parameters, attachment) {}
19 
20  unsigned int GetCompressionLevel() const;
21 
22 protected:
23  void WritePrestreamHeader();
24  void ProcessUncompressedData(const byte *string, size_t length);
25  void WritePoststreamTail();
26 
28 };
29 
31 class ZlibDecompressor : public Inflator
32 {
33 public:
34  typedef Inflator::Err Err;
35  class HeaderErr : public Err {public: HeaderErr() : Err(INVALID_DATA_FORMAT, "ZlibDecompressor: header decoding error") {}};
36  class Adler32Err : public Err {public: Adler32Err() : Err(DATA_INTEGRITY_CHECK_FAILED, "ZlibDecompressor: ADLER32 check error") {}};
37  class UnsupportedAlgorithm : public Err {public: UnsupportedAlgorithm() : Err(INVALID_DATA_FORMAT, "ZlibDecompressor: unsupported algorithm") {}};
38  class UnsupportedPresetDictionary : public Err {public: UnsupportedPresetDictionary() : Err(INVALID_DATA_FORMAT, "ZlibDecompressor: unsupported preset dictionary") {}};
39 
44  ZlibDecompressor(BufferedTransformation *attachment = NULL, bool repeat = false, int autoSignalPropagation = -1);
45  unsigned int GetLog2WindowSize() const {return m_log2WindowSize;}
46 
47 private:
48  unsigned int MaxPrestreamHeaderSize() const {return 2;}
50  void ProcessDecompressedData(const byte *string, size_t length);
51  unsigned int MaxPoststreamTailSize() const {return 4;}
52  void ProcessPoststreamTail();
53 
54  unsigned int m_log2WindowSize;
56 };
57 
59 
60 #endif
ZlibDecompressor(BufferedTransformation *attachment=NULL, bool repeat=false, int autoSignalPropagation=-1)
Construct a ZlibDecompressor.
Definition: zlib.cpp:51
uint8_t byte
Definition: Common.h:57
void ProcessPrestreamHeader()
Definition: zlib.cpp:56
#define NAMESPACE_BEGIN(x)
Definition: config.h:200
Abstract base classes that provide a uniform interface to this library.
DEFLATE compressor (RFC 1951)
Definition: zdeflate.h:78
Interface for buffered transformations.
Definition: cryptlib.h:1352
unsigned int GetLog2WindowSize() const
Definition: zlib.h:45
DEFLATE compression and decompression (RFC 1951)
Data integerity check, such as CRC or MAC, failed.
Definition: cryptlib.h:153
ADLER-32 checksum calculations.
Definition: adler32.h:15
Input data was received that did not conform to expected format.
Definition: cryptlib.h:155
ZLIB Compressor (RFC 1950)
Definition: zlib.h:12
ZlibCompressor(BufferedTransformation *attachment=NULL, unsigned int deflateLevel=DEFAULT_DEFLATE_LEVEL, unsigned int log2WindowSize=DEFAULT_LOG2_WINDOW_SIZE, bool detectUncompressible=true)
Definition: zlib.h:15
ZLIB Decompressor (RFC 1950)
Definition: zlib.h:31
Class file for ADLER-32 checksum calculations.
unsigned int MaxPrestreamHeaderSize() const
Definition: zlib.h:48
Adler32 m_adler32
Definition: zlib.h:27
DEFLATE decompressor (RFC 1951)
Definition: zinflate.h:92
void ProcessDecompressedData(const byte *string, size_t length)
Definition: zlib.cpp:78
unsigned int m_log2WindowSize
Definition: zlib.h:54
#define NAMESPACE_END
Definition: config.h:201
std::vector< char * > parameters
Definition: boostTest.cpp:46
ZlibCompressor(const NameValuePairs &parameters, BufferedTransformation *attachment=NULL)
Definition: zlib.h:17
Err(ErrorType e, const std::string &s)
Definition: zinflate.h:98
unsigned int MaxPoststreamTailSize() const
Definition: zlib.h:51
Adler32 m_adler32
Definition: zlib.h:55
void ProcessPoststreamTail()
Definition: zlib.cpp:84
Inflator::Err Err
Definition: zlib.h:34
Interface for retrieving values given their names.
Definition: cryptlib.h:279