Go to the documentation of this file.
25 #ifndef OPENVPN_PLUGIN_H_
26 #define OPENVPN_PLUGIN_H_
28 #define OPENVPN_PLUGIN_VERSION 3
30 #ifdef ENABLE_CRYPTO_MBEDTLS
31 #include <mbedtls/x509_crt.h>
32 #ifndef __OPENVPN_X509_CERT_T_DECLARED
33 #define __OPENVPN_X509_CERT_T_DECLARED
37 #include <openssl/x509.h>
38 #ifndef __OPENVPN_X509_CERT_T_DECLARED
39 #define __OPENVPN_X509_CERT_T_DECLARED
54 #define OPENVPN_VERSION_MAJOR 2
55 #define OPENVPN_VERSION_MINOR 6
56 #define OPENVPN_VERSION_PATCH "_git"
117 #define OPENVPN_PLUGIN_UP 0
118 #define OPENVPN_PLUGIN_DOWN 1
119 #define OPENVPN_PLUGIN_ROUTE_UP 2
120 #define OPENVPN_PLUGIN_IPCHANGE 3
121 #define OPENVPN_PLUGIN_TLS_VERIFY 4
122 #define OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY 5
123 #define OPENVPN_PLUGIN_CLIENT_CONNECT 6
124 #define OPENVPN_PLUGIN_CLIENT_DISCONNECT 7
125 #define OPENVPN_PLUGIN_LEARN_ADDRESS 8
126 #define OPENVPN_PLUGIN_CLIENT_CONNECT_V2 9
127 #define OPENVPN_PLUGIN_TLS_FINAL 10
129 #define OPENVPN_PLUGIN_ROUTE_PREDOWN 12
130 #define OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER 13
131 #define OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER_V2 14
132 #define OPENVPN_PLUGIN_N 15
137 #define OPENVPN_PLUGIN_MASK(x) (1<<(x))
148 #define OPENVPN_PLUGIN_FUNC_SUCCESS 0
149 #define OPENVPN_PLUGIN_FUNC_ERROR 1
150 #define OPENVPN_PLUGIN_FUNC_DEFERRED 2
155 #if defined(_WIN32) && !defined(OPENVPN_PLUGIN_H)
156 #define OPENVPN_EXPORT __declspec(dllexport)
158 #define OPENVPN_EXPORT
165 #ifdef OPENVPN_PLUGIN_H
170 #define OPENVPN_PLUGIN_DEF typedef
171 #define OPENVPN_PLUGIN_FUNC(name) (*name)
178 #define OPENVPN_PLUGIN_DEF OPENVPN_EXPORT
179 #define OPENVPN_PLUGIN_FUNC(name) name
226 #define OPENVPN_PLUGINv3_STRUCTVER 5
245 #if __USE_MINGW_ANSI_STDIO
246 #define _ovpn_chk_fmt(a, b) __attribute__ ((format(gnu_printf, (a), (b))))
248 #define _ovpn_chk_fmt(a, b) __attribute__ ((format(__printf__, (a), (b))))
251 #define _ovpn_chk_fmt(a, b)
255 const char *plugin_name,
259 const char *plugin_name,
520 (
unsigned int *type_mask,
596 void *per_client_context,
766 #define OPENVPN_PLUGIN_INIT_PRE_CONFIG_PARSE 1
767 #define OPENVPN_PLUGIN_INIT_PRE_DAEMON 2
768 #define OPENVPN_PLUGIN_INIT_POST_DAEMON 3
769 #define OPENVPN_PLUGIN_INIT_POST_UID_CHANGE 4
795 (
unsigned int *type_mask,
plugin_base64_decode_t plugin_base64_decode
int(* plugin_base64_encode_t)(const void *data, int size, char **str)
Export of openvpn_base64_encode() to be used inside plug-ins.
#define OPENVPN_PLUGIN_DEF
OPENVPN_PLUGIN_DEF void OPENVPN_PLUGIN_FUNC() openvpn_plugin_client_destructor_v1(openvpn_plugin_handle_t handle, void *per_client_context)
openvpn_plugin_handle_t handle
OPENVPN_PLUGIN_DEF int OPENVPN_PLUGIN_FUNC() openvpn_plugin_select_initialization_point_v1(void)
plugin_secure_memzero_t plugin_secure_memzero
Arguments used to transport variables to the plug-in.
struct openvpn_plugin_string_list * next
#define OPENVPN_PLUGIN_FUNC(name)
openvpn_plugin_log_flags_t
Definitions needed for the plug-in callback functions.
OPENVPN_PLUGIN_DEF int OPENVPN_PLUGIN_FUNC() openvpn_plugin_min_version_required_v1(void)
void(* plugin_log_t)(openvpn_plugin_log_flags_t flags, const char *plugin_name, const char *format,...) _ovpn_chk_fmt(3
OPENVPN_PLUGIN_DEF void OPENVPN_PLUGIN_FUNC() openvpn_plugin_close_v1(openvpn_plugin_handle_t handle)
This cleans up the last part of the plug-in, allows it to shut down cleanly and release the plug-in g...
const char *const ovpn_version_patch
const unsigned int ovpn_version_major
OPENVPN_PLUGIN_DEF void *OPENVPN_PLUGIN_FUNC() openvpn_plugin_client_constructor_v1(openvpn_plugin_handle_t handle)
openvpn_x509_cert_t * current_cert
int(* plugin_base64_decode_t)(const char *str, void *data, int size)
Export of openvpn_base64_decode() to be used inside plug-ins.
OPENVPN_PLUGIN_DEF void OPENVPN_PLUGIN_FUNC() openvpn_plugin_abort_v1(openvpn_plugin_handle_t handle)
plugin_base64_encode_t plugin_base64_encode
OPENVPN_PLUGIN_DEF openvpn_plugin_handle_t OPENVPN_PLUGIN_FUNC() openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const char *envp[])
void(*) typedef void(* plugin_vlog_t)(openvpn_plugin_log_flags_t flags, const char *plugin_name, const char *format, va_list arglist) _ovpn_chk_fmt(3
struct openvpn_plugin_string_list ** return_list
void * per_client_context
OPENVPN_PLUGIN_DEF int OPENVPN_PLUGIN_FUNC() openvpn_plugin_open_v3(const int version, struct openvpn_plugin_args_open_in const *arguments, struct openvpn_plugin_args_open_return *retptr)
This function is called when OpenVPN loads the plug-in.
plugin_vlog_t plugin_vlog
const char * ovpn_version
#define _ovpn_chk_fmt(a, b)
OPENVPN_PLUGIN_DEF int OPENVPN_PLUGIN_FUNC() openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
This function is called by OpenVPN each time the OpenVPN reaches a point where plug-in calls should h...
Arguments used to transport variables to and from the plug-in.
void(*) typedef void(*) typedef void(* plugin_secure_memzero_t)(void *data, size_t len)
Export of secure_memzero() to be used inside plug-ins.
OPENVPN_PLUGIN_DEF openvpn_plugin_handle_t OPENVPN_PLUGIN_FUNC() openvpn_plugin_open_v2(unsigned int *type_mask, const char *argv[], const char *envp[], struct openvpn_plugin_string_list **return_list)
Arguments used to transport variables from the plug-in back to the OpenVPN process.
Arguments used to transport variables to and from the plug-in.
openvpn_plugin_handle_t handle
ovpnSSLAPI
Used by the openvpn_plugin_open_v3() function to indicate to the plug-in what kind of SSL implementat...
OPENVPN_PLUGIN_DEF int OPENVPN_PLUGIN_FUNC() openvpn_plugin_func_v2(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[], void *per_client_context, struct openvpn_plugin_string_list **return_list)
struct openvpn_plugin_string_list ** return_list
Used by the openvpn_plugin_open_v3() function to pass callback function pointers to the plug-in.
void * openvpn_plugin_handle_t
struct openvpn_plugin_callbacks * callbacks
OPENVPN_PLUGIN_DEF int OPENVPN_PLUGIN_FUNC() openvpn_plugin_func_v3(const int version, struct openvpn_plugin_args_func_in const *arguments, struct openvpn_plugin_args_func_return *retptr)
const unsigned int ovpn_version_minor