Librepo library  1.17.2
C library for downloading linux repository metadata and packages
package_downloader.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, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef __LR_PACKAGE_DOWNLOADER_H__
22 #define __LR_PACKAGE_DOWNLOADER_H__
23 
24 #include <glib.h>
25 
26 #include <librepo/rcodes.h>
27 #include <librepo/handle.h>
28 #include <librepo/checksum.h>
29 
30 G_BEGIN_DECLS
31 
43 #define lr_download_simple(handle, relative_url, err) \
44  lr_download_package((handle), (relative_url), NULL, 0, \
45  NULL, 0, NULL, 0, (err))
46 
66 gboolean
68  const char *relative_url,
69  const char *dest,
70  LrChecksumType checksum_type,
71  const char *checksum,
72  gint64 expectedsize,
73  const char *base_url,
74  gboolean resume,
75  GError **err);
76 
78 typedef struct {
79 
83  char *relative_url;
86  char *dest;
89  char *base_url;
95  char *checksum;
98  gint64 expectedsize;
101  gboolean resume;
107  void *cbdata;
117  gint64 byterangestart;
120  gint64 byterangeend;
123  // Will be filled by ::lr_download_packages()
124 
125  char *local_path;
128  char *err;
131  GStringChunk *chunk;
135 
162  const char *relative_url,
163  const char *dest,
164  LrChecksumType checksum_type,
165  const char *checksum,
166  gint64 expectedsize,
167  const char *base_url,
168  gboolean resume,
169  LrProgressCb progresscb,
170  void *cbdata,
171  GError **err);
172 
204  const char *relative_url,
205  const char *dest,
206  LrChecksumType checksum_type,
207  const char *checksum,
208  gint64 expectedsize,
209  const char *base_url,
210  gboolean resume,
211  LrProgressCb progresscb,
212  void *cbdata,
213  LrEndCb endcb,
214  LrMirrorFailureCb mirrorfailurecb,
215  GError **err);
216 
233  const char *relative_url,
234  const char *dest,
235  LrChecksumType checksum_type,
236  const char *checksum,
237  gint64 expectedsize,
238  const char *base_url,
239  gboolean resume,
240  LrProgressCb progresscb,
241  void *cbdata,
242  LrEndCb endcb,
243  LrMirrorFailureCb mirrorfailurecb,
244  gint64 byterangestart,
245  gint64 byterangeend,
246  GError **err);
247 
251 void
253 
255 typedef enum {
265 
273 gboolean
274 lr_download_packages(GSList *targets,
275  LrPackageDownloadFlag flags,
276  GError **err);
277 
278 typedef enum {
289 
295 gboolean
296 lr_check_packages(GSList *targets,
297  LrPackageCheckFlag flags,
298  GError **err);
299 
302 G_END_DECLS
303 
304 #endif
LrChecksumType
Definition: checksum.h:36
LrPackageCheckFlag
int(* LrEndCb)(void *clientp, LrTransferStatus status, const char *msg)
Definition: types.h:144
void lr_packagetarget_free(LrPackageTarget *target)
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)
int(* LrMirrorFailureCb)(void *clientp, const char *msg, const char *url)
Definition: types.h:154
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)
GStringChunk * chunk
LrChecksumType checksum_type
gboolean lr_download_packages(GSList *targets, LrPackageDownloadFlag flags, GError **err)
gboolean lr_check_packages(GSList *targets, LrPackageCheckFlag flags, GError **err)
int(* LrProgressCb)(void *clientp, double total_to_download, double now_downloaded)
Definition: types.h:125
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)
LrProgressCb progresscb
LrPackageDownloadFlag
LrMirrorFailureCb mirrorfailurecb
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)
struct _LrHandle LrHandle
Definition: handle.h:39