[CLEANUP] remove many #include <types/xxx> from C files

It should be stated as a rule that a C file should never
include types/xxx.h when proto/xxx.h exists, as it gives
less exposure to declaration conflicts (one of which was
caught and fixed here) and it complicates the file headers
for nothing.

Only types/global.h, types/capture.h and types/polling.h
have been found to be valid includes from C files.
diff --git a/src/acl.c b/src/acl.c
index e5639f7..6385c6f 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -20,10 +20,6 @@
 
 #include <proto/acl.h>
 
-#include <types/acl.h>
-#include <types/proxy.h>
-#include <types/session.h>
-
 /* List head of all known ACL keywords */
 static struct acl_kw_list acl_keywords = {
 	.list = LIST_HEAD_INIT(acl_keywords.list)
diff --git a/src/appsession.c b/src/appsession.c
index 10b4df0..b3f2c76 100644
--- a/src/appsession.c
+++ b/src/appsession.c
@@ -21,11 +21,9 @@
 #include <common/ticks.h>
 #include <common/time.h>
 
-#include <types/buffers.h>
 #include <types/global.h>
-#include <types/proxy.h>
-#include <types/server.h>
 
+#include <proto/proxy.h>
 #include <proto/task.h>
 
 static struct task *appsess_refresh = NULL;
diff --git a/src/backend.c b/src/backend.c
index 7116965..ddedfd9 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -25,13 +25,7 @@
 #include <common/ticks.h>
 #include <common/time.h>
 
-#include <types/acl.h>
-#include <types/buffers.h>
 #include <types/global.h>
-#include <types/polling.h>
-#include <types/proxy.h>
-#include <types/server.h>
-#include <types/session.h>
 
 #include <proto/acl.h>
 #include <proto/backend.h>
diff --git a/src/cfgparse.c b/src/cfgparse.c
index a492a93..9aac0eb 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -32,10 +32,7 @@
 
 #include <types/capture.h>
 #include <types/global.h>
-#include <types/httperr.h>
 #include <types/polling.h>
-#include <types/proxy.h>
-#include <types/queue.h>
 
 #include <proto/acl.h>
 #include <proto/backend.h>
diff --git a/src/checks.c b/src/checks.c
index 2dc1d60..5e3c19d 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -30,9 +30,6 @@
 #include <common/time.h>
 
 #include <types/global.h>
-#include <types/polling.h>
-#include <types/proxy.h>
-#include <types/session.h>
 
 #include <proto/backend.h>
 #include <proto/buffers.h>
diff --git a/src/client.c b/src/client.c
index e76a741..f3081c1 100644
--- a/src/client.c
+++ b/src/client.c
@@ -24,15 +24,7 @@
 #include <common/config.h>
 #include <common/time.h>
 
-#include <types/acl.h>
-#include <types/backend.h>
-#include <types/buffers.h>
 #include <types/global.h>
-#include <types/httperr.h>
-#include <types/polling.h>
-#include <types/proxy.h>
-#include <types/server.h>
-#include <types/session.h>
 
 #include <proto/acl.h>
 #include <proto/buffers.h>
diff --git a/src/cttproxy.c b/src/cttproxy.c
index 04c3df2..9faed88 100644
--- a/src/cttproxy.c
+++ b/src/cttproxy.c
@@ -2,7 +2,7 @@
  * Functions for managing transparent proxying with CTTPROXY.
  * This file should be compiled only if CTTPROXY is enabled.
  *
- * Copyright 2000-2007 Willy Tarreau <w@1wt.eu>
+ * Copyright 2000-2008 Willy Tarreau <w@1wt.eu>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -25,8 +25,6 @@
 #include <common/config.h>
 #include <common/time.h>
 
-#include <types/global.h>
-
 #include <import/ip_tproxy.h>
 
 /*
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 3517a99..01ddd71 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -36,9 +36,6 @@
 #include <common/version.h>
 
 #include <types/global.h>
-#include <types/polling.h>
-#include <types/proxy.h>
-#include <types/server.h>
 
 #include <proto/backend.h>
 #include <proto/buffers.h>
diff --git a/src/ev_epoll.c b/src/ev_epoll.c
index 1c4e437..30862ca 100644
--- a/src/ev_epoll.c
+++ b/src/ev_epoll.c
@@ -24,7 +24,6 @@
 #include <types/fd.h>
 #include <types/global.h>
 
-#include <proto/fd.h>
 #include <proto/task.h>
 
 #if defined(USE_MY_EPOLL)
diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c
index 604340b..1e10b42 100644
--- a/src/ev_kqueue.c
+++ b/src/ev_kqueue.c
@@ -27,7 +27,6 @@
 #include <common/time.h>
 #include <common/tools.h>
 
-#include <types/fd.h>
 #include <types/global.h>
 
 #include <proto/fd.h>
diff --git a/src/ev_poll.c b/src/ev_poll.c
index 0a0f23d..5f0a2c4 100644
--- a/src/ev_poll.c
+++ b/src/ev_poll.c
@@ -20,7 +20,6 @@
 #include <common/ticks.h>
 #include <common/time.h>
 
-#include <types/fd.h>
 #include <types/global.h>
 
 #include <proto/fd.h>
diff --git a/src/ev_select.c b/src/ev_select.c
index ecdd870..95663ff 100644
--- a/src/ev_select.c
+++ b/src/ev_select.c
@@ -19,7 +19,6 @@
 #include <common/ticks.h>
 #include <common/time.h>
 
-#include <types/fd.h>
 #include <types/global.h>
 
 #include <proto/fd.h>
diff --git a/src/ev_sepoll.c b/src/ev_sepoll.c
index 2419b68..70b1065 100644
--- a/src/ev_sepoll.c
+++ b/src/ev_sepoll.c
@@ -56,7 +56,6 @@
 #include <common/time.h>
 #include <common/tools.h>
 
-#include <types/fd.h>
 #include <types/global.h>
 
 #include <proto/fd.h>
diff --git a/src/fd.c b/src/fd.c
index eaaaabf..0ee6a72 100644
--- a/src/fd.c
+++ b/src/fd.c
@@ -1,7 +1,7 @@
 /*
  * File descriptors management functions.
  *
- * Copyright 2000-2007 Willy Tarreau <w@1wt.eu>
+ * Copyright 2000-2008 Willy Tarreau <w@1wt.eu>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -18,8 +18,7 @@
 #include <common/compat.h>
 #include <common/config.h>
 
-#include <types/fd.h>
-#include <types/global.h>
+//#include <types/global.h>
 
 #include <proto/fd.h>
 
diff --git a/src/haproxy.c b/src/haproxy.c
index 0c8bbb0..1d3089a 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -75,9 +75,7 @@
 
 #include <types/capture.h>
 #include <types/global.h>
-#include <types/httperr.h>
 #include <types/polling.h>
-#include <types/proto_http.h>
 
 #include <proto/acl.h>
 #include <proto/backend.h>
diff --git a/src/hdr_idx.c b/src/hdr_idx.c
index aceaeb1..a8c595d 100644
--- a/src/hdr_idx.c
+++ b/src/hdr_idx.c
@@ -1,7 +1,7 @@
 /*
  * Header indexation functions.
  *
- * Copyright 2000-2006 Willy Tarreau <w@1wt.eu>
+ * Copyright 2000-2008 Willy Tarreau <w@1wt.eu>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -11,7 +11,7 @@
  */
 
 #include <common/config.h>
-#include <types/hdr_idx.h>
+#include <proto/hdr_idx.h>
 
 
 /*
diff --git a/src/log.c b/src/log.c
index d08ad16..fc04232 100644
--- a/src/log.c
+++ b/src/log.c
@@ -26,10 +26,9 @@
 #include <common/standard.h>
 #include <common/time.h>
 
-#include <types/backend.h>
 #include <types/global.h>
-#include <types/log.h>
-#include <types/session.h>
+
+#include <proto/log.h>
 
 #ifndef MSG_NOSIGNAL
 #define MSG_NOSIGNAL	(0)
diff --git a/src/proto_http.c b/src/proto_http.c
index 6a662d4..5b1221f 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -35,13 +35,8 @@
 #include <common/uri_auth.h>
 #include <common/version.h>
 
-#include <types/acl.h>
 #include <types/capture.h>
 #include <types/global.h>
-#include <types/httperr.h>
-#include <types/polling.h>
-#include <types/proxy.h>
-#include <types/server.h>
 
 #include <proto/acl.h>
 #include <proto/backend.h>
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index cc7e50c..d06b76a 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -35,11 +35,7 @@
 #include <common/time.h>
 #include <common/version.h>
 
-#include <types/acl.h>
 #include <types/global.h>
-#include <types/polling.h>
-#include <types/proxy.h>
-#include <types/server.h>
 
 #include <proto/acl.h>
 #include <proto/backend.h>
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index dece859..d00b499 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -36,12 +36,7 @@
 #include <common/time.h>
 #include <common/version.h>
 
-#include <types/acl.h>
-#include <types/capture.h>
 #include <types/global.h>
-#include <types/polling.h>
-#include <types/proxy.h>
-#include <types/server.h>
 
 #include <proto/acl.h>
 #include <proto/backend.h>
diff --git a/src/protocols.c b/src/protocols.c
index 70d04de..735c384 100644
--- a/src/protocols.c
+++ b/src/protocols.c
@@ -1,7 +1,7 @@
 /*
  * Protocol registration functions.
  *
- * Copyright 2000-2007 Willy Tarreau <w@1wt.eu>
+ * Copyright 2000-2008 Willy Tarreau <w@1wt.eu>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -18,8 +18,6 @@
 #include <common/mini-clist.h>
 #include <common/standard.h>
 
-#include <types/protocols.h>
-
 #include <proto/fd.h>
 
 /* List head of all registered protocols */
diff --git a/src/proxy.c b/src/proxy.c
index f9589ec..17728f5 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -26,7 +26,6 @@
 #include <common/time.h>
 
 #include <types/global.h>
-#include <types/polling.h>
 
 #include <proto/client.h>
 #include <proto/backend.h>
diff --git a/src/queue.c b/src/queue.c
index 178f187..3b7fd4b 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -14,9 +14,6 @@
 #include <common/memory.h>
 #include <common/time.h>
 
-#include <types/proxy.h>
-#include <types/session.h>
-
 #include <proto/queue.h>
 #include <proto/server.h>
 #include <proto/task.h>
diff --git a/src/senddata.c b/src/senddata.c
index 18bb3e2..5d6174c 100644
--- a/src/senddata.c
+++ b/src/senddata.c
@@ -32,11 +32,6 @@
 #include <common/time.h>
 #include <common/version.h>
 
-#include <types/global.h>
-#include <types/polling.h>
-#include <types/proxy.h>
-#include <types/server.h>
-
 #include <proto/backend.h>
 #include <proto/buffers.h>
 #include <proto/fd.h>
diff --git a/src/server.c b/src/server.c
index bf29d25..0016c80 100644
--- a/src/server.c
+++ b/src/server.c
@@ -14,9 +14,7 @@
 #include <common/config.h>
 #include <common/time.h>
 
-#include <types/backend.h>
-#include <types/proxy.h>
-#include <types/server.h>
+#include <proto/server.h>
 
 int srv_downtime(struct server *s) {
 
diff --git a/src/session.c b/src/session.c
index e3a736d..c27ef75 100644
--- a/src/session.c
+++ b/src/session.c
@@ -16,11 +16,7 @@
 #include <common/debug.h>
 #include <common/memory.h>
 
-#include <types/backend.h>
 #include <types/capture.h>
-#include <types/log.h>
-#include <types/proxy.h>
-#include <types/server.h>
 
 #include <proto/buffers.h>
 #include <proto/hdr_idx.h>
diff --git a/src/stream_sock.c b/src/stream_sock.c
index aa45bdd..84bc2db 100644
--- a/src/stream_sock.c
+++ b/src/stream_sock.c
@@ -26,10 +26,6 @@
 #include <common/ticks.h>
 #include <common/time.h>
 
-#include <types/buffers.h>
-#include <types/global.h>
-#include <types/polling.h>
-
 #include <proto/client.h>
 #include <proto/fd.h>
 #include <proto/stream_sock.h>
diff --git a/src/task.c b/src/task.c
index 5a9a2c2..15539c2 100644
--- a/src/task.c
+++ b/src/task.c
@@ -19,7 +19,6 @@
 
 #include <proto/proxy.h>
 #include <proto/task.h>
-#include <types/task.h>
 
 struct pool_head *pool2_task;