[MEDIUM] stick-table: make use of generic types for stored data

It's a bit cumbersome to have to know all possible storable types
from the stats interface. Instead, let's have generic types for
all data, which will facilitate their manipulation.
diff --git a/include/proto/stick_table.h b/include/proto/stick_table.h
index 6b80eef..e702356 100644
--- a/include/proto/stick_table.h
+++ b/include/proto/stick_table.h
@@ -50,6 +50,21 @@
 int stktable_get_data_type(char *name);
 struct proxy *find_stktable(const char *name);
 
+/* return allocation size for standard data type <type> */
+static inline int stktable_type_size(int type)
+{
+	switch(type) {
+	case STD_T_SINT:
+	case STD_T_UINT:
+		return sizeof(int);
+	case STD_T_ULL:
+		return sizeof(unsigned long long);
+	case STD_T_FRQP:
+		return sizeof(struct freq_ctr_period);
+	}
+	return 0;
+}
+
 /* reserve some space for data type <type>, and associate argument at <sa> if
  * not NULL. Returns PE_NONE (0) if OK or an error code among :
  *   - PE_ENUM_OOR if <type> does not exist
@@ -85,7 +100,7 @@
 		break;
 	}
 
-	t->data_size      += stktable_data_types[type].data_length;
+	t->data_size      += stktable_type_size(stktable_data_types[type].std_type);
 	t->data_ofs[type]  = -t->data_size;
 	return PE_NONE;
 }
diff --git a/include/types/stick_table.h b/include/types/stick_table.h
index a5f47e3..4338e59 100644
--- a/include/types/stick_table.h
+++ b/include/types/stick_table.h
@@ -60,6 +60,14 @@
 	STKTABLE_DATA_TYPES       /* Number of data types, must always be last */
 };
 
+/* The equivalent standard types of the stored data */
+enum {
+	STD_T_SINT = 0,           /* data is of type signed int */
+	STD_T_UINT,               /* data is of type unsigned int */
+	STD_T_ULL,                /* data is of type unsigned long long */
+	STD_T_FRQP,               /* data is of type freq_ctr_period */
+};
+
 /* The types of optional arguments to stored data */
 enum {
 	ARG_T_NONE = 0,           /* data type takes no argument (default) */
@@ -69,6 +77,13 @@
 
 /* stick_table extra data. This is mainly used for casting or size computation */
 union stktable_data {
+	/* standard types for easy casting */
+	int std_t_sint;
+	unsigned int std_t_uint;
+	unsigned long long std_t_ull;
+	struct freq_ctr_period std_t_frqp;
+
+	/* types of each storable data */
 	int server_id;
 	unsigned int gpc0;
 	unsigned int conn_cnt;
@@ -89,7 +104,7 @@
 /* known data types */
 struct stktable_data_type {
 	const char *name; /* name of the data type */
-	int data_length;  /* length of this type, or 0 if variable (eg: string) */
+	int std_type;     /* standard type we can use for this data, STD_T_* */
 	int arg_type;     /* type of optional argument, ARG_T_* */
 };