MEDIUM: vars: adds support of variables

This patch adds support of variables during the processing of each stream. The
variables scope can be set as 'session', 'transaction', 'request' or 'response'.
The variable type is the type returned by the assignment expression. The type
can change while the processing.

The allocated memory can be controlled for each scope and each request, and for
the global process.
diff --git a/include/types/arg.h b/include/types/arg.h
index c621025..cccc565 100644
--- a/include/types/arg.h
+++ b/include/types/arg.h
@@ -28,6 +28,8 @@
 #include <common/chunk.h>
 #include <common/mini-clist.h>
 
+#include <types/vars.h>
+
 /* encoding of each arg type : up to 31 types are supported */
 #define ARGT_BITS      5
 #define ARGT_NBTYPES   (1 << ARGT_BITS)
@@ -58,6 +60,7 @@
 	ARGT_USR,      /* a pointer to a user list */
 	ARGT_MAP,      /* a pointer to a map descriptor */
 	ARGT_REG,      /* a pointer to a regex */
+	ARGT_VAR,      /* contains a variable description. */
 };
 
 /* context where arguments are used, in order to help error reporting */
@@ -94,6 +97,7 @@
 	struct userlist *usr;
 	struct map_descriptor *map;
 	struct my_regex *reg;
+	struct var_desc var;
 };
 
 struct arg {
diff --git a/include/types/stream.h b/include/types/stream.h
index 4203af8..953f9d1 100644
--- a/include/types/stream.h
+++ b/include/types/stream.h
@@ -43,6 +43,7 @@
 #include <types/stream_interface.h>
 #include <types/task.h>
 #include <types/stick_table.h>
+#include <types/vars.h>
 
 
 /* Various Stream Flags, bits values 0x01 to 0x100 (shift 0) */
@@ -143,6 +144,9 @@
 
 	char **req_cap;                         /* array of captures from the request (may be NULL) */
 	char **res_cap;                         /* array of captures from the response (may be NULL) */
+	struct vars vars_sess;                  /* list of variables for the session scope. */
+	struct vars vars_txn;                   /* list of variables for the txn scope. */
+	struct vars vars_reqres;                /* list of variables for the request and resp scope. */
 
 	struct stream_interface si[2];          /* client and server stream interfaces */
 	struct strm_logs logs;                  /* logs for this stream */
diff --git a/include/types/vars.h b/include/types/vars.h
new file mode 100644
index 0000000..c387a77
--- /dev/null
+++ b/include/types/vars.h
@@ -0,0 +1,33 @@
+#ifndef _TYPES_VARS_H
+#define _TYPES_VARS_H
+
+#include <common/mini-clist.h>
+
+#include <types/sample.h>
+
+enum vars_scope {
+	SCOPE_SESS = 0,
+	SCOPE_TXN,
+	SCOPE_REQ,
+	SCOPE_RES,
+};
+
+struct vars {
+	struct list head;
+	enum vars_scope scope;
+	unsigned int size;
+};
+
+/* This struct describes a variable. */
+struct var_desc {
+	const char *name; /* Contains the normalized variable name. */
+	enum vars_scope scope;
+};
+
+struct var {
+	struct list l; /* Used for chaining vars. */
+	const char *name; /* Contains the variable name. */
+	struct sample_storage data; /* data storage. */
+};
+
+#endif