blosc_sys/bindgen.rs
1/* automatically generated by rust-bindgen 0.63.0 */
2
3pub const BLOSC_VERSION_MAJOR: u32 = 1;
4pub const BLOSC_VERSION_MINOR: u32 = 21;
5pub const BLOSC_VERSION_RELEASE: u32 = 0;
6pub const BLOSC_VERSION_STRING: &[u8; 7usize] = b"1.21.0\0";
7pub const BLOSC_VERSION_REVISION: &[u8; 6usize] = b"$Rev$\0";
8pub const BLOSC_VERSION_DATE: &[u8; 22usize] = b"$Date:: 2020-12-22 #$\0";
9pub const BLOSCLZ_VERSION_STRING: &[u8; 6usize] = b"2.3.0\0";
10pub const BLOSC_VERSION_FORMAT: u32 = 2;
11pub const BLOSC_MIN_HEADER_LENGTH: u32 = 16;
12pub const BLOSC_MAX_OVERHEAD: u32 = 16;
13pub const BLOSC_MAX_BUFFERSIZE: u32 = 2147483631;
14pub const BLOSC_MAX_TYPESIZE: u32 = 255;
15pub const BLOSC_MAX_THREADS: u32 = 256;
16pub const BLOSC_NOSHUFFLE: u32 = 0;
17pub const BLOSC_SHUFFLE: u32 = 1;
18pub const BLOSC_BITSHUFFLE: u32 = 2;
19pub const BLOSC_DOSHUFFLE: u32 = 1;
20pub const BLOSC_MEMCPYED: u32 = 2;
21pub const BLOSC_DOBITSHUFFLE: u32 = 4;
22pub const BLOSC_BLOSCLZ: u32 = 0;
23pub const BLOSC_LZ4: u32 = 1;
24pub const BLOSC_LZ4HC: u32 = 2;
25pub const BLOSC_SNAPPY: u32 = 3;
26pub const BLOSC_ZLIB: u32 = 4;
27pub const BLOSC_ZSTD: u32 = 5;
28pub const BLOSC_BLOSCLZ_COMPNAME: &[u8; 8usize] = b"blosclz\0";
29pub const BLOSC_LZ4_COMPNAME: &[u8; 4usize] = b"lz4\0";
30pub const BLOSC_LZ4HC_COMPNAME: &[u8; 6usize] = b"lz4hc\0";
31pub const BLOSC_SNAPPY_COMPNAME: &[u8; 7usize] = b"snappy\0";
32pub const BLOSC_ZLIB_COMPNAME: &[u8; 5usize] = b"zlib\0";
33pub const BLOSC_ZSTD_COMPNAME: &[u8; 5usize] = b"zstd\0";
34pub const BLOSC_BLOSCLZ_LIB: u32 = 0;
35pub const BLOSC_LZ4_LIB: u32 = 1;
36pub const BLOSC_SNAPPY_LIB: u32 = 2;
37pub const BLOSC_ZLIB_LIB: u32 = 3;
38pub const BLOSC_ZSTD_LIB: u32 = 4;
39pub const BLOSC_BLOSCLZ_LIBNAME: &[u8; 8usize] = b"BloscLZ\0";
40pub const BLOSC_LZ4_LIBNAME: &[u8; 4usize] = b"LZ4\0";
41pub const BLOSC_SNAPPY_LIBNAME: &[u8; 7usize] = b"Snappy\0";
42pub const BLOSC_ZLIB_LIBNAME: &[u8; 5usize] = b"Zlib\0";
43pub const BLOSC_ZSTD_LIBNAME: &[u8; 5usize] = b"Zstd\0";
44pub const BLOSC_BLOSCLZ_FORMAT: u32 = 0;
45pub const BLOSC_LZ4_FORMAT: u32 = 1;
46pub const BLOSC_LZ4HC_FORMAT: u32 = 1;
47pub const BLOSC_SNAPPY_FORMAT: u32 = 2;
48pub const BLOSC_ZLIB_FORMAT: u32 = 3;
49pub const BLOSC_ZSTD_FORMAT: u32 = 4;
50pub const BLOSC_BLOSCLZ_VERSION_FORMAT: u32 = 1;
51pub const BLOSC_LZ4_VERSION_FORMAT: u32 = 1;
52pub const BLOSC_LZ4HC_VERSION_FORMAT: u32 = 1;
53pub const BLOSC_SNAPPY_VERSION_FORMAT: u32 = 1;
54pub const BLOSC_ZLIB_VERSION_FORMAT: u32 = 1;
55pub const BLOSC_ZSTD_VERSION_FORMAT: u32 = 1;
56pub const BLOSC_ALWAYS_SPLIT: u32 = 1;
57pub const BLOSC_NEVER_SPLIT: u32 = 2;
58pub const BLOSC_AUTO_SPLIT: u32 = 3;
59pub const BLOSC_FORWARD_COMPAT_SPLIT: u32 = 4;
60extern "C" {
61 ///Initialize the Blosc library environment.
62 ///
63 ///You must call this previous to any other Blosc call, unless you want
64 ///Blosc to be used simultaneously in a multi-threaded environment, in
65 ///which case you should *exclusively* use the
66 ///blosc_compress_ctx()/blosc_decompress_ctx() pair (see below).
67 pub fn blosc_init();
68}
69extern "C" {
70 ///Destroy the Blosc library environment.
71 ///
72 ///You must call this after to you are done with all the Blosc calls,
73 ///unless you have not used blosc_init() before (see blosc_init()
74 ///above).
75 pub fn blosc_destroy();
76}
77extern "C" {
78 ///Compress a block of data in the `src` buffer and returns the size of
79 ///the compressed block. The size of `src` buffer is specified by
80 ///`nbytes`. There is not a minimum for `src` buffer size (`nbytes`).
81 ///
82 ///`clevel` is the desired compression level and must be a number
83 ///between 0 (no compression) and 9 (maximum compression).
84 ///
85 ///`doshuffle` specifies whether the shuffle compression filters
86 ///should be applied or not. BLOSC_NOSHUFFLE means not applying it,
87 ///BLOSC_SHUFFLE means applying it at a byte level and BLOSC_BITSHUFFLE
88 ///at a bit level (slower but may achieve better entropy alignment).
89 ///
90 ///`typesize` is the number of bytes for the atomic type in binary
91 ///`src` buffer. This is mainly useful for the shuffle filters.
92 ///For implementation reasons, only a 1 < `typesize` < 256 will allow the
93 ///shuffle filter to work. When `typesize` is not in this range, shuffle
94 ///will be silently disabled.
95 ///
96 ///The `dest` buffer must have at least the size of `destsize`. Blosc
97 ///guarantees that if you set `destsize` to, at least,
98 ///(`nbytes` + BLOSC_MAX_OVERHEAD), the compression will always succeed.
99 ///The `src` buffer and the `dest` buffer can not overlap.
100 ///
101 ///Compression is memory safe and guaranteed not to write the `dest`
102 ///buffer beyond what is specified in `destsize`.
103 ///
104 ///If `src` buffer cannot be compressed into `destsize`, the return
105 ///value is zero and you should discard the contents of the `dest`
106 ///buffer.
107 ///
108 ///A negative return value means that an internal error happened. This
109 ///should never happen. If you see this, please report it back
110 ///together with the buffer data causing this and compression settings.
111 ///
112 ///Environment variables
113 ///---------------------
114 ///
115 ///blosc_compress() honors different environment variables to control
116 ///internal parameters without the need of doing that programatically.
117 ///Here are the ones supported:
118 ///
119 ///BLOSC_CLEVEL=(INTEGER): This will overwrite the `clevel` parameter
120 ///before the compression process starts.
121 ///
122 ///BLOSC_SHUFFLE=[NOSHUFFLE | SHUFFLE | BITSHUFFLE]: This will
123 ///overwrite the `doshuffle` parameter before the compression process
124 ///starts.
125 ///
126 ///BLOSC_TYPESIZE=(INTEGER): This will overwrite the `typesize`
127 ///parameter before the compression process starts.
128 ///
129 ///BLOSC_COMPRESSOR=[BLOSCLZ | LZ4 | LZ4HC | SNAPPY | ZLIB]: This will
130 ///call blosc_set_compressor(BLOSC_COMPRESSOR) before the compression
131 ///process starts.
132 ///
133 ///BLOSC_NTHREADS=(INTEGER): This will call
134 ///blosc_set_nthreads(BLOSC_NTHREADS) before the compression process
135 ///starts.
136 ///
137 ///BLOSC_BLOCKSIZE=(INTEGER): This will call
138 ///blosc_set_blocksize(BLOSC_BLOCKSIZE) before the compression process
139 ///starts. *NOTE:* The blocksize is a critical parameter with
140 ///important restrictions in the allowed values, so use this with care.
141 ///
142 ///BLOSC_NOLOCK=(ANY VALUE): This will call blosc_compress_ctx() under
143 ///the hood, with the `compressor`, `blocksize` and
144 ///`numinternalthreads` parameters set to the same as the last calls to
145 ///blosc_set_compressor(), blosc_set_blocksize() and
146 ///blosc_set_nthreads(). BLOSC_CLEVEL, BLOSC_SHUFFLE, BLOSC_TYPESIZE
147 ///environment vars will also be honored.
148 ///
149 ///BLOSC_SPLITMODE=[ FORWARD_COMPAT | AUTO | ALWAYS | NEVER ]:
150 ///This will call blosc_set_splitmode() with the different supported values.
151 ///See blosc_set_splitmode() docstrings for more info on each mode.
152 ///
153 ///BLOSC_WARN=(INTEGER): This will print some warning message on stderr
154 ///showing more info in situations where data inputs cannot be compressed.
155 ///The values can range from 1 (less verbose) to 10 (full verbose). 0 is
156 ///the same as if the BLOSC_WARN envvar was not defined.
157 pub fn blosc_compress(
158 clevel: ::std::os::raw::c_int,
159 doshuffle: ::std::os::raw::c_int,
160 typesize: usize,
161 nbytes: usize,
162 src: *const ::std::os::raw::c_void,
163 dest: *mut ::std::os::raw::c_void,
164 destsize: usize,
165 ) -> ::std::os::raw::c_int;
166}
167extern "C" {
168 ///Context interface to blosc compression. This does not require a call
169 ///to blosc_init() and can be called from multithreaded applications
170 ///without the global lock being used, so allowing Blosc be executed
171 ///simultaneously in those scenarios.
172 ///
173 ///It uses the same parameters than the blosc_compress() function plus:
174 ///
175 ///`compressor`: the string representing the type of compressor to use.
176 ///
177 ///`blocksize`: the requested size of the compressed blocks. If 0, an
178 ///automatic blocksize will be used.
179 ///
180 ///`numinternalthreads`: the number of threads to use internally.
181 ///
182 ///A negative return value means that an internal error happened. This
183 ///should never happen. If you see this, please report it back
184 ///together with the buffer data causing this and compression settings.
185 pub fn blosc_compress_ctx(
186 clevel: ::std::os::raw::c_int,
187 doshuffle: ::std::os::raw::c_int,
188 typesize: usize,
189 nbytes: usize,
190 src: *const ::std::os::raw::c_void,
191 dest: *mut ::std::os::raw::c_void,
192 destsize: usize,
193 compressor: *const ::std::os::raw::c_char,
194 blocksize: usize,
195 numinternalthreads: ::std::os::raw::c_int,
196 ) -> ::std::os::raw::c_int;
197}
198extern "C" {
199 ///Decompress a block of compressed data in `src`, put the result in
200 ///`dest` and returns the size of the decompressed block.
201 ///
202 ///Call `blosc_cbuffer_validate` to determine the size of the destination buffer.
203 ///
204 ///The `src` buffer and the `dest` buffer can not overlap.
205 ///
206 ///Decompression is memory safe and guaranteed not to write the `dest`
207 ///buffer beyond what is specified in `destsize`.
208 ///
209 ///If an error occurs, e.g. the compressed data is corrupted or the
210 ///output buffer is not large enough, then 0 (zero) or a negative value
211 ///will be returned instead.
212 ///
213 ///Environment variables
214 ///---------------------
215 ///
216 ///blosc_decompress() honors different environment variables to control
217 ///internal parameters without the need of doing that programatically.
218 ///Here are the ones supported:
219 ///
220 ///BLOSC_NTHREADS=(INTEGER): This will call
221 ///blosc_set_nthreads(BLOSC_NTHREADS) before the proper decompression
222 ///process starts.
223 ///
224 ///BLOSC_NOLOCK=(ANY VALUE): This will call blosc_decompress_ctx()
225 ///under the hood, with the `numinternalthreads` parameter set to the
226 ///same value as the last call to blosc_set_nthreads().
227 pub fn blosc_decompress(
228 src: *const ::std::os::raw::c_void,
229 dest: *mut ::std::os::raw::c_void,
230 destsize: usize,
231 ) -> ::std::os::raw::c_int;
232}
233extern "C" {
234 ///Context interface to blosc decompression. This does not require a
235 ///call to blosc_init() and can be called from multithreaded
236 ///applications without the global lock being used, so allowing Blosc
237 ///be executed simultaneously in those scenarios.
238 ///
239 ///Call `blosc_cbuffer_validate` to determine the size of the destination buffer.
240 ///
241 ///It uses the same parameters than the blosc_decompress() function plus:
242 ///
243 ///`numinternalthreads`: number of threads to use internally.
244 ///
245 ///Decompression is memory safe and guaranteed not to write the `dest`
246 ///buffer more than what is specified in `destsize`.
247 ///
248 ///If an error occurs, e.g. the compressed data is corrupted or the
249 ///output buffer is not large enough, then 0 (zero) or a negative value
250 ///will be returned instead.
251 pub fn blosc_decompress_ctx(
252 src: *const ::std::os::raw::c_void,
253 dest: *mut ::std::os::raw::c_void,
254 destsize: usize,
255 numinternalthreads: ::std::os::raw::c_int,
256 ) -> ::std::os::raw::c_int;
257}
258extern "C" {
259 ///Get `nitems` (of typesize size) in `src` buffer starting in `start`.
260 ///The items are returned in `dest` buffer, which has to have enough
261 ///space for storing all items.
262 ///
263 ///Returns the number of bytes copied to `dest` or a negative value if
264 ///some error happens.
265 pub fn blosc_getitem(
266 src: *const ::std::os::raw::c_void,
267 start: ::std::os::raw::c_int,
268 nitems: ::std::os::raw::c_int,
269 dest: *mut ::std::os::raw::c_void,
270 ) -> ::std::os::raw::c_int;
271}
272extern "C" {
273 ///Returns the current number of threads that are used for
274 ///compression/decompression.
275 pub fn blosc_get_nthreads() -> ::std::os::raw::c_int;
276}
277extern "C" {
278 ///Initialize a pool of threads for compression/decompression. If
279 ///`nthreads` is 1, then the serial version is chosen and a possible
280 ///previous existing pool is ended. If this is not called, `nthreads`
281 ///is set to 1 internally.
282 ///
283 ///Returns the previous number of threads.
284 pub fn blosc_set_nthreads(nthreads: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
285}
286extern "C" {
287 ///Returns the current compressor that is being used for compression.
288 pub fn blosc_get_compressor() -> *const ::std::os::raw::c_char;
289}
290extern "C" {
291 ///Select the compressor to be used. The supported ones are "blosclz",
292 ///"lz4", "lz4hc", "snappy", "zlib" and "zstd". If this function is not
293 ///called, then "blosclz" will be used by default.
294 ///
295 ///In case the compressor is not recognized, or there is not support
296 ///for it in this build, it returns a -1. Else it returns the code for
297 ///the compressor (>=0).
298 pub fn blosc_set_compressor(compname: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
299}
300extern "C" {
301 ///Get the `compname` associated with the `compcode`.
302 ///
303 ///If the compressor code is not recognized, or there is not support
304 ///for it in this build, -1 is returned. Else, the compressor code is
305 ///returned.
306 pub fn blosc_compcode_to_compname(
307 compcode: ::std::os::raw::c_int,
308 compname: *mut *const ::std::os::raw::c_char,
309 ) -> ::std::os::raw::c_int;
310}
311extern "C" {
312 ///Return the compressor code associated with the compressor name.
313 ///
314 ///If the compressor name is not recognized, or there is not support
315 ///for it in this build, -1 is returned instead.
316 pub fn blosc_compname_to_compcode(
317 compname: *const ::std::os::raw::c_char,
318 ) -> ::std::os::raw::c_int;
319}
320extern "C" {
321 ///Get a list of compressors supported in the current build. The
322 ///returned value is a string with a concatenation of "blosclz", "lz4",
323 ///"lz4hc", "snappy", "zlib" or "zstd "separated by commas, depending
324 ///on which ones are present in the build.
325 ///
326 ///This function does not leak, so you should not free() the returned
327 ///list.
328 ///
329 ///This function should always succeed.
330 pub fn blosc_list_compressors() -> *const ::std::os::raw::c_char;
331}
332extern "C" {
333 ///Return the version of the C-Blosc library in string format.
334 ///
335 ///Useful for dynamic libraries.
336 pub fn blosc_get_version_string() -> *const ::std::os::raw::c_char;
337}
338extern "C" {
339 ///Get info from compression libraries included in the current build.
340 ///In `compname` you pass the compressor name that you want info from.
341 ///
342 ///In `complib` and `version` you get a pointer to the compressor
343 ///library name and the version in string format respectively. After
344 ///using the name and version, you should free() them so as to avoid
345 ///leaks. If any of `complib` and `version` are NULL, they will not be
346 ///assigned to anything, and the user should not need to free them.
347 ///
348 ///If the compressor is supported, it returns the code for the library
349 ///(>=0). If it is not supported, this function returns -1.
350 pub fn blosc_get_complib_info(
351 compname: *const ::std::os::raw::c_char,
352 complib: *mut *mut ::std::os::raw::c_char,
353 version: *mut *mut ::std::os::raw::c_char,
354 ) -> ::std::os::raw::c_int;
355}
356extern "C" {
357 ///Free possible memory temporaries and thread resources. Use this
358 ///when you are not going to use Blosc for a long while. In case of
359 ///problems releasing the resources, it returns a negative number, else
360 ///it returns 0.
361 pub fn blosc_free_resources() -> ::std::os::raw::c_int;
362}
363extern "C" {
364 ///Return information about a compressed buffer, namely the number of
365 ///uncompressed bytes (`nbytes`) and compressed (`cbytes`). It also
366 ///returns the `blocksize` (which is used internally for doing the
367 ///compression by blocks).
368 ///
369 ///You only need to pass the first BLOSC_MIN_HEADER_LENGTH bytes of a
370 ///compressed buffer for this call to work.
371 ///
372 ///If the format is not supported by the library, all output arguments will be
373 ///filled with zeros.
374 pub fn blosc_cbuffer_sizes(
375 cbuffer: *const ::std::os::raw::c_void,
376 nbytes: *mut usize,
377 cbytes: *mut usize,
378 blocksize: *mut usize,
379 );
380}
381extern "C" {
382 ///Checks that the compressed buffer starting at `cbuffer` of length `cbytes` may
383 ///contain valid blosc compressed data, and that it is safe to call
384 ///blosc_decompress/blosc_decompress_ctx/blosc_getitem.
385 ///
386 ///On success, returns 0 and sets *nbytes to the size of the uncompressed data.
387 ///This does not guarantee that the decompression function won't return an error,
388 ///but does guarantee that it is safe to attempt decompression.
389 ///
390 ///On failure, returns -1.
391 pub fn blosc_cbuffer_validate(
392 cbuffer: *const ::std::os::raw::c_void,
393 cbytes: usize,
394 nbytes: *mut usize,
395 ) -> ::std::os::raw::c_int;
396}
397extern "C" {
398 ///Return meta-information about a compressed buffer, namely the type size
399 ///(`typesize`), as well as some internal `flags`.
400 ///
401 ///The `flags` is a set of bits, where the used ones are:
402 /// bit 0: whether the shuffle filter has been applied or not
403 /// bit 1: whether the internal buffer is a pure memcpy or not
404 /// bit 2: whether the bit shuffle filter has been applied or not
405 ///
406 ///You can use the `BLOSC_DOSHUFFLE`, `BLOSC_DOBITSHUFFLE` and
407 ///`BLOSC_MEMCPYED` symbols for extracting the interesting bits
408 ///(e.g. ``flags & BLOSC_DOSHUFFLE`` says whether the buffer is
409 ///byte-shuffled or not).
410 ///
411 ///You only need to pass the first BLOSC_MIN_HEADER_LENGTH bytes of a
412 ///compressed buffer for this call to work.
413 ///
414 ///If the format is not supported by the library, all output arguments will be
415 ///filled with zeros.
416 pub fn blosc_cbuffer_metainfo(
417 cbuffer: *const ::std::os::raw::c_void,
418 typesize: *mut usize,
419 flags: *mut ::std::os::raw::c_int,
420 );
421}
422extern "C" {
423 ///Return information about a compressed buffer, namely the internal
424 ///Blosc format version (`version`) and the format for the internal
425 ///compressor used (`compversion`).
426 ///
427 ///This function should always succeed.
428 pub fn blosc_cbuffer_versions(
429 cbuffer: *const ::std::os::raw::c_void,
430 version: *mut ::std::os::raw::c_int,
431 compversion: *mut ::std::os::raw::c_int,
432 );
433}
434extern "C" {
435 ///Return the compressor library/format used in a compressed buffer.
436 ///
437 ///This function should always succeed.
438 pub fn blosc_cbuffer_complib(
439 cbuffer: *const ::std::os::raw::c_void,
440 ) -> *const ::std::os::raw::c_char;
441}
442extern "C" {
443 ///Get the internal blocksize to be used during compression. 0 means
444 ///that an automatic blocksize is computed internally (the default).
445 pub fn blosc_get_blocksize() -> ::std::os::raw::c_int;
446}
447extern "C" {
448 ///Force the use of a specific blocksize. If 0, an automatic
449 ///blocksize will be used (the default).
450 ///
451 ///The blocksize is a critical parameter with important restrictions in
452 ///the allowed values, so use this with care.
453 pub fn blosc_set_blocksize(blocksize: usize);
454}
455extern "C" {
456 ///Set the split mode.
457 ///
458 ///This function can take the next values:
459 /// BLOSC_FORWARD_COMPAT_SPLIT
460 /// BLOSC_AUTO_SPLIT
461 /// BLOSC_NEVER_SPLIT
462 /// BLOSC_ALWAYS_SPLIT
463 ///
464 ///BLOSC_FORWARD_COMPAT offers reasonably forward compatibility,
465 ///BLOSC_AUTO_SPLIT is for nearly optimal results (based on heuristics),
466 ///BLOSC_NEVER_SPLIT and BLOSC_ALWAYS_SPLIT are for the user experimenting
467 ///when trying to get best compression ratios and/or speed.
468 ///
469 ///If not called, the default mode is BLOSC_FORWARD_COMPAT_SPLIT.
470 ///
471 ///This function should always succeed.
472 pub fn blosc_set_splitmode(splitmode: ::std::os::raw::c_int);
473}