Loading...
Searching...
No Matches
handle.h
/* librepo - A library providing (libcURL like) API to downloading repository
* Copyright (C) 2012 Tomas Mlcoch
*
* Licensed under the GNU Lesser General Public License Version 2.1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __LR_HANDLE_H__
#define __LR_HANDLE_H__
#include <glib.h>
#include <gio/gio.h>
#include <librepo/result.h>
G_BEGIN_DECLS
typedef struct _LrHandle LrHandle;
#if 0
#define LRO_SUPPORTS_CACHEDIR
#endif /* 0 */
#define LRO_FASTESTMIRRORMAXAGE_DEFAULT 2592000L // 30 days
#define LRO_FASTESTMIRRORMAXAGE_MIN 0L
#define LRO_PROXYPORT_DEFAULT 1080L
#define LRO_PROXYTYPE_DEFAULT LR_PROXY_HTTP
#define LRO_MAXSPEED_DEFAULT G_GINT64_CONSTANT(0)
#define LRO_CONNECTTIMEOUT_DEFAULT 30L
#define LRO_MAXMIRRORTRIES_DEFAULT 0L
#define LRO_MAXMIRRORTRIES_MIN 0L
#define LRO_MAXPARALLELDOWNLOADS_DEFAULT 3L
#define LRO_MAXPARALLELDOWNLOADS_MIN 1L
#define LRO_MAXPARALLELDOWNLOADS_MAX 20L
#define LRO_MAXDOWNLOADSPERMIRROR_DEFAULT 3L
#define LRO_MAXDOWNLOADSPERMIRROR_MIN 1L
#define LRO_LOWSPEEDTIME_MIN 0L
#define LRO_LOWSPEEDTIME_DEFAULT 30L
#define LRO_LOWSPEEDLIMIT_MIN 0L
#define LRO_LOWSPEEDLIMIT_DEFAULT 1000L
#define LRO_IPRESOLVE_DEFAULT LR_IPRESOLVE_WHATEVER
#define LRO_ALLOWEDMIRRORFAILURES_DEFAULT 4L
#define LRO_ADAPTIVEMIRRORSORTING_DEFAULT 1L
#define LRO_GNUPGHOMEDIR_DEFAULT NULL
#define LRO_FASTESTMIRRORTIMEOUT_DEFAULT 2.0
#define LRO_OFFLINE_DEFAULT 0L
#define LRO_HTTPAUTHMETHODS_DEFAULT LR_AUTH_BASIC
#define LRO_PROXYAUTHMETHODS_DEFAULT LR_AUTH_BASIC
#define LRO_FTPUSEEPSV_DEFAULT 1L
typedef enum {
LRO_UPDATE,
LRO_URLS,
LRO_MIRRORLIST,
LRO_MIRRORLISTURL,
LRO_METALINKURL,
LRO_LOCAL,
LRO_HTTPAUTH,
LRO_USERPWD,
LRO_PROXY,
LRO_PROXYPORT,
LRO_PROXYTYPE,
LRO_PROXYAUTH,
LRO_PROXYUSERPWD,
LRO_PROGRESSCB,
LRO_PROGRESSDATA,
LRO_MAXSPEED,
LRO_DESTDIR,
LRO_REPOTYPE,
LRO_CONNECTTIMEOUT,
LRO_IGNOREMISSING,
LRO_INTERRUPTIBLE,
LRO_USERAGENT,
LRO_FETCHMIRRORS,
LRO_MAXMIRRORTRIES,
LRO_MAXPARALLELDOWNLOADS,
LRO_MAXDOWNLOADSPERMIRROR,
LRO_VARSUB,
LRO_FASTESTMIRROR,
LRO_FASTESTMIRRORCACHE,
LRO_FASTESTMIRRORMAXAGE, /*< (long)
Maximum age of a record in cache (seconds).
Default: 2592000 (30 days). */
LRO_FASTESTMIRRORCB, /* (LrFastestMirrorCb)
Fastest mirror status callback */
LRO_FASTESTMIRRORDATA, /* (void *)
User data for LRO_FASTESTMIRRORCB */
LRO_LOWSPEEDTIME, /*< (long)
The time in seconds that the transfer should be below the
LRO_LOWSPEEDLIMIT for the library to consider it too slow
and abort. */
LRO_LOWSPEEDLIMIT, /*< (long)
The transfer speed in bytes per second that the transfer
should be below during LRO_LOWSPEEDTIME seconds for
the library to consider it too slow and abort. */
/* Repo common options */
LRO_GPGCHECK,
LRO_CHECKSUM,
/* LR_YUMREPO specific options */
LRO_YUMDLIST,
LRO_RPMMDDLIST = LRO_YUMDLIST,
LRO_YUMBLIST,
LRO_RPMMDBLIST = LRO_YUMBLIST,
LRO_HMFCB,
LRO_SSLVERIFYPEER,
LRO_SSLVERIFYHOST,
LRO_IPRESOLVE,
LRO_ALLOWEDMIRRORFAILURES,
LRO_ADAPTIVEMIRRORSORTING,
LRO_GNUPGHOMEDIR,
LRO_FASTESTMIRRORTIMEOUT,
LRO_HTTPHEADER,
LRO_OFFLINE,
LRO_SSLCLIENTCERT,
LRO_SSLCLIENTKEY,
LRO_SSLCACERT,
LRO_HTTPAUTHMETHODS,
LRO_PROXYAUTHMETHODS,
LRO_FTPUSEEPSV,
LRO_YUMSLIST,
LRO_CACHEDIR,
LRO_PRESERVETIME,
LRO_ONETIMEFLAG,
LRO_SSLVERIFYSTATUS,
LRO_PROXY_SSLVERIFYPEER,
LRO_PROXY_SSLVERIFYHOST,
LRO_PROXY_SSLCLIENTCERT,
LRO_PROXY_SSLCLIENTKEY,
LRO_PROXY_SSLCACERT,
LRO_USERNAME,
LRO_PASSWORD,
LRO_SENTINEL,
} LrHandleOption;
typedef enum {
LRI_UPDATE,
LRI_URLS,
LRI_MIRRORLIST,
LRI_MIRRORLISTURL,
LRI_METALINKURL,
LRI_LOCAL,
LRI_PROGRESSCB,
LRI_PROGRESSDATA,
LRI_DESTDIR,
LRI_REPOTYPE,
LRI_USERAGENT,
LRI_YUMDLIST,
LRI_RPMMDDLIST = LRI_YUMDLIST,
LRI_YUMBLIST,
LRI_RPMMDBLIST = LRI_YUMBLIST,
LRI_FETCHMIRRORS,
LRI_MAXMIRRORTRIES,
LRI_VARSUB,
LRI_MIRRORS,
LRI_METALINK,
LRI_FASTESTMIRROR,
LRI_FASTESTMIRRORCACHE,
LRI_FASTESTMIRRORMAXAGE,
LRI_HMFCB,
LRI_SSLVERIFYPEER,
LRI_SSLVERIFYHOST,
LRI_IPRESOLVE,
LRI_ALLOWEDMIRRORFAILURES,
LRI_ADAPTIVEMIRRORSORTING,
LRI_GNUPGHOMEDIR,
LRI_FASTESTMIRRORTIMEOUT,
LRI_HTTPHEADER,
LRI_OFFLINE,
LRI_SSLCLIENTCERT,
LRI_SSLCLIENTKEY,
LRI_SSLCACERT,
LRI_LOWSPEEDTIME,
LRI_LOWSPEEDLIMIT,
LRI_HTTPAUTHMETHODS,
LRI_PROXYAUTHMETHODS,
LRI_FTPUSEEPSV,
LRI_YUMSLIST,
LRI_CACHEDIR,
LRI_SSLVERIFYSTATUS,
LRI_PROXY_SSLVERIFYPEER,
LRI_PROXY_SSLVERIFYHOST,
LRI_PROXY_SSLCLIENTCERT,
LRI_PROXY_SSLCLIENTKEY,
LRI_PROXY_SSLCACERT,
LRI_SENTINEL,
} LrHandleInfoOption;
LrHandle *
lr_handle_init(void);
void
lr_handle_free(LrHandle *handle);
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);
gboolean
lr_handle_network_wait(LrHandle *handle, GError **err, guint seconds, GCancellable *cancellable);
G_END_DECLS
#endif
LrHandleOption
LrHandleOption
Definition handle.h:127
lr_handle_free
void lr_handle_free(LrHandle *handle)
LrHandle
struct _LrHandle LrHandle
Definition handle.h:39
lr_handle_setopt
gboolean lr_handle_setopt(LrHandle *handle, GError **err, LrHandleOption option,...)
lr_handle_getinfo
gboolean lr_handle_getinfo(LrHandle *handle, GError **err, LrHandleInfoOption option,...)
lr_handle_init
LrHandle * lr_handle_init(void)
lr_handle_perform
gboolean lr_handle_perform(LrHandle *handle, LrResult *result, GError **err)
lr_handle_network_wait
gboolean lr_handle_network_wait(LrHandle *handle, GError **err, guint seconds, GCancellable *cancellable)
LrHandleInfoOption
LrHandleInfoOption
Definition handle.h:448
LRO_REPOTYPE
@ LRO_REPOTYPE
Definition handle.h:193
LRO_IPRESOLVE
@ LRO_IPRESOLVE
Definition handle.h:306
LRO_FTPUSEEPSV
@ LRO_FTPUSEEPSV
Definition handle.h:365
LRO_MAXSPEED
@ LRO_MAXSPEED
Definition handle.h:186
LRO_MIRRORLISTURL
@ LRO_MIRRORLISTURL
Definition handle.h:141
LRO_VARSUB
@ LRO_VARSUB
Definition handle.h:230
LRO_PROXY_SSLCLIENTKEY
@ LRO_PROXY_SSLCLIENTKEY
Definition handle.h:428
LRO_INTERRUPTIBLE
@ LRO_INTERRUPTIBLE
Definition handle.h:206
LRO_PROXYAUTH
@ LRO_PROXYAUTH
Definition handle.h:170
LRO_PROXY_SSLVERIFYHOST
@ LRO_PROXY_SSLVERIFYHOST
Definition handle.h:420
LRO_ONETIMEFLAG
@ LRO_ONETIMEFLAG
Definition handle.h:383
LRO_CONNECTTIMEOUT
@ LRO_CONNECTTIMEOUT
Definition handle.h:196
LRO_PROXYAUTHMETHODS
@ LRO_PROXYAUTHMETHODS
Definition handle.h:361
LRO_PROGRESSDATA
@ LRO_PROGRESSDATA
Definition handle.h:183
LRO_FASTESTMIRRORTIMEOUT
@ LRO_FASTESTMIRRORTIMEOUT
Definition handle.h:332
LRO_ADAPTIVEMIRRORSORTING
@ LRO_ADAPTIVEMIRRORSORTING
Definition handle.h:323
LRO_CHECKSUM
@ LRO_CHECKSUM
Definition handle.h:273
LRO_HTTPHEADER
@ LRO_HTTPHEADER
Definition handle.h:336
LRO_USERAGENT
@ LRO_USERAGENT
Definition handle.h:212
LRO_IGNOREMISSING
@ LRO_IGNOREMISSING
Definition handle.h:200
LRO_MAXMIRRORTRIES
@ LRO_MAXMIRRORTRIES
Definition handle.h:220
LRO_PROGRESSCB
@ LRO_PROGRESSCB
Definition handle.h:180
LRO_OFFLINE
@ LRO_OFFLINE
Definition handle.h:340
LRO_GNUPGHOMEDIR
@ LRO_GNUPGHOMEDIR
Definition handle.h:329
LRO_YUMDLIST
@ LRO_YUMDLIST
Definition handle.h:278
LRO_PROXY_SSLCACERT
@ LRO_PROXY_SSLCACERT
Definition handle.h:433
LRO_MIRRORLIST
@ LRO_MIRRORLIST
Definition handle.h:136
LRO_METALINKURL
@ LRO_METALINKURL
Definition handle.h:144
LRO_FASTESTMIRROR
@ LRO_FASTESTMIRROR
Definition handle.h:238
LRO_PROXY_SSLCLIENTCERT
@ LRO_PROXY_SSLCLIENTCERT
Definition handle.h:424
LRO_USERPWD
@ LRO_USERPWD
Definition handle.h:155
LRO_HMFCB
@ LRO_HMFCB
Definition handle.h:291
LRO_SSLCLIENTCERT
@ LRO_SSLCLIENTCERT
Definition handle.h:345
LRO_PROXYUSERPWD
@ LRO_PROXYUSERPWD
Definition handle.h:175
LRO_URLS
@ LRO_URLS
Definition handle.h:133
LRO_UPDATE
@ LRO_UPDATE
Definition handle.h:129
LRO_HTTPAUTH
@ LRO_HTTPAUTH
Definition handle.h:150
LRO_SSLVERIFYSTATUS
@ LRO_SSLVERIFYSTATUS
Definition handle.h:407
LRO_LOCAL
@ LRO_LOCAL
Definition handle.h:147
LRO_PRESERVETIME
@ LRO_PRESERVETIME
Definition handle.h:379
LRO_PROXY_SSLVERIFYPEER
@ LRO_PROXY_SSLVERIFYPEER
Definition handle.h:414
LRO_PROXY
@ LRO_PROXY
Definition handle.h:161
LRO_FETCHMIRRORS
@ LRO_FETCHMIRRORS
Definition handle.h:216
LRO_MAXPARALLELDOWNLOADS
@ LRO_MAXPARALLELDOWNLOADS
Definition handle.h:224
LRO_SSLCLIENTKEY
@ LRO_SSLCLIENTKEY
Definition handle.h:349
LRO_PROXYPORT
@ LRO_PROXYPORT
Definition handle.h:164
LRO_MAXDOWNLOADSPERMIRROR
@ LRO_MAXDOWNLOADSPERMIRROR
Definition handle.h:227
LRO_YUMSLIST
@ LRO_YUMSLIST
Definition handle.h:368
LRO_PROXYTYPE
@ LRO_PROXYTYPE
Definition handle.h:167
LRO_PASSWORD
@ LRO_PASSWORD
Definition handle.h:440
LRO_FASTESTMIRRORCACHE
@ LRO_FASTESTMIRRORCACHE
Definition handle.h:243
LRO_SSLCACERT
@ LRO_SSLCACERT
Definition handle.h:354
LRO_ALLOWEDMIRRORFAILURES
@ LRO_ALLOWEDMIRRORFAILURES
Definition handle.h:309
LRO_YUMBLIST
@ LRO_YUMBLIST
Definition handle.h:285
LRO_HTTPAUTHMETHODS
@ LRO_HTTPAUTHMETHODS
Definition handle.h:358
LRO_USERNAME
@ LRO_USERNAME
Definition handle.h:437
LRO_CACHEDIR
@ LRO_CACHEDIR
Definition handle.h:375
LRO_DESTDIR
@ LRO_DESTDIR
Definition handle.h:190
LRO_GPGCHECK
@ LRO_GPGCHECK
Definition handle.h:270
LRO_SSLVERIFYHOST
@ LRO_SSLVERIFYHOST
Definition handle.h:302
LRO_SSLVERIFYPEER
@ LRO_SSLVERIFYPEER
Definition handle.h:296
LRO_SENTINEL
@ LRO_SENTINEL
Definition handle.h:443
LRI_USERAGENT
@ LRI_USERAGENT
Definition handle.h:461
LRI_UPDATE
@ LRI_UPDATE
Definition handle.h:449
LRI_METALINK
@ LRI_METALINK
Definition handle.h:485
LRI_GNUPGHOMEDIR
@ LRI_GNUPGHOMEDIR
Definition handle.h:495
LRI_PROGRESSCB
@ LRI_PROGRESSCB
Definition handle.h:457
LRI_ALLOWEDMIRRORFAILURES
@ LRI_ALLOWEDMIRRORFAILURES
Definition handle.h:493
LRI_ADAPTIVEMIRRORSORTING
@ LRI_ADAPTIVEMIRRORSORTING
Definition handle.h:494
LRI_PROXY_SSLCACERT
@ LRI_PROXY_SSLCACERT
Definition handle.h:517
LRI_SSLCLIENTCERT
@ LRI_SSLCLIENTCERT
Definition handle.h:501
LRI_YUMDLIST
@ LRI_YUMDLIST
Definition handle.h:462
LRI_LOCAL
@ LRI_LOCAL
Definition handle.h:456
LRI_METALINKURL
@ LRI_METALINKURL
Definition handle.h:455
LRI_YUMBLIST
@ LRI_YUMBLIST
Definition handle.h:466
LRI_HTTPHEADER
@ LRI_HTTPHEADER
Definition handle.h:497
LRI_VARSUB
@ LRI_VARSUB
Definition handle.h:472
LRI_PROXY_SSLCLIENTCERT
@ LRI_PROXY_SSLCLIENTCERT
Definition handle.h:515
LRI_YUMSLIST
@ LRI_YUMSLIST
Definition handle.h:509
LRI_MIRRORLIST
@ LRI_MIRRORLIST
Definition handle.h:453
LRI_HTTPAUTHMETHODS
@ LRI_HTTPAUTHMETHODS
Definition handle.h:506
LRI_REPOTYPE
@ LRI_REPOTYPE
Definition handle.h:460
LRI_FASTESTMIRROR
@ LRI_FASTESTMIRROR
Definition handle.h:486
LRI_DESTDIR
@ LRI_DESTDIR
Definition handle.h:459
LRI_HMFCB
@ LRI_HMFCB
Definition handle.h:489
LRI_FASTESTMIRRORMAXAGE
@ LRI_FASTESTMIRRORMAXAGE
Definition handle.h:488
LRI_SSLVERIFYSTATUS
@ LRI_SSLVERIFYSTATUS
Definition handle.h:511
LRI_LOWSPEEDLIMIT
@ LRI_LOWSPEEDLIMIT
Definition handle.h:505
LRI_PROGRESSDATA
@ LRI_PROGRESSDATA
Definition handle.h:458
LRI_MIRRORLISTURL
@ LRI_MIRRORLISTURL
Definition handle.h:454
LRI_URLS
@ LRI_URLS
Definition handle.h:450
LRI_OFFLINE
@ LRI_OFFLINE
Definition handle.h:500
LRI_MAXMIRRORTRIES
@ LRI_MAXMIRRORTRIES
Definition handle.h:471
LRI_PROXYAUTHMETHODS
@ LRI_PROXYAUTHMETHODS
Definition handle.h:507
LRI_PROXY_SSLVERIFYPEER
@ LRI_PROXY_SSLVERIFYPEER
Definition handle.h:513
LRI_SSLCACERT
@ LRI_SSLCACERT
Definition handle.h:503
LRI_SSLVERIFYHOST
@ LRI_SSLVERIFYHOST
Definition handle.h:491
LRI_PROXY_SSLVERIFYHOST
@ LRI_PROXY_SSLVERIFYHOST
Definition handle.h:514
LRI_FASTESTMIRRORTIMEOUT
@ LRI_FASTESTMIRRORTIMEOUT
Definition handle.h:496
LRI_IPRESOLVE
@ LRI_IPRESOLVE
Definition handle.h:492
LRI_LOWSPEEDTIME
@ LRI_LOWSPEEDTIME
Definition handle.h:504
LRI_CACHEDIR
@ LRI_CACHEDIR
Definition handle.h:510
LRI_SSLCLIENTKEY
@ LRI_SSLCLIENTKEY
Definition handle.h:502
LRI_MIRRORS
@ LRI_MIRRORS
Definition handle.h:473
LRI_FETCHMIRRORS
@ LRI_FETCHMIRRORS
Definition handle.h:470
LRI_PROXY_SSLCLIENTKEY
@ LRI_PROXY_SSLCLIENTKEY
Definition handle.h:516
LRI_FTPUSEEPSV
@ LRI_FTPUSEEPSV
Definition handle.h:508
LRI_FASTESTMIRRORCACHE
@ LRI_FASTESTMIRRORCACHE
Definition handle.h:487
LRI_SSLVERIFYPEER
@ LRI_SSLVERIFYPEER
Definition handle.h:490
LrResult
struct _LrResult LrResult
Definition result.h:37