Librepo library  1.14.5
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,
433 } LrHandleOption;
436 typedef enum {
438  LRI_URLS,
450  LRI_YUMDLIST,
453  LRI_RPMMDDLIST = LRI_YUMDLIST,
454  LRI_YUMBLIST,
457  LRI_RPMMDBLIST = LRI_YUMBLIST,
461  LRI_MIRRORS,
507  LRI_SENTINEL,
513 LrHandle *
515 
519 void
521 
529 gboolean
531  GError **err,
532  LrHandleOption option,
533  ...);
534 
548 gboolean
550  GError **err,
551  LrHandleInfoOption option,
552  ...);
553 
560 gboolean
561 lr_handle_perform(LrHandle *handle, LrResult *result, GError **err);
562 
565 G_END_DECLS
566 
567 #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:436
@ 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_PROXY_SSLCLIENTKEY
Definition: handle.h:422
@ LRO_INTERRUPTIBLE
Definition: handle.h:200
@ LRO_PROXYAUTH
Definition: handle.h:166
@ LRO_PROXY_SSLVERIFYHOST
Definition: handle.h:414
@ 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_PROXY_SSLCACERT
Definition: handle.h:427
@ LRO_MIRRORLIST
Definition: handle.h:135
@ LRO_METALINKURL
Definition: handle.h:143
@ LRO_FASTESTMIRROR
Definition: handle.h:232
@ LRO_PROXY_SSLCLIENTCERT
Definition: handle.h:418
@ 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_SSLVERIFYSTATUS
Definition: handle.h:401
@ LRO_LOCAL
Definition: handle.h:146
@ LRO_PRESERVETIME
Definition: handle.h:373
@ LRO_PROXY_SSLVERIFYPEER
Definition: handle.h:408
@ 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:431
@ LRI_USERAGENT
Definition: handle.h:449
@ LRI_UPDATE
Definition: handle.h:437
@ LRI_METALINK
Definition: handle.h:473
@ LRI_GNUPGHOMEDIR
Definition: handle.h:483
@ LRI_PROGRESSCB
Definition: handle.h:445
@ LRI_ALLOWEDMIRRORFAILURES
Definition: handle.h:481
@ LRI_ADAPTIVEMIRRORSORTING
Definition: handle.h:482
@ LRI_PROXY_SSLCACERT
Definition: handle.h:505
@ LRI_SSLCLIENTCERT
Definition: handle.h:489
@ LRI_YUMDLIST
Definition: handle.h:450
@ LRI_LOCAL
Definition: handle.h:444
@ LRI_METALINKURL
Definition: handle.h:443
@ LRI_YUMBLIST
Definition: handle.h:454
@ LRI_HTTPHEADER
Definition: handle.h:485
@ LRI_VARSUB
Definition: handle.h:460
@ LRI_PROXY_SSLCLIENTCERT
Definition: handle.h:503
@ LRI_YUMSLIST
Definition: handle.h:497
@ LRI_MIRRORLIST
Definition: handle.h:441
@ LRI_HTTPAUTHMETHODS
Definition: handle.h:494
@ LRI_REPOTYPE
Definition: handle.h:448
@ LRI_FASTESTMIRROR
Definition: handle.h:474
@ LRI_DESTDIR
Definition: handle.h:447
@ LRI_HMFCB
Definition: handle.h:477
@ LRI_FASTESTMIRRORMAXAGE
Definition: handle.h:476
@ LRI_SSLVERIFYSTATUS
Definition: handle.h:499
@ LRI_LOWSPEEDLIMIT
Definition: handle.h:493
@ LRI_PROGRESSDATA
Definition: handle.h:446
@ LRI_MIRRORLISTURL
Definition: handle.h:442
@ LRI_URLS
Definition: handle.h:438
@ LRI_OFFLINE
Definition: handle.h:488
@ LRI_MAXMIRRORTRIES
Definition: handle.h:459
@ LRI_PROXYAUTHMETHODS
Definition: handle.h:495
@ LRI_PROXY_SSLVERIFYPEER
Definition: handle.h:501
@ LRI_SSLCACERT
Definition: handle.h:491
@ LRI_SSLVERIFYHOST
Definition: handle.h:479
@ LRI_PROXY_SSLVERIFYHOST
Definition: handle.h:502
@ LRI_FASTESTMIRRORTIMEOUT
Definition: handle.h:484
@ LRI_IPRESOLVE
Definition: handle.h:480
@ LRI_LOWSPEEDTIME
Definition: handle.h:492
@ LRI_CACHEDIR
Definition: handle.h:498
@ LRI_SSLCLIENTKEY
Definition: handle.h:490
@ LRI_MIRRORS
Definition: handle.h:461
@ LRI_FETCHMIRRORS
Definition: handle.h:458
@ LRI_PROXY_SSLCLIENTKEY
Definition: handle.h:504
@ LRI_FTPUSEEPSV
Definition: handle.h:496
@ LRI_FASTESTMIRRORCACHE
Definition: handle.h:475
@ LRI_SSLVERIFYPEER
Definition: handle.h:478
struct _LrResult LrResult
Definition: result.h:37