blob: dcdabdb25513dc8cfe2b8bdee1e64d30d03393fb [file] [log] [blame]
Yann Collet439eb772015-01-31 10:52:59 +01001/*
2 zstd - standard compression library
3 Header File for static linking only
4 Copyright (C) 2014-2015, Yann Collet.
5
6 BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
7
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are
10 met:
11 * Redistributions of source code must retain the above copyright
12 notice, this list of conditions and the following disclaimer.
13 * Redistributions in binary form must reproduce the above
14 copyright notice, this list of conditions and the following disclaimer
15 in the documentation and/or other materials provided with the
16 distribution.
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 You can contact the author at :
30 - zstd source repository : https://github.com/Cyan4973/zstd
31 - ztsd public forum : https://groups.google.com/forum/#!forum/lz4c
32*/
33#pragma once
34
Yann Collet59aac5f2015-10-14 16:28:19 +010035/* The objects defined into this file should be considered experimental.
36 * They are not labelled stable, as their prototype may change in the future.
37 * You can use them for tests, provide feedback, or if you can endure risk of future changes.
38 */
39
Yann Collet439eb772015-01-31 10:52:59 +010040#if defined (__cplusplus)
41extern "C" {
42#endif
43
Yann Collet353c5d22015-10-21 14:39:26 +010044/* *************************************
Yann Collet439eb772015-01-31 10:52:59 +010045* Includes
Yann Collet353c5d22015-10-21 14:39:26 +010046***************************************/
Yann Collet439eb772015-01-31 10:52:59 +010047#include "zstd.h"
48
49
Yann Collet353c5d22015-10-21 14:39:26 +010050/* *************************************
Yann Collet439eb772015-01-31 10:52:59 +010051* Streaming functions
Yann Collet353c5d22015-10-21 14:39:26 +010052***************************************/
53size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, void* dst, size_t maxDstSize);
54size_t ZSTD_compressContinue(ZSTD_CCtx* cctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize);
55size_t ZSTD_compressEnd(ZSTD_CCtx* cctx, void* dst, size_t maxDstSize);
Yann Collet439eb772015-01-31 10:52:59 +010056
Yann Collet439eb772015-01-31 10:52:59 +010057
Yann Collet353c5d22015-10-21 14:39:26 +010058typedef struct ZSTD_DCtx_s ZSTD_DCtx;
59ZSTD_DCtx* ZSTD_createDCtx(void);
60size_t ZSTD_resetDCtx(ZSTD_DCtx* dctx);
61size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx);
Yann Collet7393c5a2015-07-04 18:20:42 -080062
Yann Collet353c5d22015-10-21 14:39:26 +010063size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx* dctx);
64size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize);
Yann Collet00be3432015-02-20 18:53:31 +010065/*
66 Use above functions alternatively.
Yann Collet59aac5f2015-10-14 16:28:19 +010067 ZSTD_nextSrcSizeToDecompress() tells how much bytes to provide as 'srcSize' to ZSTD_decompressContinue().
Yann Colletb1f3f4b2015-10-18 22:18:32 +010068 ZSTD_decompressContinue() will use previous data blocks to improve compression if they are located prior to current block.
Yann Collet59aac5f2015-10-14 16:28:19 +010069 Result is the number of bytes regenerated within 'dst'.
Yann Collet00be3432015-02-20 18:53:31 +010070 It can be zero, which is not an error; it just means ZSTD_decompressContinue() has decoded some header.
71*/
Yann Collet439eb772015-01-31 10:52:59 +010072
Yann Collet353c5d22015-10-21 14:39:26 +010073/* *************************************
Yann Colletb1f3f4b2015-10-18 22:18:32 +010074* Prefix - version detection
Yann Collet353c5d22015-10-21 14:39:26 +010075***************************************/
Yann Colletb1f3f4b2015-10-18 22:18:32 +010076#define ZSTD_magicNumber 0xFD2FB522 /* v0.2 (current)*/
77
78
Yann Collet353c5d22015-10-21 14:39:26 +010079/* *************************************
Yann Collet439eb772015-01-31 10:52:59 +010080* Error management
Yann Collet353c5d22015-10-21 14:39:26 +010081***************************************/
Yann Colletb1f3f4b2015-10-18 22:18:32 +010082#include "error.h"
Yann Collet439eb772015-01-31 10:52:59 +010083
84
85#if defined (__cplusplus)
86}
Yann Colletc5d46b52015-02-16 18:06:26 +010087#endif