Loading...
Searching...
No Matches
util.h
/* librepo - A library providing (libcURL like) API to downloading repository
* Copyright (C) 2012 Tomas Mlcoch
*
* Licensed under the GNU Lesser General Public License Version 2.1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __LR_UTIL_H__
#define __LR_UTIL_H__
#include <glib.h>
#include <stdlib.h>
#include <stdarg.h>
#include <curl/curl.h>
#if 0
#include <zck.h>
#endif /* 0 */
#include <librepo/checksum.h>
#include <librepo/xmlparser.h>
#include <librepo/downloadtarget.h>
G_BEGIN_DECLS
#define LR_CURL_VERSION_CHECK(major,minor,patch) \
(LIBCURL_VERSION_MAJOR > (major) || \
(LIBCURL_VERSION_MAJOR == (major) && LIBCURL_VERSION_MINOR > (minor)) || \
(LIBCURL_VERSION_MAJOR == (major) && LIBCURL_VERSION_MINOR == (minor) && \
LIBCURL_VERSION_PATCH >= (patch)))
void lr_global_init(void);
void lr_log_librepo_summary(void);
void lr_out_of_memory(void);
void *lr_malloc(size_t len);
void *lr_malloc0(size_t len);
void *lr_realloc(void *ptr, size_t len);
void lr_free(void *mem);
int lr_gettmpfile(void);
char *lr_gettmpdir(void);
char *lr_pathconcat(const char *str, ...) G_GNUC_NULL_TERMINATED;
int lr_remove_dir(const char *path);
int lr_copy_content(int source, int dest);
char *lr_prepend_url_protocol(const char *path);
gchar *
lr_string_chunk_insert(GStringChunk *chunk, const gchar *string);
int
lr_xml_parser_warning_logger(LrXmlParserWarningType type G_GNUC_UNUSED,
char *msg,
void *cbdata,
GError **err G_GNUC_UNUSED) G_GNUC_UNUSED;
gboolean
lr_best_checksum(GSList *list, LrChecksumType *type, gchar **value);
gchar *
lr_url_without_path(const char *url);
gchar **
lr_strv_dup(gchar **array);
gboolean
lr_is_local_path(const gchar *path);
gboolean
lr_key_file_save_to_file(GKeyFile *key_file,
const gchar *filename,
GError **error);
#if 0
LrChecksumType
lr_checksum_from_zck_hash(zck_hash zck_checksum_type);
zck_hash
lr_zck_hash_from_lr_checksum(LrChecksumType checksum_type);
zckCtx *
lr_zck_init_read_base(const char *checksum, LrChecksumType checksum_type,
gint64 zck_header_size, int fd, GError **err);
gboolean
lr_zck_valid_header_base(const char *checksum, LrChecksumType checksum_type,
gint64 zck_header_size, int fd, GError **err);
zckCtx *
lr_zck_init_read(LrDownloadTarget *target, char *filename, int fd, GError **err);
gboolean
lr_zck_valid_header(LrDownloadTarget *target, char *filename, int fd, GError **err);
#endif /* 0 */
GSList *
lr_get_recursive_files(char *path, char *extension, GError **err);
G_END_DECLS
#endif
LrChecksumType
LrChecksumType
Definition checksum.h:36
lr_malloc0
void * lr_malloc0(size_t len)
lr_string_chunk_insert
gchar * lr_string_chunk_insert(GStringChunk *chunk, const gchar *string)
lr_global_init
void lr_global_init(void)
lr_key_file_save_to_file
gboolean lr_key_file_save_to_file(GKeyFile *key_file, const gchar *filename, GError **error)
lr_realloc
void * lr_realloc(void *ptr, size_t len)
lr_xml_parser_warning_logger
int lr_xml_parser_warning_logger(LrXmlParserWarningType type G_GNUC_UNUSED, char *msg, void *cbdata, GError **err G_GNUC_UNUSED) G_GNUC_UNUSED
lr_out_of_memory
void lr_out_of_memory(void)
lr_best_checksum
gboolean lr_best_checksum(GSList *list, LrChecksumType *type, gchar **value)
lr_strv_dup
gchar ** lr_strv_dup(gchar **array)
lr_remove_dir
int lr_remove_dir(const char *path)
lr_gettmpfile
int lr_gettmpfile(void)
lr_gettmpdir
char * lr_gettmpdir(void)
lr_free
void lr_free(void *mem)
lr_malloc
void * lr_malloc(size_t len)
lr_url_without_path
gchar * lr_url_without_path(const char *url)
lr_is_local_path
gboolean lr_is_local_path(const gchar *path)
lr_log_librepo_summary
void lr_log_librepo_summary(void)
lr_prepend_url_protocol
char * lr_prepend_url_protocol(const char *path)
lr_copy_content
int lr_copy_content(int source, int dest)
lr_pathconcat
char * lr_pathconcat(const char *str,...) G_GNUC_NULL_TERMINATED
LrXmlParserWarningType
LrXmlParserWarningType
Definition xmlparser.h:38