Librepo library  1.7.13
C library for downloading linux repository metadata and packages
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules
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 
41 #define LRO_FASTESTMIRRORMAXAGE_DEFAULT 2592000 // 30 days
42 
44 #define LRO_FASTESTMIRRORMAXAGE_MIN 0
45 
47 #define LRO_PROXYPORT_DEFAULT 1080
48 
50 #define LRO_PROXYTYPE_DEFAULT LR_PROXY_HTTP
51 
53 #define LRO_MAXSPEED_DEFAULT G_GINT64_CONSTANT(0)
54 
56 #define LRO_CONNECTTIMEOUT_DEFAULT 120
57 
59 #define LRO_MAXMIRRORTRIES_DEFAULT 0
60 
62 #define LRO_MAXMIRRORTRIES_MIN 0
63 
65 #define LRO_MAXPARALLELDOWNLOADS_DEFAULT 3
66 
68 #define LRO_MAXPARALLELDOWNLOADS_MIN 1
69 
71 #define LRO_MAXPARALLELDOWNLOADS_MAX 20
72 
74 #define LRO_MAXDOWNLOADSPERMIRROR_DEFAULT 3
75 
77 #define LRO_MAXDOWNLOADSPERMIRROR_MIN 1
78 
80 #define LRO_LOWSPEEDTIME_MIN 0
81 
83 #define LRO_LOWSPEEDTIME_DEFAULT 120
84 
86 #define LRO_LOWSPEEDLIMIT_MIN 0
87 
89 #define LRO_LOWSPEEDLIMIT_DEFAULT 1000
90 
92 #define LRO_IPRESOLVE_DEFAULT LR_IPRESOLVE_WHATEVER
93 
95 #define LRO_ALLOWEDMIRRORFAILURES_DEFAULT 4
96 
98 #define LRO_ADAPTIVEMIRRORSORTING_DEFAULT 1
99 
101 #define LRO_GNUPGHOMEDIR_DEFAULT NULL
102 
104 #define LRO_FASTESTMIRRORTIMEOUT_DEFAULT 2.0
105 
106 
108 typedef enum {
109 
218  LRO_FASTESTMIRRORMAXAGE, /*< (long)
219  Maximum age of a record in cache (seconds).
220  Default: 2592000 (30 days). */
221 
222  LRO_FASTESTMIRRORCB, /* (LrFastestMirrorCb)
223  Fastest mirror status callback */
224 
225  LRO_FASTESTMIRRORDATA, /* (void *)
226  User data for LRO_FASTESTMIRRORCB */
227 
228  LRO_LOWSPEEDTIME, /*< (long)
229  The time in seconds that the transfer should be below the
230  LRO_LOWSPEEDLIMIT for the library to consider it too slow
231  and abort. */
232 
233  LRO_LOWSPEEDLIMIT, /*< (long)
234  The transfer speed in bytes per second that the transfer
235  should be below during LRO_LOWSPEEDTIME seconds for
236  the library to consider it too slow and abort. */
237 
238  /* Repo common options */
239 
246  /* LR_YUMREPO specific options */
247 
304 } LrHandleOption;
307 typedef enum {
358  LRI_SENTINEL,
364 LrHandle *
366 
370 void
371 lr_handle_free(LrHandle *handle);
372 
380 gboolean
381 lr_handle_setopt(LrHandle *handle,
382  GError **err,
383  LrHandleOption option,
384  ...);
385 
399 gboolean
401  GError **err,
402  LrHandleInfoOption option,
403  ...);
404 
411 gboolean
412 lr_handle_perform(LrHandle *handle, LrResult *result, GError **err);
413 
416 G_END_DECLS
417 
418 #endif
LrHandleOption
Definition: handle.h:108
LrHandleInfoOption
Definition: handle.h:307
gboolean lr_handle_getinfo(LrHandle *handle, GError **err, LrHandleInfoOption option,...)
gboolean lr_handle_setopt(LrHandle *handle, GError **err, LrHandleOption option,...)
LrHandle * lr_handle_init()
gboolean lr_handle_perform(LrHandle *handle, LrResult *result, GError **err)
struct _LrResult LrResult
Definition: result.h:37
void lr_handle_free(LrHandle *handle)
struct _LrHandle LrHandle
Definition: handle.h:38