Librepo library  1.7.13
C library for downloading linux repository metadata and packages
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules
Librepo Handle

Macros

#define LRO_FASTESTMIRRORMAXAGE_DEFAULT   2592000
 
#define LRO_FASTESTMIRRORMAXAGE_MIN   0
 
#define LRO_PROXYPORT_DEFAULT   1080
 
#define LRO_PROXYTYPE_DEFAULT   LR_PROXY_HTTP
 
#define LRO_MAXSPEED_DEFAULT   G_GINT64_CONSTANT(0)
 
#define LRO_CONNECTTIMEOUT_DEFAULT   120
 
#define LRO_MAXMIRRORTRIES_DEFAULT   0
 
#define LRO_MAXMIRRORTRIES_MIN   0
 
#define LRO_MAXPARALLELDOWNLOADS_DEFAULT   3
 
#define LRO_MAXPARALLELDOWNLOADS_MIN   1
 
#define LRO_MAXPARALLELDOWNLOADS_MAX   20
 
#define LRO_MAXDOWNLOADSPERMIRROR_DEFAULT   3
 
#define LRO_MAXDOWNLOADSPERMIRROR_MIN   1
 
#define LRO_LOWSPEEDTIME_MIN   0
 
#define LRO_LOWSPEEDTIME_DEFAULT   120
 
#define LRO_LOWSPEEDLIMIT_MIN   0
 
#define LRO_LOWSPEEDLIMIT_DEFAULT   1000
 
#define LRO_IPRESOLVE_DEFAULT   LR_IPRESOLVE_WHATEVER
 
#define LRO_ALLOWEDMIRRORFAILURES_DEFAULT   4
 
#define LRO_ADAPTIVEMIRRORSORTING_DEFAULT   1
 
#define LRO_GNUPGHOMEDIR_DEFAULT   NULL
 
#define LRO_FASTESTMIRRORTIMEOUT_DEFAULT   2.0
 

Typedefs

typedef struct _LrHandle LrHandle
 

Enumerations

enum  LrHandleOption {
  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, LRO_FASTESTMIRRORCB, LRO_FASTESTMIRRORDATA,
  LRO_LOWSPEEDTIME, LRO_LOWSPEEDLIMIT, LRO_GPGCHECK, LRO_CHECKSUM,
  LRO_YUMDLIST, LRO_YUMBLIST, LRO_HMFCB, LRO_SSLVERIFYPEER,
  LRO_SSLVERIFYHOST, LRO_IPRESOLVE, LRO_ALLOWEDMIRRORFAILURES, LRO_ADAPTIVEMIRRORSORTING,
  LRO_GNUPGHOMEDIR, LRO_FASTESTMIRRORTIMEOUT, LRO_SENTINEL
}
 
enum  LrHandleInfoOption {
  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_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_SENTINEL
}
 

Functions

LrHandlelr_handle_init ()
 
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)
 

Detailed Description

Macro Definition Documentation

#define LRO_ADAPTIVEMIRRORSORTING_DEFAULT   1

LRO_ADAPTIVEMIRRORSORTING

Definition at line 98 of file handle.h.

#define LRO_ALLOWEDMIRRORFAILURES_DEFAULT   4

LRO_ALLOWEDMIRRORFAILURES default value

Definition at line 95 of file handle.h.

#define LRO_CONNECTTIMEOUT_DEFAULT   120

LRO_CONNECTTIMEOUT default value

Definition at line 56 of file handle.h.

#define LRO_FASTESTMIRRORMAXAGE_DEFAULT   2592000

LRO_FASTESTMIRRORMAXAGE default value

Definition at line 41 of file handle.h.

#define LRO_FASTESTMIRRORMAXAGE_MIN   0

LRO_FASTESTMIRRORMAXAGE minimal allowed value

Definition at line 44 of file handle.h.

#define LRO_FASTESTMIRRORTIMEOUT_DEFAULT   2.0

LRO_FASTESTMIRRORTIMEOUT

Definition at line 104 of file handle.h.

#define LRO_GNUPGHOMEDIR_DEFAULT   NULL

LRO_GNUPGHOMEDIR

Definition at line 101 of file handle.h.

