diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2010-12-10 00:15:27 +0100 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2011-03-25 09:38:48 +0100 |
commit | 76b41d7f69853b07d2a32d7179136b2781dcedf8 (patch) | |
tree | 7c153f68806a6d2ab2ef45c9a5ba04a15180fa1d /plugin.c | |
parent | 6b2e3b9132e5820cebf4984c86ef742c11587790 (diff) | |
download | openvpn-76b41d7f69853b07d2a32d7179136b2781dcedf8.tar.gz openvpn-76b41d7f69853b07d2a32d7179136b2781dcedf8.tar.xz openvpn-76b41d7f69853b07d2a32d7179136b2781dcedf8.zip |
Implement the core v3 plug-in function calls.
Let OpenVPN call the openvpn_plugin_open_v3() and
openvpn_plugin_func_v3() plug-in functions if they exist in the plug-in.
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Acked-by: James Yonan <james@openvpn.net>
Diffstat (limited to 'plugin.c')
-rw-r--r-- | plugin.c | 29 |
1 files changed, 27 insertions, 2 deletions
@@ -298,7 +298,21 @@ plugin_open_item (struct plugin *p, /* * Call the plugin initialization */ - if (p->open2) + if (p->open3) { + struct openvpn_plugin_args_open_in args = { .type_mask = p->plugin_type_mask, + .argv = o->argv, + .envp = envp }; + struct openvpn_plugin_args_open_return retargs; + + CLEAR(retargs); + if ((*p->open3)(OPENVPN_PLUGIN_VERSION, &args, &retargs) == OPENVPN_PLUGIN_FUNC_SUCCESS) { + p->plugin_type_mask = retargs.type_mask; + p->plugin_handle = retargs.handle; + retlist = retargs.return_list; + } else { + p->plugin_handle = NULL; + } + } else if (p->open2) p->plugin_handle = (*p->open2)(&p->plugin_type_mask, o->argv, envp, retlist); else if (p->open1) p->plugin_handle = (*p->open1)(&p->plugin_type_mask, o->argv, envp); @@ -350,7 +364,18 @@ plugin_call_item (const struct plugin *p, /* * Call the plugin work function */ - if (p->func2) + if (p->func3) { + struct openvpn_plugin_args_func_in args = { .type = type, + .argv = (const char **) a.argv, + .envp = envp, + .handle = p->plugin_handle, + .per_client_context = per_client_context }; + struct openvpn_plugin_args_func_return retargs; + + CLEAR(retargs); + status = (*p->func3)(OPENVPN_PLUGIN_VERSION, &args, &retargs); + retlist = retargs.return_list; + } else if (p->func2) status = (*p->func2)(p->plugin_handle, type, (const char **)a.argv, envp, per_client_context, retlist); else if (p->func1) status = (*p->func1)(p->plugin_handle, type, (const char **)a.argv, envp); |