Librepo library  1.12.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 
26 #include "result.h"
27 
28 G_BEGIN_DECLS
29 
38 typedef struct _LrHandle LrHandle;
39 
40 #ifdef WITH_ZCHUNK
43 #define LRO_SUPPORTS_CACHEDIR
44 #endif /* WITH_ZCHUNK */
45 
47 #define LRO_FASTESTMIRRORMAXAGE_DEFAULT 2592000L // 30 days
48 
50 #define LRO_FASTESTMIRRORMAXAGE_MIN 0L
51 
53 #define LRO_PROXYPORT_DEFAULT 1080L
54 
56 #define LRO_PROXYTYPE_DEFAULT LR_PROXY_HTTP
57 
59 #define LRO_MAXSPEED_DEFAULT G_GINT64_CONSTANT(0)
60 
62 #define LRO_CONNECTTIMEOUT_DEFAULT 30L
63 
65 #define LRO_MAXMIRRORTRIES_DEFAULT 0L
66 
68 #define LRO_MAXMIRRORTRIES_MIN 0L
69 
71 #define LRO_MAXPARALLELDOWNLOADS_DEFAULT 3L
72 
74 #define LRO_MAXPARALLELDOWNLOADS_MIN 1L
75 
77 #define LRO_MAXPARALLELDOWNLOADS_MAX 20L
78 
80 #define LRO_MAXDOWNLOADSPERMIRROR_DEFAULT 3L
81 
83 #define LRO_MAXDOWNLOADSPERMIRROR_MIN 1L
84 
86 #define LRO_LOWSPEEDTIME_MIN 0L
87 
89 #define LRO_LOWSPEEDTIME_DEFAULT 30L
90 
92 #define LRO_LOWSPEEDLIMIT_MIN 0L
93 
95 #define LRO_LOWSPEEDLIMIT_DEFAULT 1000L
96 
98 #define LRO_IPRESOLVE_DEFAULT LR_IPRESOLVE_WHATEVER
99 
101 #define LRO_ALLOWEDMIRRORFAILURES_DEFAULT 4L
102 
104 #define LRO_ADAPTIVEMIRRORSORTING_DEFAULT 1L
105 
107 #define LRO_GNUPGHOMEDIR_DEFAULT NULL
108 
110 #define LRO_FASTESTMIRRORTIMEOUT_DEFAULT 2.0
111 
113 #define LRO_OFFLINE_DEFAULT 0L
114 
116 #define LRO_HTTPAUTHMETHODS_DEFAULT LR_AUTH_BASIC
117 
119 #define LRO_PROXYAUTHMETHODS_DEFAULT LR_AUTH_BASIC
120 
122 #define LRO_FTPUSEEPSV_DEFAULT 1L
123 
124 
126 typedef enum {
127 
128  LRO_UPDATE,
132  LRO_URLS,
146  LRO_LOCAL,
149  LRO_HTTPAUTH,
154  LRO_USERPWD,
157  LRO_PROXY,
160  LRO_PROXYPORT,
163  LRO_PROXYTYPE,
166  LRO_PROXYAUTH,
180  LRO_MAXSPEED,
184  LRO_DESTDIR,
187  LRO_REPOTYPE,
206  LRO_USERAGENT,
224  LRO_VARSUB,
242  LRO_FASTESTMIRRORMAXAGE, /*< (long)
243  Maximum age of a record in cache (seconds).
244  Default: 2592000 (30 days). */
245 
246  LRO_FASTESTMIRRORCB, /* (LrFastestMirrorCb)
247  Fastest mirror status callback */
248 
249  LRO_FASTESTMIRRORDATA, /* (void *)
250  User data for LRO_FASTESTMIRRORCB */
251 
252  LRO_LOWSPEEDTIME, /*< (long)
253  The time in seconds that the transfer should be below the
254  LRO_LOWSPEEDLIMIT for the library to consider it too slow
255  and abort. */
256 
257  LRO_LOWSPEEDLIMIT, /*< (long)
258  The transfer speed in bytes per second that the transfer
259  should be below during LRO_LOWSPEEDTIME seconds for
260  the library to consider it too slow and abort. */
261 
262  /* Repo common options */
263 
264  LRO_GPGCHECK,
267  LRO_CHECKSUM,
270  /* LR_YUMREPO specific options */
271 
272  LRO_YUMDLIST,
277  LRO_RPMMDDLIST = LRO_YUMDLIST,
278 
279  LRO_YUMBLIST,
283  LRO_RPMMDBLIST = LRO_YUMBLIST,
284 
285  LRO_HMFCB,
300  LRO_IPRESOLVE,
334  LRO_OFFLINE,
348  LRO_SSLCACERT,
362  LRO_YUMSLIST,
369  LRO_CACHEDIR,
403 } LrHandleOption;
406 typedef enum {
408  LRI_URLS,
420  LRI_YUMDLIST,
423  LRI_RPMMDDLIST = LRI_YUMDLIST,
424  LRI_YUMBLIST,
427  LRI_RPMMDBLIST = LRI_YUMBLIST,
431  LRI_MIRRORS,
469  LRI_SENTINEL,
475 LrHandle *
477 
481 void
483 
491 gboolean
493  GError **err,
494  LrHandleOption option,
495  ...);
496 
510 gboolean
512  GError **err,
513  LrHandleInfoOption option,
514  ...);
515 
522 gboolean
523 lr_handle_perform(LrHandle *handle, LrResult *result, GError **err);
524 
527 G_END_DECLS
528 
529 #endif
LrHandleOption
Definition: handle.h:126
void lr_handle_free(LrHandle *handle)
struct _LrHandle LrHandle
Definition: handle.h:38
LrHandle * lr_handle_init(void)
gboolean lr_handle_setopt(LrHandle *handle, GError **err, LrHandleOption option,...)
gboolean lr_handle_getinfo(LrHandle *handle, GError **err, LrHandleInfoOption option,...)
gboolean lr_handle_perform(LrHandle *handle, LrResult *result, GError **err)
LrHandleInfoOption
Definition: handle.h:406
@ LRO_REPOTYPE
Definition: handle.h:187
@ LRO_IPRESOLVE
Definition: handle.h:300
@ LRO_FTPUSEEPSV
Definition: handle.h:359
@ LRO_MAXSPEED
Definition: handle.h:180
@ LRO_MIRRORLISTURL
Definition: handle.h:140
@ LRO_VARSUB
Definition: handle.h:224
@ LRO_INTERRUPTIBLE
Definition: handle.h:200
@ LRO_PROXYAUTH
Definition: handle.h:166
@ LRO_ONETIMEFLAG
Definition: handle.h:377
@ LRO_CONNECTTIMEOUT
Definition: handle.h:190
@ LRO_PROXYAUTHMETHODS
Definition: handle.h:355
@ LRO_PROGRESSDATA
Definition: handle.h:177
@ LRO_FASTESTMIRRORTIMEOUT
Definition: handle.h:326
@ LRO_ADAPTIVEMIRRORSORTING
Definition: handle.h:317
@ LRO_CHECKSUM
Definition: handle.h:267
@ LRO_HTTPHEADER
Definition: handle.h:330
@ LRO_USERAGENT
Definition: handle.h:206
@ LRO_IGNOREMISSING
Definition: handle.h:194
@ LRO_MAXMIRRORTRIES
Definition: handle.h:214
@ LRO_PROGRESSCB
Definition: handle.h:174
@ LRO_OFFLINE
Definition: handle.h:334
@ LRO_GNUPGHOMEDIR
Definition: handle.h:323
@ LRO_YUMDLIST
Definition: handle.h:272
@ LRO_MIRRORLIST
Definition: handle.h:135
@ LRO_METALINKURL
Definition: handle.h:143
@ LRO_FASTESTMIRROR
Definition: handle.h:232
@ LRO_USERPWD
Definition: handle.h:154
@ LRO_HMFCB
Definition: handle.h:285
@ LRO_SSLCLIENTCERT
Definition: handle.h:339
@ LRO_PROXYUSERPWD
Definition: handle.h:171
@ LRO_URLS
Definition: handle.h:132
@ LRO_UPDATE
Definition: handle.h:128
@ LRO_HTTPAUTH
Definition: handle.h:149
@ LRO_LOCAL
Definition: handle.h:146
@ LRO_PRESERVETIME
Definition: handle.h:373
@ LRO_PROXY
Definition: handle.h:157
@ LRO_FETCHMIRRORS
Definition: handle.h:210
@ LRO_MAXPARALLELDOWNLOADS
Definition: handle.h:218
@ LRO_SSLCLIENTKEY
Definition: handle.h:343
@ LRO_PROXYPORT
Definition: handle.h:160
@ LRO_MAXDOWNLOADSPERMIRROR
Definition: handle.h:221
@ LRO_YUMSLIST
Definition: handle.h:362
@ LRO_PROXYTYPE
Definition: handle.h:163
@ LRO_FASTESTMIRRORCACHE
Definition: handle.h:237
@ LRO_SSLCACERT
Definition: handle.h:348
@ LRO_ALLOWEDMIRRORFAILURES
Definition: handle.h:303
@ LRO_YUMBLIST
Definition: handle.h:279
@ LRO_HTTPAUTHMETHODS
Definition: handle.h:352
@ LRO_CACHEDIR
Definition: handle.h:369
@ LRO_DESTDIR
Definition: handle.h:184
@ LRO_GPGCHECK
Definition: handle.h:264
@ LRO_SSLVERIFYHOST
Definition: handle.h:296
@ LRO_SSLVERIFYPEER
Definition: handle.h:290
@ LRO_SENTINEL
Definition: handle.h:401
@ LRI_USERAGENT
Definition: handle.h:419
@ LRI_UPDATE
Definition: handle.h:407
@ LRI_METALINK
Definition: handle.h:443
@ LRI_GNUPGHOMEDIR
Definition: handle.h:453
@ LRI_PROGRESSCB
Definition: handle.h:415
@ LRI_ALLOWEDMIRRORFAILURES
Definition: handle.h:451
@ LRI_ADAPTIVEMIRRORSORTING
Definition: handle.h:452
@ LRI_SSLCLIENTCERT
Definition: handle.h:459
@ LRI_YUMDLIST
Definition: handle.h:420
@ LRI_LOCAL
Definition: handle.h:414
@ LRI_METALINKURL
Definition: handle.h:413
@ LRI_YUMBLIST
Definition: handle.h:424
@ LRI_HTTPHEADER
Definition: handle.h:455
@ LRI_VARSUB
Definition: handle.h:430
@ LRI_YUMSLIST
Definition: handle.h:467
@ LRI_MIRRORLIST
Definition: handle.h:411
@ LRI_HTTPAUTHMETHODS
Definition: handle.h:464
@ LRI_REPOTYPE
Definition: handle.h:418
@ LRI_FASTESTMIRROR
Definition: handle.h:444
@ LRI_DESTDIR
Definition: handle.h:417
@ LRI_HMFCB
Definition: handle.h:447
@ LRI_FASTESTMIRRORMAXAGE
Definition: handle.h:446
@ LRI_LOWSPEEDLIMIT
Definition: handle.h:463
@ LRI_PROGRESSDATA
Definition: handle.h:416
@ LRI_MIRRORLISTURL
Definition: handle.h:412
@ LRI_URLS
Definition: handle.h:408
@ LRI_OFFLINE
Definition: handle.h:458
@ LRI_MAXMIRRORTRIES
Definition: handle.h:429
@ LRI_PROXYAUTHMETHODS
Definition: handle.h:465
@ LRI_SSLCACERT
Definition: handle.h:461
@ LRI_SSLVERIFYHOST
Definition: handle.h:449
@ LRI_FASTESTMIRRORTIMEOUT
Definition: handle.h:454
@ LRI_IPRESOLVE
Definition: handle.h:450
@ LRI_LOWSPEEDTIME
Definition: handle.h:462
@ LRI_CACHEDIR
Definition: handle.h:468
@ LRI_SSLCLIENTKEY
Definition: handle.h:460
@ LRI_MIRRORS
Definition: handle.h:431
@ LRI_FETCHMIRRORS
Definition: handle.h:428
@ LRI_FTPUSEEPSV
Definition: handle.h:466
@ LRI_FASTESTMIRRORCACHE
Definition: handle.h:445
@ LRI_SSLVERIFYPEER
Definition: handle.h:448
struct _LrResult LrResult
Definition: result.h:37