#define LRO_IPRESOLVE_DEFAULT   LR_IPRESOLVE_WHATEVER

LRO_IPRESOLVE default value

Definition at line 92 of file handle.h.

#define LRO_LOWSPEEDLIMIT_DEFAULT   1000

LRO_LOWSPEEDLIMIT default value

Definition at line 89 of file handle.h.

#define LRO_LOWSPEEDLIMIT_MIN   0

LRO_LOWSPEEDLIMIT minimal allowed value

Definition at line 86 of file handle.h.

#define LRO_LOWSPEEDTIME_DEFAULT   120

LRO_LOWSPEEDTIME default value

Definition at line 83 of file handle.h.

#define LRO_LOWSPEEDTIME_MIN   0

LRO_LOWSPEEDTIME minimal allowed value

Definition at line 80 of file handle.h.

#define LRO_MAXDOWNLOADSPERMIRROR_DEFAULT   3

LRO_MAXDOWNLOADSPERMIRROR default value

Definition at line 74 of file handle.h.

#define LRO_MAXDOWNLOADSPERMIRROR_MIN   1

LRO_MAXDOWNLOADSPERMIRROR minimal allowed value

Definition at line 77 of file handle.h.

#define LRO_MAXMIRRORTRIES_DEFAULT   0

LRO_MAXMIRRORTRIES default value

Definition at line 59 of file handle.h.

#define LRO_MAXMIRRORTRIES_MIN   0

LRO_MAXMIRRORTRIES minimal allowed value

Definition at line 62 of file handle.h.

#define LRO_MAXPARALLELDOWNLOADS_DEFAULT   3

LRO_MAXPARALLELDOWNLOADS default value

Definition at line 65 of file handle.h.

#define LRO_MAXPARALLELDOWNLOADS_MAX   20

LRO_MAXPARALLELDOWNLOADS maximal allowed value

Definition at line 71 of file handle.h.

#define LRO_MAXPARALLELDOWNLOADS_MIN   1

LRO_MAXPARALLELDOWNLOADS minimal allowed value

Definition at line 68 of file handle.h.

#define LRO_MAXSPEED_DEFAULT   G_GINT64_CONSTANT(0)

LRO_MAXSPEED default value (0 == unlimited speed)

Definition at line 53 of file handle.h.

#define LRO_PROXYPORT_DEFAULT   1080

LRO_PROXYPORT default value

Definition at line 47 of file handle.h.

#define LRO_PROXYTYPE_DEFAULT   LR_PROXY_HTTP

LRO_PROXYTYPE default value

Definition at line 50 of file handle.h.

Typedef Documentation

typedef struct _LrHandle LrHandle

Handle object containing configration for repository metadata and package downloading.

Definition at line 38 of file handle.h.

Enumeration Type Documentation

Handle options for the lr_handle_getinfo function.

Enumerator
LRI_UPDATE 

(long *)

LRI_URLS 

(char ***) NOTE: Returned list must be freed as well as all its items! You could use g_strfreev() function.

LRI_MIRRORLIST 

(char **)

LRI_MIRRORLISTURL 

(char **)

LRI_METALINKURL 

(char **)

LRI_LOCAL 

(long *)

LRI_PROGRESSCB 

(void *)

LRI_PROGRESSDATA 

(LrProgressCb)

LRI_DESTDIR 

(char **)

LRI_REPOTYPE 

(long *)

LRI_USERAGENT 

(char **)

LRI_YUMDLIST 

(char ***) NOTE: Returned list must be freed as well as all its items! You could use g_strfreev() function.

LRI_YUMBLIST 

(char ***) NOTE: Returned list must be freed as well as all its items! You could use g_strfreev() function.

LRI_FETCHMIRRORS 

(long *)

LRI_MAXMIRRORTRIES 

(long *)

LRI_VARSUB 

(LrUrlVars **)

LRI_MIRRORS 

(char ***) Mirrorlist associated with the repository.

If LRO_MIRRORLIST was specified, then content of this list is created from the specified mirrorlist. If no LRO_MIRRORLIST was specified and repository is on a local filesystem and contains a mirrorlist then the mirrorlist is automatically loaded.

