createrepo_c library
1.2.3
C library for metadata manipulation
Toggle main menu visibility
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
24
extern
"C"
{
25
#endif
26
27
#include <glib.h>
28
#include "checksum.h"
29
34
37
typedef
enum
{
38
CR_CW_AUTO_DETECT_COMPRESSION
,
39
CR_CW_UNKNOWN_COMPRESSION
,
40
CR_CW_NO_COMPRESSION
,
41
CR_CW_GZ_COMPRESSION
,
42
CR_CW_BZ2_COMPRESSION
,
43
CR_CW_XZ_COMPRESSION
,
44
CR_CW_ZCK_COMPRESSION
,
45
CR_CW_ZSTD_COMPRESSION
,
46
CR_CW_COMPRESSION_SENTINEL
,
47
}
cr_CompressionType
;
48
51
typedef
enum
{
52
CR_CW_MODE_READ
,
53
CR_CW_MODE_WRITE
,
54
CR_CW_MODE_SENTINEL
,
55
}
cr_OpenMode
;
56
59
typedef
struct
{
60
gint64
size
;
61
cr_ChecksumType
checksum_type
;
62
char
*
checksum
;
63
gint64
hdr_size
;
64
cr_ChecksumType
hdr_checksum_type
;
65
char
*
hdr_checksum
;
66
}
cr_ContentStat
;
67
74
cr_ContentStat
*
cr_contentstat_new
(
cr_ChecksumType
type, GError **err);
75
80
void
cr_contentstat_free
(
cr_ContentStat
*cstat, GError **err);
81
84
typedef
struct
{
85
cr_CompressionType
type
;
86
void
*
FILE
;
87
void
*
INNERFILE
;
88
cr_OpenMode
mode
;
89
cr_ContentStat
*
stat
;
90
cr_ChecksumCtx
*
checksum_ctx
;
91
}
CR_FILE
;
92
93
#define CR_CW_ERR -1
94
99
const
char
*
cr_compression_suffix
(
cr_CompressionType
comtype);
100
106
cr_CompressionType
cr_detect_compression
(
const
char
* filename, GError **err);
107
112
cr_CompressionType
cr_compression_type
(
const
char
*name);
113
121
#define cr_open(FILENAME, MODE, COMTYPE, ERR) \
122
cr_sopen(FILENAME, MODE, COMTYPE, NULL, ERR)
123
134
CR_FILE
*
cr_sopen
(
const
char
*filename,
135
cr_OpenMode
mode,
136
cr_CompressionType
comtype,
137
cr_ContentStat
*stat,
138
GError **err);
139
147
int
cr_set_dict
(
CR_FILE
*cr_file,
const
void
*dict,
unsigned
int
len, GError **err);
148
156
int
cr_read
(
CR_FILE
*cr_file,
void
*buffer,
unsigned
int
len, GError **err);
157
166
int
cr_write
(
CR_FILE
*cr_file,
167
const
void
*buffer,
168
unsigned
int
len,
169
GError **err);
170
177
int
cr_puts
(
CR_FILE
*cr_file,
const
char
*str, GError **err);
178
184
int
cr_end_chunk
(
CR_FILE
*cr_file, GError **err);
185
192
int
cr_set_autochunk
(
CR_FILE
*cr_file, gboolean auto_chunk, GError **err);
193
201
ssize_t
cr_get_zchunk_with_index
(
CR_FILE
*f, ssize_t zchunk_index,
char
**copy_buf, GError **err);
202
210
int
cr_printf
(GError **err,
CR_FILE
*cr_file,
const
char
*format, ...);
211
217
int
cr_close
(
CR_FILE
*cr_file, GError **err);
218
220
221
#ifdef __cplusplus
222
}
223
#endif
224
225
#endif
/* __C_CREATEREPOLIB_COMPRESSION_WRAPPER_H__ */
cr_ChecksumType
cr_ChecksumType
Definition
checksum.h:43
cr_ChecksumCtx
struct _cr_ChecksumCtx cr_ChecksumCtx
Definition
checksum.h:36
cr_compression_type
cr_CompressionType cr_compression_type(const char *name)
cr_end_chunk
int cr_end_chunk(CR_FILE *cr_file, GError **err)
cr_sopen
CR_FILE * cr_sopen(const char *filename, cr_OpenMode mode, cr_CompressionType comtype, cr_ContentStat *stat, GError **err)
cr_contentstat_new
cr_ContentStat * cr_contentstat_new(cr_ChecksumType type, GError **err)
cr_set_autochunk
int cr_set_autochunk(CR_FILE *cr_file, gboolean auto_chunk, GError **err)
cr_OpenMode
cr_OpenMode
Definition
compression_wrapper.h:51
cr_get_zchunk_with_index
ssize_t cr_get_zchunk_with_index(CR_FILE *f, ssize_t zchunk_index, char **copy_buf, GError **err)
cr_read
int cr_read(CR_FILE *cr_file, void *buffer, unsigned int len, GError **err)
cr_detect_compression
cr_CompressionType cr_detect_compression(const char *filename, GError **err)
cr_write
int cr_write(CR_FILE *cr_file, const void *buffer, unsigned int len, GError **err)
cr_contentstat_free
void cr_contentstat_free(cr_ContentStat *cstat, GError **err)
cr_set_dict
int cr_set_dict(CR_FILE *cr_file, const void *dict, unsigned int len, GError **err)
cr_CompressionType
cr_CompressionType
Definition
compression_wrapper.h:37
cr_close
int cr_close(CR_FILE *cr_file, GError **err)
cr_compression_suffix
const char * cr_compression_suffix(cr_CompressionType comtype)
cr_puts
int cr_puts(CR_FILE *cr_file, const char *str, GError **err)
cr_printf
int cr_printf(GError **err, CR_FILE *cr_file, const char *format,...)
CR_CW_MODE_SENTINEL
@ CR_CW_MODE_SENTINEL
Definition
compression_wrapper.h:54
CR_CW_MODE_READ
@ CR_CW_MODE_READ
Definition
compression_wrapper.h:52
CR_CW_MODE_WRITE
@ CR_CW_MODE_WRITE
Definition
compression_wrapper.h:53
CR_CW_ZCK_COMPRESSION
@ CR_CW_ZCK_COMPRESSION
Definition
compression_wrapper.h:44
CR_CW_XZ_COMPRESSION
@ CR_CW_XZ_COMPRESSION
Definition
compression_wrapper.h:43
CR_CW_NO_COMPRESSION
@ CR_CW_NO_COMPRESSION
Definition
compression_wrapper.h:40
CR_CW_COMPRESSION_SENTINEL
@ CR_CW_COMPRESSION_SENTINEL
Definition
compression_wrapper.h:46
CR_CW_UNKNOWN_COMPRESSION
@ CR_CW_UNKNOWN_COMPRESSION
Definition
compression_wrapper.h:39
CR_CW_AUTO_DETECT_COMPRESSION
@ CR_CW_AUTO_DETECT_COMPRESSION
Definition
compression_wrapper.h:38
CR_CW_BZ2_COMPRESSION
@ CR_CW_BZ2_COMPRESSION
Definition
compression_wrapper.h:42
CR_CW_ZSTD_COMPRESSION
@ CR_CW_ZSTD_COMPRESSION
Definition
compression_wrapper.h:45
CR_CW_GZ_COMPRESSION
@ CR_CW_GZ_COMPRESSION
Definition
compression_wrapper.h:41
CR_FILE
Definition
compression_wrapper.h:84
CR_FILE::stat
cr_ContentStat * stat
Definition
compression_wrapper.h:89
CR_FILE::FILE
void * FILE
Definition
compression_wrapper.h:86
CR_FILE::checksum_ctx
cr_ChecksumCtx * checksum_ctx
Definition
compression_wrapper.h:90
CR_FILE::mode
cr_OpenMode mode
Definition
compression_wrapper.h:88
CR_FILE::type
cr_CompressionType type
Definition
compression_wrapper.h:85
CR_FILE::INNERFILE
void * INNERFILE
Definition
compression_wrapper.h:87
cr_ContentStat
Definition
compression_wrapper.h:59
cr_ContentStat::size
gint64 size
Definition
compression_wrapper.h:60
cr_ContentStat::hdr_checksum_type
cr_ChecksumType hdr_checksum_type
Definition
compression_wrapper.h:64
cr_ContentStat::checksum_type
cr_ChecksumType checksum_type
Definition
compression_wrapper.h:61
cr_ContentStat::hdr_size
gint64 hdr_size
Definition
compression_wrapper.h:63
cr_ContentStat::checksum
char * checksum
Definition
compression_wrapper.h:62
cr_ContentStat::hdr_checksum
char * hdr_checksum
Definition
compression_wrapper.h:65
src
compression_wrapper.h
Generated by
1.17.0