1#![no_std]
5#![allow(non_upper_case_globals)]
6#![allow(non_camel_case_types)]
7#![allow(non_snake_case)]
8
9
10pub type brotli_alloc_func = ::core::option::Option<
11 unsafe extern "C" fn(opaque: *mut libc::c_void, size: usize) -> *mut libc::c_void,
12>;
13pub type brotli_free_func = ::core::option::Option<
14 unsafe extern "C" fn(opaque: *mut libc::c_void, address: *mut libc::c_void),
15>;
16#[repr(C)]
17#[derive(Debug, Copy, Clone)]
18pub struct BrotliSharedDictionaryStruct {
19 _unused: [u8; 0],
20}
21pub type BrotliSharedDictionary = BrotliSharedDictionaryStruct;
22pub const BrotliSharedDictionaryType_BROTLI_SHARED_DICTIONARY_RAW: BrotliSharedDictionaryType = 0;
23pub const BrotliSharedDictionaryType_BROTLI_SHARED_DICTIONARY_SERIALIZED:
24 BrotliSharedDictionaryType = 1;
25pub type BrotliSharedDictionaryType = libc::c_int;
26extern "C" {
27 pub fn BrotliSharedDictionaryCreateInstance(
28 alloc_func: brotli_alloc_func,
29 free_func: brotli_free_func,
30 opaque: *mut libc::c_void,
31 ) -> *mut BrotliSharedDictionary;
32}
33extern "C" {
34 pub fn BrotliSharedDictionaryDestroyInstance(dict: *mut BrotliSharedDictionary);
35}
36extern "C" {
37 pub fn BrotliSharedDictionaryAttach(
38 dict: *mut BrotliSharedDictionary,
39 type_: BrotliSharedDictionaryType,
40 data_size: usize,
41 data: *const u8,
42 ) -> libc::c_int;
43}
44pub const BrotliEncoderMode_BROTLI_MODE_GENERIC: BrotliEncoderMode = 0;
45pub const BrotliEncoderMode_BROTLI_MODE_TEXT: BrotliEncoderMode = 1;
46pub const BrotliEncoderMode_BROTLI_MODE_FONT: BrotliEncoderMode = 2;
47pub type BrotliEncoderMode = libc::c_int;
48pub const BrotliEncoderOperation_BROTLI_OPERATION_PROCESS: BrotliEncoderOperation = 0;
49pub const BrotliEncoderOperation_BROTLI_OPERATION_FLUSH: BrotliEncoderOperation = 1;
50pub const BrotliEncoderOperation_BROTLI_OPERATION_FINISH: BrotliEncoderOperation = 2;
51pub const BrotliEncoderOperation_BROTLI_OPERATION_EMIT_METADATA: BrotliEncoderOperation = 3;
52pub type BrotliEncoderOperation = libc::c_int;
53pub const BrotliEncoderParameter_BROTLI_PARAM_MODE: BrotliEncoderParameter = 0;
54pub const BrotliEncoderParameter_BROTLI_PARAM_QUALITY: BrotliEncoderParameter = 1;
55pub const BrotliEncoderParameter_BROTLI_PARAM_LGWIN: BrotliEncoderParameter = 2;
56pub const BrotliEncoderParameter_BROTLI_PARAM_LGBLOCK: BrotliEncoderParameter = 3;
57pub const BrotliEncoderParameter_BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:
58 BrotliEncoderParameter = 4;
59pub const BrotliEncoderParameter_BROTLI_PARAM_SIZE_HINT: BrotliEncoderParameter = 5;
60pub const BrotliEncoderParameter_BROTLI_PARAM_LARGE_WINDOW: BrotliEncoderParameter = 6;
61pub const BrotliEncoderParameter_BROTLI_PARAM_NPOSTFIX: BrotliEncoderParameter = 7;
62pub const BrotliEncoderParameter_BROTLI_PARAM_NDIRECT: BrotliEncoderParameter = 8;
63pub const BrotliEncoderParameter_BROTLI_PARAM_STREAM_OFFSET: BrotliEncoderParameter = 9;
64pub type BrotliEncoderParameter = libc::c_int;
65#[repr(C)]
66#[derive(Debug, Copy, Clone)]
67pub struct BrotliEncoderStateStruct {
68 _unused: [u8; 0],
69}
70pub type BrotliEncoderState = BrotliEncoderStateStruct;
71extern "C" {
72 pub fn BrotliEncoderSetParameter(
73 state: *mut BrotliEncoderState,
74 param: BrotliEncoderParameter,
75 value: u32,
76 ) -> libc::c_int;
77}
78extern "C" {
79 pub fn BrotliEncoderCreateInstance(
80 alloc_func: brotli_alloc_func,
81 free_func: brotli_free_func,
82 opaque: *mut libc::c_void,
83 ) -> *mut BrotliEncoderState;
84}
85extern "C" {
86 pub fn BrotliEncoderDestroyInstance(state: *mut BrotliEncoderState);
87}
88#[repr(C)]
89#[derive(Debug, Copy, Clone)]
90pub struct BrotliEncoderPreparedDictionaryStruct {
91 _unused: [u8; 0],
92}
93pub type BrotliEncoderPreparedDictionary = BrotliEncoderPreparedDictionaryStruct;
94extern "C" {
95 pub fn BrotliEncoderPrepareDictionary(
96 type_: BrotliSharedDictionaryType,
97 data_size: usize,
98 data: *const u8,
99 quality: libc::c_int,
100 alloc_func: brotli_alloc_func,
101 free_func: brotli_free_func,
102 opaque: *mut libc::c_void,
103 ) -> *mut BrotliEncoderPreparedDictionary;
104}
105extern "C" {
106 pub fn BrotliEncoderDestroyPreparedDictionary(dictionary: *mut BrotliEncoderPreparedDictionary);
107}
108extern "C" {
109 pub fn BrotliEncoderAttachPreparedDictionary(
110 state: *mut BrotliEncoderState,
111 dictionary: *const BrotliEncoderPreparedDictionary,
112 ) -> libc::c_int;
113}
114extern "C" {
115 pub fn BrotliEncoderMaxCompressedSize(input_size: usize) -> usize;
116}
117extern "C" {
118 pub fn BrotliEncoderCompress(
119 quality: libc::c_int,
120 lgwin: libc::c_int,
121 mode: BrotliEncoderMode,
122 input_size: usize,
123 input_buffer: *const u8,
124 encoded_size: *mut usize,
125 encoded_buffer: *mut u8,
126 ) -> libc::c_int;
127}
128extern "C" {
129 pub fn BrotliEncoderCompressStream(
130 state: *mut BrotliEncoderState,
131 op: BrotliEncoderOperation,
132 available_in: *mut usize,
133 next_in: *mut *const u8,
134 available_out: *mut usize,
135 next_out: *mut *mut u8,
136 total_out: *mut usize,
137 ) -> libc::c_int;
138}
139extern "C" {
140 pub fn BrotliEncoderIsFinished(state: *mut BrotliEncoderState) -> libc::c_int;
141}
142extern "C" {
143 pub fn BrotliEncoderHasMoreOutput(state: *mut BrotliEncoderState) -> libc::c_int;
144}
145extern "C" {
146 pub fn BrotliEncoderTakeOutput(state: *mut BrotliEncoderState, size: *mut usize) -> *const u8;
147}
148extern "C" {
149 pub fn BrotliEncoderEstimatePeakMemoryUsage(
150 quality: libc::c_int,
151 lgwin: libc::c_int,
152 input_size: usize,
153 ) -> usize;
154}
155extern "C" {
156 pub fn BrotliEncoderGetPreparedDictionarySize(
157 dictionary: *const BrotliEncoderPreparedDictionary,
158 ) -> usize;
159}
160extern "C" {
161 pub fn BrotliEncoderVersion() -> u32;
162}
163#[repr(C)]
164#[derive(Debug, Copy, Clone)]
165pub struct BrotliDecoderStateStruct {
166 _unused: [u8; 0],
167}
168pub type BrotliDecoderState = BrotliDecoderStateStruct;
169pub const BrotliDecoderResult_BROTLI_DECODER_RESULT_ERROR: BrotliDecoderResult = 0;
170pub const BrotliDecoderResult_BROTLI_DECODER_RESULT_SUCCESS: BrotliDecoderResult = 1;
171pub const BrotliDecoderResult_BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: BrotliDecoderResult = 2;
172pub const BrotliDecoderResult_BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: BrotliDecoderResult = 3;
173pub type BrotliDecoderResult = libc::c_int;
174pub const BrotliDecoderErrorCode_BROTLI_DECODER_NO_ERROR: BrotliDecoderErrorCode = 0;
175pub const BrotliDecoderErrorCode_BROTLI_DECODER_SUCCESS: BrotliDecoderErrorCode = 1;
176pub const BrotliDecoderErrorCode_BROTLI_DECODER_NEEDS_MORE_INPUT: BrotliDecoderErrorCode = 2;
177pub const BrotliDecoderErrorCode_BROTLI_DECODER_NEEDS_MORE_OUTPUT: BrotliDecoderErrorCode = 3;
178pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:
179 BrotliDecoderErrorCode = -1;
180pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_RESERVED: BrotliDecoderErrorCode = -2;
181pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:
182 BrotliDecoderErrorCode = -3;
183pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:
184 BrotliDecoderErrorCode = -4;
185pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:
186 BrotliDecoderErrorCode = -5;
187pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: BrotliDecoderErrorCode = -6;
188pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: BrotliDecoderErrorCode =
189 -7;
190pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:
191 BrotliDecoderErrorCode = -8;
192pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:
193 BrotliDecoderErrorCode = -9;
194pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:
195 BrotliDecoderErrorCode = -10;
196pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: BrotliDecoderErrorCode =
197 -11;
198pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: BrotliDecoderErrorCode =
199 -12;
200pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: BrotliDecoderErrorCode =
201 -13;
202pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_PADDING_1: BrotliDecoderErrorCode =
203 -14;
204pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_PADDING_2: BrotliDecoderErrorCode =
205 -15;
206pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_FORMAT_DISTANCE: BrotliDecoderErrorCode = -16;
207pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_COMPOUND_DICTIONARY: BrotliDecoderErrorCode =
208 -18;
209pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: BrotliDecoderErrorCode =
210 -19;
211pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: BrotliDecoderErrorCode =
212 -20;
213pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: BrotliDecoderErrorCode =
214 -21;
215pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: BrotliDecoderErrorCode =
216 -22;
217pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: BrotliDecoderErrorCode =
218 -25;
219pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: BrotliDecoderErrorCode =
220 -26;
221pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: BrotliDecoderErrorCode =
222 -27;
223pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:
224 BrotliDecoderErrorCode = -30;
225pub const BrotliDecoderErrorCode_BROTLI_DECODER_ERROR_UNREACHABLE: BrotliDecoderErrorCode = -31;
226pub type BrotliDecoderErrorCode = libc::c_int;
227pub const BrotliDecoderParameter_BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:
228 BrotliDecoderParameter = 0;
229pub const BrotliDecoderParameter_BROTLI_DECODER_PARAM_LARGE_WINDOW: BrotliDecoderParameter = 1;
230pub type BrotliDecoderParameter = libc::c_int;
231extern "C" {
232 pub fn BrotliDecoderSetParameter(
233 state: *mut BrotliDecoderState,
234 param: BrotliDecoderParameter,
235 value: u32,
236 ) -> libc::c_int;
237}
238extern "C" {
239 pub fn BrotliDecoderAttachDictionary(
240 state: *mut BrotliDecoderState,
241 type_: BrotliSharedDictionaryType,
242 data_size: usize,
243 data: *const u8,
244 ) -> libc::c_int;
245}
246extern "C" {
247 pub fn BrotliDecoderCreateInstance(
248 alloc_func: brotli_alloc_func,
249 free_func: brotli_free_func,
250 opaque: *mut libc::c_void,
251 ) -> *mut BrotliDecoderState;
252}
253extern "C" {
254 pub fn BrotliDecoderDestroyInstance(state: *mut BrotliDecoderState);
255}
256extern "C" {
257 pub fn BrotliDecoderDecompress(
258 encoded_size: usize,
259 encoded_buffer: *const u8,
260 decoded_size: *mut usize,
261 decoded_buffer: *mut u8,
262 ) -> BrotliDecoderResult;
263}
264extern "C" {
265 pub fn BrotliDecoderDecompressStream(
266 state: *mut BrotliDecoderState,
267 available_in: *mut usize,
268 next_in: *mut *const u8,
269 available_out: *mut usize,
270 next_out: *mut *mut u8,
271 total_out: *mut usize,
272 ) -> BrotliDecoderResult;
273}
274extern "C" {
275 pub fn BrotliDecoderHasMoreOutput(state: *const BrotliDecoderState) -> libc::c_int;
276}
277extern "C" {
278 pub fn BrotliDecoderTakeOutput(state: *mut BrotliDecoderState, size: *mut usize) -> *const u8;
279}
280extern "C" {
281 pub fn BrotliDecoderIsUsed(state: *const BrotliDecoderState) -> libc::c_int;
282}
283extern "C" {
284 pub fn BrotliDecoderIsFinished(state: *const BrotliDecoderState) -> libc::c_int;
285}
286extern "C" {
287 pub fn BrotliDecoderGetErrorCode(state: *const BrotliDecoderState) -> BrotliDecoderErrorCode;
288}
289extern "C" {
290 pub fn BrotliDecoderErrorString(c: BrotliDecoderErrorCode) -> *const libc::c_char;
291}
292extern "C" {
293 pub fn BrotliDecoderVersion() -> u32;
294}
295pub type brotli_decoder_metadata_start_func =
296 ::core::option::Option<unsafe extern "C" fn(opaque: *mut libc::c_void, size: usize)>;
297pub type brotli_decoder_metadata_chunk_func = ::core::option::Option<
298 unsafe extern "C" fn(opaque: *mut libc::c_void, data: *const u8, size: usize),
299>;
300extern "C" {
301 pub fn BrotliDecoderSetMetadataCallbacks(
302 state: *mut BrotliDecoderState,
303 start_func: brotli_decoder_metadata_start_func,
304 chunk_func: brotli_decoder_metadata_chunk_func,
305 opaque: *mut libc::c_void,
306 );
307}