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
8 * Copyright (C) 2002-2009 OpenVPN Technologies, Inc. <sales@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"
38 #define MAX_PLUGINS 16
40 struct plugin_option
{
41 const char *so_pathname
;
45 struct plugin_option_list
{
47 struct plugin_option plugins
[MAX_PLUGINS
];
52 const char *so_pathname
;
53 unsigned int plugin_type_mask
;
54 int requested_initialization_point
;
56 #if defined(USE_LIBDL)
58 #elif defined(USE_LOAD_LIBRARY)
62 openvpn_plugin_open_v1 open1
;
63 openvpn_plugin_open_v2 open2
;
64 openvpn_plugin_func_v1 func1
;
65 openvpn_plugin_func_v2 func2
;
66 openvpn_plugin_close_v1 close
;
67 openvpn_plugin_abort_v1 abort
;
68 openvpn_plugin_client_constructor_v1 client_constructor
;
69 openvpn_plugin_client_destructor_v1 client_destructor
;
70 openvpn_plugin_min_version_required_v1 min_version_required
;
71 openvpn_plugin_select_initialization_point_v1 initialization_point
;
73 openvpn_plugin_handle_t plugin_handle
;
76 struct plugin_per_client
78 void *per_client_context
[MAX_PLUGINS
];
84 struct plugin plugins
[MAX_PLUGINS
];
89 struct plugin_per_client per_client
;
90 struct plugin_common
*common
;
97 struct openvpn_plugin_string_list
*list
[MAX_PLUGINS
];
100 struct plugin_option_list
*plugin_option_list_new (struct gc_arena
*gc
);
101 bool plugin_option_list_add (struct plugin_option_list
*list
, char **p
, struct gc_arena
*gc
);
104 void plugin_option_list_print (const struct plugin_option_list
*list
, int msglevel
);
107 struct plugin_list
*plugin_list_init (const struct plugin_option_list
*list
);
109 void plugin_list_open (struct plugin_list
*pl
,
110 const struct plugin_option_list
*list
,
111 struct plugin_return
*pr
,
112 const struct env_set
*es
,
113 const int init_point
);
115 struct plugin_list
*plugin_list_inherit (const struct plugin_list
*src
);
117 int plugin_call (const struct plugin_list
*pl
,
119 const struct argv
*av
,
120 struct plugin_return
*pr
,
123 void plugin_list_close (struct plugin_list
*pl
);
124 bool plugin_defined (const struct plugin_list
*pl
, const int type
);
126 void plugin_return_get_column (const struct plugin_return
*src
,
127 struct plugin_return
*dest
,
128 const char *colname
);
130 void plugin_return_free (struct plugin_return
*pr
);
133 void plugin_return_print (const int msglevel
, const char *prefix
, const struct plugin_return
*pr
);
137 plugin_n (const struct plugin_list
*pl
)
139 if (pl
&& pl
->common
)
140 return pl
->common
->n
;
146 plugin_return_defined (const struct plugin_return
*pr
)
152 plugin_return_init (struct plugin_return
*pr
)
159 struct plugin_list
{ int dummy
; };
160 struct plugin_return
{ int dummy
; };
163 plugin_defined (const struct plugin_list
*pl
, const int type
)
169 plugin_call (const struct plugin_list
*pl
,
171 const struct argv
*av
,
172 struct plugin_return
*pr
,
178 #endif /* ENABLE_PLUGIN */
180 #endif /* OPENVPN_PLUGIN_H */