Crate zstd_sys [] [src]

Structs

ZSTD_CCtx_s
ZSTD_CDict_s
ZSTD_CStream_s
ZSTD_DCtx_s
ZSTD_DDict_s
ZSTD_DStream_s
ZSTD_compressionParameters
ZSTD_customMem
ZSTD_frameParameters
ZSTD_frameParams
ZSTD_inBuffer_s
ZSTD_outBuffer_s
ZSTD_parameters

Enums

ZSTD_CCtxParameter
ZSTD_DStreamParameter_e
ZSTD_nextInputType_e
ZSTD_strategy

Constants

ZSTD_BLOCKSIZE_ABSOLUTEMAX
ZSTD_CHAINLOG_MIN
ZSTD_CONTENTSIZE_ERROR
ZSTD_CONTENTSIZE_UNKNOWN
ZSTD_FRAMEHEADERSIZE_MAX
ZSTD_FRAMEHEADERSIZE_MIN
ZSTD_HASHLOG3_MAX
ZSTD_HASHLOG_MIN
ZSTD_MAGICNUMBER
ZSTD_MAGIC_SKIPPABLE_START
ZSTD_SEARCHLENGTH_MAX
ZSTD_SEARCHLENGTH_MIN
ZSTD_SEARCHLOG_MIN
ZSTD_TARGETLENGTH_MAX
ZSTD_TARGETLENGTH_MIN
ZSTD_VERSION_MAJOR
ZSTD_VERSION_MINOR
ZSTD_VERSION_NUMBER
ZSTD_VERSION_RELEASE
ZSTD_WINDOWLOG_MAX_32
ZSTD_WINDOWLOG_MAX_64
ZSTD_WINDOWLOG_MIN
ZSTD_frameHeaderSize_max
ZSTD_frameHeaderSize_min
ZSTD_frameHeaderSize_prefix
ZSTD_skippableHeaderSize

Functions

ZDICT_getDictID
ZDICT_getErrorName
ZDICT_isError
ZDICT_trainFromBuffer

ZDICT_trainFromBuffer() : Train a dictionary from an array of samples. Samples must be stored concatenated in a single flat buffer samplesBuffer, supplied with an array of sizes samplesSizes, providing the size of each sample, in order. The resulting dictionary will be saved into dictBuffer. @return : size of dictionary stored into dictBuffer (<= dictBufferCapacity) or an error code, which can be tested with ZDICT_isError(). Tips : In general, a reasonable dictionary has a size of ~ 100 KB. It's obviously possible to target smaller or larger ones, just by specifying different dictBufferCapacity. In general, it's recommended to provide a few thousands samples, but this can vary a lot. It's recommended that total size of all samples be about ~x100 times the target size of dictionary.

ZSTD_CStreamInSize
ZSTD_CStreamOutSize
ZSTD_DStreamInSize
ZSTD_DStreamOutSize
ZSTD_adjustCParams

ZSTD_adjustCParams() : * optimize params for a given srcSize and dictSize. * both values are optional, select 0 if unknown.

ZSTD_checkCParams

ZSTD_checkCParams() : * Ensure param values remain within authorized range

ZSTD_compress

