2 * libdpkg - Debian packaging suite library routines
3 * compress.h - compression support functions
5 * Copyright © 2004 Scott James Remnant <scott@netsplit.com>
6 * Copyright © 2006-2014 Guillem Jover <guillem@debian.org>
8 * This is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 #ifndef LIBDPKG_COMPRESS_H
23 #define LIBDPKG_COMPRESS_H
25 #include <dpkg/macros.h>
26 #include <dpkg/error.h>
33 * @defgroup compress Compression
34 * @ingroup dpkg-internal
38 enum compressor_type
{
39 COMPRESSOR_TYPE_UNKNOWN
= -1,
43 COMPRESSOR_TYPE_BZIP2
,
47 enum compressor_strategy
{
48 COMPRESSOR_STRATEGY_UNKNOWN
= -1,
49 COMPRESSOR_STRATEGY_NONE
,
50 COMPRESSOR_STRATEGY_FILTERED
,
51 COMPRESSOR_STRATEGY_HUFFMAN
,
52 COMPRESSOR_STRATEGY_RLE
,
53 COMPRESSOR_STRATEGY_FIXED
,
54 COMPRESSOR_STRATEGY_EXTREME
,
57 struct compress_params
{
58 enum compressor_type type
;
59 enum compressor_strategy strategy
;
63 enum compressor_type
compressor_find_by_name(const char *name
);
64 enum compressor_type
compressor_find_by_extension(const char *name
);
66 const char *compressor_get_name(enum compressor_type type
);
67 const char *compressor_get_extension(enum compressor_type type
);
69 enum compressor_strategy
compressor_get_strategy(const char *name
);
71 bool compressor_check_params(struct compress_params
*params
,
72 struct dpkg_error
*err
);
74 void decompress_filter(enum compressor_type type
, int fd_in
, int fd_out
,
75 const char *desc
, ...)
77 void compress_filter(struct compress_params
*params
, int fd_in
, int fd_out
,
78 const char *desc
, ...)
85 #endif /* LIBDPKG_COMPRESS_H */