Mirrors from this list are used for downloading only if the mirrorlist was specified by LRO_MIRRORLIST option! Automatically loaded mirrorlist from a local repository is not implicitly used for downloading!

NOTE: Returned list must be freed as well as all its items! You could use g_strfreev() function.

LRI_METALINK 

(LrMetalink *)

LRI_FASTESTMIRROR 

(long *)

LRI_FASTESTMIRRORCACHE 

(char **)

LRI_FASTESTMIRRORMAXAGE 

(long *)

LRI_HMFCB 

(LrHandleMirrorFailureCb)

LRI_SSLVERIFYPEER 

(long *)

LRI_SSLVERIFYHOST 

(long *)

LRI_IPRESOLVE 

(LrIpResolveType *)

LRI_ALLOWEDMIRRORFAILURES 

(long *)

LRI_ADAPTIVEMIRRORSORTING 

(long *)

LRI_GNUPGHOMEDIR 

(char **)

LRI_FASTESTMIRRORTIMEOUT 

(double *)

Definition at line 307 of file handle.h.

Handle options for the lr_handle_setopt function.

Enumerator
LRO_UPDATE 

(long 1 or 0) Update existing repo in LrResult. Update means download missing (previously omitted) metadata file(s).

LRO_URLS 

(char ** NULL-terminated) List of base repo URLs

LRO_MIRRORLIST 

(char *) Mirrorlist or metalink url. This option is DEPRECATED

LRO_MIRRORLISTURL 

(char *) Mirrorlist url

LRO_METALINKURL 

(char *) Metalink url

LRO_LOCAL 

(long 1 or 0) Do not duplicate local metadata, just locate the old one

LRO_HTTPAUTH 

(long 1 or 0) Enable all supported method of HTTP authentification.

LRO_USERPWD 

(char *) User and password for http authetification in format user:password

LRO_PROXY 

(char *) Address of proxy server eg. "proxy-host.com:8080"

LRO_PROXYPORT 

(long) Set port number for proxy separately. Default port is 1080.

LRO_PROXYTYPE 

(LrProxyType) Type of the proxy used.

LRO_PROXYAUTH 

(long 1 or 0) Enable all supported method for proxy authentification

LRO_PROXYUSERPWD 

(char *) User and password for proxy in format user:password

LRO_PROGRESSCB 

(LrProgressCb) Progress callback

LRO_PROGRESSDATA 

(void *) Progress callback user data

LRO_MAXSPEED 

(gint64) Maximum download speed in bytes per second. Default is 0 = unlimited download speed.

LRO_DESTDIR 

(char *) Where to save downloaded files

LRO_REPOTYPE 

(LrRepotype) Type of downloaded repo, currently only supported is LR_YUMREPO.

LRO_CONNECTTIMEOUT 

(long) Max time in sec for connection phase. default timeout is 300 seconds.

LRO_IGNOREMISSING 

(long 1 or 0) If you want to localise (LRO_LOCAL is enabled) a incomplete local repository (eg. only primary and filelists are present) you could use LRO_YUMDLIST and specify only file that are present, or use this option.

LRO_INTERRUPTIBLE 

(long 1 or 0) If true, Librepo setups its own signal handler for SIGTERM and stops downloading if SIGTERM is catched. In this case current operation could return any kind of error code. Handle which operation was interrupted shoud never be used again!

LRO_USERAGENT 

(char *) String for User-Agent: header in the http request sent to the remote server

LRO_FETCHMIRRORS 

(long 1 or 0) If true - do not download anything, except mirrorlist or metalink (during lr_handle_perform()).

LRO_MAXMIRRORTRIES 

(long) If download fails try at most the specified number of mirrors. 0 means try all available mirrors.

LRO_MAXPARALLELDOWNLOADS 

(long) Maximum number of parallel downloads.

LRO_MAXDOWNLOADSPERMIRROR 

(long) Maximum number of parallel downloads per mirror.

LRO_VARSUB 

