summaryrefslogtreecommitdiff
path: root/src/openvpn/plugin.h
diff options
context:
space:
mode:
authorAlberto Gonzalez Iniesta <agi@inittab.org>2016-12-27 18:25:47 +0100
committerAlberto Gonzalez Iniesta <agi@inittab.org>2016-12-27 18:25:47 +0100
commit79f3537f69e125f19f59c36aa090120a63186a54 (patch)
tree2089a3b7dac990841dbc2e4d9b2f535b82dbb0af /src/openvpn/plugin.h
parentf2137fedb30cb87448eb03b2f288920df6187571 (diff)
parent3a2bbdb05ca6a6996e424c9fb225cb0d53804125 (diff)
Merge tag 'upstream/2.4.0'
Upstream version 2.4.0
Diffstat (limited to 'src/openvpn/plugin.h')
-rw-r--r--src/openvpn/plugin.h180
1 files changed, 94 insertions, 86 deletions
diff --git a/src/openvpn/plugin.h b/src/openvpn/plugin.h
index b1e0458..4ded529 100644
--- a/src/openvpn/plugin.h
+++ b/src/openvpn/plugin.h
@@ -5,7 +5,7 @@
* packet encryption, packet authentication, and
* packet compression.
*
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
+ * Copyright (C) 2002-2017 OpenVPN Technologies, Inc. <sales@openvpn.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
@@ -44,168 +44,176 @@
#define MAX_PLUGINS 16
struct plugin_option {
- const char *so_pathname;
- const char **argv;
+ const char *so_pathname;
+ const char **argv;
};
struct plugin_option_list {
- int n;
- struct plugin_option plugins[MAX_PLUGINS];
+ int n;
+ struct plugin_option plugins[MAX_PLUGINS];
};
struct plugin {
- bool initialized;
- const char *so_pathname;
- unsigned int plugin_type_mask;
- int requested_initialization_point;
+ bool initialized;
+ const char *so_pathname;
+ unsigned int plugin_type_mask;
+ int requested_initialization_point;
#ifndef _WIN32
- void *handle;
+ void *handle;
#else
- HMODULE module;
+ HMODULE module;
#endif
- openvpn_plugin_open_v1 open1;
- openvpn_plugin_open_v2 open2;
- openvpn_plugin_open_v3 open3;
- openvpn_plugin_func_v1 func1;
- openvpn_plugin_func_v2 func2;
- openvpn_plugin_func_v3 func3;
- openvpn_plugin_close_v1 close;
- openvpn_plugin_abort_v1 abort;
- openvpn_plugin_client_constructor_v1 client_constructor;
- openvpn_plugin_client_destructor_v1 client_destructor;
- openvpn_plugin_min_version_required_v1 min_version_required;
- openvpn_plugin_select_initialization_point_v1 initialization_point;
-
- openvpn_plugin_handle_t plugin_handle;
+ openvpn_plugin_open_v1 open1;
+ openvpn_plugin_open_v2 open2;
+ openvpn_plugin_open_v3 open3;
+ openvpn_plugin_func_v1 func1;
+ openvpn_plugin_func_v2 func2;
+ openvpn_plugin_func_v3 func3;
+ openvpn_plugin_close_v1 close;
+ openvpn_plugin_abort_v1 abort;
+ openvpn_plugin_client_constructor_v1 client_constructor;
+ openvpn_plugin_client_destructor_v1 client_destructor;
+ openvpn_plugin_min_version_required_v1 min_version_required;
+ openvpn_plugin_select_initialization_point_v1 initialization_point;
+
+ openvpn_plugin_handle_t plugin_handle;
};
struct plugin_per_client
{
- void *per_client_context[MAX_PLUGINS];
+ void *per_client_context[MAX_PLUGINS];
};
struct plugin_common
{
- int n;
- struct plugin plugins[MAX_PLUGINS];
+ int n;
+ struct plugin plugins[MAX_PLUGINS];
};
struct plugin_list
{
- struct plugin_per_client per_client;
- struct plugin_common *common;
- bool common_owned;
+ struct plugin_per_client per_client;
+ struct plugin_common *common;
+ bool common_owned;
};
struct plugin_return
{
- int n;
- struct openvpn_plugin_string_list *list[MAX_PLUGINS];
+ int n;
+ struct openvpn_plugin_string_list *list[MAX_PLUGINS];
};
-struct plugin_option_list *plugin_option_list_new (struct gc_arena *gc);
-bool plugin_option_list_add (struct plugin_option_list *list, char **p, struct gc_arena *gc);
+struct plugin_option_list *plugin_option_list_new(struct gc_arena *gc);
+
+bool plugin_option_list_add(struct plugin_option_list *list, char **p, struct gc_arena *gc);
#ifndef ENABLE_SMALL
-void plugin_option_list_print (const struct plugin_option_list *list, int msglevel);
+void plugin_option_list_print(const struct plugin_option_list *list, int msglevel);
+
#endif
-struct plugin_list *plugin_list_init (const struct plugin_option_list *list);
+struct plugin_list *plugin_list_init(const struct plugin_option_list *list);
-void plugin_list_open (struct plugin_list *pl,
- const struct plugin_option_list *list,
- struct plugin_return *pr,
- const struct env_set *es,
- const int init_point);
+void plugin_list_open(struct plugin_list *pl,
+ const struct plugin_option_list *list,
+ struct plugin_return *pr,
+ const struct env_set *es,
+ const int init_point);
-struct plugin_list *plugin_list_inherit (const struct plugin_list *src);
+struct plugin_list *plugin_list_inherit(const struct plugin_list *src);
-int plugin_call_ssl (const struct plugin_list *pl,
- const int type,
- const struct argv *av,
- struct plugin_return *pr,
- struct env_set *es
+int plugin_call_ssl(const struct plugin_list *pl,
+ const int type,
+ const struct argv *av,
+ struct plugin_return *pr,
+ struct env_set *es
#ifdef ENABLE_CRYPTO
- , int current_cert_depth,
- openvpn_x509_cert_t *current_cert
+ , int current_cert_depth,
+ openvpn_x509_cert_t *current_cert
#endif
- );
+ );
-void plugin_list_close (struct plugin_list *pl);
-bool plugin_defined (const struct plugin_list *pl, const int type);
+void plugin_list_close(struct plugin_list *pl);
-void plugin_return_get_column (const struct plugin_return *src,
- struct plugin_return *dest,
- const char *colname);
+bool plugin_defined(const struct plugin_list *pl, const int type);
-void plugin_return_free (struct plugin_return *pr);
+void plugin_return_get_column(const struct plugin_return *src,
+ struct plugin_return *dest,
+ const char *colname);
+
+void plugin_return_free(struct plugin_return *pr);
#ifdef ENABLE_DEBUG
-void plugin_return_print (const int msglevel, const char *prefix, const struct plugin_return *pr);
+void plugin_return_print(const int msglevel, const char *prefix, const struct plugin_return *pr);
+
#endif
static inline int
-plugin_n (const struct plugin_list *pl)
+plugin_n(const struct plugin_list *pl)
{
- if (pl && pl->common)
- return pl->common->n;
- else
- return 0;
+ if (pl && pl->common)
+ {
+ return pl->common->n;
+ }
+ else
+ {
+ return 0;
+ }
}
static inline bool
-plugin_return_defined (const struct plugin_return *pr)
+plugin_return_defined(const struct plugin_return *pr)
{
- return pr->n >= 0;
+ return pr->n >= 0;
}
static inline void
-plugin_return_init (struct plugin_return *pr)
+plugin_return_init(struct plugin_return *pr)
{
- pr->n = 0;
+ pr->n = 0;
}
-#else
+#else /* ifdef ENABLE_PLUGIN */
struct plugin_list { int dummy; };
struct plugin_return { int dummy; };
static inline bool
-plugin_defined (const struct plugin_list *pl, const int type)
+plugin_defined(const struct plugin_list *pl, const int type)
{
- return false;
+ return false;
}
static inline int
-plugin_call_ssl (const struct plugin_list *pl,
- const int type,
- const struct argv *av,
- struct plugin_return *pr,
- struct env_set *es
+plugin_call_ssl(const struct plugin_list *pl,
+ const int type,
+ const struct argv *av,
+ struct plugin_return *pr,
+ struct env_set *es
#ifdef ENABLE_CRYPTO
- , int current_cert_depth,
- openvpn_x509_cert_t *current_cert
+ , int current_cert_depth,
+ openvpn_x509_cert_t *current_cert
#endif
- )
+ )
{
- return 0;
+ return 0;
}
#endif /* ENABLE_PLUGIN */
static inline int
plugin_call(const struct plugin_list *pl,
- const int type,
- const struct argv *av,
- struct plugin_return *pr,
- struct env_set *es)
+ const int type,
+ const struct argv *av,
+ struct plugin_return *pr,
+ struct env_set *es)
{
- return plugin_call_ssl(pl, type, av, pr, es
+ return plugin_call_ssl(pl, type, av, pr, es
#ifdef ENABLE_CRYPTO
- , -1, NULL
+ , -1, NULL
#endif
- );
+ );
}
#endif /* OPENVPN_PLUGIN_H */