Librepo library  1.7.13
C library for downloading linux repository metadata and packages
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules
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 "rcodes.h"
27 #include "handle.h"
28 #include "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 
161  const char *relative_url,
162  const char *dest,
163  LrChecksumType checksum_type,
164  const char *checksum,
165  gint64 expectedsize,
166  const char *base_url,
167  gboolean resume,
168  LrProgressCb progresscb,
169  void *cbdata,
170  GError **err);
171 
203  const char *relative_url,
204  const char *dest,
205  LrChecksumType checksum_type,
206  const char *checksum,
207  gint64 expectedsize,
208  const char *base_url,
209  gboolean resume,
210  LrProgressCb progresscb,
211  void *cbdata,
212  LrEndCb endcb,
213  LrMirrorFailureCb mirrorfailurecb,
214  GError **err);
215 
232  const char *relative_url,
233  const char *dest,
234  LrChecksumType checksum_type,
235  const char *checksum,
236  gint64 expectedsize,
237  const char *base_url,
238  gboolean resume,
239  LrProgressCb progresscb,
240  void *cbdata,
241  LrEndCb endcb,
242  LrMirrorFailureCb mirrorfailurecb,
243  gint64 byterangestart,
244  gint64 byterangeend,
245  GError **err);
246 
250 void
252 
254 typedef enum {
264 
272 gboolean
273 lr_download_packages(GSList *targets,
274  LrPackageDownloadFlag flags,
275  GError **err);
276 
277 typedef enum {
288 
294 gboolean
295 lr_check_packages(GSList *targets,
296  LrPackageCheckFlag flags,
297  GError **err);
298 
301 G_END_DECLS
302 
303 #endif
LrChecksumType
Definition: checksum.h:36
LrPackageCheckFlag
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(* LrEndCb)(void *clientp, LrTransferStatus status, const char *msg)
Definition: types.h:119
int(* LrProgressCb)(void *clientp, double total_to_download, double now_downloaded)
Definition: types.h:101
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)
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)
int(* LrMirrorFailureCb)(void *clientp, const char *msg, const char *url)
Definition: types.h:129
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:38