rtrproxy builds now
[anytun.git] / openvpn / plugin.h
blob7d710b09375290f7ba5a7b1c8bee47067946325c
1 /*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single TCP/UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
6 * packet compression.
8 * Copyright (C) 2002-2005 OpenVPN Solutions LLC <info@openvpn.net>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program (see the file COPYING included with this
21 * distribution); if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 * plug-in support, using dynamically loaded libraries
29 #ifndef OPENVPN_PLUGIN_H
30 #define OPENVPN_PLUGIN_H
32 #include "openvpn-plugin.h"
34 #ifdef ENABLE_PLUGIN
36 #include "misc.h"
38 #define MAX_PLUGINS 32
40 struct plugin_option {
41 const char *so_pathname;
42 const char *args;
45 struct plugin_option_list {
46 int n;
47 struct plugin_option plugins[MAX_PLUGINS];
50 struct plugin {
51 const char *so_pathname;
52 unsigned int plugin_type_mask;
53 #if defined(USE_LIBDL)
54 void *handle;
55 #elif defined(USE_LOAD_LIBRARY)
56 HMODULE module;
57 #endif
58 openvpn_plugin_open_v1 open;
59 openvpn_plugin_func_v1 func;
60 openvpn_plugin_close_v1 close;
61 openvpn_plugin_abort_v1 abort;
63 openvpn_plugin_handle_t plugin_handle;
66 struct plugin_list {
67 int n;
68 struct plugin plugins[MAX_PLUGINS];
71 struct plugin_option_list *plugin_option_list_new (struct gc_arena *gc);
72 bool plugin_option_list_add (struct plugin_option_list *list, const char *so_pathname, const char *args);
74 #ifdef ENABLE_DEBUG
75 void plugin_option_list_print (const struct plugin_option_list *list, int msglevel);
76 #endif
78 struct plugin_list *plugin_list_open (const struct plugin_option_list *list, const struct env_set *es);
79 int plugin_call (const struct plugin_list *pl, const int type, const char *args, struct env_set *es);
80 void plugin_list_close (struct plugin_list *pl);
81 bool plugin_defined (const struct plugin_list *pl, const int type);
83 #else
85 struct plugin_list { int dummy; };
87 static inline bool
88 plugin_defined (const struct plugin_list *pl, const int type)
90 return false;
93 static inline int
94 plugin_call (const struct plugin_list *pl, const int type, const char *args, struct env_set *es)
96 return 0;
99 #endif /* ENABLE_PLUGIN */
101 #endif /* OPENVPN_PLUGIN_H */