summaryrefslogtreecommitdiff
path: root/include/openvpn-plugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/openvpn-plugin.h')
-rw-r--r--include/openvpn-plugin.h186
1 files changed, 93 insertions, 93 deletions
diff --git a/include/openvpn-plugin.h b/include/openvpn-plugin.h
index dc5887b..8ce8ea7 100644
--- a/include/openvpn-plugin.h
+++ b/include/openvpn-plugin.h
@@ -6,7 +6,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
@@ -35,7 +35,7 @@
#define __OPENVPN_X509_CERT_T_DECLARED
typedef mbedtls_x509_crt openvpn_x509_cert_t;
#endif
-#else
+#else /* ifdef ENABLE_CRYPTO_MBEDTLS */
#include <openssl/x509.h>
#ifndef __OPENVPN_X509_CERT_T_DECLARED
#define __OPENVPN_X509_CERT_T_DECLARED
@@ -55,7 +55,7 @@ extern "C" {
*/
#define OPENVPN_VERSION_MAJOR 2
#define OPENVPN_VERSION_MINOR 4
-#define OPENVPN_VERSION_PATCH "_rc1"
+#define OPENVPN_VERSION_PATCH ".0"
/*
* Plug-in types. These types correspond to the set of script callbacks
@@ -86,7 +86,7 @@ extern "C" {
*
* FUNC: openvpn_plugin_func_v1 OPENVPN_PLUGIN_CLIENT_CONNECT_V2
* FUNC: openvpn_plugin_func_v1 OPENVPN_PLUGIN_LEARN_ADDRESS
- *
+ *
* [Client session ensues]
*
* For each "TLS soft reset", according to reneg-sec option (or similar):
@@ -97,7 +97,7 @@ extern "C" {
* in the server chain)
* FUNC: openvpn_plugin_func_v1 OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY
* FUNC: openvpn_plugin_func_v1 OPENVPN_PLUGIN_TLS_FINAL
- *
+ *
* [If OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY returned OPENVPN_PLUGIN_FUNC_DEFERRED,
* we expect that authentication is verified via auth_control_file within
* the number of seconds defined by the "hand-window" option. Data channel traffic
@@ -156,9 +156,9 @@ typedef void *openvpn_plugin_handle_t;
* For Windows (needs to be modified for MSVC)
*/
#if defined(_WIN32) && !defined(OPENVPN_PLUGIN_H)
-# define OPENVPN_EXPORT __declspec(dllexport)
+#define OPENVPN_EXPORT __declspec(dllexport)
#else
-# define OPENVPN_EXPORT
+#define OPENVPN_EXPORT
#endif
/*
@@ -173,7 +173,7 @@ typedef void *openvpn_plugin_handle_t;
#define OPENVPN_PLUGIN_DEF typedef
#define OPENVPN_PLUGIN_FUNC(name) (*name)
-#else
+#else /* ifdef OPENVPN_PLUGIN_H */
/*
* We are compiling plugin.
@@ -192,9 +192,9 @@ typedef void *openvpn_plugin_handle_t;
*/
struct openvpn_plugin_string_list
{
- struct openvpn_plugin_string_list *next;
- char *name;
- char *value;
+ struct openvpn_plugin_string_list *next;
+ char *name;
+ char *value;
};
@@ -227,35 +227,35 @@ struct openvpn_plugin_string_list
*/
typedef enum
{
- PLOG_ERR = (1 << 0), /* Error condition message */
- PLOG_WARN = (1 << 1), /* General warning message */
- PLOG_NOTE = (1 << 2), /* Informational message */
- PLOG_DEBUG = (1 << 3), /* Debug message, displayed if verb >= 7 */
+ PLOG_ERR = (1 << 0),/* Error condition message */
+ PLOG_WARN = (1 << 1),/* General warning message */
+ PLOG_NOTE = (1 << 2),/* Informational message */
+ PLOG_DEBUG = (1 << 3),/* Debug message, displayed if verb >= 7 */
- PLOG_ERRNO = (1 << 8), /* Add error description to message */
- PLOG_NOMUTE = (1 << 9), /* Mute setting does not apply for message */
+ PLOG_ERRNO = (1 << 8),/* Add error description to message */
+ PLOG_NOMUTE = (1 << 9), /* Mute setting does not apply for message */
} openvpn_plugin_log_flags_t;
#ifdef __GNUC__
#if __USE_MINGW_ANSI_STDIO
-# define _ovpn_chk_fmt(a, b) __attribute__ ((format(gnu_printf, (a), (b))))
+#define _ovpn_chk_fmt(a, b) __attribute__ ((format(gnu_printf, (a), (b))))
#else
-# define _ovpn_chk_fmt(a, b) __attribute__ ((format(__printf__, (a), (b))))
+#define _ovpn_chk_fmt(a, b) __attribute__ ((format(__printf__, (a), (b))))
#endif
-#else
-# define _ovpn_chk_fmt(a, b)
+#else /* ifdef __GNUC__ */
+#define _ovpn_chk_fmt(a, b)
#endif
-typedef void (*plugin_log_t) (openvpn_plugin_log_flags_t flags,
- const char *plugin_name,
- const char *format, ...) _ovpn_chk_fmt(3, 4);
+typedef void (*plugin_log_t)(openvpn_plugin_log_flags_t flags,
+ const char *plugin_name,
+ const char *format, ...) _ovpn_chk_fmt (3, 4);
-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, 0);
+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, 0);
/* #undef _ovpn_chk_fmt */
@@ -271,8 +271,8 @@ typedef void (*plugin_vlog_t) (openvpn_plugin_log_flags_t flags,
*/
struct openvpn_plugin_callbacks
{
- plugin_log_t plugin_log;
- plugin_vlog_t plugin_vlog;
+ plugin_log_t plugin_log;
+ plugin_vlog_t plugin_vlog;
};
/**
@@ -282,9 +282,9 @@ struct openvpn_plugin_callbacks
* and the plug-in against OpenSSL.
*/
typedef enum {
- SSLAPI_NONE,
- SSLAPI_OPENSSL,
- SSLAPI_MBEDTLS
+ SSLAPI_NONE,
+ SSLAPI_OPENSSL,
+ SSLAPI_MBEDTLS
} ovpnSSLAPI;
/**
@@ -310,15 +310,15 @@ typedef enum {
*/
struct openvpn_plugin_args_open_in
{
- const int type_mask;
- const char ** const argv;
- const char ** const envp;
- struct openvpn_plugin_callbacks *callbacks;
- const ovpnSSLAPI ssl_api;
- const char *ovpn_version;
- const unsigned int ovpn_version_major;
- const unsigned int ovpn_version_minor;
- const char * const ovpn_version_patch;
+ const int type_mask;
+ const char **const argv;
+ const char **const envp;
+ struct openvpn_plugin_callbacks *callbacks;
+ const ovpnSSLAPI ssl_api;
+ const char *ovpn_version;
+ const unsigned int ovpn_version_major;
+ const unsigned int ovpn_version_minor;
+ const char *const ovpn_version_patch;
};
@@ -345,9 +345,9 @@ struct openvpn_plugin_args_open_in
*/
struct openvpn_plugin_args_open_return
{
- int type_mask;
- openvpn_plugin_handle_t *handle;
- struct openvpn_plugin_string_list **return_list;
+ int type_mask;
+ openvpn_plugin_handle_t *handle;
+ struct openvpn_plugin_string_list **return_list;
};
/**
@@ -380,17 +380,17 @@ struct openvpn_plugin_args_open_return
*/
struct openvpn_plugin_args_func_in
{
- const int type;
- const char ** const argv;
- const char ** const envp;
- openvpn_plugin_handle_t handle;
- void *per_client_context;
+ const int type;
+ const char **const argv;
+ const char **const envp;
+ openvpn_plugin_handle_t handle;
+ void *per_client_context;
#ifdef ENABLE_CRYPTO
- int current_cert_depth;
- openvpn_x509_cert_t *current_cert;
+ int current_cert_depth;
+ openvpn_x509_cert_t *current_cert;
#else
- int __current_cert_depth_disabled; /* Unused, for compatibility purposes only */
- void *__current_cert_disabled; /* Unused, for compatibility purposes only */
+ int __current_cert_depth_disabled; /* Unused, for compatibility purposes only */
+ void *__current_cert_disabled; /* Unused, for compatibility purposes only */
#endif
};
@@ -408,7 +408,7 @@ struct openvpn_plugin_args_func_in
*/
struct openvpn_plugin_args_func_return
{
- struct openvpn_plugin_string_list **return_list;
+ struct openvpn_plugin_string_list **return_list;
};
/*
@@ -442,7 +442,7 @@ struct openvpn_plugin_args_func_return
* FUNCTION: openvpn_plugin_open_v2
*
* REQUIRED: YES
- *
+ *
* Called on initial plug-in load. OpenVPN will preserve plug-in state
* across SIGUSR1 restarts but not across SIGHUP restarts. A SIGHUP reset
* will cause the plugin to be closed and reopened.
@@ -474,10 +474,10 @@ struct openvpn_plugin_args_func_return
* An openvpn_plugin_handle_t value on success, NULL on failure
*/
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);
+ (unsigned int *type_mask,
+ const char *argv[],
+ const char *envp[],
+ struct openvpn_plugin_string_list **return_list);
/*
* FUNCTION: openvpn_plugin_func_v2
@@ -485,7 +485,7 @@ OPENVPN_PLUGIN_DEF openvpn_plugin_handle_t OPENVPN_PLUGIN_FUNC(openvpn_plugin_op
* Called to perform the work of a given script type.
*
* REQUIRED: YES
- *
+ *
* ARGUMENTS
*
* handle : the openvpn_plugin_handle_t value which was returned by
@@ -570,12 +570,12 @@ OPENVPN_PLUGIN_DEF openvpn_plugin_handle_t OPENVPN_PLUGIN_FUNC(openvpn_plugin_op
* authentication and client-specific packet filtering.
*/
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);
+ (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);
/*
@@ -590,8 +590,8 @@ OPENVPN_PLUGIN_DEF int OPENVPN_PLUGIN_FUNC(openvpn_plugin_func_v2)
* ARGUMENTS
*
* version : fixed value, defines the API version of the OpenVPN plug-in API. The plug-in
- * should validate that this value is matching the OPENVPN_PLUGINv3_STRUCTVER
- * value.
+ * should validate that this value is matching the OPENVPN_PLUGINv3_STRUCTVER
+ * value.
*
* arguments : Structure with all arguments available to the plug-in.
*
@@ -602,9 +602,9 @@ OPENVPN_PLUGIN_DEF int OPENVPN_PLUGIN_FUNC(openvpn_plugin_func_v2)
* OPENVPN_PLUGIN_FUNC_SUCCESS on success, OPENVPN_PLUGIN_FUNC_ERROR on failure
*/
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);
+ (const int version,
+ struct openvpn_plugin_args_open_in const *arguments,
+ struct openvpn_plugin_args_open_return *retptr);
/*
* FUNCTION: openvpn_plugin_func_v3
@@ -686,15 +686,15 @@ OPENVPN_PLUGIN_DEF int OPENVPN_PLUGIN_FUNC(openvpn_plugin_open_v3)
* authentication and client-specific packet filtering.
*/
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 int version,
+ struct openvpn_plugin_args_func_in const *arguments,
+ struct openvpn_plugin_args_func_return *retptr);
/*
* FUNCTION: openvpn_plugin_close_v1
*
* REQUIRED: YES
- *
+ *
* ARGUMENTS
*
* handle : the openvpn_plugin_handle_t value which was returned by
@@ -703,13 +703,13 @@ OPENVPN_PLUGIN_DEF int OPENVPN_PLUGIN_FUNC(openvpn_plugin_func_v3)
* Called immediately prior to plug-in unload.
*/
OPENVPN_PLUGIN_DEF void OPENVPN_PLUGIN_FUNC(openvpn_plugin_close_v1)
- (openvpn_plugin_handle_t handle);
+ (openvpn_plugin_handle_t handle);
/*
* FUNCTION: openvpn_plugin_abort_v1
*
* REQUIRED: NO
- *
+ *
* ARGUMENTS
*
* handle : the openvpn_plugin_handle_t value which was returned by
@@ -720,7 +720,7 @@ OPENVPN_PLUGIN_DEF void OPENVPN_PLUGIN_FUNC(openvpn_plugin_close_v1)
* openvpn_plugin_open callback.
*/
OPENVPN_PLUGIN_DEF void OPENVPN_PLUGIN_FUNC(openvpn_plugin_abort_v1)
- (openvpn_plugin_handle_t handle);
+ (openvpn_plugin_handle_t handle);
/*
* FUNCTION: openvpn_plugin_client_constructor_v1
@@ -737,7 +737,7 @@ OPENVPN_PLUGIN_DEF void OPENVPN_PLUGIN_FUNC(openvpn_plugin_abort_v1)
* return a void * to this memory region.
*
* REQUIRED: NO
- *
+ *
* ARGUMENTS
*
* handle : the openvpn_plugin_handle_t value which was returned by
@@ -748,8 +748,8 @@ OPENVPN_PLUGIN_DEF void OPENVPN_PLUGIN_FUNC(openvpn_plugin_abort_v1)
* void * pointer to plugin's private per-client memory region, or NULL
* if no memory region is required.
*/
-OPENVPN_PLUGIN_DEF void * OPENVPN_PLUGIN_FUNC(openvpn_plugin_client_constructor_v1)
- (openvpn_plugin_handle_t handle);
+OPENVPN_PLUGIN_DEF void *OPENVPN_PLUGIN_FUNC(openvpn_plugin_client_constructor_v1)
+ (openvpn_plugin_handle_t handle);
/*
* FUNCTION: openvpn_plugin_client_destructor_v1
@@ -757,7 +757,7 @@ OPENVPN_PLUGIN_DEF void * OPENVPN_PLUGIN_FUNC(openvpn_plugin_client_constructor_
* This function is called on client instance object destruction.
*
* REQUIRED: NO
- *
+ *
* ARGUMENTS
*
* handle : the openvpn_plugin_handle_t value which was returned by
@@ -767,7 +767,7 @@ OPENVPN_PLUGIN_DEF void * OPENVPN_PLUGIN_FUNC(openvpn_plugin_client_constructor_
* openvpn_plugin_client_constructor_v1, if defined.
*/
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, void *per_client_context);
/*
* FUNCTION: openvpn_plugin_select_initialization_point_v1
@@ -780,7 +780,7 @@ OPENVPN_PLUGIN_DEF void OPENVPN_PLUGIN_FUNC(openvpn_plugin_client_destructor_v1)
* OPENVPN_PLUGIN_INIT_PRE_CONFIG_PARSE.
*
* REQUIRED: NO
- *
+ *
* RETURN VALUE:
*
* An OPENVPN_PLUGIN_INIT_x value.
@@ -791,35 +791,35 @@ OPENVPN_PLUGIN_DEF void OPENVPN_PLUGIN_FUNC(openvpn_plugin_client_destructor_v1)
#define OPENVPN_PLUGIN_INIT_POST_UID_CHANGE 4
OPENVPN_PLUGIN_DEF int OPENVPN_PLUGIN_FUNC(openvpn_plugin_select_initialization_point_v1)
- (void);
+ (void);
/*
* FUNCTION: openvpn_plugin_min_version_required_v1
*
* This function is called by OpenVPN to query the minimum
- plugin interface version number required by the plugin.
+ * plugin interface version number required by the plugin.
*
* REQUIRED: NO
- *
+ *
* RETURN VALUE
*
* The minimum OpenVPN plugin interface version number necessary to support
* this plugin.
*/
OPENVPN_PLUGIN_DEF int OPENVPN_PLUGIN_FUNC(openvpn_plugin_min_version_required_v1)
- (void);
+ (void);
/*
* Deprecated functions which are still supported for backward compatibility.
*/
OPENVPN_PLUGIN_DEF openvpn_plugin_handle_t OPENVPN_PLUGIN_FUNC(openvpn_plugin_open_v1)
- (unsigned int *type_mask,
- const char *argv[],
- const char *envp[]);
+ (unsigned int *type_mask,
+ const char *argv[],
+ const char *envp[]);
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[]);
+ (openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[]);
#ifdef __cplusplus
}