Librepo library  1.13.0
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
41 
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 
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 
270  /* LR_YUMREPO specific options */
271 
277  LRO_RPMMDDLIST = LRO_YUMDLIST,
278 
283  LRO_RPMMDBLIST = LRO_YUMBLIST,
284 
433 } LrHandleOption;
436 typedef enum {
453  LRI_RPMMDDLIST = LRI_YUMDLIST,
457  LRI_RPMMDBLIST = LRI_YUMBLIST,
507  LRI_SENTINEL,
513 LrHandle *
514 lr_handle_init(void);
515 
519 void
520 lr_handle_free(LrHandle *handle);
521 
529 gboolean
530 lr_handle_setopt(LrHandle *handle,
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
LrHandleInfoOption
Definition: handle.h:436
gboolean lr_handle_getinfo(LrHandle *handle, GError **err, LrHandleInfoOption option,...)
gboolean lr_handle_setopt(LrHandle *handle, GError **err, LrHandleOption option,...)
gboolean lr_handle_perform(LrHandle *handle, LrResult *result, GError **err)
struct _LrResult LrResult
Definition: result.h:37
void lr_handle_free(LrHandle *handle)
LrHandle * lr_handle_init(void)
struct _LrHandle LrHandle
Definition: handle.h:38