Librepo library 1.22.1
C library for downloading linux repository metadata and packages
Loading...
Searching...
No Matches
util.h
1/* librepo - A library providing (libcURL like) API to downloading repository
2 * Copyright (C) 2012 Tomas Mlcoch
3 *
4 * Licensed under the GNU Lesser General Public License Version 2.1
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef __LR_UTIL_H__
21#define __LR_UTIL_H__
22
23#include <glib.h>
24#include <stdlib.h>
25#include <stdarg.h>
26#include <curl/curl.h>
27
28#if 1
29#include <zck.h>
30#endif /* 1 */
31
32#include <librepo/checksum.h>
33#include <librepo/xmlparser.h>
34#include <librepo/downloadtarget.h>
35
36G_BEGIN_DECLS
37
42
49#define LR_CURL_VERSION_CHECK(major,minor,patch) \
50 (LIBCURL_VERSION_MAJOR > (major) || \
51 (LIBCURL_VERSION_MAJOR == (major) && LIBCURL_VERSION_MINOR > (minor)) || \
52 (LIBCURL_VERSION_MAJOR == (major) && LIBCURL_VERSION_MINOR == (minor) && \
53 LIBCURL_VERSION_PATCH >= (patch)))
54
59void lr_global_init(void);
60
64
68
73
78void *lr_malloc(size_t len);
79
84void *lr_malloc0(size_t len);
85
91void *lr_realloc(void *ptr, size_t len);
92
96void lr_free(void *mem);
97
102
106char *lr_gettmpdir(void);
107
114char *lr_pathconcat(const char *str, ...) G_GNUC_NULL_TERMINATED;
115
120int lr_remove_dir(const char *path);
121
127int lr_copy_content(int source, int dest);
128
135char *lr_prepend_url_protocol(const char *path);
136
143gchar *
144lr_string_chunk_insert(GStringChunk *chunk, const gchar *string);
145
149int
151 char *msg,
152 void *cbdata,
153 GError **err G_GNUC_UNUSED) G_GNUC_UNUSED;
154
155
164gboolean
165lr_best_checksum(GSList *list, LrChecksumType *type, gchar **value);
166
171gchar *
172lr_url_without_path(const char *url);
173
180gchar **
181lr_strv_dup(gchar **array);
182
183
191gboolean
192lr_is_local_path(const gchar *path);
193
202gboolean
203lr_key_file_save_to_file(GKeyFile *key_file,
204 const gchar *filename,
205 GError **error);
206
207#if 1
216lr_checksum_from_zck_hash(zck_hash zck_checksum_type);
217
225zck_hash
227
239zckCtx *
240lr_zck_init_read_base(const char *checksum, LrChecksumType checksum_type,
241 gint64 zck_header_size, int fd, GError **err);
242
253gboolean
254lr_zck_valid_header_base(const char *checksum, LrChecksumType checksum_type,
255 gint64 zck_header_size, int fd, GError **err);
256
265zckCtx *
266lr_zck_init_read(LrDownloadTarget *target, char *filename, int fd, GError **err);
267
276gboolean
277lr_zck_valid_header(LrDownloadTarget *target, char *filename, int fd, GError **err);
278
288#endif /* 1 */
289
290GSList *
291lr_get_recursive_files(char *path, char *extension, GError **err);
292
294
295G_END_DECLS
296
297#endif
LrChecksumType
Definition checksum.h:35
void * lr_malloc0(size_t len)
gchar * lr_string_chunk_insert(GStringChunk *chunk, const gchar *string)
void lr_global_init(void)
gboolean lr_key_file_save_to_file(GKeyFile *key_file, const gchar *filename, GError **error)
zckCtx * lr_zck_init_read(LrDownloadTarget *target, char *filename, int fd, GError **err)
void * lr_realloc(void *ptr, size_t len)
int lr_xml_parser_warning_logger(LrXmlParserWarningType type G_GNUC_UNUSED, char *msg, void *cbdata, GError **err G_GNUC_UNUSED) G_GNUC_UNUSED
void lr_out_of_memory(void)
gboolean lr_best_checksum(GSList *list, LrChecksumType *type, gchar **value)
gchar ** lr_strv_dup(gchar **array)
int lr_remove_dir(const char *path)
int lr_gettmpfile(void)
zck_hash lr_zck_hash_from_lr_checksum(LrChecksumType checksum_type)
GSList * lr_get_recursive_files(char *path, char *extension, GError **err)
gboolean lr_zck_valid_header(LrDownloadTarget *target, char *filename, int fd, GError **err)
char * lr_gettmpdir(void)
void lr_free(void *mem)
void * lr_malloc(size_t len)
gchar * lr_url_without_path(const char *url)
gboolean lr_is_local_path(const gchar *path)
void lr_log_librepo_summary(void)
gboolean lr_zck_valid_header_base(const char *checksum, LrChecksumType checksum_type, gint64 zck_header_size, int fd, GError **err)
char * lr_prepend_url_protocol(const char *path)
LrChecksumType lr_checksum_from_zck_hash(zck_hash zck_checksum_type)
int lr_copy_content(int source, int dest)
zckCtx * lr_zck_init_read_base(const char *checksum, LrChecksumType checksum_type, gint64 zck_header_size, int fd, GError **err)
char * lr_pathconcat(const char *str,...) G_GNUC_NULL_TERMINATED
LrXmlParserWarningType
Definition xmlparser.h:37