| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 1 | /* |
| 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 | */ |
| Yann Collet | aa07405 | 2015-10-30 11:21:50 +0100 | [diff] [blame^] | 33 | #ifndef ZSTD_STATIC_H |
| 34 | #define ZSTD_STATIC_H |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 35 | |
| Yann Collet | 59aac5f | 2015-10-14 16:28:19 +0100 | [diff] [blame] | 36 | /* The objects defined into this file should be considered experimental. |
| 37 | * They are not labelled stable, as their prototype may change in the future. |
| 38 | * You can use them for tests, provide feedback, or if you can endure risk of future changes. |
| 39 | */ |
| 40 | |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 41 | #if defined (__cplusplus) |
| 42 | extern "C" { |
| 43 | #endif |
| 44 | |
| Yann Collet | 353c5d2 | 2015-10-21 14:39:26 +0100 | [diff] [blame] | 45 | /* ************************************* |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 46 | * Includes |
| Yann Collet | 353c5d2 | 2015-10-21 14:39:26 +0100 | [diff] [blame] | 47 | ***************************************/ |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 48 | #include "zstd.h" |
| 49 | |
| 50 | |
| Yann Collet | 353c5d2 | 2015-10-21 14:39:26 +0100 | [diff] [blame] | 51 | /* ************************************* |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 52 | * Streaming functions |
| Yann Collet | 353c5d2 | 2015-10-21 14:39:26 +0100 | [diff] [blame] | 53 | ***************************************/ |
| 54 | size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, void* dst, size_t maxDstSize); |
| 55 | size_t ZSTD_compressContinue(ZSTD_CCtx* cctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize); |
| 56 | size_t ZSTD_compressEnd(ZSTD_CCtx* cctx, void* dst, size_t maxDstSize); |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 57 | |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 58 | |
| Yann Collet | 353c5d2 | 2015-10-21 14:39:26 +0100 | [diff] [blame] | 59 | typedef struct ZSTD_DCtx_s ZSTD_DCtx; |
| 60 | ZSTD_DCtx* ZSTD_createDCtx(void); |
| 61 | size_t ZSTD_resetDCtx(ZSTD_DCtx* dctx); |
| 62 | size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx); |
| Yann Collet | 7393c5a | 2015-07-04 18:20:42 -0800 | [diff] [blame] | 63 | |
| Yann Collet | 353c5d2 | 2015-10-21 14:39:26 +0100 | [diff] [blame] | 64 | size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx* dctx); |
| 65 | size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize); |
| Yann Collet | 00be343 | 2015-02-20 18:53:31 +0100 | [diff] [blame] | 66 | /* |
| 67 | Use above functions alternatively. |
| Yann Collet | 59aac5f | 2015-10-14 16:28:19 +0100 | [diff] [blame] | 68 | ZSTD_nextSrcSizeToDecompress() tells how much bytes to provide as 'srcSize' to ZSTD_decompressContinue(). |
| Yann Collet | b1f3f4b | 2015-10-18 22:18:32 +0100 | [diff] [blame] | 69 | ZSTD_decompressContinue() will use previous data blocks to improve compression if they are located prior to current block. |
| Yann Collet | 59aac5f | 2015-10-14 16:28:19 +0100 | [diff] [blame] | 70 | Result is the number of bytes regenerated within 'dst'. |
| Yann Collet | 00be343 | 2015-02-20 18:53:31 +0100 | [diff] [blame] | 71 | It can be zero, which is not an error; it just means ZSTD_decompressContinue() has decoded some header. |
| 72 | */ |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 73 | |
| Yann Collet | 353c5d2 | 2015-10-21 14:39:26 +0100 | [diff] [blame] | 74 | /* ************************************* |
| Yann Collet | b1f3f4b | 2015-10-18 22:18:32 +0100 | [diff] [blame] | 75 | * Prefix - version detection |
| Yann Collet | 353c5d2 | 2015-10-21 14:39:26 +0100 | [diff] [blame] | 76 | ***************************************/ |
| Yann Collet | 083fcc8 | 2015-10-25 14:06:35 +0100 | [diff] [blame] | 77 | #define ZSTD_magicNumber 0xFD2FB523 /* v0.3 (current)*/ |
| Yann Collet | b1f3f4b | 2015-10-18 22:18:32 +0100 | [diff] [blame] | 78 | |
| 79 | |
| Yann Collet | 353c5d2 | 2015-10-21 14:39:26 +0100 | [diff] [blame] | 80 | /* ************************************* |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 81 | * Error management |
| Yann Collet | 353c5d2 | 2015-10-21 14:39:26 +0100 | [diff] [blame] | 82 | ***************************************/ |
| Yann Collet | b1f3f4b | 2015-10-18 22:18:32 +0100 | [diff] [blame] | 83 | #include "error.h" |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 84 | |
| 85 | |
| 86 | #if defined (__cplusplus) |
| 87 | } |
| Yann Collet | c5d46b5 | 2015-02-16 18:06:26 +0100 | [diff] [blame] | 88 | #endif |
| Yann Collet | aa07405 | 2015-10-30 11:21:50 +0100 | [diff] [blame^] | 89 | |
| 90 | #endif /* ZSTD_STATIC_H */ |