]> wimlib.net Git - wimlib/blob - include/wimlib/compressor_ops.h
32bc62c8fb668aa521f5ef080c16a0cbabdffd7b
[wimlib] / include / wimlib / compressor_ops.h
1 /*
2  * compressor_ops.h
3  *
4  * Interface implemented by compressors for specific formats.
5  */
6
7 #ifndef _WIMLIB_COMPRESSOR_OPS_H
8 #define _WIMLIB_COMPRESSOR_OPS_H
9
10 #include <wimlib/types.h>
11
12 struct wimlib_compressor_params_header;
13
14 struct compressor_ops {
15
16         bool (*params_valid)(const struct wimlib_compressor_params_header *params);
17
18         u64 (*get_needed_memory)(size_t max_block_size,
19                                  const struct wimlib_compressor_params_header *params);
20
21         int (*create_compressor)(size_t max_block_size,
22                                  const struct wimlib_compressor_params_header *params,
23                                  void **private_ret);
24
25         size_t (*compress)(const void *uncompressed_data,
26                            size_t uncompressed_size,
27                            void *compressed_data,
28                            size_t compressed_size_avail,
29                            void *private);
30
31         void (*free_compressor)(void *private);
32 };
33
34 extern const struct compressor_ops lzx_compressor_ops;
35 extern const struct compressor_ops xpress_compressor_ops;
36 extern const struct compressor_ops lzms_compressor_ops;
37
38 extern void
39 cleanup_compressor_params(void);
40
41 #endif /* _WIMLIB_COMPRESSOR_OPS_H */