ZSTD_compress() : * Compresses src content as a single zstd compressed frame into already allocated dst. * Hint : compression runs faster if dstCapacity >= ZSTD_compressBound(srcSize). * @return : compressed size written into dst (<= `dstCapacity), * or an error code if it fails (which can be tested using ZSTD_isError()).

ZSTD_compressBegin

Buffer-less streaming compression (synchronous mode)

ZSTD_compressBegin_advanced
ZSTD_compressBegin_usingCDict
ZSTD_compressBegin_usingCDict_advanced
ZSTD_compressBegin_usingDict
ZSTD_compressBlock
ZSTD_compressBound
ZSTD_compressCCtx

ZSTD_compressCCtx() : * Same as ZSTD_compress(), requires an allocated ZSTD_CCtx (see ZSTD_createCCtx()).

ZSTD_compressContinue
ZSTD_compressEnd
ZSTD_compressStream
ZSTD_compress_advanced

ZSTD_compress_advanced() : * Same as ZSTD_compress_usingDict(), with fine-tune control over each compression parameter

ZSTD_compress_usingCDict

ZSTD_compress_usingCDict() : * Compression using a digested Dictionary. * Faster startup than ZSTD_compress_usingDict(), recommended when same dictionary is used multiple times. * Note that compression level is decided during dictionary creation. * Frame parameters are hardcoded (dictID=yes, contentSize=yes, checksum=no)

ZSTD_compress_usingCDict_advanced

ZSTD_compress_usingCDict_advanced() : * Same as ZSTD_compress_usingCDict(), with fine-tune control over frame parameters

ZSTD_compress_usingDict

ZSTD_compress_usingDict() : * Compression using a predefined Dictionary (see dictBuilder/zdict.h). * Note : This function loads the dictionary, resulting in significant startup delay. * Note : When dict == NULL || dictSize < 8 no dictionary is used.

ZSTD_copyCCtx
ZSTD_copyDCtx
ZSTD_createCCtx
ZSTD_createCCtx_advanced

ZSTD_createCCtx_advanced() : * Create a ZSTD compression context using external alloc and free functions

ZSTD_createCDict

ZSTD_createCDict() : * When compressing multiple messages / blocks with the same dictionary, it's recommended to load it just once. * ZSTD_createCDict() will create a digested dictionary, ready to start future compression operations without startup delay. * ZSTD_CDict can be created once and used by multiple threads concurrently, as its usage is read-only. * dictBuffer can be released after ZSTD_CDict creation, as its content is copied within CDict

ZSTD_createCDict_advanced

ZSTD_createCDict_advanced() : * Create a ZSTD_CDict using external alloc and free, and customized compression parameters

ZSTD_createCDict_byReference

ZSTD_createCDict_byReference() : * Create a digested dictionary for compression * Dictionary content is simply referenced, and therefore stays in dictBuffer. * It is important that dictBuffer outlives CDict, it must remain read accessible throughout the lifetime of CDict

ZSTD_createCStream
ZSTD_createCStream_advanced
ZSTD_createDCtx
ZSTD_createDCtx_advanced

ZSTD_createDCtx_advanced() : * Create a ZSTD decompression context using external alloc and free functions

ZSTD_createDDict

ZSTD_createDDict() : * Create a digested dictionary, ready to start decompression operation without startup delay. * dictBuffer can be released after DDict creation, as its content is copied inside DDict

ZSTD_createDDict_advanced

ZSTD_createDDict_advanced() : * Create a ZSTD_DDict using external alloc and free, optionally by reference

ZSTD_createDDict_byReference

ZSTD_createDDict_byReference() : * Create a digested dictionary, ready to start decompression operation without startup delay. * Dictionary content is simply referenced, and therefore stays in dictBuffer. * It is important that dictBuffer outlives DDict, it must remain read accessible throughout the lifetime of DDict

ZSTD_createDStream
ZSTD_createDStream_advanced
ZSTD_decompress

ZSTD_decompress() : * compressedSize : must be the exact size of some number of compressed and/or skippable frames. * dstCapacity is an upper bound of originalSize. * If user cannot imply a maximum upper bound, it's better to use streaming mode to decompress data. * @return : the number of bytes decompressed into dst (<= dstCapacity), * or an errorCode if it fails (which can be tested using ZSTD_isError()).

ZSTD_decompressBegin
ZSTD_decompressBegin_usingDict
ZSTD_decompressBlock
ZSTD_decompressContinue
ZSTD_decompressDCtx

ZSTD_decompressDCtx() : * Same as ZSTD_decompress(), requires an allocated ZSTD_DCtx (see ZSTD_createDCtx()).

ZSTD_decompressStream
ZSTD_decompress_usingDDict

ZSTD_decompress_usingDDict() : * Decompression using a digested Dictionary. * Faster startup than ZSTD_decompress_usingDict(), recommended when same dictionary is used multiple times.

ZSTD_decompress_usingDict

ZSTD_decompress_usingDict() : * Decompression using a predefined Dictionary (see dictBuilder/zdict.h). * Dictionary must be identical to the one used during compression. * Note : This function loads the dictionary, resulting in significant startup delay. * Note : When dict == NULL || dictSize < 8 no dictionary is used.

ZSTD_endStream
ZSTD_estimateCCtxSize

ZSTD_estimateCCtxSize() : * Gives the amount of memory allocated for a ZSTD_CCtx given a set of compression parameters. * frameContentSize is an optional parameter, provide 0 if unknown

ZSTD_estimateDCtxSize

ZSTD_estimateDCtxSize() : * Gives the potential amount of memory allocated to create a ZSTD_DCtx

ZSTD_findDecompressedSize

ZSTD_findDecompressedSize() : * src should point the start of a series of ZSTD encoded and/or skippable frames * srcSize must be the exact size of this series * (i.e. there should be a frame boundary exactly srcSize bytes after src) * @return : the decompressed size of all data in the contained frames, as a 64-bit value if known * - if the decompressed size cannot be determined: ZSTD_CONTENTSIZE_UNKNOWN * - if an error occurred: ZSTD_CONTENTSIZE_ERROR * * note 1 : decompressed size is an optional field, that may not be present, especially in streaming mode. * When return==ZSTD_CONTENTSIZE_UNKNOWN, data to decompress could be any size. * In which case, it's necessary to use streaming mode to decompress data. * Optionally, application can still use ZSTD_decompress() while relying on implied limits. * (For example, data may be necessarily cut into blocks <= 16 KB). * note 2 : decompressed size is always present when compression is done with ZSTD_compress() * note 3 : decompressed size can be very large (64-bits value), * potentially larger than what local system can handle as a single memory segment. * In which case, it's necessary to use streaming mode to decompress data. * note 4 : If source is untrusted, decompressed size could be wrong or intentionally modified. * Always ensure result fits within application's authorized limits. * Each application can set its own limits. * note 5 : ZSTD_findDecompressedSize handles multiple frames, and so it must traverse the input to * read each contained frame header. This is efficient as most of the data is skipped, * however it does mean that all frame data must be present and valid.

ZSTD_findFrameCompressedSize

ZSTD_findFrameCompressedSize() : * src should point to the start of a ZSTD encoded frame or skippable frame * srcSize must be at least as large as the frame * @return : the compressed size of the frame pointed to by src, suitable to pass to * ZSTD_decompress or similar, or an error code if given invalid input.

ZSTD_flushStream
ZSTD_freeCCtx
ZSTD_freeCDict

ZSTD_freeCDict() : * Function frees memory allocated by ZSTD_createCDict().

ZSTD_freeCStream
ZSTD_freeDCtx
ZSTD_freeDDict

ZSTD_freeDDict() : * Function frees memory allocated with ZSTD_createDDict()

ZSTD_freeDStream
ZSTD_getBlockSizeMax
ZSTD_getCParams

ZSTD_getCParams() : * @return ZSTD_compressionParameters structure for a selected compression level and estimated srcSize. * estimatedSrcSize value is optional, select 0 if not known

ZSTD_getDecompressedSize

ZSTD_getDecompressedSize() : * NOTE: This function is planned to be obsolete, in favour of ZSTD_getFrameContentSize. * ZSTD_getFrameContentSize functions the same way, returning the decompressed size of a single * frame, but distinguishes empty frames from frames with an unknown size, or errors. * * Additionally, ZSTD_findDecompressedSize can be used instead. It can handle multiple * concatenated frames in one buffer, and so is more general. * As a result however, it requires more computation and entire frames to be passed to it, * as opposed to ZSTD_getFrameContentSize which requires only a single frame's header. * * 'src' is the start of a zstd compressed frame. * @return : content size to be decompressed, as a 64-bits value if known, 0 otherwise. * note 1 : decompressed size is an optional field, that may not be present, especially in streaming mode. * When return==0, data to decompress could be any size. * In which case, it's necessary to use streaming mode to decompress data. * Optionally, application can still use ZSTD_decompress() while relying on implied limits. * (For example, data may be necessarily cut into blocks <= 16 KB). * note 2 : decompressed size is always present when compression is done with ZSTD_compress() * note 3 : decompressed size can be very large (64-bits value), * potentially larger than what local system can handle as a single memory segment. * In which case, it's necessary to use streaming mode to decompress data. * note 4 : If source is untrusted, decompressed size could be wrong or intentionally modified. * Always ensure result fits within application's authorized limits. * Each application can set its own limits. * note 5 : when return==0, if precise failure cause is needed, use ZSTD_getFrameParams() to know more.

ZSTD_getDictID_fromDDict

ZSTD_getDictID_fromDDict() : * Provides the dictID of the dictionary loaded into ddict. * If @return == 0, the dictionary is not conformant to Zstandard specification, or empty. * Non-conformant dictionaries can still be loaded, but as content-only dictionaries.

ZSTD_getDictID_fromDict

ZSTD_getDictID_fromDict() : * Provides the dictID stored within dictionary. * if @return == 0, the dictionary is not conformant with Zstandard specification. * It can still be loaded, but as a content-only dictionary.

ZSTD_getDictID_fromFrame

ZSTD_getDictID_fromFrame() : * Provides the dictID required to decompressed the frame stored within src. * If @return == 0, the dictID could not be decoded. * This could for one of the following reasons : * - The frame does not require a dictionary to be decoded (most common case). * - The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a hidden information. * Note : this use case also happens when using a non-conformant dictionary. * - srcSize is too small, and as a result, the frame header could not be decoded (only possible if srcSize < ZSTD_FRAMEHEADERSIZE_MAX). * - This is not a Zstandard frame. * When identifying the exact failure cause, it's possible to use ZSTD_getFrameParams(), which will provide a more precise error code.

ZSTD_getErrorName
ZSTD_getFrameContentSize

ZSTD_getFrameContentSize() : * src should point to the start of a ZSTD encoded frame * srcSize must be at least as large as the frame header. A value greater than or equal * to ZSTD_frameHeaderSize_max is guaranteed to be large enough in all cases. * @return : decompressed size of the frame pointed to be src if known, otherwise * - ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined * - ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small)

ZSTD_getFrameParams
ZSTD_getParams

ZSTD_getParams() : * same as ZSTD_getCParams(), but @return a full ZSTD_parameters object instead of sub-component ZSTD_compressionParameters. * All fields of ZSTD_frameParameters are set to default (0)

ZSTD_initCStream
ZSTD_initCStream_advanced
ZSTD_initCStream_srcSize
ZSTD_initCStream_usingCDict
ZSTD_initCStream_usingCDict_advanced
ZSTD_initCStream_usingDict
ZSTD_initDStream
ZSTD_initDStream_usingDDict
ZSTD_initDStream_usingDict
ZSTD_insertBlock
ZSTD_isError
ZSTD_isFrame

ZSTD_isFrame() : * Tells if the content of buffer starts with a valid Frame Identifier. * Note : Frame Identifier is 4 bytes. If size < 4, @return will always be 0. * Note 2 : Legacy Frame Identifiers are considered valid only if Legacy Support is enabled. * Note 3 : Skippable Frame Identifiers are considered valid.

ZSTD_maxCLevel
ZSTD_nextInputType
ZSTD_nextSrcSizeToDecompress
ZSTD_resetCStream

ZSTD_resetCStream() : * start a new compression job, using same parameters from previous job. * This is typically useful to skip dictionary loading stage, since it will re-use it in-place.. * Note that zcs must be init at least once before using ZSTD_resetCStream(). * pledgedSrcSize==0 means "srcSize unknown". * If pledgedSrcSize > 0, its value must be correct, as it will be written in header, and controlled at the end. * @return : 0, or an error code (which can be tested using ZSTD_isError())

ZSTD_resetDStream
ZSTD_setCCtxParameter

ZSTD_setCCtxParameter() : * Set advanced parameters, selected through enum ZSTD_CCtxParameter * @result : 0, or an error code (which can be tested with ZSTD_isError())

ZSTD_setDStreamParameter
ZSTD_sizeof_CCtx

ZSTD_sizeofCCtx() : * Gives the amount of memory used by a given ZSTD_CCtx

ZSTD_sizeof_CDict

ZSTD_sizeof_CDict() : * Gives the amount of memory used by a given ZSTD_sizeof_CDict

ZSTD_sizeof_CStream
ZSTD_sizeof_DCtx

ZSTD_sizeof_DCtx() : * Gives the amount of memory used by a given ZSTD_DCtx

ZSTD_sizeof_DDict

ZSTD_sizeof_DDict() : * Gives the amount of memory used by a given ZSTD_DDict

ZSTD_sizeof_DStream
ZSTD_versionNumber

Type Definitions

ZSTD_CCtx
ZSTD_CDict
ZSTD_CStream
ZSTD_DCtx
ZSTD_DDict
ZSTD_DStream
ZSTD_allocFunction
ZSTD_freeFunction
ZSTD_inBuffer
ZSTD_outBuffer
wchar_t