mirror of
https://github.com/Sarsoo/csbindgen.git
synced 2024-12-23 06:56:27 +00:00
591 lines
65 KiB
C#
Vendored
591 lines
65 KiB
C#
Vendored
// <auto-generated>
|
|
// This code is generated by csbindgen.
|
|
// DON'T CHANGE THIS DIRECTLY.
|
|
// </auto-generated>
|
|
#pragma warning disable CS8500
|
|
#pragma warning disable CS8981
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
namespace CsBindgen
|
|
{
|
|
public static unsafe partial class LibLz4
|
|
{
|
|
#if UNITY_IOS && !UNITY_EDITOR
|
|
const string __DllName = "__Internal";
|
|
#else
|
|
const string __DllName = "csbindgen_tests";
|
|
#endif
|
|
|
|
|
|
public const uint LZ4_FREESTANDING = 0;
|
|
public const uint LZ4_VERSION_MAJOR = 1;
|
|
public const uint LZ4_VERSION_MINOR = 9;
|
|
public const uint LZ4_VERSION_RELEASE = 4;
|
|
public const uint LZ4_VERSION_NUMBER = 10904;
|
|
public const uint LZ4_MEMORY_USAGE_MIN = 10;
|
|
public const uint LZ4_MEMORY_USAGE_DEFAULT = 14;
|
|
public const uint LZ4_MEMORY_USAGE_MAX = 20;
|
|
public const uint LZ4_MEMORY_USAGE = 14;
|
|
public const uint LZ4_MAX_INPUT_SIZE = 2113929216;
|
|
public const uint LZ4_HASHLOG = 12;
|
|
public const uint LZ4_HASHTABLESIZE = 16384;
|
|
public const uint LZ4_HASH_SIZE_U32 = 4096;
|
|
public const uint _STDINT_H = 1;
|
|
public const uint _FEATURES_H = 1;
|
|
public const uint _DEFAULT_SOURCE = 1;
|
|
public const uint __GLIBC_USE_ISOC2X = 0;
|
|
public const uint __USE_ISOC11 = 1;
|
|
public const uint __USE_ISOC99 = 1;
|
|
public const uint __USE_ISOC95 = 1;
|
|
public const uint __USE_POSIX_IMPLICITLY = 1;
|
|
public const uint _POSIX_SOURCE = 1;
|
|
public const uint _POSIX_C_SOURCE = 200809;
|
|
public const uint __USE_POSIX = 1;
|
|
public const uint __USE_POSIX2 = 1;
|
|
public const uint __USE_POSIX199309 = 1;
|
|
public const uint __USE_POSIX199506 = 1;
|
|
public const uint __USE_XOPEN2K = 1;
|
|
public const uint __USE_XOPEN2K8 = 1;
|
|
public const uint _ATFILE_SOURCE = 1;
|
|
public const uint __WORDSIZE = 64;
|
|
public const uint __WORDSIZE_TIME64_COMPAT32 = 1;
|
|
public const uint __SYSCALL_WORDSIZE = 64;
|
|
public const uint __TIMESIZE = 64;
|
|
public const uint __USE_MISC = 1;
|
|
public const uint __USE_ATFILE = 1;
|
|
public const uint __USE_FORTIFY_LEVEL = 0;
|
|
public const uint __GLIBC_USE_DEPRECATED_GETS = 0;
|
|
public const uint __GLIBC_USE_DEPRECATED_SCANF = 0;
|
|
public const uint _STDC_PREDEF_H = 1;
|
|
public const uint __STDC_IEC_559__ = 1;
|
|
public const uint __STDC_IEC_60559_BFP__ = 201404;
|
|
public const uint __STDC_IEC_559_COMPLEX__ = 1;
|
|
public const uint __STDC_IEC_60559_COMPLEX__ = 201404;
|
|
public const uint __STDC_ISO_10646__ = 201706;
|
|
public const uint __GNU_LIBRARY__ = 6;
|
|
public const uint __GLIBC__ = 2;
|
|
public const uint __GLIBC_MINOR__ = 35;
|
|
public const uint _SYS_CDEFS_H = 1;
|
|
public const uint __glibc_c99_flexarr_available = 1;
|
|
public const uint __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI = 0;
|
|
public const uint __HAVE_GENERIC_SELECTION = 1;
|
|
public const uint __GLIBC_USE_LIB_EXT2 = 0;
|
|
public const uint __GLIBC_USE_IEC_60559_BFP_EXT = 0;
|
|
public const uint __GLIBC_USE_IEC_60559_BFP_EXT_C2X = 0;
|
|
public const uint __GLIBC_USE_IEC_60559_EXT = 0;
|
|
public const uint __GLIBC_USE_IEC_60559_FUNCS_EXT = 0;
|
|
public const uint __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X = 0;
|
|
public const uint __GLIBC_USE_IEC_60559_TYPES_EXT = 0;
|
|
public const uint _BITS_TYPES_H = 1;
|
|
public const uint _BITS_TYPESIZES_H = 1;
|
|
public const uint __OFF_T_MATCHES_OFF64_T = 1;
|
|
public const uint __INO_T_MATCHES_INO64_T = 1;
|
|
public const uint __RLIM_T_MATCHES_RLIM64_T = 1;
|
|
public const uint __STATFS_MATCHES_STATFS64 = 1;
|
|
public const uint __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 = 1;
|
|
public const uint __FD_SETSIZE = 1024;
|
|
public const uint _BITS_TIME64_H = 1;
|
|
public const uint _BITS_WCHAR_H = 1;
|
|
public const uint _BITS_STDINT_INTN_H = 1;
|
|
public const uint _BITS_STDINT_UINTN_H = 1;
|
|
public const uint INT8_MAX = 127;
|
|
public const uint INT16_MAX = 32767;
|
|
public const uint INT32_MAX = 2147483647;
|
|
public const uint UINT8_MAX = 255;
|
|
public const uint UINT16_MAX = 65535;
|
|
public const uint UINT32_MAX = 4294967295;
|
|
public const uint INT_LEAST8_MAX = 127;
|
|
public const uint INT_LEAST16_MAX = 32767;
|
|
public const uint INT_LEAST32_MAX = 2147483647;
|
|
public const uint UINT_LEAST8_MAX = 255;
|
|
public const uint UINT_LEAST16_MAX = 65535;
|
|
public const uint UINT_LEAST32_MAX = 4294967295;
|
|
public const uint INT_FAST8_MAX = 127;
|
|
public const ulong INT_FAST16_MAX = 9223372036854775807;
|
|
public const ulong INT_FAST32_MAX = 9223372036854775807;
|
|
public const uint UINT_FAST8_MAX = 255;
|
|
public const ulong INTPTR_MAX = 9223372036854775807;
|
|
public const ulong PTRDIFF_MAX = 9223372036854775807;
|
|
public const uint SIG_ATOMIC_MAX = 2147483647;
|
|
public const uint WINT_MIN = 0;
|
|
public const uint WINT_MAX = 4294967295;
|
|
public const uint LZ4_STREAM_MINSIZE = 16416;
|
|
public const uint LZ4_STREAMDECODE_MINSIZE = 32;
|
|
public const uint LZ4HC_CLEVEL_MIN = 3;
|
|
public const uint LZ4HC_CLEVEL_DEFAULT = 9;
|
|
public const uint LZ4HC_CLEVEL_OPT_MIN = 10;
|
|
public const uint LZ4HC_CLEVEL_MAX = 12;
|
|
public const uint LZ4HC_DICTIONARY_LOGSIZE = 16;
|
|
public const uint LZ4HC_MAXD = 65536;
|
|
public const uint LZ4HC_MAXD_MASK = 65535;
|
|
public const uint LZ4HC_HASH_LOG = 15;
|
|
public const uint LZ4HC_HASHTABLESIZE = 32768;
|
|
public const uint LZ4HC_HASH_MASK = 32767;
|
|
public const uint LZ4_STREAMHC_MINSIZE = 262200;
|
|
public const uint LZ4F_VERSION = 100;
|
|
public const uint LZ4F_HEADER_SIZE_MIN = 7;
|
|
public const uint LZ4F_HEADER_SIZE_MAX = 19;
|
|
public const uint LZ4F_BLOCK_HEADER_SIZE = 4;
|
|
public const uint LZ4F_BLOCK_CHECKSUM_SIZE = 4;
|
|
public const uint LZ4F_CONTENT_CHECKSUM_SIZE = 4;
|
|
public const uint LZ4F_MAGICNUMBER = 407708164;
|
|
public const uint LZ4F_MAGIC_SKIPPABLE_START = 407710288;
|
|
public const uint LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH = 5;
|
|
public const uint XXHASH_H_5627135585666179 = 1;
|
|
public const uint XXH_VERSION_MAJOR = 0;
|
|
public const uint XXH_VERSION_MINOR = 6;
|
|
public const uint XXH_VERSION_RELEASE = 5;
|
|
public const uint XXH_VERSION_NUMBER = 605;
|
|
public const uint LZ4F_blockSizeID_t_LZ4F_default = 0;
|
|
public const uint LZ4F_blockSizeID_t_LZ4F_max64KB = 4;
|
|
public const uint LZ4F_blockSizeID_t_LZ4F_max256KB = 5;
|
|
public const uint LZ4F_blockSizeID_t_LZ4F_max1MB = 6;
|
|
public const uint LZ4F_blockSizeID_t_LZ4F_max4MB = 7;
|
|
public const uint LZ4F_blockMode_t_LZ4F_blockLinked = 0;
|
|
public const uint LZ4F_blockMode_t_LZ4F_blockIndependent = 1;
|
|
public const uint LZ4F_contentChecksum_t_LZ4F_noContentChecksum = 0;
|
|
public const uint LZ4F_contentChecksum_t_LZ4F_contentChecksumEnabled = 1;
|
|
public const uint LZ4F_blockChecksum_t_LZ4F_noBlockChecksum = 0;
|
|
public const uint LZ4F_blockChecksum_t_LZ4F_blockChecksumEnabled = 1;
|
|
public const uint LZ4F_frameType_t_LZ4F_frame = 0;
|
|
public const uint LZ4F_frameType_t_LZ4F_skippableFrame = 1;
|
|
public const uint XXH_errorcode_XXH_OK = 0;
|
|
public const uint XXH_errorcode_XXH_ERROR = 1;
|
|
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_versionNumber", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_versionNumber();
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_versionString", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern byte* LZ4_versionString();
|
|
|
|
/// <summary>LZ4_compress_default() : Compresses 'srcSize' bytes from buffer 'src' into already allocated 'dst' buffer of size 'dstCapacity'. Compression is guaranteed to succeed if 'dstCapacity' >= LZ4_compressBound(srcSize). It also runs faster, so it's a recommended setting. If the function cannot compress 'src' into a more limited 'dst' budget, compression stops *immediately*, and the function result is zero. In which case, 'dst' content is undefined (invalid). srcSize : max supported value is LZ4_MAX_INPUT_SIZE. dstCapacity : size of buffer 'dst' (which must be already allocated) @return : the number of bytes written into buffer 'dst' (necessarily <= dstCapacity) or 0 if compression fails Note : This function is protected against buffer overflow scenarios (never writes outside 'dst' buffer, nor read outside 'source' buffer).</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_default", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_default(byte* src, byte* dst, int srcSize, int dstCapacity);
|
|
|
|
/// <summary>LZ4_decompress_safe() : @compressedSize : is the exact complete size of the compressed block. @dstCapacity : is the size of destination buffer (which must be already allocated), is an upper bound of decompressed size. @return : the number of bytes decompressed into destination buffer (necessarily <= dstCapacity) If destination buffer is not large enough, decoding will stop and output an error code (negative value). If the source stream is detected malformed, the function will stop decoding and return a negative result. Note 1 : This function is protected against malicious data packets : it will never writes outside 'dst' buffer, nor read outside 'source' buffer, even if the compressed block is maliciously modified to order the decoder to do these actions. In such case, the decoder stops immediately, and considers the compressed block malformed. Note 2 : compressedSize and dstCapacity must be provided to the function, the compressed block does not contain them. The implementation is free to send / store / derive this information in whichever way is most beneficial. If there is a need for a different format which bundles together both compressed data and its metadata, consider looking at lz4frame.h instead.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_decompress_safe", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_decompress_safe(byte* src, byte* dst, int compressedSize, int dstCapacity);
|
|
|
|
/// <summary>LZ4_compressBound() :Provides the maximum size that LZ4 compression may output in a \"worst case\" scenario (input data not compressible)This function is primarily useful for memory allocation purposes (destination buffer size).Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example).Note that LZ4_compress_default() compresses faster when dstCapacity is >= LZ4_compressBound(srcSize)inputSize : max supported value is LZ4_MAX_INPUT_SIZEreturn : maximum output size in a \"worst case\" scenarioor 0, if input size is incorrect (too large or negative)</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compressBound", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compressBound(int inputSize);
|
|
|
|
/// <summary>LZ4_compress_fast() :Same as LZ4_compress_default(), but allows selection of \"acceleration\" factor.The larger the acceleration value, the faster the algorithm, but also the lesser the compression.It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed.An acceleration value of \"1\" is the same as regular LZ4_compress_default()Values <= 0 will be replaced by LZ4_ACCELERATION_DEFAULT (currently == 1, see lz4.c).Values > LZ4_ACCELERATION_MAX will be replaced by LZ4_ACCELERATION_MAX (currently == 65537, see lz4.c).</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_fast", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_fast(byte* src, byte* dst, int srcSize, int dstCapacity, int acceleration);
|
|
|
|
/// <summary>LZ4_compress_fast_extState() : Same as LZ4_compress_fast(), using an externally allocated memory space for its state. Use LZ4_sizeofState() to know how much memory must be allocated, and allocate it on 8-bytes boundaries (using `malloc()` typically). Then, provide this buffer as `void* state` to compression function.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_sizeofState", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_sizeofState();
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_fast_extState", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_fast_extState(void* state, byte* src, byte* dst, int srcSize, int dstCapacity, int acceleration);
|
|
|
|
/// <summary>LZ4_compress_destSize() : Reverse the logic : compresses as much data as possible from 'src' buffer into already allocated buffer 'dst', of size >= 'targetDestSize'. This function either compresses the entire 'src' content into 'dst' if it's large enough, or fill 'dst' buffer completely with as much data as possible from 'src'. note: acceleration parameter is fixed to \"default\". *srcSizePtr : will be modified to indicate how many bytes where read from 'src' to fill 'dst'. New value is necessarily <= input value. @return : Nb bytes written into 'dst' (necessarily <= targetDestSize) or 0 if compression fails. Note : from v1.8.2 to v1.9.1, this function had a bug (fixed un v1.9.2+): the produced compressed content could, in specific circumstances, require to be decompressed into a destination buffer larger by at least 1 byte than the content to decompress. If an application uses `LZ4_compress_destSize()`, it's highly recommended to update liblz4 to v1.9.2 or better. If this can't be done or ensured, the receiving decompression function should provide a dstCapacity which is > decompressedSize, by at least 1 byte. See https://github.com/lz4/lz4/issues/859 for details</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_destSize", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_destSize(byte* src, byte* dst, int* srcSizePtr, int targetDstSize);
|
|
|
|
/// <summary>LZ4_decompress_safe_partial() : Decompress an LZ4 compressed block, of size 'srcSize' at position 'src', into destination buffer 'dst' of size 'dstCapacity'. Up to 'targetOutputSize' bytes will be decoded. The function stops decoding on reaching this objective. This can be useful to boost performance whenever only the beginning of a block is required. @return : the number of bytes decoded in `dst` (necessarily <= targetOutputSize) If source stream is detected malformed, function returns a negative result. Note 1 : @return can be < targetOutputSize, if compressed block contains less data. Note 2 : targetOutputSize must be <= dstCapacity Note 3 : this function effectively stops decoding on reaching targetOutputSize, so dstCapacity is kind of redundant. This is because in older versions of this function, decoding operation would still write complete sequences. Therefore, there was no guarantee that it would stop writing at exactly targetOutputSize, it could write more bytes, though only up to dstCapacity. Some \"margin\" used to be required for this operation to work properly. Thankfully, this is no longer necessary. The function nonetheless keeps the same signature, in an effort to preserve API compatibility. Note 4 : If srcSize is the exact size of the block, then targetOutputSize can be any value, including larger than the block's decompressed size. The function will, at most, generate block's decompressed size. Note 5 : If srcSize is _larger_ than block's compressed size, then targetOutputSize **MUST** be <= block's decompressed size. Otherwise, *silent corruption will occur*.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_decompress_safe_partial", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_decompress_safe_partial(byte* src, byte* dst, int srcSize, int targetOutputSize, int dstCapacity);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_createStream", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern LZ4_stream_u* LZ4_createStream();
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_freeStream", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_freeStream(LZ4_stream_u* streamPtr);
|
|
|
|
/// <summary>LZ4_resetStream_fast() : v1.9.0+ Use this to prepare an LZ4_stream_t for a new chain of dependent blocks (e.g., LZ4_compress_fast_continue()). An LZ4_stream_t must be initialized once before usage. This is automatically done when created by LZ4_createStream(). However, should the LZ4_stream_t be simply declared on stack (for example), it's necessary to initialize it first, using LZ4_initStream(). After init, start any new stream with LZ4_resetStream_fast(). A same LZ4_stream_t can be re-used multiple times consecutively and compress multiple streams, provided that it starts each new stream with LZ4_resetStream_fast(). LZ4_resetStream_fast() is much faster than LZ4_initStream(), but is not compatible with memory regions containing garbage data. Note: it's only useful to call LZ4_resetStream_fast() in the context of streaming compression. The *extState* functions perform their own resets. Invoking LZ4_resetStream_fast() before is redundant, and even counterproductive.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_resetStream_fast", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern void LZ4_resetStream_fast(LZ4_stream_u* streamPtr);
|
|
|
|
/// <summary>LZ4_loadDict() : Use this function to reference a static dictionary into LZ4_stream_t. The dictionary must remain available during compression. LZ4_loadDict() triggers a reset, so any previous data will be forgotten. The same dictionary will have to be loaded on decompression side for successful decoding. Dictionary are useful for better compression of small data (KB range). While LZ4 accept any input as dictionary, results are generally better when using Zstandard's Dictionary Builder. Loading a size of 0 is allowed, and is the same as reset. @return : loaded dictionary size, in bytes (necessarily <= 64 KB)</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_loadDict", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_loadDict(LZ4_stream_u* streamPtr, byte* dictionary, int dictSize);
|
|
|
|
/// <summary>LZ4_compress_fast_continue() : Compress 'src' content using data from previously compressed blocks, for better compression ratio. 'dst' buffer must be already allocated. If dstCapacity >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster. @return : size of compressed block or 0 if there is an error (typically, cannot fit into 'dst'). Note 1 : Each invocation to LZ4_compress_fast_continue() generates a new block. Each block has precise boundaries. Each block must be decompressed separately, calling LZ4_decompress_*() with relevant metadata. It's not possible to append blocks together and expect a single invocation of LZ4_decompress_*() to decompress them together. Note 2 : The previous 64KB of source data is __assumed__ to remain present, unmodified, at same address in memory ! Note 3 : When input is structured as a double-buffer, each buffer can have any size, including < 64 KB. Make sure that buffers are separated, by at least one byte. This construction ensures that each block only depends on previous block. Note 4 : If input buffer is a ring-buffer, it can have any size, including < 64 KB. Note 5 : After an error, the stream status is undefined (invalid), it can only be reset or freed.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_fast_continue", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_fast_continue(LZ4_stream_u* streamPtr, byte* src, byte* dst, int srcSize, int dstCapacity, int acceleration);
|
|
|
|
/// <summary>LZ4_saveDict() : If last 64KB data cannot be guaranteed to remain available at its current memory location, save it into a safer place (char* safeBuffer). This is schematically equivalent to a memcpy() followed by LZ4_loadDict(), but is much faster, because LZ4_saveDict() doesn't need to rebuild tables. @return : saved dictionary size in bytes (necessarily <= maxDictSize), or 0 if error.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_saveDict", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_saveDict(LZ4_stream_u* streamPtr, byte* safeBuffer, int maxDictSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_createStreamDecode", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern LZ4_streamDecode_u* LZ4_createStreamDecode();
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_freeStreamDecode", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_freeStreamDecode(LZ4_streamDecode_u* LZ4_stream);
|
|
|
|
/// <summary>LZ4_setStreamDecode() : An LZ4_streamDecode_t context can be allocated once and re-used multiple times. Use this function to start decompression of a new stream of blocks. A dictionary can optionally be set. Use NULL or size 0 for a reset order. Dictionary is presumed stable : it must remain accessible and unmodified during next decompression. @return : 1 if OK, 0 if error</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_setStreamDecode", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_setStreamDecode(LZ4_streamDecode_u* LZ4_streamDecode, byte* dictionary, int dictSize);
|
|
|
|
/// <summary>LZ4_decoderRingBufferSize() : v1.8.2+ Note : in a ring buffer scenario (optional), blocks are presumed decompressed next to each other up to the moment there is not enough remaining space for next block (remainingSize < maxBlockSize), at which stage it resumes from beginning of ring buffer. When setting such a ring buffer for streaming decompression, provides the minimum size of this ring buffer to be compatible with any source respecting maxBlockSize condition. @return : minimum ring buffer size, or 0 if there is an error (invalid maxBlockSize).</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_decoderRingBufferSize", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_decoderRingBufferSize(int maxBlockSize);
|
|
|
|
/// <summary>LZ4_decompress_safe_continue() : This decoding function allows decompression of consecutive blocks in \"streaming\" mode. The difference with the usual independent blocks is that new blocks are allowed to find references into former blocks. A block is an unsplittable entity, and must be presented entirely to the decompression function. LZ4_decompress_safe_continue() only accepts one block at a time. It's modeled after `LZ4_decompress_safe()` and behaves similarly. @LZ4_streamDecode : decompression state, tracking the position in memory of past data @compressedSize : exact complete size of one compressed block. @dstCapacity : size of destination buffer (which must be already allocated), must be an upper bound of decompressed size. @return : number of bytes decompressed into destination buffer (necessarily <= dstCapacity) If destination buffer is not large enough, decoding will stop and output an error code (negative value). If the source stream is detected malformed, the function will stop decoding and return a negative result. The last 64KB of previously decoded data *must* remain available and unmodified at the memory position where they were previously decoded. If less than 64KB of data has been decoded, all the data must be present. Special : if decompression side sets a ring buffer, it must respect one of the following conditions : - Decompression buffer size is _at least_ LZ4_decoderRingBufferSize(maxBlockSize). maxBlockSize is the maximum size of any single block. It can have any value > 16 bytes. In which case, encoding and decoding buffers do not need to be synchronized. Actually, data can be produced by any source compliant with LZ4 format specification, and respecting maxBlockSize. - Synchronized mode : Decompression buffer size is _exactly_ the same as compression buffer size, and follows exactly same update rule (block boundaries at same positions), and decoding function is provided with exact decompressed size of each block (exception for last block of the stream), _then_ decoding & encoding ring buffer can have any size, including small ones ( < 64 KB). - Decompression buffer is larger than encoding buffer, by a minimum of maxBlockSize more bytes. In which case, encoding and decoding buffers do not need to be synchronized, and encoding ring buffer can have any size, including small ones ( < 64 KB). Whenever these conditions are not possible, save the last 64KB of decoded data into a safe buffer where it can't be modified during decompression, then indicate where this data is saved using LZ4_setStreamDecode(), before decompressing next block.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_decompress_safe_continue", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_decompress_safe_continue(LZ4_streamDecode_u* LZ4_streamDecode, byte* src, byte* dst, int srcSize, int dstCapacity);
|
|
|
|
/// <summary>LZ4_decompress_safe_usingDict() : Works the same as a combination of LZ4_setStreamDecode() followed by LZ4_decompress_safe_continue() However, it's stateless: it doesn't need any LZ4_streamDecode_t state. Dictionary is presumed stable : it must remain accessible and unmodified during decompression. Performance tip : Decompression speed can be substantially increased when dst == dictStart + dictSize.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_decompress_safe_usingDict", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_decompress_safe_usingDict(byte* src, byte* dst, int srcSize, int dstCapacity, byte* dictStart, int dictSize);
|
|
|
|
/// <summary>LZ4_decompress_safe_partial_usingDict() : Behaves the same as LZ4_decompress_safe_partial() with the added ability to specify a memory segment for past data. Performance tip : Decompression speed can be substantially increased when dst == dictStart + dictSize.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_decompress_safe_partial_usingDict", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_decompress_safe_partial_usingDict(byte* src, byte* dst, int compressedSize, int targetOutputSize, int maxOutputSize, byte* dictStart, int dictSize);
|
|
|
|
/// <summary>LZ4_initStream() : v1.9.0+ An LZ4_stream_t structure must be initialized at least once. This is automatically done when invoking LZ4_createStream(), but it's not when the structure is simply declared on stack (for example). Use LZ4_initStream() to properly initialize a newly declared LZ4_stream_t. It can also initialize any arbitrary buffer of sufficient size, and will @return a pointer of proper type upon initialization. Note : initialization fails if size and alignment conditions are not respected. In which case, the function will @return NULL. Note2: An LZ4_stream_t structure guarantees correct alignment and size. Note3: Before v1.9.0, use LZ4_resetStream() instead</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_initStream", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern LZ4_stream_u* LZ4_initStream(void* buffer, nuint size);
|
|
|
|
/// <summary>Obsolete compression functions (since v1.7.3)</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress(byte* src, byte* dest, int srcSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_limitedOutput", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_limitedOutput(byte* src, byte* dest, int srcSize, int maxOutputSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_withState", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_withState(void* state, byte* source, byte* dest, int inputSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_limitedOutput_withState", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_limitedOutput_withState(void* state, byte* source, byte* dest, int inputSize, int maxOutputSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_continue", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_continue(LZ4_stream_u* LZ4_streamPtr, byte* source, byte* dest, int inputSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_limitedOutput_continue", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_limitedOutput_continue(LZ4_stream_u* LZ4_streamPtr, byte* source, byte* dest, int inputSize, int maxOutputSize);
|
|
|
|
/// <summary>Obsolete decompression functions (since v1.8.0)</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_uncompress", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_uncompress(byte* source, byte* dest, int outputSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_uncompress_unknownOutputSize", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_uncompress_unknownOutputSize(byte* source, byte* dest, int isize_, int maxOutputSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_create", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern void* LZ4_create(byte* inputBuffer);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_sizeofStreamState", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_sizeofStreamState();
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_resetStreamState", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_resetStreamState(void* state, byte* inputBuffer);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_slideInputBuffer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern byte* LZ4_slideInputBuffer(void* state);
|
|
|
|
/// <summary>Obsolete streaming decoding functions (since v1.7.0)</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_decompress_safe_withPrefix64k", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_decompress_safe_withPrefix64k(byte* src, byte* dst, int compressedSize, int maxDstSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_decompress_fast_withPrefix64k", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_decompress_fast_withPrefix64k(byte* src, byte* dst, int originalSize);
|
|
|
|
/// <summary>Obsolete LZ4_decompress_fast variants (since v1.9.0) : These functions used to be faster than LZ4_decompress_safe(), but this is no longer the case. They are now slower. This is because LZ4_decompress_fast() doesn't know the input size, and therefore must progress more cautiously into the input buffer to not read beyond the end of block. On top of that `LZ4_decompress_fast()` is not protected vs malformed or malicious inputs, making it a security liability. As a consequence, LZ4_decompress_fast() is strongly discouraged, and deprecated. The last remaining LZ4_decompress_fast() specificity is that it can decompress a block without knowing its compressed size. Such functionality can be achieved in a more secure manner by employing LZ4_decompress_safe_partial(). Parameters: originalSize : is the uncompressed size to regenerate. `dst` must be already allocated, its size must be >= 'originalSize' bytes. @return : number of bytes read from source buffer (== compressed size). The function expects to finish at block's end exactly. If the source stream is detected malformed, the function stops decoding and returns a negative result. note : LZ4_decompress_fast*() requires originalSize. Thanks to this information, it never writes past the output buffer. However, since it doesn't know its 'src' size, it may read an unknown amount of input, past input buffer bounds. Also, since match offsets are not validated, match reads from 'src' may underflow too. These issues never happen if input (compressed) data is correct. But they may happen if input data is invalid (error or intentional tampering). As a consequence, use these functions in trusted environments with trusted data **only**.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_decompress_fast", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_decompress_fast(byte* src, byte* dst, int originalSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_decompress_fast_continue", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_decompress_fast_continue(LZ4_streamDecode_u* LZ4_streamDecode, byte* src, byte* dst, int originalSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_decompress_fast_usingDict", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_decompress_fast_usingDict(byte* src, byte* dst, int originalSize, byte* dictStart, int dictSize);
|
|
|
|
/// <summary>LZ4_resetStream() : An LZ4_stream_t structure must be initialized at least once. This is done with LZ4_initStream(), or LZ4_resetStream(). Consider switching to LZ4_initStream(), invoking LZ4_resetStream() will trigger deprecation warnings in the future.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_resetStream", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern void LZ4_resetStream(LZ4_stream_u* streamPtr);
|
|
|
|
/// <summary>LZ4_compress_HC() : Compress data from `src` into `dst`, using the powerful but slower \"HC\" algorithm. `dst` must be already allocated. Compression is guaranteed to succeed if `dstCapacity >= LZ4_compressBound(srcSize)` (see \"lz4.h\") Max supported `srcSize` value is LZ4_MAX_INPUT_SIZE (see \"lz4.h\") `compressionLevel` : any value between 1 and LZ4HC_CLEVEL_MAX will work. Values > LZ4HC_CLEVEL_MAX behave the same as LZ4HC_CLEVEL_MAX. @return : the number of bytes written into 'dst' or 0 if compression fails.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_HC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_HC(byte* src, byte* dst, int srcSize, int dstCapacity, int compressionLevel);
|
|
|
|
/// <summary>LZ4_compress_HC_extStateHC() : Same as LZ4_compress_HC(), but using an externally allocated memory segment for `state`. `state` size is provided by LZ4_sizeofStateHC(). Memory segment must be aligned on 8-bytes boundaries (which a normal malloc() should do properly).</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_sizeofStateHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_sizeofStateHC();
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_HC_extStateHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_HC_extStateHC(void* stateHC, byte* src, byte* dst, int srcSize, int maxDstSize, int compressionLevel);
|
|
|
|
/// <summary>LZ4_compress_HC_destSize() : v1.9.0+ Will compress as much data as possible from `src` to fit into `targetDstSize` budget. Result is provided in 2 parts : @return : the number of bytes written into 'dst' (necessarily <= targetDstSize) or 0 if compression fails. `srcSizePtr` : on success, *srcSizePtr is updated to indicate how much bytes were read from `src`</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_HC_destSize", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_HC_destSize(void* stateHC, byte* src, byte* dst, int* srcSizePtr, int targetDstSize, int compressionLevel);
|
|
|
|
/// <summary>LZ4_createStreamHC() and LZ4_freeStreamHC() : These functions create and release memory for LZ4 HC streaming state. Newly created states are automatically initialized. A same state can be used multiple times consecutively, starting with LZ4_resetStreamHC_fast() to start a new stream of blocks.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_createStreamHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern LZ4_streamHC_u* LZ4_createStreamHC();
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_freeStreamHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_freeStreamHC(LZ4_streamHC_u* streamHCPtr);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_resetStreamHC_fast", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern void LZ4_resetStreamHC_fast(LZ4_streamHC_u* streamHCPtr, int compressionLevel);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_loadDictHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_loadDictHC(LZ4_streamHC_u* streamHCPtr, byte* dictionary, int dictSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_HC_continue", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_HC_continue(LZ4_streamHC_u* streamHCPtr, byte* src, byte* dst, int srcSize, int maxDstSize);
|
|
|
|
/// <summary>LZ4_compress_HC_continue_destSize() : v1.9.0+ Similar to LZ4_compress_HC_continue(), but will read as much data as possible from `src` to fit into `targetDstSize` budget. Result is provided into 2 parts : @return : the number of bytes written into 'dst' (necessarily <= targetDstSize) or 0 if compression fails. `srcSizePtr` : on success, *srcSizePtr will be updated to indicate how much bytes were read from `src`. Note that this function may not consume the entire input.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compress_HC_continue_destSize", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compress_HC_continue_destSize(LZ4_streamHC_u* LZ4_streamHCPtr, byte* src, byte* dst, int* srcSizePtr, int targetDstSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_saveDictHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_saveDictHC(LZ4_streamHC_u* streamHCPtr, byte* safeBuffer, int maxDictSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_initStreamHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern LZ4_streamHC_u* LZ4_initStreamHC(void* buffer, nuint size);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compressHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compressHC(byte* source, byte* dest, int inputSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compressHC_limitedOutput", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compressHC_limitedOutput(byte* source, byte* dest, int inputSize, int maxOutputSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compressHC2", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compressHC2(byte* source, byte* dest, int inputSize, int compressionLevel);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compressHC2_limitedOutput", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compressHC2_limitedOutput(byte* source, byte* dest, int inputSize, int maxOutputSize, int compressionLevel);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compressHC_withStateHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compressHC_withStateHC(void* state, byte* source, byte* dest, int inputSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compressHC_limitedOutput_withStateHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compressHC_limitedOutput_withStateHC(void* state, byte* source, byte* dest, int inputSize, int maxOutputSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compressHC2_withStateHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compressHC2_withStateHC(void* state, byte* source, byte* dest, int inputSize, int compressionLevel);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compressHC2_limitedOutput_withStateHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compressHC2_limitedOutput_withStateHC(void* state, byte* source, byte* dest, int inputSize, int maxOutputSize, int compressionLevel);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compressHC_continue", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compressHC_continue(LZ4_streamHC_u* LZ4_streamHCPtr, byte* source, byte* dest, int inputSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compressHC_limitedOutput_continue", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compressHC_limitedOutput_continue(LZ4_streamHC_u* LZ4_streamHCPtr, byte* source, byte* dest, int inputSize, int maxOutputSize);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_createHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern void* LZ4_createHC(byte* inputBuffer);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_freeHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_freeHC(void* LZ4HC_Data);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_slideInputBufferHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern byte* LZ4_slideInputBufferHC(void* LZ4HC_Data);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compressHC2_continue", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compressHC2_continue(void* LZ4HC_Data, byte* source, byte* dest, int inputSize, int compressionLevel);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_compressHC2_limitedOutput_continue", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_compressHC2_limitedOutput_continue(void* LZ4HC_Data, byte* source, byte* dest, int inputSize, int maxOutputSize, int compressionLevel);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_sizeofStreamStateHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_sizeofStreamStateHC();
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_resetStreamStateHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4_resetStreamStateHC(void* state, byte* inputBuffer);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4_resetStreamHC", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern void LZ4_resetStreamHC(LZ4_streamHC_u* streamHCPtr, int compressionLevel);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_isError", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern uint LZ4F_isError(nuint code);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_getErrorName", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern byte* LZ4F_getErrorName(nuint code);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_compressionLevel_max", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern int LZ4F_compressionLevel_max();
|
|
|
|
/// <summary>LZ4F_compressFrameBound() : Returns the maximum possible compressed size with LZ4F_compressFrame() given srcSize and preferences. `preferencesPtr` is optional. It can be replaced by NULL, in which case, the function will assume default preferences. Note : this result is only usable with LZ4F_compressFrame(). It may also be relevant to LZ4F_compressUpdate() _only if_ no flush() operation is ever performed.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_compressFrameBound", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern nuint LZ4F_compressFrameBound(nuint srcSize, LZ4F_preferences_t* preferencesPtr);
|
|
|
|
/// <summary>LZ4F_compressFrame() : Compress srcBuffer content into an LZ4-compressed frame. It's a one shot operation, all input content is consumed, and all output is generated. Note : it's a stateless operation (no LZ4F_cctx state needed). In order to reduce load on the allocator, LZ4F_compressFrame(), by default, uses the stack to allocate space for the compression state and some table. If this usage of the stack is too much for your application, consider compiling `lz4frame.c` with compile-time macro LZ4F_HEAPMODE set to 1 instead. All state allocations will use the Heap. It also means each invocation of LZ4F_compressFrame() will trigger several internal alloc/free invocations. @dstCapacity MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr). @preferencesPtr is optional : one can provide NULL, in which case all preferences are set to default. @return : number of bytes written into dstBuffer. or an error code if it fails (can be tested using LZ4F_isError())</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_compressFrame", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern nuint LZ4F_compressFrame(void* dstBuffer, nuint dstCapacity, void* srcBuffer, nuint srcSize, LZ4F_preferences_t* preferencesPtr);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_getVersion", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern uint LZ4F_getVersion();
|
|
|
|
/// <summary>LZ4F_createCompressionContext() : The first thing to do is to create a compressionContext object, which will keep track of operation state during streaming compression. This is achieved using LZ4F_createCompressionContext(), which takes as argument a version, and a pointer to LZ4F_cctx*, to write the resulting pointer into. @version provided MUST be LZ4F_VERSION. It is intended to track potential version mismatch, notably when using DLL. The function provides a pointer to a fully allocated LZ4F_cctx object. @cctxPtr MUST be != NULL. If @return != zero, context creation failed. A created compression context can be employed multiple times for consecutive streaming operations. Once all streaming compression jobs are completed, the state object can be released using LZ4F_freeCompressionContext(). Note1 : LZ4F_freeCompressionContext() is always successful. Its return value can be ignored. Note2 : LZ4F_freeCompressionContext() works fine with NULL input pointers (do nothing).</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_createCompressionContext", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern nuint LZ4F_createCompressionContext(LZ4F_cctx_s** cctxPtr, uint version);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_freeCompressionContext", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern nuint LZ4F_freeCompressionContext(LZ4F_cctx_s* cctx);
|
|
|
|
/// <summary>LZ4F_compressBegin() : will write the frame header into dstBuffer. dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes. `prefsPtr` is optional : NULL can be provided to set all preferences to default. @return : number of bytes written into dstBuffer for the header or an error code (which can be tested using LZ4F_isError())</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_compressBegin", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern nuint LZ4F_compressBegin(LZ4F_cctx_s* cctx, void* dstBuffer, nuint dstCapacity, LZ4F_preferences_t* prefsPtr);
|
|
|
|
/// <summary>LZ4F_compressBound() : Provides minimum dstCapacity required to guarantee success of LZ4F_compressUpdate(), given a srcSize and preferences, for a worst case scenario. When srcSize==0, LZ4F_compressBound() provides an upper bound for LZ4F_flush() and LZ4F_compressEnd() instead. Note that the result is only valid for a single invocation of LZ4F_compressUpdate(). When invoking LZ4F_compressUpdate() multiple times, if the output buffer is gradually filled up instead of emptied and re-used from its start, one must check if there is enough remaining capacity before each invocation, using LZ4F_compressBound(). @return is always the same for a srcSize and prefsPtr. prefsPtr is optional : when NULL is provided, preferences will be set to cover worst case scenario. tech details : @return if automatic flushing is not enabled, includes the possibility that internal buffer might already be filled by up to (blockSize-1) bytes. It also includes frame footer (ending + checksum), since it might be generated by LZ4F_compressEnd(). @return doesn't include frame header, as it was already generated by LZ4F_compressBegin().</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_compressBound", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern nuint LZ4F_compressBound(nuint srcSize, LZ4F_preferences_t* prefsPtr);
|
|
|
|
/// <summary>LZ4F_compressUpdate() : LZ4F_compressUpdate() can be called repetitively to compress as much data as necessary. Important rule: dstCapacity MUST be large enough to ensure operation success even in worst case situations. This value is provided by LZ4F_compressBound(). If this condition is not respected, LZ4F_compress() will fail (result is an errorCode). After an error, the state is left in a UB state, and must be re-initialized or freed. If previously an uncompressed block was written, buffered data is flushed before appending compressed data is continued. `cOptPtr` is optional : NULL can be provided, in which case all options are set to default. @return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered). or an error code if it fails (which can be tested using LZ4F_isError())</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_compressUpdate", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern nuint LZ4F_compressUpdate(LZ4F_cctx_s* cctx, void* dstBuffer, nuint dstCapacity, void* srcBuffer, nuint srcSize, LZ4F_compressOptions_t* cOptPtr);
|
|
|
|
/// <summary>LZ4F_flush() : When data must be generated and sent immediately, without waiting for a block to be completely filled, it's possible to call LZ4_flush(). It will immediately compress any data buffered within cctx. `dstCapacity` must be large enough to ensure the operation will be successful. `cOptPtr` is optional : it's possible to provide NULL, all options will be set to default. @return : nb of bytes written into dstBuffer (can be zero, when there is no data stored within cctx) or an error code if it fails (which can be tested using LZ4F_isError()) Note : LZ4F_flush() is guaranteed to be successful when dstCapacity >= LZ4F_compressBound(0, prefsPtr).</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_flush", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern nuint LZ4F_flush(LZ4F_cctx_s* cctx, void* dstBuffer, nuint dstCapacity, LZ4F_compressOptions_t* cOptPtr);
|
|
|
|
/// <summary>LZ4F_compressEnd() : To properly finish an LZ4 frame, invoke LZ4F_compressEnd(). It will flush whatever data remained within `cctx` (like LZ4_flush()) and properly finalize the frame, with an endMark and a checksum. `cOptPtr` is optional : NULL can be provided, in which case all options will be set to default. @return : nb of bytes written into dstBuffer, necessarily >= 4 (endMark), or an error code if it fails (which can be tested using LZ4F_isError()) Note : LZ4F_compressEnd() is guaranteed to be successful when dstCapacity >= LZ4F_compressBound(0, prefsPtr). A successful call to LZ4F_compressEnd() makes `cctx` available again for another compression task.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_compressEnd", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern nuint LZ4F_compressEnd(LZ4F_cctx_s* cctx, void* dstBuffer, nuint dstCapacity, LZ4F_compressOptions_t* cOptPtr);
|
|
|
|
/// <summary>LZ4F_createDecompressionContext() : Create an LZ4F_dctx object, to track all decompression operations. @version provided MUST be LZ4F_VERSION. @dctxPtr MUST be valid. The function fills @dctxPtr with the value of a pointer to an allocated and initialized LZ4F_dctx object. The @return is an errorCode, which can be tested using LZ4F_isError(). dctx memory can be released using LZ4F_freeDecompressionContext(); Result of LZ4F_freeDecompressionContext() indicates current state of decompressionContext when being released. That is, it should be == 0 if decompression has been completed fully and correctly.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_createDecompressionContext", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern nuint LZ4F_createDecompressionContext(LZ4F_dctx_s** dctxPtr, uint version);
|
|
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_freeDecompressionContext", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern nuint LZ4F_freeDecompressionContext(LZ4F_dctx_s* dctx);
|
|
|
|
/// <summary>LZ4F_headerSize() : v1.9.0+ Provide the header size of a frame starting at `src`. `srcSize` must be >= LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH, which is enough to decode the header length. @return : size of frame header or an error code, which can be tested using LZ4F_isError() note : Frame header size is variable, but is guaranteed to be >= LZ4F_HEADER_SIZE_MIN bytes, and <= LZ4F_HEADER_SIZE_MAX bytes.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_headerSize", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern nuint LZ4F_headerSize(void* src, nuint srcSize);
|
|
|
|
/// <summary>LZ4F_getFrameInfo() : This function extracts frame parameters (max blockSize, dictID, etc.). Its usage is optional: user can also invoke LZ4F_decompress() directly. Extracted information will fill an existing LZ4F_frameInfo_t structure. This can be useful for allocation and dictionary identification purposes. LZ4F_getFrameInfo() can work in the following situations : 1) At the beginning of a new frame, before any invocation of LZ4F_decompress(). It will decode header from `srcBuffer`, consuming the header and starting the decoding process. Input size must be large enough to contain the full frame header. Frame header size can be known beforehand by LZ4F_headerSize(). Frame header size is variable, but is guaranteed to be >= LZ4F_HEADER_SIZE_MIN bytes, and not more than <= LZ4F_HEADER_SIZE_MAX bytes. Hence, blindly providing LZ4F_HEADER_SIZE_MAX bytes or more will always work. It's allowed to provide more input data than the header size, LZ4F_getFrameInfo() will only consume the header. If input size is not large enough, aka if it's smaller than header size, function will fail and return an error code. 2) After decoding has been started, it's possible to invoke LZ4F_getFrameInfo() anytime to extract already decoded frame parameters stored within dctx. Note that, if decoding has barely started, and not yet read enough information to decode the header, LZ4F_getFrameInfo() will fail. The number of bytes consumed from srcBuffer will be updated in *srcSizePtr (necessarily <= original value). LZ4F_getFrameInfo() only consumes bytes when decoding has not yet started, and when decoding the header has been successful. Decompression must then resume from (srcBuffer + *srcSizePtr). @return : a hint about how many srcSize bytes LZ4F_decompress() expects for next call, or an error code which can be tested using LZ4F_isError(). note 1 : in case of error, dctx is not modified. Decoding operation can resume from beginning safely. note 2 : frame parameters are *copied into* an already allocated LZ4F_frameInfo_t structure.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_getFrameInfo", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern nuint LZ4F_getFrameInfo(LZ4F_dctx_s* dctx, LZ4F_frameInfo_t* frameInfoPtr, void* srcBuffer, nuint* srcSizePtr);
|
|
|
|
/// <summary>LZ4F_decompress() : Call this function repetitively to regenerate data compressed in `srcBuffer`. The function requires a valid dctx state. It will read up to *srcSizePtr bytes from srcBuffer, and decompress data into dstBuffer, of capacity *dstSizePtr. The nb of bytes consumed from srcBuffer will be written into *srcSizePtr (necessarily <= original value). The nb of bytes decompressed into dstBuffer will be written into *dstSizePtr (necessarily <= original value). The function does not necessarily read all input bytes, so always check value in *srcSizePtr. Unconsumed source data must be presented again in subsequent invocations. `dstBuffer` can freely change between each consecutive function invocation. `dstBuffer` content will be overwritten. Note: if `LZ4F_getFrameInfo()` is called before `LZ4F_decompress()`, srcBuffer must be updated to reflect the number of bytes consumed after reading the frame header. Failure to update srcBuffer before calling `LZ4F_decompress()` will cause decompression failure or, even worse, successful but incorrect decompression. See the `LZ4F_getFrameInfo()` docs for details. @return : an hint of how many `srcSize` bytes LZ4F_decompress() expects for next call. Schematically, it's the size of the current (or remaining) compressed block + header of next block. Respecting the hint provides some small speed benefit, because it skips intermediate buffers. This is just a hint though, it's always possible to provide any srcSize. When a frame is fully decoded, @return will be 0 (no more data expected). When provided with more bytes than necessary to decode a frame, LZ4F_decompress() will stop reading exactly at end of current frame, and @return 0. If decompression failed, @return is an error code, which can be tested using LZ4F_isError(). After a decompression error, the `dctx` context is not resumable. Use LZ4F_resetDecompressionContext() to return to clean state. After a frame is fully decoded, dctx can be used again to decompress another frame.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_decompress", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern nuint LZ4F_decompress(LZ4F_dctx_s* dctx, void* dstBuffer, nuint* dstSizePtr, void* srcBuffer, nuint* srcSizePtr, LZ4F_decompressOptions_t* dOptPtr);
|
|
|
|
/// <summary>LZ4F_resetDecompressionContext() : added in v1.8.0 In case of an error, the context is left in \"undefined\" state. In which case, it's necessary to reset it, before re-using it. This method can also be used to abruptly stop any unfinished decompression, and start a new one using same context resources.</summary>
|
|
[DllImport(__DllName, EntryPoint = "csbindgen_LZ4F_resetDecompressionContext", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
public static extern void LZ4F_resetDecompressionContext(LZ4F_dctx_s* dctx);
|
|
|
|
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public unsafe partial struct LZ4_stream_t_internal
|
|
{
|
|
public fixed uint hashTable[4096];
|
|
public byte* dictionary;
|
|
public LZ4_stream_t_internal* dictCtx;
|
|
public uint currentOffset;
|
|
public uint tableType;
|
|
public uint dictSize;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Explicit)]
|
|
public unsafe partial struct LZ4_stream_u
|
|
{
|
|
[FieldOffset(0)]
|
|
public fixed byte minStateSize[16416];
|
|
[FieldOffset(0)]
|
|
public LZ4_stream_t_internal internal_donotuse;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public unsafe partial struct LZ4_streamDecode_t_internal
|
|
{
|
|
public byte* externalDict;
|
|
public byte* prefixEnd;
|
|
public nuint extDictSize;
|
|
public nuint prefixSize;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Explicit)]
|
|
public unsafe partial struct LZ4_streamDecode_u
|
|
{
|
|
[FieldOffset(0)]
|
|
public fixed byte minStateSize[32];
|
|
[FieldOffset(0)]
|
|
public LZ4_streamDecode_t_internal internal_donotuse;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public unsafe partial struct LZ4HC_CCtx_internal
|
|
{
|
|
public fixed uint hashTable[32768];
|
|
public fixed ushort chainTable[65536];
|
|
public byte* end;
|
|
public byte* prefixStart;
|
|
public byte* dictStart;
|
|
public uint dictLimit;
|
|
public uint lowLimit;
|
|
public uint nextToUpdate;
|
|
public short compressionLevel;
|
|
public sbyte favorDecSpeed;
|
|
public sbyte dirty;
|
|
public LZ4HC_CCtx_internal* dictCtx;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Explicit)]
|
|
public unsafe partial struct LZ4_streamHC_u
|
|
{
|
|
[FieldOffset(0)]
|
|
public fixed byte minStateSize[262200];
|
|
[FieldOffset(0)]
|
|
public LZ4HC_CCtx_internal internal_donotuse;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public unsafe partial struct LZ4F_frameInfo_t
|
|
{
|
|
public uint blockSizeID;
|
|
public uint blockMode;
|
|
public uint contentChecksumFlag;
|
|
public uint frameType;
|
|
public ulong contentSize;
|
|
public uint dictID;
|
|
public uint blockChecksumFlag;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public unsafe partial struct LZ4F_preferences_t
|
|
{
|
|
public LZ4F_frameInfo_t frameInfo;
|
|
public int compressionLevel;
|
|
public uint autoFlush;
|
|
public uint favorDecSpeed;
|
|
public fixed uint reserved[3];
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public unsafe partial struct LZ4F_cctx_s
|
|
{
|
|
public fixed byte _unused[1];
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public unsafe partial struct LZ4F_compressOptions_t
|
|
{
|
|
public uint stableSrc;
|
|
public fixed uint reserved[3];
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public unsafe partial struct LZ4F_dctx_s
|
|
{
|
|
public fixed byte _unused[1];
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public unsafe partial struct LZ4F_decompressOptions_t
|
|
{
|
|
public uint stableDst;
|
|
public uint skipChecksums;
|
|
public uint reserved1;
|
|
public uint reserved0;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|