createrepo_c library 0.21.1
C library for metadata manipulation
Loading...
Searching...
No Matches
compression_wrapper.h
1/* createrepo_c - Library of routines for manipulation with repodata
2 * Copyright (C) 2012 Tomas Mlcoch
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17 * USA.
18 */
19
20#ifndef __C_CREATEREPOLIB_COMPRESSION_WRAPPER_H__
21#define __C_CREATEREPOLIB_COMPRESSION_WRAPPER_H__
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include <glib.h>
28#include "checksum.h"
29
37typedef enum {
47
50typedef enum {
55
58typedef struct {
59 gint64 size;
61 char *checksum;
62 gint64 hdr_size;
66
74
79void cr_contentstat_free(cr_ContentStat *cstat, GError **err);
80
83typedef struct {
85 void *FILE;
86 void *INNERFILE;
90} CR_FILE;
91
92#define CR_CW_ERR -1
99
105cr_CompressionType cr_detect_compression(const char* filename, GError **err);
106
112
120#define cr_open(FILENAME, MODE, COMTYPE, ERR) \
121 cr_sopen(FILENAME, MODE, COMTYPE, NULL, ERR)
122
133CR_FILE *cr_sopen(const char *filename,
134 cr_OpenMode mode,
135 cr_CompressionType comtype,
136 cr_ContentStat *stat,
137 GError **err);
138
146int cr_set_dict(CR_FILE *cr_file, const void *dict, unsigned int len, GError **err);
147
155int cr_read(CR_FILE *cr_file, void *buffer, unsigned int len, GError **err);
156
165int cr_write(CR_FILE *cr_file,
166 const void *buffer,
167 unsigned int len,
168 GError **err);
169
176int cr_puts(CR_FILE *cr_file, const char *str, GError **err);
177
183int cr_end_chunk(CR_FILE *cr_file, GError **err);
184
191int cr_set_autochunk(CR_FILE *cr_file, gboolean auto_chunk, GError **err);
192
200ssize_t cr_get_zchunk_with_index(CR_FILE *f, ssize_t zchunk_index, char **copy_buf, GError **err);
201
209int cr_printf(GError **err, CR_FILE *cr_file, const char *format, ...);
210
216int cr_close(CR_FILE *cr_file, GError **err);
217
220#ifdef __cplusplus
221}
222#endif
223
224#endif /* __C_CREATEREPOLIB_COMPRESSION_WRAPPER_H__ */
cr_ChecksumType
Definition: checksum.h:43
struct _cr_ChecksumCtx cr_ChecksumCtx
Definition: checksum.h:36
cr_CompressionType cr_compression_type(const char *name)
int cr_end_chunk(CR_FILE *cr_file, GError **err)
CR_FILE * cr_sopen(const char *filename, cr_OpenMode mode, cr_CompressionType comtype, cr_ContentStat *stat, GError **err)
cr_ContentStat * cr_contentstat_new(cr_ChecksumType type, GError **err)
int cr_set_autochunk(CR_FILE *cr_file, gboolean auto_chunk, GError **err)
ssize_t cr_get_zchunk_with_index(CR_FILE *f, ssize_t zchunk_index, char **copy_buf, GError **err)
int cr_read(CR_FILE *cr_file, void *buffer, unsigned int len, GError **err)
cr_CompressionType cr_detect_compression(const char *filename, GError **err)
int cr_write(CR_FILE *cr_file, const void *buffer, unsigned int len, GError **err)
void cr_contentstat_free(cr_ContentStat *cstat, GError **err)
int cr_set_dict(CR_FILE *cr_file, const void *dict, unsigned int len, GError **err)
cr_CompressionType
int cr_close(CR_FILE *cr_file, GError **err)
const char * cr_compression_suffix(cr_CompressionType comtype)
int cr_puts(CR_FILE *cr_file, const char *str, GError **err)
int cr_printf(GError **err, CR_FILE *cr_file, const char *format,...)
@ CR_CW_MODE_SENTINEL
@ CR_CW_MODE_READ
@ CR_CW_MODE_WRITE
@ CR_CW_ZCK_COMPRESSION
@ CR_CW_XZ_COMPRESSION
@ CR_CW_NO_COMPRESSION
@ CR_CW_COMPRESSION_SENTINEL
@ CR_CW_UNKNOWN_COMPRESSION
@ CR_CW_AUTO_DETECT_COMPRESSION
@ CR_CW_BZ2_COMPRESSION
@ CR_CW_GZ_COMPRESSION
cr_ContentStat * stat
cr_ChecksumCtx * checksum_ctx
cr_OpenMode mode
cr_CompressionType type
void * INNERFILE
cr_ChecksumType hdr_checksum_type
cr_ChecksumType checksum_type