REORG: include: move stick_table.h to haproxy/stick_table{,-t}.h

The stktable_types[] array declaration was moved to the main file as
it had nothing to do in the types. A few declarations were reordered
in the types file so that defines were before the structs. Thread-t
was added since there are a few __decl_thread(). The loss of peers.h
revealed that cfgparse-listen needed it.
diff --git a/include/haproxy/action-t.h b/include/haproxy/action-t.h
index 54dd63b..9a76366 100644
--- a/include/haproxy/action-t.h
+++ b/include/haproxy/action-t.h
@@ -25,7 +25,7 @@
 #include <haproxy/regex-t.h>
 
 #include <types/applet.h>
-#include <types/stick_table.h>
+#include <haproxy/stick_table-t.h>
 
 enum act_from {
 	ACT_F_TCP_REQ_CON, /* tcp-request connection */
diff --git a/include/haproxy/arg-t.h b/include/haproxy/arg-t.h
index a283eff..c5a95d3 100644
--- a/include/haproxy/arg-t.h
+++ b/include/haproxy/arg-t.h
@@ -30,7 +30,7 @@
 #include <haproxy/protobuf-t.h>
 #include <haproxy/vars-t.h>
 
-#include <types/stick_table.h>
+#include <haproxy/stick_table-t.h>
 
 /* encoding of each arg type : up to 31 types are supported */
 #define ARGT_BITS      5
diff --git a/include/haproxy/hlua-t.h b/include/haproxy/hlua-t.h
index a49de51..0f99223 100644
--- a/include/haproxy/hlua-t.h
+++ b/include/haproxy/hlua-t.h
@@ -36,7 +36,7 @@
 #include <types/http_ana.h>
 #include <types/proxy.h>
 #include <types/server.h>
-#include <types/stick_table.h>
+#include <haproxy/stick_table-t.h>
 
 #define CLASS_CORE         "Core"
 #define CLASS_TXN          "TXN"
diff --git a/include/haproxy/peers.h b/include/haproxy/peers.h
index 10fd8d8..c07ee6d 100644
--- a/include/haproxy/peers.h
+++ b/include/haproxy/peers.h
@@ -29,7 +29,7 @@
 #include <haproxy/time.h>
 
 #include <types/proxy.h>
-#include <types/stick_table.h>
+#include <haproxy/stick_table-t.h>
 #include <types/stream.h>
 
 extern struct peers *cfg_peers;
diff --git a/include/haproxy/sample.h b/include/haproxy/sample.h
index 1c30fd4..970dc1b 100644
--- a/include/haproxy/sample.h
+++ b/include/haproxy/sample.h
@@ -26,7 +26,7 @@
 #include <haproxy/arg-t.h>
 #include <haproxy/api.h>
 #include <haproxy/sample-t.h>
-#include <types/stick_table.h>
+#include <haproxy/stick_table-t.h>
 
 extern sample_cast_fct sample_casts[SMP_TYPES][SMP_TYPES];
 extern const unsigned int fetch_cap[SMP_SRC_ENTRIES];
diff --git a/include/types/stick_table.h b/include/haproxy/stick_table-t.h
similarity index 96%
rename from include/types/stick_table.h
rename to include/haproxy/stick_table-t.h
index 2918381..86d8dad 100644
--- a/include/types/stick_table.h
+++ b/include/haproxy/stick_table-t.h
@@ -1,5 +1,5 @@
 /*
- * include/types/stick_table.h
+ * include/haproxy/stick_table-t.h
  * Macros, variables and structures for stick tables management.
  *
  * Copyright (C) 2009-2010 EXCELIANCE, Emeric Brun <ebrun@exceliance.fr>
@@ -20,20 +20,20 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _TYPES_STICK_TABLE_H
-#define _TYPES_STICK_TABLE_H
+#ifndef _HAPROXY_STICK_TABLE_T_H
+#define _HAPROXY_STICK_TABLE_T_H
 
 #include <sys/socket.h>
 #include <netinet/in.h>
 
-#include <import/ebtree.h>
-#include <import/ebmbtree.h>
 #include <import/eb32tree.h>
-#include <haproxy/dict-t.h>
-#include <haproxy/pool-t.h>
+#include <import/ebmbtree.h>
+#include <import/ebpttree.h>
+
 #include <haproxy/freq_ctr-t.h>
-#include <haproxy/peers-t.h>
-#include <haproxy/sample-t.h>
+#include <haproxy/thread-t.h>
+#include <haproxy/api-t.h>
+
 
 /* The types of extra data we can store in a stick table */
 enum {
@@ -80,6 +80,27 @@
 	ARG_T_DELAY,              /* a delay which supports time units */
 };
 
+/* stick table key type flags */
+#define STK_F_CUSTOM_KEYSIZE      0x00000001   /* this table's key size is configurable */
+
+/* WARNING: if new fields are added, they must be initialized in stream_accept()
+ * and freed in stream_free() !
+ *
+ * What's the purpose of there two macro:
+ *   - STKCTR_TRACK_BACKEND indicates that a tracking pointer was set from the backend
+ *    and thus that when a keep-alive request goes to another backend, the track
+ *    must cease.
+ *
+ *   - STKCTR_TRACK_CONTENT indicates that the tracking pointer was set in a
+ *    content-aware rule (tcp-request content or http-request) and that the
+ *    tracking has to be performed in the stream and not in the session, and
+ *    will cease for a new keep-alive request over the same connection.
+ *
+ * These values are mixed with the stksess pointer in stkctr->entry.
+ */
+#define STKCTR_TRACK_BACKEND 1
+#define STKCTR_TRACK_CONTENT 2
+
 /* stick_table extra data. This is mainly used for casting or size computation */
 union stktable_data {
 	/* standard types for easy casting */
@@ -119,9 +140,6 @@
 	int arg_type;     /* type of optional argument, ARG_T_* */
 };
 
-/* stick table key type flags */
-#define STK_F_CUSTOM_KEYSIZE      0x00000001   /* this table's key size is configurable */
-
 /* stick table keyword type */
 struct stktable_type {
 	const char *kw;           /* keyword string */
@@ -129,8 +147,6 @@
 	size_t default_size;      /* default key size */
 };
 
-extern struct stktable_type stktable_types[];
-
 /* Sticky session.
  * Any additional data related to the stuck session is installed *before*
  * stksess (with negative offsets). This allows us to run variable-sized
@@ -202,22 +218,6 @@
 	size_t key_len;                 /* data len to read in buff in case of null terminated string */
 };
 
