Annotation of embedaddon/strongswan/src/libstrongswan/fetcher/fetcher_manager.h, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2008 Martin Willi
! 3: * HSR 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 registered fetcher_t instances.
! 30: */
! 31: struct fetcher_manager_t {
! 32:
! 33: /**
! 34: * Fetch data from URI.
! 35: *
! 36: * The variable argument list contains fetcher_option_t's, followed
! 37: * by a option specific data argument.
! 38: * If no FETCH_CALLBACK function is given as option, userdata must be
! 39: * a chunk_t*. This chunk gets allocated, accumulated data using the
! 40: * fetcher_default_callback() function.
! 41: *
! 42: * @param uri URI to fetch from
! 43: * @param userdata userdata to pass to callback function.
! 44: * @param options FETCH_END terminated fetcher_option_t arguments
! 45: * @return status indicating result of fetch
! 46: */
! 47: status_t (*fetch)(fetcher_manager_t *this, char *url, void *userdata, ...);
! 48:
! 49: /**
! 50: * Register a fetcher implementation.
! 51: *
! 52: * @param constructor fetcher constructor function
! 53: * @param url URL type this fetcher fetches, e.g. "http://"
! 54: */
! 55: void (*add_fetcher)(fetcher_manager_t *this,
! 56: fetcher_constructor_t constructor, char *url);
! 57:
! 58: /**
! 59: * Unregister a previously registered fetcher implementation.
! 60: *
! 61: * @param constructor fetcher constructor function to unregister
! 62: */
! 63: void (*remove_fetcher)(fetcher_manager_t *this,
! 64: fetcher_constructor_t constructor);
! 65:
! 66: /**
! 67: * Destroy a fetcher_manager instance.
! 68: */
! 69: void (*destroy)(fetcher_manager_t *this);
! 70: };
! 71:
! 72: /**
! 73: * Create a fetcher_manager instance.
! 74: */
! 75: fetcher_manager_t *fetcher_manager_create();
! 76:
! 77: #endif /** FETCHER_MANAGER_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>