summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am2
-rw-r--r--include/Makefile.in8
-rw-r--r--include/openvpn-msg.h110
-rw-r--r--include/openvpn-plugin.h186
-rw-r--r--include/openvpn-plugin.h.in184
5 files changed, 245 insertions, 245 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index 498b3b5..a52c427 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -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>
# Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@gmail.com>
#
diff --git a/include/Makefile.in b/include/Makefile.in
index f381a43..ebd3f24 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.13.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
@@ -21,7 +21,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>
# Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@gmail.com>
#
@@ -392,8 +392,8 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
openvpn-plugin.h: stamp-h2
- @test -f $@ || rm -f stamp-h2
- @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h2
+ @if test ! -f $@; then rm -f stamp-h2; else :; fi
+ @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h2; else :; fi
stamp-h2: $(srcdir)/openvpn-plugin.h.in $(top_builddir)/config.status
@rm -f stamp-h2
diff --git a/include/openvpn-msg.h b/include/openvpn-msg.h
index f7fbdd2..5f3c96c 100644
--- a/include/openvpn-msg.h
+++ b/include/openvpn-msg.h
@@ -5,7 +5,7 @@
* packet encryption, packet authentication, and
* packet compression.
*
- * Copyright (C) 2013 Heiko Hund <heiko.hund@sophos.com>
+ * Copyright (C) 2013-2017 Heiko Hund <heiko.hund@sophos.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
@@ -26,90 +26,90 @@
#define OPENVPN_MSG_H_
typedef enum {
- msg_acknowledgement,
- msg_add_address,
- msg_del_address,
- msg_add_route,
- msg_del_route,
- msg_add_dns_cfg,
- msg_del_dns_cfg,
- msg_add_nbt_cfg,
- msg_del_nbt_cfg,
- msg_flush_neighbors,
- msg_add_block_dns,
- msg_del_block_dns,
- msg_register_dns
+ msg_acknowledgement,
+ msg_add_address,
+ msg_del_address,
+ msg_add_route,
+ msg_del_route,
+ msg_add_dns_cfg,
+ msg_del_dns_cfg,
+ msg_add_nbt_cfg,
+ msg_del_nbt_cfg,
+ msg_flush_neighbors,
+ msg_add_block_dns,
+ msg_del_block_dns,
+ msg_register_dns
} message_type_t;
typedef struct {
- message_type_t type;
- size_t size;
- int message_id;
+ message_type_t type;
+ size_t size;
+ int message_id;
} message_header_t;
typedef union {
- struct in_addr ipv4;
- struct in6_addr ipv6;
+ struct in_addr ipv4;
+ struct in6_addr ipv6;
} inet_address_t;
typedef struct {
- int index;
- char name[256];
+ int index;
+ char name[256];
} interface_t;
typedef struct {
- message_header_t header;
- short family;
- inet_address_t address;
- int prefix_len;
- interface_t iface;
+ message_header_t header;
+ short family;
+ inet_address_t address;
+ int prefix_len;
+ interface_t iface;
} address_message_t;
typedef struct {
- message_header_t header;
- short family;
- inet_address_t prefix;
- int prefix_len;
- inet_address_t gateway;
- interface_t iface;
- int metric;
+ message_header_t header;
+ short family;
+ inet_address_t prefix;
+ int prefix_len;
+ inet_address_t gateway;
+ interface_t iface;
+ int metric;
} route_message_t;
typedef struct {
- message_header_t header;
- interface_t iface;
- char domains[512];
- short family;
- int addr_len;
- inet_address_t addr[4]; /* support up to 4 dns addresses */
+ message_header_t header;
+ interface_t iface;
+ char domains[512];
+ short family;
+ int addr_len;
+ inet_address_t addr[4]; /* support up to 4 dns addresses */
} dns_cfg_message_t;
typedef struct {
- message_header_t header;
- interface_t iface;
- int disable_nbt;
- int nbt_type;
- char scope_id[256];
- struct in_addr primary_nbns;
- struct in_addr secondary_nbns;
+ message_header_t header;
+ interface_t iface;
+ int disable_nbt;
+ int nbt_type;
+ char scope_id[256];
+ struct in_addr primary_nbns;
+ struct in_addr secondary_nbns;
} nbt_cfg_message_t;
-// TODO: NTP
+/* TODO: NTP */
typedef struct {
- message_header_t header;
- short family;
- interface_t iface;
+ message_header_t header;
+ short family;
+ interface_t iface;
} flush_neighbors_message_t;
typedef struct {
- message_header_t header;
- int error_number;
+ message_header_t header;
+ int error_number;
} ack_message_t;
typedef struct {
- message_header_t header;
- interface_t iface;
+ message_header_t header;
+ interface_t iface;
} block_dns_message_t;
-#endif
+#endif /* ifndef OPENVPN_MSG_H_ */
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
}
diff --git a/include/openvpn-plugin.h.in b/include/openvpn-plugin.h.in
index 34ad18b..0b30352 100644
--- a/include/openvpn-plugin.h.in
+++ b/include/openvpn-plugin.h.in
@@ -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
@@ -34,7 +34,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
@@ -85,7 +85,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):
@@ -96,7 +96,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
@@ -155,9 +155,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
/*
@@ -172,7 +172,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.
@@ -191,9 +191,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;
};
@@ -226,35 +226,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
@@ -270,8 +270,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;
};
/**
@@ -281,9 +281,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;
/**
@@ -309,15 +309,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;
};
@@ -344,9 +344,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;
};
/**
@@ -379,17 +379,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
};
@@ -407,7 +407,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;
};
/*
@@ -441,7 +441,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.
@@ -473,10 +473,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
@@ -484,7 +484,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
@@ -569,12 +569,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);
/*
@@ -589,8 +589,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.
*
@@ -601,9 +601,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
@@ -685,15 +685,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
@@ -702,13 +702,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
@@ -719,7 +719,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
@@ -736,7 +736,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
@@ -747,8 +747,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
@@ -756,7 +756,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
@@ -766,7 +766,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
@@ -779,7 +779,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.
@@ -790,35 +790,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
}