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