2017-01-30 14:57:02 -08:00
|
|
|
/*
|
2017-08-31 12:11:57 -07:00
|
|
|
* Copyright (c) 2016-present, Facebook, Inc.
|
2017-01-30 14:57:02 -08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
2017-08-31 12:11:57 -07:00
|
|
|
* This source code is licensed under both the BSD-style license (found in the
|
|
|
|
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
|
|
|
* in the COPYING file in the root directory of this source tree).
|
2017-01-30 14:57:02 -08:00
|
|
|
*/
|
|
|
|
|
2017-08-11 18:40:19 -07:00
|
|
|
/******* EXPOSED TYPES ********************************************************/
|
|
|
|
/*
|
|
|
|
* Contains the parsed contents of a dictionary
|
|
|
|
* This includes Huffman and FSE tables used for decoding and data on offsets
|
|
|
|
*/
|
|
|
|
typedef struct dictionary_s dictionary_t;
|
|
|
|
/******* END EXPOSED TYPES ****************************************************/
|
2017-08-11 17:53:37 -07:00
|
|
|
|
|
|
|
/******* DECOMPRESSION FUNCTIONS **********************************************/
|
|
|
|
/// Zstandard decompression functions.
|
|
|
|
/// `dst` must point to a space at least as large as the reconstructed output.
|
2017-01-31 15:57:18 -08:00
|
|
|
size_t ZSTD_decompress(void *const dst, const size_t dst_len,
|
2017-08-11 17:53:37 -07:00
|
|
|
const void *const src, const size_t src_len);
|
|
|
|
|
|
|
|
/// If `dict != NULL` and `dict_len >= 8`, does the same thing as
|
|
|
|
/// `ZSTD_decompress` but uses the provided dict
|
2017-01-31 15:57:18 -08:00
|
|
|
size_t ZSTD_decompress_with_dict(void *const dst, const size_t dst_len,
|
2017-08-11 17:53:37 -07:00
|
|
|
const void *const src, const size_t src_len,
|
2017-08-11 18:40:19 -07:00
|
|
|
dictionary_t* parsed_dict);
|
2017-08-11 17:53:37 -07:00
|
|
|
|
|
|
|
/// Get the decompressed size of an input stream so memory can be allocated in
|
|
|
|
/// advance
|
|
|
|
/// Returns -1 if the size can't be determined
|
|
|
|
/// Assumes decompression of a single frame
|
2017-01-31 15:57:18 -08:00
|
|
|
size_t ZSTD_get_decompressed_size(const void *const src, const size_t src_len);
|
2017-08-11 17:53:37 -07:00
|
|
|
/******* END DECOMPRESSION FUNCTIONS ******************************************/
|
|
|
|
|
|
|
|
/******* DICTIONARY MANAGEMENT ***********************************************/
|
|
|
|
/*
|
2017-08-11 18:40:19 -07:00
|
|
|
* Return a valid dictionary_t pointer for use with dictionary initialization
|
|
|
|
* or decompression
|
2017-08-11 17:53:37 -07:00
|
|
|
*/
|
2017-08-11 18:40:19 -07:00
|
|
|
dictionary_t* create_dictionary();
|
2017-01-30 11:42:45 -08:00
|
|
|
|
2017-08-11 17:53:37 -07:00
|
|
|
/*
|
|
|
|
* Parse a provided dictionary blob for use in decompression
|
|
|
|
* `src` -- must point to memory space representing the dictionary
|
|
|
|
* `src_len` -- must provide the dictionary size
|
|
|
|
* `dict` -- will contain the parsed contents of the dictionary and
|
|
|
|
* can be used for decompression
|
|
|
|
*/
|
|
|
|
void parse_dictionary(dictionary_t *const dict, const void *src,
|
|
|
|
size_t src_len);
|
2017-08-11 18:40:19 -07:00
|
|
|
|
2017-08-11 17:53:37 -07:00
|
|
|
/*
|
|
|
|
* Free internal Huffman tables, FSE tables, and dictionary content
|
|
|
|
*/
|
|
|
|
void free_dictionary(dictionary_t *const dict);
|
|
|
|
/******* END DICTIONARY MANAGEMENT *******************************************/
|