Added plugin_loader method to reload plugin configurations
[strongswan.git] / src / libstrongswan / plugins / plugin_loader.h
1 /*
2 * Copyright (C) 2007 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 plugin_loader plugin_loader
18 * @{ @ingroup plugin
19 */
20
21 #ifndef PLUGIN_LOADER_H_
22 #define PLUGIN_LOADER_H_
23
24 typedef struct plugin_loader_t plugin_loader_t;
25
26 #include <utils/enumerator.h>
27
28 /**
29 * The plugin_loader loads plugins from a directory and initializes them
30 */
31 struct plugin_loader_t {
32
33 /**
34 * Load a list of plugins from a directory.
35 *
36 * Each plugin in list may have a ending exclamation mark (!) to mark it
37 * as a critical plugin. If loading a critical plugin fails, plugin loading
38 * is aborted and FALSE is returned.
39 *
40 * @param path path containing loadable plugins, NULL for default
41 * @param list space separated list of plugins to load
42 * @return TRUE if all critical plugins loaded successfully
43 */
44 bool (*load)(plugin_loader_t *this, char *path, char *list);
45
46 /**
47 * Reload the configuration of one or multiple plugins.
48 *
49 * @param space separated plugin names to reload, NULL for all
50 * @return number of plugins that did support reloading
51 */
52 u_int (*reload)(plugin_loader_t *this, char *list);
53
54 /**
55 * Unload all loaded plugins.
56 */
57 void (*unload)(plugin_loader_t *this);
58
59 /**
60 * Create an enumerator over all loaded plugins.
61 *
62 * @return enumerator over plugin_t*
63 */
64 enumerator_t* (*create_plugin_enumerator)(plugin_loader_t *this);
65
66 /**
67 * Unload loaded plugins, destroy plugin_loader instance.
68 */
69 void (*destroy)(plugin_loader_t *this);
70 };
71
72 /**
73 * Create a plugin_loader instance.
74 *
75 * @return plugin loader instance
76 */
77 plugin_loader_t *plugin_loader_create();
78
79 #endif /** PLUGIN_LOADER_H_ @}*/