
Untitled
By: a guest on
Aug 1st, 2012 | syntax:
C | size: 1.01 KB | hits: 17 | expires: Never
/* NB: PROTOTYPE SUGGESTION - NOT COMPILE TESTED */
/* openvpn-plugin.h */
struct openvpn_plugin_args_open_in
{
const int type_mask;
const char ** const argv;
const char ** const envp;
void (*plugin_function_log) (const char *plgname, openvpn_plugin_log_flags_t f, const char *m, ...);
};
#ifdef PLUGIN_NAME
static void (*_plugin_log) (const char *plgname, openvpn_plugin_log_flags_t f, const char *m, ...);
#define OPENVPN_PREPARE_LOG_FUNCTION(plgargs_in) \
_plugin_log = (plgargs_in)->plugin_function_log;
#define plugin_log(flags, fmt, logdata...) _plugin_log(PLUGIN_NAME, flags, fmt, ## logdata);
#endif
/* how to use it in a plug-in: */
#define PLUGIN_NAME "demo"
#include <openvpn-plugin.h>
OPENVPN_EXPORT int
openvpn_plugin_open_v3 (const int v3structver,
struct openvpn_plugin_args_open_in const *args,
struct openvpn_plugin_args_open_return *ret)
{
OPENVPN_PREPARE_LOG_FUNCTION(args);
plugin_log(PLOG_INFO, "Hello world!");
}