30 #ifndef WRAPPERLIB_HPP
31 #define WRAPPERLIB_HPP
33 #include "../my_config.h"
37 #if HAVE_ZLIB_H && LIBZ_AVAILABLE
41 #if HAVE_BZLIB_H && LIBBZ2_AVAILABLE
45 #if HAVE_LZMA_H && LIBLZMA_AVAILABLE
59 const int WR_MEM_ERROR = 1;
60 const int WR_VERSION_ERROR = 2;
61 const int WR_STREAM_ERROR = 3;
62 const int WR_DATA_ERROR = 4;
63 const int WR_NO_FLUSH = 5;
64 const int WR_BUF_ERROR = 6;
65 const int WR_STREAM_END = 7;
66 const int WR_FINISH = 8;
68 enum wrapperlib_mode { zlib_mode, bzlib_mode, xz_mode };
84 void set_next_in(
const char *x) {
return (this->*x_set_next_in)(x); };
85 void set_avail_in(U_I x) {
return (this->*x_set_avail_in)(x); };
86 U_I get_avail_in()
const {
return (this->*x_get_avail_in)(); };
87 U_64 get_total_in()
const {
return (this->*x_get_total_in)(); };
89 void set_next_out(
char *x) {
return (this->*x_set_next_out)(x); };
90 char *get_next_out()
const {
return (this->*x_get_next_out)(); };
91 void set_avail_out(U_I x) {
return (this->*x_set_avail_out)(x); };
92 U_I get_avail_out()
const {
return (this->*x_get_avail_out)(); };
93 U_64 get_total_out()
const {
return (this->*x_get_total_out)(); };
95 S_I compressInit(U_I compression_level) { level = compression_level;
return (this->*x_compressInit)(compression_level); };
96 S_I decompressInit() {
return (this->*x_decompressInit)(); };
97 S_I compressEnd() {
return (this->*x_compressEnd)(); };
98 S_I decompressEnd() {
return (this->*x_decompressEnd)(); };
99 S_I compress(S_I flag) {
return (this->*x_compress)(flag); };
100 S_I decompress(S_I flag) {
return (this->*x_decompress)(flag);};
102 S_I decompressReset();
111 #if LIBLZMA_AVAILABLE
112 lzma_stream *lzma_ptr;
117 void (
wrapperlib::*x_set_next_in)(
const char *x);
128 S_I (
wrapperlib::*x_compressInit)(U_I compression_level);
138 S_I z_compressInit(U_I compression_level);
139 S_I z_decompressInit();
141 S_I z_decompressEnd();
142 S_I z_compress(S_I flag);
143 S_I z_decompress(S_I flag);
144 void z_set_next_in(
const char *x);
145 void z_set_avail_in(U_I x);
146 U_I z_get_avail_in()
const;
147 U_64 z_get_total_in()
const;
148 void z_set_next_out(
char *x);
149 char *z_get_next_out()
const;
150 void z_set_avail_out(U_I x);
151 U_I z_get_avail_out()
const;
152 U_64 z_get_total_out()
const;
157 S_I bz_compressInit(U_I compression_level);
158 S_I bz_decompressInit();
159 S_I bz_compressEnd();
160 S_I bz_decompressEnd();
161 S_I bz_compress(S_I flag);
162 S_I bz_decompress(S_I flag);
163 void bz_set_next_in(
const char *x);
164 void bz_set_avail_in(U_I x);
165 U_I bz_get_avail_in()
const;
166 U_64 bz_get_total_in()
const;
167 void bz_set_next_out(
char *x);
168 char *bz_get_next_out()
const;
169 void bz_set_avail_out(U_I x);
170 U_I bz_get_avail_out()
const;
171 U_64 bz_get_total_out()
const;
175 #if LIBLZMA_AVAILABLE
176 S_I lzma_compressInit(U_I compression_level);
177 S_I lzma_decompressInit();
179 S_I lzma_encode(S_I flag);
180 void lzma_set_next_in(
const char *x);
181 void lzma_set_avail_in(U_I x);
182 U_I lzma_get_avail_in()
const;
183 U_64 lzma_get_total_in()
const;
184 void lzma_set_next_out(
char *x);
185 char *lzma_get_next_out()
const;
186 void lzma_set_avail_out(U_I x);
187 U_I lzma_get_avail_out()
const;
188 U_64 lzma_get_total_out()
const;
this class encapsulates calls to libz or libbz2
are defined here basic integer types that tend to be portable
libdar namespace encapsulate all libdar symbols