2 * Copyright (C) 2008 Martin Willi
4 * Copyright (C) secunet Security Networks AG
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>.
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
18 * @defgroup fetcher_manager fetcher_manager
22 #ifndef FETCHER_MANAGER_H_
23 #define FETCHER_MANAGER_H_
25 typedef struct fetcher_manager_t fetcher_manager_t
;
27 #include <fetcher/fetcher.h>
30 * Fetches from URIs using registered fetcher_t instances.
32 struct fetcher_manager_t
{
35 * Fetch data from URI.
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.
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
48 status_t (*fetch
)(fetcher_manager_t
*this, char *url
, void *userdata
, ...);
51 * Register a fetcher implementation.
53 * @param constructor fetcher constructor function
54 * @param url URL type this fetcher fetches, e.g. "http://"
56 void (*add_fetcher
)(fetcher_manager_t
*this,
57 fetcher_constructor_t constructor
, char *url
);
60 * Unregister a previously registered fetcher implementation.
62 * @param constructor fetcher constructor function to unregister
64 void (*remove_fetcher
)(fetcher_manager_t
*this,
65 fetcher_constructor_t constructor
);
68 * Destroy a fetcher_manager instance.
70 void (*destroy
)(fetcher_manager_t
*this);
74 * Create a fetcher_manager instance.
76 fetcher_manager_t
*fetcher_manager_create();
78 #endif /** FETCHER_MANAGER_H_ @}*/