-/* WARNING: if new fields are added, they must be initialized in stream_accept()
- * and freed in stream_free() !
- *
- * What's the purpose of there two macro:
- *   - STKCTR_TRACK_BACKEND indicates that a tracking pointer was set from the backend
- *    and thus that when a keep-alive request goes to another backend, the track
- *    must cease.
- *
- *   - STKCTR_TRACK_CONTENT indicates that the tracking pointer was set in a
- *    content-aware rule (tcp-request content or http-request) and that the
- *    tracking has to be performed in the stream and not in the session, and
- *    will cease for a new keep-alive request over the same connection.
- */
-#define STKCTR_TRACK_BACKEND 1
-#define STKCTR_TRACK_CONTENT 2
-
 /* stick counter. The <entry> member is a composite address (caddr) made of a
  * pointer to an stksess struct, and two flags among STKCTR_TRACK_* above.
  */
@@ -235,4 +235,4 @@
 	} table;
 };
 
-#endif /* _TYPES_STICK_TABLE_H */
+#endif /* _HAPROXY_STICK_TABLE_T_H */
diff --git a/include/proto/stick_table.h b/include/haproxy/stick_table.h
similarity index 96%
rename from include/proto/stick_table.h
rename to include/haproxy/stick_table.h
index ebc4d67..c77988f 100644
--- a/include/proto/stick_table.h
+++ b/include/haproxy/stick_table.h
@@ -1,5 +1,5 @@
 /*
- * include/proto/stick_table.h
+ * include/haproxy/stick_table.h
  * Functions for stick tables management.
  *
  * Copyright (C) 2009-2010 EXCELIANCE, Emeric Brun <ebrun@exceliance.fr>
@@ -20,17 +20,20 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _PROTO_STICK_TABLE_H
-#define _PROTO_STICK_TABLE_H
+#ifndef _HAPROXY_STICK_TABLE_H
+#define _HAPROXY_STICK_TABLE_H
 
+#include <haproxy/api.h>
 #include <haproxy/dict-t.h>
 #include <haproxy/errors.h>
+#include <haproxy/sample-t.h>
+#include <haproxy/stick_table-t.h>
 #include <haproxy/tools.h>
 #include <haproxy/ticks.h>
 #include <haproxy/time.h>
-#include <types/stick_table.h>
 
 extern struct stktable *stktables_list;
+extern struct stktable_type stktable_types[];
 
 #define stktable_data_size(type) (sizeof(((union stktable_data*)0)->type))
 #define stktable_data_cast(ptr, type) ((union stktable_data*)(ptr))->type
@@ -200,4 +203,4 @@
 	stkctr->entry = caddr_clr_flags(stkctr->entry, flags);
 }
 
-#endif /* _PROTO_STICK_TABLE_H */
+#endif /* _HAPROXY_STICK_TABLE_H */
diff --git a/include/proto/session.h b/include/proto/session.h
index 01e2d94..45bfedb 100644
--- a/include/proto/session.h
+++ b/include/proto/session.h
@@ -29,7 +29,7 @@
 #include <haproxy/global-t.h>
 #include <types/session.h>
 
