xref: /freebsd/contrib/xz/src/liblzma/lzma/lzma_decoder.h (revision ae12432049e7873ab3912643ae5d08297b8cbc49)
1 // SPDX-License-Identifier: 0BSD
2 
3 ///////////////////////////////////////////////////////////////////////////////
4 //
5 /// \file       lzma_decoder.h
6 /// \brief      LZMA decoder API
7 ///
8 //  Authors:    Igor Pavlov
9 //              Lasse Collin
10 //
11 ///////////////////////////////////////////////////////////////////////////////
12 
13 #ifndef LZMA_LZMA_DECODER_H
14 #define LZMA_LZMA_DECODER_H
15 
16 #include "common.h"
17 
18 
19 /// Allocates and initializes LZMA decoder
20 extern lzma_ret lzma_lzma_decoder_init(lzma_next_coder *next,
21 		const lzma_allocator *allocator,
22 		const lzma_filter_info *filters);
23 
24 extern uint64_t lzma_lzma_decoder_memusage(const void *options);
25 
26 /// Gets memory usage without validating lc/lp/pb. This is used by LZMA2
27 /// decoder, because raw LZMA2 decoding doesn't need lc/lp/pb. Also
28 /// alone_decoder.c and lzip_decoder.c use this because there lc/lp/pb
29 /// are known to be valid.
30 extern uint64_t lzma_lzma_decoder_memusage_nocheck(const void *options);
31 
32 extern lzma_ret lzma_lzma_props_decode(
33 		void **options, const lzma_allocator *allocator,
34 		const uint8_t *props, size_t props_size);
35 
36 
37 /// \brief      Decodes the LZMA Properties byte (lc/lp/pb)
38 ///
39 /// \return     true if error occurred, false on success
40 ///
41 extern bool lzma_lzma_lclppb_decode(
42 		lzma_options_lzma *options, uint8_t byte);
43 
44 
45 #ifdef LZMA_LZ_DECODER_H
46 /// Allocate and setup function pointers only. This is used by LZMA1 and
47 /// LZMA2 decoders.
48 extern lzma_ret lzma_lzma_decoder_create(
49 		lzma_lz_decoder *lz, const lzma_allocator *allocator,
50 		const lzma_options_lzma *opt, lzma_lz_options *lz_options);
51 #endif
52 
53 #endif
54