Loading...
Searching...
No Matches
package_downloader.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_PACKAGE_DOWNLOADER_H__
#define __LR_PACKAGE_DOWNLOADER_H__
#include <glib.h>
#include <librepo/rcodes.h>
#include <librepo/handle.h>
#include <librepo/checksum.h>
G_BEGIN_DECLS
#define lr_download_simple(handle, relative_url, err) \
lr_download_package((handle), (relative_url), NULL, 0, \
NULL, 0, NULL, 0, (err))
gboolean
lr_download_package(LrHandle *handle,
const char *relative_url,
const char *dest,
LrChecksumType checksum_type,
const char *checksum,
gint64 expectedsize,
const char *base_url,
gboolean resume,
GError **err);
typedef struct {
LrHandle *handle;
char *relative_url;
char *dest;
char *base_url;
LrChecksumType checksum_type;
char *checksum;
gint64 expectedsize;
gboolean resume;
LrProgressCb progresscb;
void *cbdata;
LrEndCb endcb;
LrMirrorFailureCb mirrorfailurecb;
gint64 byterangestart;
gint64 byterangeend;
// Will be filled by ::lr_download_packages()
char *local_path;
char *err;
GStringChunk *chunk;
} LrPackageTarget;
LrPackageTarget *
lr_packagetarget_new(LrHandle *handle,
const char *relative_url,
const char *dest,
LrChecksumType checksum_type,
const char *checksum,
gint64 expectedsize,
const char *base_url,
gboolean resume,
LrProgressCb progresscb,
void *cbdata,
GError **err);
LrPackageTarget *
lr_packagetarget_new_v2(LrHandle *handle,
const char *relative_url,
const char *dest,
LrChecksumType checksum_type,
const char *checksum,
gint64 expectedsize,
const char *base_url,
gboolean resume,
LrProgressCb progresscb,
void *cbdata,
LrEndCb endcb,
LrMirrorFailureCb mirrorfailurecb,
GError **err);
LrPackageTarget *
lr_packagetarget_new_v3(LrHandle *handle,
const char *relative_url,
const char *dest,
LrChecksumType checksum_type,
const char *checksum,
gint64 expectedsize,
const char *base_url,
gboolean resume,
LrProgressCb progresscb,
void *cbdata,
LrEndCb endcb,
LrMirrorFailureCb mirrorfailurecb,
gint64 byterangestart,
gint64 byterangeend,
GError **err);
void
lr_packagetarget_free(LrPackageTarget *target);
typedef enum {
LR_PACKAGEDOWNLOAD_FAILFAST = 1 << 0,
} LrPackageDownloadFlag;
gboolean
lr_download_packages(GSList *targets,
LrPackageDownloadFlag flags,
GError **err);
typedef enum {
LR_PACKAGECHECK_FAILFAST = 1 << 0,
} LrPackageCheckFlag;
gboolean
lr_check_packages(GSList *targets,
LrPackageCheckFlag flags,
GError **err);
G_END_DECLS
#endif
LrChecksumType
LrChecksumType
Definition checksum.h:36
LrHandle
struct _LrHandle LrHandle
Definition handle.h:39
lr_check_packages
gboolean lr_check_packages(GSList *targets, LrPackageCheckFlag flags, GError **err)
LrPackageCheckFlag
LrPackageCheckFlag
Definition package_downloader.h:278
lr_packagetarget_free
void lr_packagetarget_free(LrPackageTarget *target)
lr_packagetarget_new
LrPackageTarget * lr_packagetarget_new(LrHandle *handle, const char *relative_url, const char *dest, LrChecksumType checksum_type, const char *checksum, gint64 expectedsize, const char *base_url, gboolean resume, LrProgressCb progresscb, void *cbdata, GError **err)
lr_packagetarget_new_v2
LrPackageTarget * lr_packagetarget_new_v2(LrHandle *handle, const char *relative_url, const char *dest, LrChecksumType checksum_type, const char *checksum, gint64 expectedsize, const char *base_url, gboolean resume, LrProgressCb progresscb, void *cbdata, LrEndCb endcb, LrMirrorFailureCb mirrorfailurecb, GError **err)
lr_download_packages
gboolean lr_download_packages(GSList *targets, LrPackageDownloadFlag flags, GError **err)
LrPackageDownloadFlag
LrPackageDownloadFlag
Definition package_downloader.h:255
lr_download_package
gboolean lr_download_package(LrHandle *handle, const char *relative_url, const char *dest, LrChecksumType checksum_type, const char *checksum, gint64 expectedsize, const char *base_url, gboolean resume, GError **err)
lr_packagetarget_new_v3
LrPackageTarget * lr_packagetarget_new_v3(LrHandle *handle, const char *relative_url, const char *dest, LrChecksumType checksum_type, const char *checksum, gint64 expectedsize, const char *base_url, gboolean resume, LrProgressCb progresscb, void *cbdata, LrEndCb endcb, LrMirrorFailureCb mirrorfailurecb, gint64 byterangestart, gint64 byterangeend, GError **err)
LR_PACKAGECHECK_FAILFAST
@ LR_PACKAGECHECK_FAILFAST
Definition package_downloader.h:279
LR_PACKAGEDOWNLOAD_FAILFAST
@ LR_PACKAGEDOWNLOAD_FAILFAST
Definition package_downloader.h:256
LrEndCb
int(* LrEndCb)(void *clientp, LrTransferStatus status, const char *msg)
Definition types.h:144
LrMirrorFailureCb
int(* LrMirrorFailureCb)(void *clientp, const char *msg, const char *url)
Definition types.h:154
LrProgressCb
int(* LrProgressCb)(void *clientp, double total_to_download, double now_downloaded)
Definition types.h:125
LrPackageTarget
Definition package_downloader.h:78
LrPackageTarget::relative_url
char * relative_url
Definition package_downloader.h:83
LrPackageTarget::base_url
char * base_url
Definition package_downloader.h:89
LrPackageTarget::dest
char * dest
Definition package_downloader.h:86
LrPackageTarget::resume
gboolean resume
Definition package_downloader.h:101
LrPackageTarget::handle
LrHandle * handle
Definition package_downloader.h:80
LrPackageTarget::checksum
char * checksum
Definition package_downloader.h:95
LrPackageTarget::chunk
GStringChunk * chunk
Definition package_downloader.h:131
LrPackageTarget::endcb
LrEndCb endcb
Definition package_downloader.h:110
LrPackageTarget::err
char * err
Definition package_downloader.h:128
LrPackageTarget::mirrorfailurecb
LrMirrorFailureCb mirrorfailurecb
Definition package_downloader.h:114
LrPackageTarget::local_path
char * local_path
Definition package_downloader.h:125
LrPackageTarget::expectedsize
gint64 expectedsize
Definition package_downloader.h:98
LrPackageTarget::byterangeend
gint64 byterangeend
Definition package_downloader.h:120
LrPackageTarget::checksum_type
LrChecksumType checksum_type
Definition package_downloader.h:92
LrPackageTarget::byterangestart
gint64 byterangestart
Definition package_downloader.h:117
LrPackageTarget::cbdata
void * cbdata
Definition package_downloader.h:107
LrPackageTarget::progresscb
LrProgressCb progresscb
Definition package_downloader.h:104