Librepo library  1.17.0
C library for downloading linux repository metadata and packages
handle.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_HANDLE_H__
22 #define __LR_HANDLE_H__
23 
24 #include <glib.h>
25 #include <gio/gio.h>
26 
27 #include <librepo/result.h>
28 
29 G_BEGIN_DECLS
30 
39 typedef struct _LrHandle LrHandle;
40 
41 #ifdef WITH_ZCHUNK
42 
44 #define LRO_SUPPORTS_CACHEDIR
45 #endif /* WITH_ZCHUNK */
46 
48 #define LRO_FASTESTMIRRORMAXAGE_DEFAULT 2592000L // 30 days
49 
51 #define LRO_FASTESTMIRRORMAXAGE_MIN 0L
52 
54 #define LRO_PROXYPORT_DEFAULT 1080L
55 
57 #define LRO_PROXYTYPE_DEFAULT LR_PROXY_HTTP
58 
60 #define LRO_MAXSPEED_DEFAULT G_GINT64_CONSTANT(0)
61 
63 #define LRO_CONNECTTIMEOUT_DEFAULT 30L
64 
66 #define LRO_MAXMIRRORTRIES_DEFAULT 0L
67 
69 #define LRO_MAXMIRRORTRIES_MIN 0L
70 
72 #define LRO_MAXPARALLELDOWNLOADS_DEFAULT 3L
73 
75 #define LRO_MAXPARALLELDOWNLOADS_MIN 1L
76 
78 #define LRO_MAXPARALLELDOWNLOADS_MAX 20L
79 
81 #define LRO_MAXDOWNLOADSPERMIRROR_DEFAULT 3L
82 
84 #define LRO_MAXDOWNLOADSPERMIRROR_MIN 1L
85 
87 #define LRO_LOWSPEEDTIME_MIN 0L
88 
90 #define LRO_LOWSPEEDTIME_DEFAULT 30L
91 
93 #define LRO_LOWSPEEDLIMIT_MIN 0L
94 
96 #define LRO_LOWSPEEDLIMIT_DEFAULT 1000L
97 
99 #define LRO_IPRESOLVE_DEFAULT LR_IPRESOLVE_WHATEVER
100 
102 #define LRO_ALLOWEDMIRRORFAILURES_DEFAULT 4L
103 
105 #define LRO_ADAPTIVEMIRRORSORTING_DEFAULT 1L
106 
108 #define LRO_GNUPGHOMEDIR_DEFAULT NULL
109 
111 #define LRO_FASTESTMIRRORTIMEOUT_DEFAULT 2.0
112 
114 #define LRO_OFFLINE_DEFAULT 0L
115 
117 #define LRO_HTTPAUTHMETHODS_DEFAULT LR_AUTH_BASIC
118 
120 #define LRO_PROXYAUTHMETHODS_DEFAULT LR_AUTH_BASIC
121 
123 #define LRO_FTPUSEEPSV_DEFAULT 1L
124 
125 
127 typedef enum {
128 
243  LRO_FASTESTMIRRORMAXAGE, /*< (long)
244  Maximum age of a record in cache (seconds).
245  Default: 2592000 (30 days). */
246 
247  LRO_FASTESTMIRRORCB, /* (LrFastestMirrorCb)
248  Fastest mirror status callback */
249 
250  LRO_FASTESTMIRRORDATA, /* (void *)
251  User data for LRO_FASTESTMIRRORCB */
252 
253  LRO_LOWSPEEDTIME, /*< (long)
254  The time in seconds that the transfer should be below the
255  LRO_LOWSPEEDLIMIT for the library to consider it too slow
256  and abort. */
257 
258  LRO_LOWSPEEDLIMIT, /*< (long)
259  The transfer speed in bytes per second that the transfer
260  should be below during LRO_LOWSPEEDTIME seconds for
261  the library to consider it too slow and abort. */
262 
263  /* Repo common options */
264 
271  /* LR_YUMREPO specific options */
272 
278  LRO_RPMMDDLIST = LRO_YUMDLIST,
279 
284  LRO_RPMMDBLIST = LRO_YUMBLIST,
285 
434 } LrHandleOption;
437 typedef enum {
454  LRI_RPMMDDLIST = LRI_YUMDLIST,
458  LRI_RPMMDBLIST = LRI_YUMBLIST,
508  LRI_SENTINEL,
514 LrHandle *
515 lr_handle_init(void);
516 
520 void
521 lr_handle_free(LrHandle *handle);
522 
530 gboolean
531 lr_handle_setopt(LrHandle *handle,
532  GError **err,
533  LrHandleOption option,
534  ...);
535 
549 gboolean
551  GError **err,
552  LrHandleInfoOption option,
553  ...);
554 
561 gboolean
562 lr_handle_perform(LrHandle *handle, LrResult *result, GError **err);
563 
571 gboolean
572 lr_handle_network_wait(LrHandle *handle, GError **err, guint seconds, GCancellable *cancellable);
573 
576 G_END_DECLS
577 
578 #endif
LrHandleOption
Definition: handle.h:127
LrHandleInfoOption
Definition: handle.h:437
gboolean lr_handle_getinfo(LrHandle *handle, GError **err, LrHandleInfoOption option,...)
gboolean lr_handle_setopt(LrHandle *handle, GError **err, LrHandleOption option,...)
gboolean lr_handle_network_wait(LrHandle *handle, GError **err, guint seconds, GCancellable *cancellable)
gboolean lr_handle_perform(LrHandle *handle, LrResult *result, GError **err)
struct _LrResult LrResult
Definition: result.h:37
void lr_handle_free(LrHandle *handle)
LrHandle * lr_handle_init(void)
struct _LrHandle LrHandle
Definition: handle.h:39