diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2010-11-30 22:35:00 +0100 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2010-11-30 22:35:00 +0100 |
commit | d04d1d78c04b60a406bc5a24c004264f43af520f (patch) | |
tree | 2abef984326a8ddb48e1378914beadda75865d0e /plugin/environment.h | |
parent | 525d75316848f79208101e48a54e21396464c98b (diff) | |
download | eurephia-d04d1d78c04b60a406bc5a24c004264f43af520f.tar.gz eurephia-d04d1d78c04b60a406bc5a24c004264f43af520f.tar.xz eurephia-d04d1d78c04b60a406bc5a24c004264f43af520f.zip |
Implemented detection of OpenVPN tunnel device type
This will later be used to be able to support OpenVPN in tun mode
as well as the now only supported tap mode. It will first try to
detect the tunnel type based on the 'dev_type' environment variable
if available. If not, it will try to figure it out based on the
device name. If this fails, it is possible to force the eurephia
to a specific device type by setting the openvpn_devtype config
variable.
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Diffstat (limited to 'plugin/environment.h')
-rw-r--r-- | plugin/environment.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/plugin/environment.h b/plugin/environment.h index dbefe25..12b0d0b 100644 --- a/plugin/environment.h +++ b/plugin/environment.h @@ -49,6 +49,29 @@ */ char *get_env(eurephiaCTX *ctx, int logmasking, size_t len, const char *envp[], const char *fmt, ... ); +#define MAXLEN_DEVNAME 64 /**< Maximum allowed length of the device name of the tunnel device */ +/** + * Macro for retrieving the OpenVPN tunnel device name (openvpn --dev option) + * + * @param ctx eurephiaCTX + * @param env Char array pointer to the environment table where the value resides + * + * @return Returns a pointer to a new memory region with the value. This region must be freed after use. + * @see get_env() + */ +#define GETENV_DEVNAME(ctx, env) get_env(ctx, 0, MAXLEN_DEVNAME, env, "dev"); + +#define MAXLEN_DEVTYPE 8 /**< Maximum allowed length of the device type of the tunnel device */ +/** + * Macro for retrieving the OpenVPN tunnel device type (openvpn --dev-type option) + * + * @param ctx eurephiaCTX + * @param env Char array pointer to the environment table where the value resides + * + * @return Returns a pointer to a new memory region with the value. This region must be freed after use. + * @see get_env() + */ +#define GETENV_DEVTYPE(ctx, env) get_env(ctx, 0, MAXLEN_DEVTYPE, env, "dev_type"); #define MAXLEN_TLSID 2048 /**< Maximum allowed length of the TLS ID string*/ /** |