]> git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libstrongswan/fetcher/fetcher_manager.h
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libstrongswan / fetcher / fetcher_manager.h
1 /*
2 * Copyright (C) 2008 Martin Willi
3 *
4 * Copyright (C) secunet Security Networks AG
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 /**
18 * @defgroup fetcher_manager fetcher_manager
19 * @{ @ingroup fetcher
20 */
21
22 #ifndef FETCHER_MANAGER_H_
23 #define FETCHER_MANAGER_H_
24
25 typedef struct fetcher_manager_t fetcher_manager_t;
26
27 #include <fetcher/fetcher.h>
28
29 /**
30 * Fetches from URIs using registered fetcher_t instances.
31 */
32 struct fetcher_manager_t {
33
34 /**
35 * Fetch data from URI.
36 *
37 * The variable argument list contains fetcher_option_t's, followed
38 * by a option specific data argument.
39 * If no FETCH_CALLBACK function is given as option, userdata must be
40 * a chunk_t*. This chunk gets allocated, accumulated data using the
41 * fetcher_default_callback() function.
42 *
43 * @param uri URI to fetch from
44 * @param userdata userdata to pass to callback function.
45 * @param options FETCH_END terminated fetcher_option_t arguments
46 * @return status indicating result of fetch
47 */
48 status_t (*fetch)(fetcher_manager_t *this, char *url, void *userdata, ...);
49
50 /**
51 * Register a fetcher implementation.
52 *
53 * @param constructor fetcher constructor function
54 * @param url URL type this fetcher fetches, e.g. "http://"
55 */
56 void (*add_fetcher)(fetcher_manager_t *this,
57 fetcher_constructor_t constructor, char *url);
58
59 /**
60 * Unregister a previously registered fetcher implementation.
61 *
62 * @param constructor fetcher constructor function to unregister
63 */
64 void (*remove_fetcher)(fetcher_manager_t *this,
65 fetcher_constructor_t constructor);
66
67 /**
68 * Destroy a fetcher_manager instance.
69 */
70 void (*destroy)(fetcher_manager_t *this);
71 };
72
73 /**
74 * Create a fetcher_manager instance.
75 */
76 fetcher_manager_t *fetcher_manager_create();
77
78 #endif /** FETCHER_MANAGER_H_ @}*/