Librepo library  1.18.1
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 #if 1
42 
44 #define LRO_SUPPORTS_CACHEDIR
45 #endif /* 1 */
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 
248  LRO_FASTESTMIRRORMAXAGE, /*< (long)
249  Maximum age of a record in cache (seconds).
250  Default: 2592000 (30 days). */
251 
252  LRO_FASTESTMIRRORCB, /* (LrFastestMirrorCb)
253  Fastest mirror status callback */
254 
255  LRO_FASTESTMIRRORDATA, /* (void *)
256  User data for LRO_FASTESTMIRRORCB */
257 
258  LRO_LOWSPEEDTIME, /*< (long)
259  The time in seconds that the transfer should be below the
260  LRO_LOWSPEEDLIMIT for the library to consider it too slow
261  and abort. */
262 
263  LRO_LOWSPEEDLIMIT, /*< (long)
264  The transfer speed in bytes per second that the transfer
265  should be below during LRO_LOWSPEEDTIME seconds for
266  the library to consider it too slow and abort. */
267 
268  /* Repo common options */
269 
276  /* LR_YUMREPO specific options */
277 
283  LRO_RPMMDDLIST = LRO_YUMDLIST,
284 
289  LRO_RPMMDBLIST = LRO_YUMBLIST,
290 
445 } LrHandleOption;
448 typedef enum {
465  LRI_RPMMDDLIST = LRI_YUMDLIST,
469  LRI_RPMMDBLIST = LRI_YUMBLIST,
519  LRI_SENTINEL,
525 LrHandle *
526 lr_handle_init(void);
527 
531 void
532 lr_handle_free(LrHandle *handle);
533 
541 gboolean
542 lr_handle_setopt(LrHandle *handle,
543  GError **err,
544  LrHandleOption option,
545  ...);
546 
560 gboolean
562  GError **err,
563  LrHandleInfoOption option,
564  ...);
565 
572 gboolean
573 lr_handle_perform(LrHandle *handle, LrResult *result, GError **err);
574 
582 gboolean
583 lr_handle_network_wait(LrHandle *handle, GError **err, guint seconds, GCancellable *cancellable);
584 
587 G_END_DECLS
588 
589 #endif
LrHandleOption
Definition: handle.h:127
LrHandleInfoOption
Definition: handle.h:448
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