Librepo library 1.20.0
C library for downloading linux repository metadata and packages
Loading...
Searching...
No Matches
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
29G_BEGIN_DECLS
30
39typedef struct _LrHandle LrHandle;
40
41#if 0
44#define LRO_SUPPORTS_CACHEDIR
45#endif /* 0 */
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
127typedef enum {
128
129 LRO_UPDATE,
133 LRO_URLS,
147 LRO_LOCAL,
161 LRO_PROXY,
230 LRO_VARSUB,
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
291 LRO_HMFCB,
525LrHandle *
527
531void
533
541gboolean
543 GError **err,
544 LrHandleOption option,
545 ...);
546
560gboolean
562 GError **err,
563 LrHandleInfoOption option,
564 ...);
565
572gboolean
573lr_handle_perform(LrHandle *handle, LrResult *result, GError **err);
574
582gboolean
583lr_handle_network_wait(LrHandle *handle, GError **err, guint seconds, GCancellable *cancellable);
584
587G_END_DECLS
588
589#endif
LrHandleOption
Definition handle.h:127
void lr_handle_free(LrHandle *handle)
struct _LrHandle LrHandle
Definition handle.h:39
gboolean lr_handle_setopt(LrHandle *handle, GError **err, LrHandleOption option,...)
gboolean lr_handle_getinfo(LrHandle *handle, GError **err, LrHandleInfoOption option,...)
LrHandle * lr_handle_init(void)
gboolean lr_handle_perform(LrHandle *handle, LrResult *result, GError **err)
gboolean lr_handle_network_wait(LrHandle *handle, GError **err, guint seconds, GCancellable *cancellable)
LrHandleInfoOption
Definition handle.h:448
@ LRO_REPOTYPE
Definition handle.h:193
@ LRO_IPRESOLVE
Definition handle.h:306
@ LRO_FTPUSEEPSV
Definition handle.h:365
@ LRO_MAXSPEED
Definition handle.h:186
@ LRO_MIRRORLISTURL
Definition handle.h:141
@ LRO_VARSUB
Definition handle.h:230
@ LRO_PROXY_SSLCLIENTKEY
Definition handle.h:428
@ LRO_INTERRUPTIBLE
Definition handle.h:206
@ LRO_PROXYAUTH
Definition handle.h:170
@ LRO_PROXY_SSLVERIFYHOST
Definition handle.h:420
@ LRO_ONETIMEFLAG
Definition handle.h:383
@ LRO_CONNECTTIMEOUT
Definition handle.h:196
@ LRO_PROXYAUTHMETHODS
Definition handle.h:361
@ LRO_PROGRESSDATA
Definition handle.h:183
@ LRO_FASTESTMIRRORTIMEOUT
Definition handle.h:332
@ LRO_ADAPTIVEMIRRORSORTING
Definition handle.h:323
@ LRO_CHECKSUM
Definition handle.h:273
@ LRO_HTTPHEADER
Definition handle.h:336
@ LRO_USERAGENT
Definition handle.h:212
@ LRO_IGNOREMISSING
Definition handle.h:200
@ LRO_MAXMIRRORTRIES
Definition handle.h:220
@ LRO_PROGRESSCB
Definition handle.h:180
@ LRO_OFFLINE
Definition handle.h:340
@ LRO_GNUPGHOMEDIR
Definition handle.h:329
@ LRO_YUMDLIST
Definition handle.h:278
@ LRO_PROXY_SSLCACERT
Definition handle.h:433
@ LRO_MIRRORLIST
Definition handle.h:136
@ LRO_METALINKURL
Definition handle.h:144
@ LRO_FASTESTMIRROR
Definition handle.h:238
@ LRO_PROXY_SSLCLIENTCERT
Definition handle.h:424
@ LRO_USERPWD
Definition handle.h:155
@ LRO_HMFCB
Definition handle.h:291
@ LRO_SSLCLIENTCERT
Definition handle.h:345
@ LRO_PROXYUSERPWD
Definition handle.h:175
@ LRO_URLS
Definition handle.h:133
@ LRO_UPDATE
Definition handle.h:129
@ LRO_HTTPAUTH
Definition handle.h:150
@ LRO_SSLVERIFYSTATUS
Definition handle.h:407
@ LRO_LOCAL
Definition handle.h:147
@ LRO_PRESERVETIME
Definition handle.h:379
@ LRO_PROXY_SSLVERIFYPEER
Definition handle.h:414
@ LRO_PROXY
Definition handle.h:161
@ LRO_FETCHMIRRORS
Definition handle.h:216
@ LRO_MAXPARALLELDOWNLOADS
Definition handle.h:224
@ LRO_SSLCLIENTKEY
Definition handle.h:349
@ LRO_PROXYPORT
Definition handle.h:164
@ LRO_MAXDOWNLOADSPERMIRROR
Definition handle.h:227
@ LRO_YUMSLIST
Definition handle.h:368
@ LRO_PROXYTYPE
Definition handle.h:167
@ LRO_PASSWORD
Definition handle.h:440
@ LRO_FASTESTMIRRORCACHE
Definition handle.h:243
@ LRO_SSLCACERT
Definition handle.h:354
@ LRO_ALLOWEDMIRRORFAILURES
Definition handle.h:309
@ LRO_YUMBLIST
Definition handle.h:285
@ LRO_HTTPAUTHMETHODS
Definition handle.h:358
@ LRO_USERNAME
Definition handle.h:437
@ LRO_CACHEDIR
Definition handle.h:375
@ LRO_DESTDIR
Definition handle.h:190
@ LRO_GPGCHECK
Definition handle.h:270
@ LRO_SSLVERIFYHOST
Definition handle.h:302
@ LRO_SSLVERIFYPEER
Definition handle.h:296
@ LRO_SENTINEL
Definition handle.h:443
@ LRI_USERAGENT
Definition handle.h:461
@ LRI_UPDATE
Definition handle.h:449
@ LRI_METALINK
Definition handle.h:485
@ LRI_GNUPGHOMEDIR
Definition handle.h:495
@ LRI_PROGRESSCB
Definition handle.h:457
@ LRI_ALLOWEDMIRRORFAILURES
Definition handle.h:493
@ LRI_ADAPTIVEMIRRORSORTING
Definition handle.h:494
@ LRI_PROXY_SSLCACERT
Definition handle.h:517
@ LRI_SSLCLIENTCERT
Definition handle.h:501
@ LRI_YUMDLIST
Definition handle.h:462
@ LRI_LOCAL
Definition handle.h:456
@ LRI_METALINKURL
Definition handle.h:455
@ LRI_YUMBLIST
Definition handle.h:466
@ LRI_HTTPHEADER
Definition handle.h:497
@ LRI_VARSUB
Definition handle.h:472
@ LRI_PROXY_SSLCLIENTCERT
Definition handle.h:515
@ LRI_YUMSLIST
Definition handle.h:509
@ LRI_MIRRORLIST
Definition handle.h:453
@ LRI_HTTPAUTHMETHODS
Definition handle.h:506
@ LRI_REPOTYPE
Definition handle.h:460
@ LRI_FASTESTMIRROR
Definition handle.h:486
@ LRI_DESTDIR
Definition handle.h:459
@ LRI_HMFCB
Definition handle.h:489
@ LRI_FASTESTMIRRORMAXAGE
Definition handle.h:488
@ LRI_SSLVERIFYSTATUS
Definition handle.h:511
@ LRI_LOWSPEEDLIMIT
Definition handle.h:505
@ LRI_PROGRESSDATA
Definition handle.h:458
@ LRI_MIRRORLISTURL
Definition handle.h:454
@ LRI_URLS
Definition handle.h:450
@ LRI_OFFLINE
Definition handle.h:500
@ LRI_MAXMIRRORTRIES
Definition handle.h:471
@ LRI_PROXYAUTHMETHODS
Definition handle.h:507
@ LRI_PROXY_SSLVERIFYPEER
Definition handle.h:513
@ LRI_SSLCACERT
Definition handle.h:503
@ LRI_SSLVERIFYHOST
Definition handle.h:491
@ LRI_PROXY_SSLVERIFYHOST
Definition handle.h:514
@ LRI_FASTESTMIRRORTIMEOUT
Definition handle.h:496
@ LRI_IPRESOLVE
Definition handle.h:492
@ LRI_LOWSPEEDTIME
Definition handle.h:504
@ LRI_CACHEDIR
Definition handle.h:510
@ LRI_SSLCLIENTKEY
Definition handle.h:502
@ LRI_MIRRORS
Definition handle.h:473
@ LRI_FETCHMIRRORS
Definition handle.h:470
@ LRI_PROXY_SSLCLIENTKEY
Definition handle.h:516
@ LRI_FTPUSEEPSV
Definition handle.h:508
@ LRI_FASTESTMIRRORCACHE
Definition handle.h:487
@ LRI_SSLVERIFYPEER
Definition handle.h:490
struct _LrResult LrResult
Definition result.h:37