Librepo library  1.7.7
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 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 typedef enum {
102 
211  LRO_FASTESTMIRRORMAXAGE, /*< (long)
212  Maximum age of a record in cache (seconds).
213  Default: 2592000 (30 days). */
214 
215  LRO_FASTESTMIRRORCB, /* (LrFastestMirrorCb)
216  Fastest mirror status callback */
217 
218  LRO_FASTESTMIRRORDATA, /* (void *)
219  User data for LRO_FASTESTMIRRORCB */
220 
221  LRO_LOWSPEEDTIME, /*< (long)
222  The time in seconds that the transfer should be below the
223  LRO_LOWSPEEDLIMIT for the library to consider it too slow
224  and abort. */
225 
226  LRO_LOWSPEEDLIMIT, /*< (long)
227  The transfer speed in bytes per second that the transfer
228  should be below during LRO_LOWSPEEDTIME seconds for
229  the library to consider it too slow and abort. */
230 
231  /* Repo common options */
232 
239  /* LR_YUMREPO specific options */
240 
290 } LrHandleOption;
293 typedef enum {
342  LRI_SENTINEL,
348 LrHandle *
350 
354 void
355 lr_handle_free(LrHandle *handle);
356 
364 gboolean
365 lr_handle_setopt(LrHandle *handle,
366  GError **err,
367  LrHandleOption option,
368  ...);
369 
383 gboolean
385  GError **err,
386  LrHandleInfoOption option,
387  ...);
388 
395 gboolean
396 lr_handle_perform(LrHandle *handle, LrResult *result, GError **err);
397 
400 G_END_DECLS
401 
402 #endif
LrHandleOption
Definition: handle.h:101
LrHandleInfoOption
Definition: handle.h:293
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