susy_snappy_sys_dev/
lib.rs

1// Copyright 2015-2018 Susy Technologies (UK) Ltd.
2// This file is part of Susy.
3
4// Susy is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8
9// Susy is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License
15// along with Susy.  If not, see <http://www.gnu.org/licenses/>.
16
17//! Snappy compression bindings.
18extern crate libc;
19
20use libc::{c_char, c_int, size_t};
21
22pub const SNAPPY_OK: c_int = 0;
23pub const SNAPPY_INVALID_INPUT: c_int = 1;
24pub const SNAPPY_BUFFER_TOO_SMALL: c_int = 2;
25
26extern {
27	pub fn snappy_compress(
28		input: *const c_char,
29		input_len: size_t,
30		compressed: *mut c_char,
31		compressed_len: *mut size_t
32	) -> c_int;
33
34	pub fn snappy_max_compressed_length(source_len: size_t) -> size_t;
35
36	pub fn snappy_uncompress(
37		compressed: *const c_char,
38		compressed_len: size_t,
39		uncompressed: *mut c_char,
40		uncompressed_len: *mut size_t,
41	) -> c_int;
42
43	pub fn snappy_uncompressed_length(
44		compressed: *const c_char,
45		compressed_len: size_t,
46		result: *mut size_t,
47	) -> c_int;
48
49	pub fn snappy_validate_compressed_buffer(
50		compressed: *const c_char,
51		compressed_len: size_t,
52	) -> c_int;
53}