summaryrefslogtreecommitdiffstats
path: root/plugin/environment.h
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2009-10-05 00:01:18 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2009-10-05 00:01:18 +0200
commit164032f3fcf86d4f08244764aab1b68a0fb6c71e (patch)
tree1541aa0612f9acc782d25d2170f2bdcd6ac2bdff /plugin/environment.h
parent8f8632ef5f8e63cc9495550c09605d4cc9c58de8 (diff)
downloadeurephia-164032f3fcf86d4f08244764aab1b68a0fb6c71e.tar.gz
eurephia-164032f3fcf86d4f08244764aab1b68a0fb6c71e.tar.xz
eurephia-164032f3fcf86d4f08244764aab1b68a0fb6c71e.zip
Use macros to extract values via get_env()
This has two purposes. To make the code more readable and to use the same maximum length of the data being retrieved from the environment table.
Diffstat (limited to 'plugin/environment.h')
-rw-r--r--plugin/environment.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/plugin/environment.h b/plugin/environment.h
index a8355cb..7f1041f 100644
--- a/plugin/environment.h
+++ b/plugin/environment.h
@@ -44,4 +44,56 @@
*/
char *get_env(eurephiaCTX *ctx, int logmasking, size_t len, const char *envp[], const char *fmt, ... );
+
+#define MAXLEN_TLSID 2048
+#define GETENV_TLSID(ctx, env, id) get_env(ctx, 0, MAXLEN_TLSID, env, "tls_id_%i", id)
+
+#define MAXLEN_TLSDIGEST 60
+#define GETENV_TLSDIGEST(ctx, env, id) get_env(ctx, 0, MAXLEN_TLSDIGEST, env, "tls_digest_%i", id)
+
+#define MAXLEN_UNTRUSTEDIP 34
+#define GETENV_UNTRUSTEDIP(ctx, env) get_env(ctx, 0, MAXLEN_UNTRUSTEDIP, env, "untrusted_ip")
+
+#define MAXLEN_USERNAME 34
+#define GETENV_USERNAME(ctx, env) get_env(ctx, 0, MAXLEN_USERNAME, env, "username")
+
+#define MAXLEN_PASSWORD 64
+#define GETENV_PASSWORD(ctx, env) get_env(ctx, 1, MAXLEN_PASSWORD, env, "password")
+
+#define MAXLEN_BYTESRECEIVED 21
+#define GETENV_BYTESRECEIVED(ctx, env) get_env(ctx, 0, MAXLEN_BYTESRECEIVED, env, "bytes_received");
+
+#define MAXLEN_BYTESSENT 21
+#define GETENV_BYTESSENT(ctx, env) get_env(ctx, 0, MAXLEN_BYTESSENT, env, "bytes_sent");
+
+#define MAXLEN_TIMEDURATION 21
+#define GETENV_TIMEDURATION(ctx, env) get_env(ctx, 0, MAXLEN_TIMEDURATION, env, "time_duration");
+
+#define MAXLEN_POOLNETMASK 34
+#define GETENV_POOLNETMASK(ctx, env) get_env(ctx, 0, MAXLEN_POOLNETMASK, env, "ifconfig_pool_netmask");
+
+#define MAXLEN_POOLIPADDR 34
+#define GETENV_POOLIPADDR(ctx, env) get_env(ctx, 0, MAXLEN_POOLIPADDR, env, "ifconfig_pool_remote_ip");
+
+#define MAXLEN_TRUSTEDIP 34
+#define GETENV_TRUSTEDIP(ctx, env) get_env(ctx, 0, MAXLEN_TRUSTEDIP, env, "trusted_ip");
+
+#define MAXLEN_PROTO1 4
+#define GETENV_PROTO1(ctx, env) get_env(ctx, 0, MAXLEN_PROTO1, env, "proto_1");
+
+#define MAXLEN_CNAME 64
+#define GETENV_CNAME(ctx, env) get_env(ctx, 0, MAXLEN_CNAME, env, "common_name");
+
+#define MAXLEN_TRUSTEDPORT 6
+#define GETENV_TRUSTEDPORT(ctx, env) get_env(ctx, 0, MAXLEN_TRUSTEDPORT, env, "trusted_port");
+
+#define MAXLEN_UNTRUSTEDPORT 6
+#define GETENV_UNTRUSTEDPORT(ctx, env) get_env(ctx, 0, MAXLEN_UNTRUSTEDPORT, env, "untrusted_port");
+
+#define MAXLEN_DAEMON 32
+#define GETENV_DAEMON(env) get_env(NULL, 0, MAXLEN_DAEMON, env, "daemon");
+
+#define MAXLEN_DAEMONLOGREDIR 32
+#define GETENV_DAEMONLOGREDIR(env) get_env(NULL, 0, MAXLEN_DAEMONLOGREDIR, env, "daemon_log_redirect");
+
#endif