-#include <proto/stick_table.h>
+#include <haproxy/stick_table.h>
 #include <proto/server.h>
 
 extern struct pool_head *pool_head_session;
diff --git a/include/proto/stream.h b/include/proto/stream.h
index 9be8d46..80a616b 100644
--- a/include/proto/stream.h
+++ b/include/proto/stream.h
@@ -30,7 +30,7 @@
 #include <haproxy/freq_ctr.h>
 #include <haproxy/obj_type.h>
 #include <proto/queue.h>
-#include <proto/stick_table.h>
+#include <haproxy/stick_table.h>
 #include <haproxy/task.h>
 #include <proto/trace.h>
 
diff --git a/include/types/proxy.h b/include/types/proxy.h
index 5ba68c7..7579d8a 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -46,7 +46,7 @@
 #include <types/log.h>
 #include <haproxy/sample-t.h>
 #include <types/server.h>
-#include <types/stick_table.h>
+#include <haproxy/stick_table-t.h>
 
 /* values for proxy->state */
 enum pr_state {
diff --git a/include/types/session.h b/include/types/session.h
index 559e786..3942d62 100644
--- a/include/types/session.h
+++ b/include/types/session.h
@@ -33,7 +33,7 @@
 #include <haproxy/obj_type-t.h>
 #include <haproxy/vars-t.h>
 
-#include <types/stick_table.h>
+#include <haproxy/stick_table-t.h>
 #include <haproxy/task-t.h>
 
 struct sess_srv_list {
diff --git a/include/types/stream.h b/include/types/stream.h
index e2e01db..1a99429 100644
--- a/include/types/stream.h
+++ b/include/types/stream.h
@@ -44,7 +44,7 @@
 #include <types/session.h>
 #include <types/stream_interface.h>
 #include <haproxy/task-t.h>
-#include <types/stick_table.h>
+#include <haproxy/stick_table-t.h>
 
 /* Various Stream Flags, bits values 0x01 to 0x100 (shift 0) */
 #define SF_DIRECT	0x00000001	/* connection made on the server matching the client cookie */