]> wimlib.net Git - wimlib/blob - include/wimlib/compressor_ops.h
Revert "read_wim_lookup_table(): Make sure all resources get validated"
[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 compressor_ops {
13
14         bool (*params_valid)(const struct wimlib_compressor_params_header *params);
15
16         u64 (*get_needed_memory)(size_t max_block_size,
17                                  const struct wimlib_compressor_params_header *params);
18
19         int (*create_compressor)(size_t max_block_size,
20                                  const struct wimlib_compressor_params_header *params,
21                                  void **private_ret);
22
23         size_t (*compress)(const void *uncompressed_data,
24                            size_t uncompressed_size,
25                            void *compressed_data,
26                            size_t compressed_size_avail,
27                            void *private);
28
29         void (*free_compressor)(void *private);
30 };
31
32 extern const struct compressor_ops lzx_compressor_ops;
33 extern const struct compressor_ops xpress_compressor_ops;
34 extern const struct compressor_ops lzms_compressor_ops;
35
36 extern void
37 cleanup_compressor_params(void);
38
39 #endif /* _WIMLIB_COMPRESSOR_OPS_H */