(LrUrlVars *) Variables and its substitutions for repo URL. [{"releasever", "f18"}], ...; (e.g.: http://foo/$releasever => http://foo/f18) LrUrlVars has to be constructed by the lr_urlvars_set() function. After set the list to the handle, it has not to be freed! Handle itself takes care about freeing the list.

LRO_FASTESTMIRROR 

(long 1 or 0) Sort the internal mirrorlist, after it is constructed, by the determined connection speed. Disabled by default.

LRO_FASTESTMIRRORCACHE 

(char *) Path to the fastestmirror's cache file. Used when LRO_FASTESTMIRROR is enabled. If it doesn't exists, it will be created.

LRO_GPGCHECK 

(long 1 or 0) Check GPG signature if available

LRO_CHECKSUM 

(long 1 or 0) Check files checksum if available

LRO_YUMDLIST 

(char ** NULL-terminated) Download only specified records from repomd (e.g. ["primary", "filelists", NULL]). Note: Last element of the list must be NULL!

LRO_YUMBLIST 

(char ** NULL-terminated) Do not download this specified records from repomd (blacklist). Note: Last element of the list must be NULL!

LRO_HMFCB 

(LrHandleMirrorFailureCb) Handle specific mirror failure callaback. Callback called when a repodata download from a mirror fails. This callback gets the user data setted by LRO_PROGRESSDATA

LRO_SSLVERIFYPEER 

(long 1 or 0) This option determines whether librepo verifies the authenticity of the peer's certificate. This trust is based on a chain of digital signatures, rooted in certification authority (CA) certificates.

LRO_SSLVERIFYHOST 

(long 1 or 0) This option determines whether librepo verifies that the server cert is for the server it is known as.

LRO_IPRESOLVE 

(LrIpResolveType) Sets what kind of IP addresses to use when resolving host names.

LRO_ALLOWEDMIRRORFAILURES 

(long) If all transfers from a mirror failed (no successful transfer from the mirror exists) and the number of failed downloads is higher or equal to this value the mirror will be skipped (ignored) for all next downloads. Note: Number of failed transfers for a single mirror can outreach this number! For example, if you set this value to 1 but you allow 3 parallel downloads it is possible that all three downloads start from the mirror, before any of them can fail. Then, if all three transfers fail, the number of failures for the mirror will be 3, even if this option was set to 1. Set -1 or 0 to disable this option

LRO_ADAPTIVEMIRRORSORTING 

(long 1 or 0) If enabled, internal list of mirrors for each handle is re-sorted after each finished transfer. The the sorting is based on mirror error rate etc.

LRO_GNUPGHOMEDIR 

(char *) Configuration directory for GNUPG (a directory with keyring)

LRO_FASTESTMIRRORTIMEOUT 

(double) Max length of fastest mirror measurement in seconds. Default value is 2sec

LRO_SENTINEL 

Sentinel

Definition at line 108 of file handle.h.

Function Documentation

void lr_handle_free ( LrHandle handle)

Frees handle and its content.

Parameters
handleHandle.
gboolean lr_handle_getinfo ( LrHandle handle,
GError **  err,
LrHandleInfoOption  option,
  ... 
)

Get information from handle. Most of returned pointers point directly to the handle internal values and therefore you should assume that they are only valid until any manipulation (lr_handle_setopt, lr_handle_perform, ...) with handle occurs. NOTE: You should not free or modify the memory returned by this function unless it is explicitly mentioned!

Parameters
handleLibrepo handle.
errGError **
optionOption from LrHandleInfoOption enum.
...Apropriate variable fro the selected option.
Returns
TRUE if everything is ok, FALSE if err is set.
LrHandle* lr_handle_init ( )

Return new handle.

Returns
New allocated handle.
gboolean lr_handle_perform ( LrHandle handle,
LrResult result,
GError **  err 
)

Perform repodata download or location.

Parameters
handleLibrepo handle.
resultLibrepo result.
errGError **
Returns
TRUE if everything is ok, FALSE if err is set.
gboolean lr_handle_setopt ( LrHandle handle,
GError **  err,
LrHandleOption  option,
  ... 
)

Set option (LrHandleOption) of the handle.

Parameters
handleHandle.
errGError **
optionOption from LrHandleOption enum.
...Value for the option.
Returns
TRUE if everything is ok, FALSE if err is set.