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

This one is particularly difficult to split because it provides all the
functions used to manipulate a proxy state and to retrieve names or IDs
for error reporting, and as such, it was included in 73 files (down to
68 after cleanup). It would deserve a small cleanup though the cut points
are not obvious at the moment given the number of structs involved in
the struct proxy itself.
diff --git a/contrib/prometheus-exporter/service-prometheus.c b/contrib/prometheus-exporter/service-prometheus.c
index 41207ab..6e9e116 100644
--- a/contrib/prometheus-exporter/service-prometheus.c
+++ b/contrib/prometheus-exporter/service-prometheus.c
@@ -29,7 +29,7 @@
 #include <proto/backend.h>
 #include <haproxy/compression.h>
 #include <haproxy/pipe.h>
-#include <proto/proxy.h>
+#include <haproxy/proxy.h>
 #include <haproxy/sample.h>
 #include <proto/server.h>
 #include <haproxy/ssl_sock.h>
diff --git a/include/common/cfgparse.h b/include/common/cfgparse.h
index 9dd6363..86bceb6 100644
--- a/include/common/cfgparse.h
+++ b/include/common/cfgparse.h
@@ -25,7 +25,7 @@
 #include <haproxy/api.h>
 #include <haproxy/list-t.h>
 #include <haproxy/log.h>
-#include <proto/proxy.h>
+#include <haproxy/proxy.h>
 
 /* configuration sections */
 #define CFG_NONE	0
diff --git a/include/haproxy/acl-t.h b/include/haproxy/acl-t.h
index 3e3762c..d2b0e31 100644
--- a/include/haproxy/acl-t.h
+++ b/include/haproxy/acl-t.h
@@ -24,11 +24,11 @@
 
 #include <import/ebmbtree.h>
 
+#include <haproxy/arg-t.h>
 #include <haproxy/list-t.h>
 #include <haproxy/pattern-t.h>
 #include <haproxy/api-t.h>
 
-#include <types/proxy.h>
 #include <types/server.h>
 
 
diff --git a/include/haproxy/applet-t.h b/include/haproxy/applet-t.h
index 4323905..7ce112a 100644
--- a/include/haproxy/applet-t.h
+++ b/include/haproxy/applet-t.h
@@ -27,10 +27,10 @@
 #include <haproxy/freq_ctr-t.h>
 #include <haproxy/hlua-t.h>
 #include <haproxy/obj_type-t.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/api-t.h>
 #include <haproxy/xref-t.h>
 
-#include <types/proxy.h>
 #include <types/stream.h>
 
 /* flags for appctx->state */
diff --git a/include/haproxy/check.h b/include/haproxy/check.h
index 85fc49b..f38ba2a 100644
--- a/include/haproxy/check.h
+++ b/include/haproxy/check.h
@@ -26,7 +26,7 @@
 #include <haproxy/check-t.h>
 #include <haproxy/list-t.h>
 #include <haproxy/mailers.h>
-#include <types/proxy.h>
+#include <haproxy/proxy-t.h>
 #include <types/server.h>
 
 const char *get_check_status_description(short check_status);
diff --git a/include/haproxy/fcgi-app.h b/include/haproxy/fcgi-app.h
index becfdde..23f29f1 100644
--- a/include/haproxy/fcgi-app.h
+++ b/include/haproxy/fcgi-app.h
@@ -23,7 +23,7 @@
 #define _HAPROXY_HTTP_FCGI_H
 
 #include <haproxy/fcgi-app-t.h>
-#include <types/proxy.h>
+#include <haproxy/proxy-t.h>
 #include <types/stream.h>
 
 struct fcgi_app *fcgi_app_find_by_name(const char *name);
diff --git a/include/haproxy/filters.h b/include/haproxy/filters.h
index b9f24bf..74b4ce9 100644
--- a/include/haproxy/filters.h
+++ b/include/haproxy/filters.h
@@ -24,7 +24,7 @@
 #include <haproxy/channel.h>
 #include <haproxy/filters-t.h>
 #include <haproxy/http_ana-t.h>
-#include <types/proxy.h>
+#include <haproxy/proxy-t.h>
 #include <types/stream.h>
 
 extern const char *trace_flt_id;
diff --git a/include/haproxy/flt_http_comp.h b/include/haproxy/flt_http_comp.h
index 4ba5ebb..56f984a 100644
--- a/include/haproxy/flt_http_comp.h
+++ b/include/haproxy/flt_http_comp.h
@@ -21,7 +21,7 @@
 #ifndef _HAPROXY_FLT_HTTP_COMP_H
 #define _HAPROXY_FLT_HTTP_COMP_H
 
-#include <types/proxy.h>
+#include <haproxy/proxy-t.h>
 
 int check_implicit_http_comp_flt(struct proxy *proxy);
 
diff --git a/include/haproxy/global.h b/include/haproxy/global.h
index a3f952c..5cfe0b9 100644
--- a/include/haproxy/global.h
+++ b/include/haproxy/global.h
@@ -28,7 +28,7 @@
 #include <haproxy/vars-t.h>
 #include <haproxy/mworker-t.h>
 
-#include <types/proxy.h>
+#include <haproxy/proxy-t.h>
 
 extern struct global global;
 extern int  pid;                /* current process id */
diff --git a/include/haproxy/hlua-t.h b/include/haproxy/hlua-t.h
index f363326..35a7a81 100644
--- a/include/haproxy/hlua-t.h
+++ b/include/haproxy/hlua-t.h
@@ -30,10 +30,10 @@
 #include <import/ebpttree.h>
 
 #include <haproxy/list-t.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/regex-t.h>
 #include <haproxy/xref-t.h>
 
-#include <types/proxy.h>
 #include <types/server.h>
 #include <haproxy/stick_table-t.h>
 
diff --git a/include/haproxy/http_htx.h b/include/haproxy/http_htx.h
index 775037b..4b0f097 100644
--- a/include/haproxy/http_htx.h
+++ b/include/haproxy/http_htx.h
@@ -26,8 +26,8 @@
 #include <import/ist.h>
 #include <haproxy/buf-t.h>
 #include <haproxy/http_htx-t.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/regex-t.h>
-#include <types/proxy.h>
 
 extern struct buffer http_err_chunks[HTTP_ERR_SIZE];
 extern struct http_reply http_err_replies[HTTP_ERR_SIZE];
diff --git a/include/haproxy/http_rules.h b/include/haproxy/http_rules.h
index cc480f8..2006742 100644
--- a/include/haproxy/http_rules.h
+++ b/include/haproxy/http_rules.h
@@ -25,7 +25,7 @@
 #include <haproxy/api.h>
 #include <haproxy/list.h>
 #include <haproxy/action-t.h>
-#include <types/proxy.h>
+#include <haproxy/proxy-t.h>
 
 extern struct action_kw_list http_req_keywords;
 extern struct action_kw_list http_res_keywords;
diff --git a/include/haproxy/lb_fas.h b/include/haproxy/lb_fas.h
index 3293db8..fa2a507 100644
--- a/include/haproxy/lb_fas.h
+++ b/include/haproxy/lb_fas.h
@@ -24,7 +24,7 @@
 
 #include <haproxy/api.h>
 #include <haproxy/lb_fas-t.h>
-#include <types/proxy.h>
+#include <haproxy/proxy-t.h>
 #include <types/server.h>
 
 struct server *fas_get_next_server(struct proxy *p, struct server *srvtoavoid);
diff --git a/include/haproxy/lb_fwlc.h b/include/haproxy/lb_fwlc.h
index 5a549e3..24c7d74 100644
--- a/include/haproxy/lb_fwlc.h
+++ b/include/haproxy/lb_fwlc.h
@@ -24,7 +24,7 @@
 
 #include <haproxy/api.h>
 #include <haproxy/lb_fwlc-t.h>
-#include <types/proxy.h>
+#include <haproxy/proxy-t.h>
 #include <types/server.h>
 
 struct server *fwlc_get_next_server(struct proxy *p, struct server *srvtoavoid);
diff --git a/include/haproxy/lb_fwrr.h b/include/haproxy/lb_fwrr.h
index af38996..0accf06 100644
--- a/include/haproxy/lb_fwrr.h
+++ b/include/haproxy/lb_fwrr.h
@@ -24,7 +24,7 @@
 
 #include <haproxy/api.h>
 #include <haproxy/lb_fwrr-t.h>
-#include <types/proxy.h>
+#include <haproxy/proxy-t.h>
 #include <types/server.h>
 
 void fwrr_init_server_groups(struct proxy *p);
diff --git a/include/haproxy/lb_map.h b/include/haproxy/lb_map.h
index 2ab7158..1e390f7 100644
--- a/include/haproxy/lb_map.h
+++ b/include/haproxy/lb_map.h
@@ -23,7 +23,7 @@
 #define _HAPROXY_LB_MAP_H
 
 #include <haproxy/api.h>
-#include <types/proxy.h>
+#include <haproxy/proxy-t.h>
 #include <types/server.h>
 
 void recalc_server_map(struct proxy *px);
diff --git a/include/haproxy/log.h b/include/haproxy/log.h
index caddd95..1092920 100644
--- a/include/haproxy/log.h
+++ b/include/haproxy/log.h
@@ -27,9 +27,9 @@
 #include <haproxy/api.h>
 #include <haproxy/log-t.h>
 #include <haproxy/pool-t.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/thread-t.h>
 #include <proto/stream.h>
-#include <types/proxy.h>
 
 extern struct pool_head *pool_head_requri;
 extern struct pool_head *pool_head_uniqueid;
diff --git a/include/haproxy/obj_type.h b/include/haproxy/obj_type.h
index f59cf0a..0f932dd 100644
--- a/include/haproxy/obj_type.h
+++ b/include/haproxy/obj_type.h
@@ -29,7 +29,7 @@
 #include <haproxy/listener-t.h>
 #include <haproxy/obj_type-t.h>
 #include <haproxy/pool.h>
-#include <types/proxy.h>
+#include <haproxy/proxy-t.h>
 #include <types/server.h>
 #include <types/stream.h>
 #include <haproxy/stream_interface-t.h>
diff --git a/include/haproxy/peers.h b/include/haproxy/peers.h
index c07ee6d..958123a 100644
--- a/include/haproxy/peers.h
+++ b/include/haproxy/peers.h
@@ -26,9 +26,9 @@
 #include <haproxy/connection.h>
 #include <haproxy/obj_type.h>
 #include <haproxy/peers-t.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/time.h>
 
-#include <types/proxy.h>
 #include <haproxy/stick_table-t.h>
 #include <types/stream.h>
 
diff --git a/include/types/proxy.h b/include/haproxy/proxy-t.h
similarity index 98%
rename from include/types/proxy.h
rename to include/haproxy/proxy-t.h
index 6bcad16..d66ab34 100644
--- a/include/types/proxy.h
+++ b/include/haproxy/proxy-t.h
@@ -1,5 +1,5 @@
 /*
- * include/types/proxy.h
+ * include/haproxy/proxy-t.h
  * This file defines everything related to proxies.
  *
  * Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu
@@ -19,33 +19,27 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _TYPES_PROXY_H
-#define _TYPES_PROXY_H
+#ifndef _HAPROXY_PROXY_T_H
+#define _HAPROXY_PROXY_T_H
 
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
+#include <import/eb32tree.h>
+#include <import/ebpttree.h>
+
 #include <haproxy/arg-t.h>
-#include <haproxy/api-t.h>
 #include <haproxy/check-t.h>
-#include <haproxy/chunk.h>
 #include <haproxy/counters-t.h>
-#include <haproxy/http-t.h>
+#include <haproxy/freq_ctr-t.h>
 #include <haproxy/list-t.h>
 #include <haproxy/obj_type-t.h>
-#include <haproxy/thread.h>
-
-#include <import/eb32tree.h>
-#include <import/ebistree.h>
-
-#include <haproxy/acl-t.h>
+#include <haproxy/thread-t.h>
+#include <haproxy/api-t.h>
 #include <types/backend.h>
-#include <haproxy/freq_ctr-t.h>
-#include <haproxy/sample-t.h>
 #include <types/server.h>
-#include <haproxy/stick_table-t.h>
 
 /* values for proxy->state */
 enum pr_state {
@@ -532,7 +526,7 @@
 	unsigned int mode;
 };
 
-#endif /* _TYPES_PROXY_H */
+#endif /* _HAPROXY_PROXY_T_H */
 
 /*
  * Local variables:
diff --git a/include/proto/proxy.h b/include/haproxy/proxy.h
similarity index 97%
rename from include/proto/proxy.h
rename to include/haproxy/proxy.h
index f5f0bf3..0cfea6a 100644
--- a/include/proto/proxy.h
+++ b/include/haproxy/proxy.h
@@ -1,5 +1,5 @@
 /*
- * include/proto/proxy.h
+ * include/haproxy/proxy.h
  * This file defines function prototypes for proxy management.
  *
  * Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu
@@ -19,17 +19,17 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _PROTO_PROXY_H
-#define _PROTO_PROXY_H
+#ifndef _HAPROXY_PROXY_H
+#define _HAPROXY_PROXY_H
 
 #include <haproxy/applet-t.h>
 #include <haproxy/api.h>
+#include <haproxy/freq_ctr.h>
 #include <haproxy/listener-t.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/ticks.h>
 #include <haproxy/time.h>
-#include <haproxy/global-t.h>
-#include <types/proxy.h>
-#include <haproxy/freq_ctr.h>
+#include <types/server.h>
 
 extern struct proxy *proxies_list;
 extern struct eb_root used_proxy_id;	/* list of proxy IDs in use */
@@ -191,7 +191,7 @@
 	return 0;
 }
 
-#endif /* _PROTO_PROXY_H */
+#endif /* _HAPROXY_PROXY_H */
 
 /*
  * Local variables:
diff --git a/include/haproxy/ssl_sock.h b/include/haproxy/ssl_sock.h
index 1c4acd9..f15b1ce 100644
--- a/include/haproxy/ssl_sock.h
+++ b/include/haproxy/ssl_sock.h
@@ -28,10 +28,9 @@
 #include <haproxy/openssl-compat.h>
 #include <haproxy/ssl_sock-t.h>
 #include <haproxy/pool-t.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/thread.h>
 
-#include <types/proxy.h>
-
 extern struct list tlskeys_reference;
 extern int sslconns;
 extern int totalsslconns;
diff --git a/include/proto/backend.h b/include/proto/backend.h
index f702be9..57d606e 100644
--- a/include/proto/backend.h
+++ b/include/proto/backend.h
@@ -23,10 +23,10 @@
 #define _PROTO_BACKEND_H
 
 #include <haproxy/api.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/time.h>
 
 #include <types/backend.h>
-#include <types/proxy.h>
 #include <types/server.h>
 #include <types/stream.h>
 
diff --git a/include/proto/queue.h b/include/proto/queue.h
index 4397d60..735a1f1 100644
--- a/include/proto/queue.h
+++ b/include/proto/queue.h
@@ -24,8 +24,8 @@
 
 #include <haproxy/api.h>
 #include <haproxy/pool.h>
+#include <haproxy/proxy-t.h>
 
-#include <types/proxy.h>
 #include <types/queue.h>
 #include <types/stream.h>
 #include <types/server.h>
diff --git a/include/proto/server.h b/include/proto/server.h
index 3431423..383e832 100644
--- a/include/proto/server.h
+++ b/include/proto/server.h
@@ -27,9 +27,9 @@
 #include <haproxy/applet-t.h>
 #include <haproxy/api.h>
 #include <haproxy/dns-t.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/task.h>
 #include <haproxy/time.h>
-#include <types/proxy.h>
 #include <types/queue.h>
 #include <types/server.h>
 
diff --git a/include/types/spoe.h b/include/types/spoe.h
index 1f0a84a..f3edf86 100644
--- a/include/types/spoe.h
+++ b/include/types/spoe.h
@@ -27,10 +27,10 @@
 #include <haproxy/dynbuf-t.h>
 #include <haproxy/filters-t.h>
 #include <haproxy/list-t.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/thread.h>
 
 #include <haproxy/freq_ctr-t.h>
-#include <types/proxy.h>
 #include <haproxy/sample-t.h>
 #include <types/stream.h>
 #include <haproxy/task-t.h>
diff --git a/include/types/stream.h b/include/types/stream.h
index 41b800c..8f87ad5 100644
--- a/include/types/stream.h
+++ b/include/types/stream.h
@@ -36,11 +36,11 @@
 #include <haproxy/http_ana-t.h>
 #include <haproxy/list-t.h>
 #include <haproxy/obj_type-t.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/session-t.h>
 #include <haproxy/stream_interface-t.h>
 #include <haproxy/vars-t.h>
 
-#include <types/proxy.h>
 #include <types/queue.h>
 #include <types/server.h>
 #include <haproxy/task-t.h>
diff --git a/src/acl.c b/src/acl.c
index f3332ac..77440ed 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -20,12 +20,12 @@
 #include <haproxy/list.h>
 #include <haproxy/log.h>
 #include <haproxy/pattern.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/tools.h>
 
 #include <haproxy/global.h>
 
 #include <haproxy/arg.h>
-#include <proto/proxy.h>
 #include <haproxy/sample.h>
 #include <haproxy/stick_table.h>
 
diff --git a/src/action.c b/src/action.c
index 9997903..d715379 100644
--- a/src/action.c
+++ b/src/action.c
@@ -16,10 +16,10 @@
 #include <haproxy/pool.h>
 #include <haproxy/list.h>
 #include <haproxy/log.h>
+#include <haproxy/proxy.h>
 #include <haproxy/task.h>
 #include <haproxy/tools.h>
 
-#include <proto/proxy.h>
 #include <haproxy/stick_table.h>
 
 
diff --git a/src/backend.c b/src/backend.c
index 423163f..18a5697 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -37,6 +37,7 @@
 #include <haproxy/log.h>
 #include <haproxy/obj_type.h>
 #include <haproxy/payload.h>
+#include <haproxy/proxy.h>
 #include <haproxy/session.h>
 #include <haproxy/ssl_sock.h>
 #include <haproxy/stream_interface.h>
@@ -51,7 +52,6 @@
 #include <proto/backend.h>
 #include <haproxy/protocol.h>
 #include <haproxy/proto_tcp.h>
-#include <proto/proxy.h>
 #include <proto/queue.h>
 #include <haproxy/sample.h>
 #include <proto/server.h>
diff --git a/src/cache.c b/src/cache.c
index 0858a8d..e95493a 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -19,14 +19,12 @@
 #include <haproxy/http_htx.h>
 #include <haproxy/http_rules.h>
 #include <haproxy/log.h>
+#include <haproxy/proxy.h>
 #include <haproxy/shctx.h>
 #include <haproxy/stream_interface.h>
 #include <import/eb32tree.h>
 #include <import/sha1.h>
 
-#include <types/proxy.h>
-
-#include <proto/proxy.h>
 #include <proto/stream.h>
 
 
diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c
index 9ec25a3..425b57c 100644
--- a/src/cfgparse-listen.c
+++ b/src/cfgparse-listen.c
@@ -23,11 +23,11 @@
 #include <haproxy/http_rules.h>
 #include <haproxy/listener.h>
 #include <haproxy/peers.h>
+#include <haproxy/proxy.h>
 #include <haproxy/sample.h>
 #include <haproxy/stats-t.h>
 
 #include <haproxy/protocol.h>
-#include <proto/proxy.h>
 #include <proto/server.h>
 #include <haproxy/stick_table.h>
 
diff --git a/src/cfgparse.c b/src/cfgparse.c
index a15028b..0be9834 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -60,6 +60,7 @@
 #include <haproxy/obj_type-t.h>
 #include <haproxy/peers-t.h>
 #include <haproxy/pool.h>
+#include <haproxy/proxy.h>
 #include <haproxy/session.h>
 #include <haproxy/stats-t.h>
 #include <haproxy/tools.h>
@@ -73,7 +74,6 @@
 
 #include <proto/backend.h>
 #include <haproxy/protocol.h>
-#include <proto/proxy.h>
 #include <haproxy/peers.h>
 #include <haproxy/sample.h>
 #include <proto/server.h>
diff --git a/src/check.c b/src/check.c
index 6b4f9fa..d328350 100644
--- a/src/check.c
+++ b/src/check.c
@@ -47,6 +47,7 @@
 #include <haproxy/h1.h>
 #include <haproxy/htx.h>
 #include <haproxy/log.h>
+#include <haproxy/proxy.h>
 #include <haproxy/signal.h>
 #include <haproxy/ssl_sock.h>
 #include <haproxy/stats-t.h>
@@ -63,7 +64,6 @@
 #include <haproxy/port_range.h>
 #include <haproxy/proto_tcp.h>
 #include <haproxy/protocol.h>
-#include <proto/proxy.h>
 #include <proto/server.h>
 #include <haproxy/proto_udp.h>
 #include <haproxy/sample.h>
diff --git a/src/cli.c b/src/cli.c
index e5413e9..dd4ef0d 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -40,6 +40,7 @@
 #include <haproxy/mworker-t.h>
 #include <haproxy/pattern-t.h>
 #include <haproxy/peers.h>
+#include <haproxy/proxy.h>
 #include <haproxy/sample-t.h>
 #include <haproxy/session.h>
 #include <haproxy/stats-t.h>
@@ -60,7 +61,6 @@
 #include <haproxy/freq_ctr.h>
 #include <haproxy/pipe.h>
 #include <haproxy/protocol.h>
-#include <proto/proxy.h>
 #include <proto/stream.h>
 #include <proto/server.h>
 
diff --git a/src/dns.c b/src/dns.c
index bcbc435..dd29d27 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -29,6 +29,7 @@
 #include <haproxy/errors.h>
 #include <haproxy/http_rules.h>
 #include <haproxy/log.h>
+#include <haproxy/proxy.h>
 #include <haproxy/sample.h>
 #include <haproxy/stats-t.h>
 #include <haproxy/stream_interface.h>
@@ -44,7 +45,6 @@
 #include <haproxy/fd.h>
 #include <proto/server.h>
 #include <haproxy/proto_udp.h>
-#include <proto/proxy.h>
 
 struct list dns_resolvers  = LIST_HEAD_INIT(dns_resolvers);
 struct list dns_srvrq_list = LIST_HEAD_INIT(dns_srvrq_list);
diff --git a/src/fcgi-app.c b/src/fcgi-app.c
index d7183c5..5d7aeff 100644
--- a/src/fcgi-app.c
+++ b/src/fcgi-app.c
@@ -20,6 +20,7 @@
 #include <haproxy/http_fetch.h>
 #include <haproxy/http_htx.h>
 #include <haproxy/log.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/regex.h>
 #include <haproxy/sample.h>
 #include <haproxy/session.h>
@@ -27,7 +28,6 @@
 
 #include <haproxy/global.h>
 
-#include <proto/proxy.h>
 #include <proto/server.h>
 
 /* Global list of all FCGI applications */
diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c
index 1b8fffb..db758d1 100644
--- a/src/flt_http_comp.c
+++ b/src/flt_http_comp.c
@@ -20,11 +20,10 @@
 #include <common/cfgparse.h>
 #include <haproxy/htx.h>
 #include <haproxy/list.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/sample.h>
 #include <haproxy/tools.h>
 
-#include <types/proxy.h>
-
 #include <proto/stream.h>
 
 const char *http_comp_flt_id = "compression filter";
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index f5094c0..ec393b2 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -24,6 +24,7 @@
 #include <haproxy/signal.h>
 #include <haproxy/thread.h>
 #include <haproxy/pool.h>
+#include <haproxy/proxy.h>
 #include <haproxy/session.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
@@ -38,7 +39,6 @@
 #include <haproxy/arg.h>
 #include <proto/backend.h>
 #include <haproxy/freq_ctr.h>
-#include <proto/proxy.h>
 #include <proto/spoe.h>
 #include <proto/stream.h>
 
diff --git a/src/flt_trace.c b/src/flt_trace.c
index 01278bb..940ddd2 100644
--- a/src/flt_trace.c
+++ b/src/flt_trace.c
@@ -19,11 +19,11 @@
 #include <haproxy/http_htx.h>
 #include <haproxy/htx.h>
 #include <haproxy/log.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/tools.h>
 #include <haproxy/time.h>
 
 #include <haproxy/global.h>
-#include <types/proxy.h>
 #include <types/stream.h>
 
 #include <proto/stream.h>
diff --git a/src/frontend.c b/src/frontend.c
index 8252c81..78dc964 100644
--- a/src/frontend.c
+++ b/src/frontend.c
@@ -28,6 +28,7 @@
 #include <haproxy/frontend.h>
 #include <haproxy/http_ana.h>
 #include <haproxy/log.h>
+#include <haproxy/proxy.h>
 #include <haproxy/sample.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
@@ -39,7 +40,6 @@
 #include <haproxy/arg.h>
 #include <haproxy/fd.h>
 #include <haproxy/proto_tcp.h>
-#include <proto/proxy.h>
 #include <proto/stream.h>
 
 /* Finish a stream accept() for a proxy (TCP or HTTP). It returns a negative
diff --git a/src/haproxy.c b/src/haproxy.c
index 9e2f94a..b617249 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -104,6 +104,7 @@
 #include <haproxy/openssl-compat.h>
 #include <haproxy/pattern.h>
 #include <haproxy/peers.h>
+#include <haproxy/proxy.h>
 #include <haproxy/sample.h>
 #include <haproxy/regex.h>
 #include <haproxy/session.h>
@@ -125,7 +126,6 @@
 #include <proto/backend.h>
 #include <haproxy/fd.h>
 #include <haproxy/protocol.h>
-#include <proto/proxy.h>
 #include <proto/queue.h>
 #include <proto/server.h>
 #include <proto/stream.h>
diff --git a/src/hlua.c b/src/hlua.c
index afff59a..d557777 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -43,6 +43,7 @@
 #include <haproxy/obj_type.h>
 #include <haproxy/pattern.h>
 #include <haproxy/payload.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/sample.h>
 #include <haproxy/session.h>
 #include <haproxy/stats-t.h>
@@ -52,8 +53,6 @@
 #include <haproxy/tools.h>
 #include <haproxy/vars.h>
 
-#include <types/proxy.h>
-
 #include <haproxy/arg.h>
 #include <proto/queue.h>
 #include <proto/server.h>
diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c
index 12bca02..34577b5 100644
--- a/src/hlua_fcn.c
+++ b/src/hlua_fcn.c
@@ -23,13 +23,12 @@
 #include <haproxy/http.h>
 #include <haproxy/log.h>
 #include <haproxy/net_helper.h>
+#include <haproxy/pattern-t.h>
+#include <haproxy/proxy.h>
 #include <haproxy/regex.h>
 #include <haproxy/stats.h>
 #include <haproxy/time.h>
 
-#include <types/proxy.h>
-
-#include <proto/proxy.h>
 #include <proto/server.h>
 #include <haproxy/stick_table.h>
 
diff --git a/src/http_ana.c b/src/http_ana.c
index 373e399..c420d79 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -24,6 +24,7 @@
 #include <haproxy/htx.h>
 #include <haproxy/log.h>
 #include <haproxy/net_helper.h>
+#include <haproxy/proxy.h>
 #include <haproxy/regex.h>
 #include <haproxy/stats.h>
 #include <haproxy/stream_interface.h>
@@ -32,7 +33,6 @@
 
 #include <haproxy/capture-t.h>
 
-#include <proto/proxy.h>
 #include <proto/server.h>
 #include <proto/stream.h>
 
diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c
index e13ce55..5664b88 100644
--- a/src/mux_fcgi.c
+++ b/src/mux_fcgi.c
@@ -23,13 +23,12 @@
 #include <haproxy/list.h>
 #include <haproxy/log.h>
 #include <haproxy/net_helper.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/regex.h>
 #include <haproxy/session-t.h>
 #include <haproxy/ssl_sock.h>
 #include <haproxy/stream_interface.h>
 
-#include <types/proxy.h>
-
 #include <proto/stream.h>
 #include <haproxy/trace.h>
 
diff --git a/src/mux_h1.c b/src/mux_h1.c
index 75a6408..c2896b4 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -21,7 +21,7 @@
 #include <import/ebistree.h>
 
 #include <haproxy/pipe-t.h>
-#include <types/proxy.h>
+#include <haproxy/proxy-t.h>
 
 #include <haproxy/http_htx.h>
 #include <haproxy/log.h>
diff --git a/src/mworker.c b/src/mworker.c
index d891f2f..9546b26 100644
--- a/src/mworker.c
+++ b/src/mworker.c
@@ -25,6 +25,7 @@
 #include <haproxy/log.h>
 #include <haproxy/mworker.h>
 #include <haproxy/peers.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/signal.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/version.h>
@@ -32,7 +33,6 @@
 #include <haproxy/global.h>
 
 #include <haproxy/fd.h>
-#include <proto/proxy.h>
 #include <proto/stream.h>
 
 
diff --git a/src/peers.c b/src/peers.c
index 633f9ae..933f8ba 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -30,6 +30,7 @@
 #include <haproxy/net_helper.h>
 #include <haproxy/obj_type-t.h>
 #include <haproxy/peers.h>
+#include <haproxy/proxy.h>
 #include <haproxy/task.h>
 #include <haproxy/session-t.h>
 #include <haproxy/signal.h>
@@ -40,7 +41,6 @@
 #include <haproxy/thread.h>
 
 #include <haproxy/fd.h>
-#include <proto/proxy.h>
 #include <proto/stream.h>
 #include <haproxy/stick_table.h>
 
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 63624f6..c2a1869 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -40,6 +40,7 @@
 #include <haproxy/list.h>
 #include <haproxy/listener.h>
 #include <haproxy/log.h>
+#include <haproxy/proxy-t.h>
 #include <haproxy/sample.h>
 #include <haproxy/tools.h>
 #include <haproxy/namespace.h>
@@ -51,7 +52,6 @@
 #include <haproxy/port_range.h>
 #include <haproxy/protocol.h>
 #include <haproxy/proto_tcp.h>
-#include <proto/proxy.h>
 #include <proto/server.h>
 #include <haproxy/tcp_rules.h>
 
diff --git a/src/proxy.c b/src/proxy.c
index 6a0a158..1ca6ab2 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -30,6 +30,7 @@
 #include <haproxy/obj_type-t.h>
 #include <haproxy/peers.h>
 #include <haproxy/pool.h>
+#include <haproxy/proxy.h>
 #include <haproxy/stats-t.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
@@ -43,7 +44,6 @@
 #include <proto/backend.h>
 #include <haproxy/fd.h>
 #include <haproxy/proto_tcp.h>
-#include <proto/proxy.h>
 #include <proto/server.h>
 #include <haproxy/signal.h>
 #include <proto/stream.h>
diff --git a/src/sample.c b/src/sample.c
index 99b6fd5..f7ecb65 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -27,6 +27,7 @@
 #include <haproxy/log.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/protobuf.h>
+#include <haproxy/proxy.h>
 #include <haproxy/regex.h>
 #include <haproxy/sample.h>
 #include <haproxy/tools.h>
@@ -35,7 +36,6 @@
 #include <haproxy/base64.h>
 
 #include <haproxy/arg.h>
-#include <proto/proxy.h>
 #include <haproxy/sink.h>
 #include <haproxy/stick_table.h>
 
diff --git a/src/session.c b/src/session.c
index 4169870..7066a8f 100644
--- a/src/session.c
+++ b/src/session.c
@@ -17,11 +17,11 @@
 #include <haproxy/listener.h>
 #include <haproxy/log.h>
 #include <haproxy/pool.h>
+#include <haproxy/proxy.h>
 #include <haproxy/session.h>
 #include <haproxy/tcp_rules.h>
 #include <haproxy/vars.h>
 
-#include <proto/proxy.h>
 #include <proto/stream.h>
 
 DECLARE_POOL(pool_head_session, "session", sizeof(struct session));
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 1b1b0e4..3a0918f 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -56,6 +56,7 @@
 #include <haproxy/log.h>
 #include <haproxy/openssl-compat.h>
 #include <haproxy/pattern-t.h>
+#include <haproxy/proxy.h>
 #include <haproxy/shctx.h>
 #include <haproxy/ssl_ckch.h>
 #include <haproxy/ssl_crtlist.h>
@@ -78,7 +79,6 @@
 #include <haproxy/freq_ctr.h>
 #include <haproxy/proto_tcp.h>
 #include <proto/server.h>
-#include <proto/proxy.h>
 #include <proto/stream.h>
 
 /* ***** READ THIS before adding code here! *****
diff --git a/src/stats.c b/src/stats.c
index 40ea9c8..477b0ab 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -44,6 +44,7 @@
 #include <haproxy/log.h>
 #include <haproxy/map-t.h>
 #include <haproxy/pattern-t.h>
+#include <haproxy/proxy.h>
 #include <haproxy/session.h>
 #include <haproxy/ssl_sock.h>
 #include <haproxy/stats.h>
@@ -60,7 +61,6 @@
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
 #include <haproxy/pipe.h>
-#include <proto/proxy.h>
 #include <proto/stream.h>
 #include <proto/server.h>
 
diff --git a/src/stick_table.c b/src/stick_table.c
index fdf1b58..03f6ca4 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -24,6 +24,7 @@
 #include <haproxy/log.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/peers.h>
+#include <haproxy/proxy.h>
 #include <haproxy/stats-t.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
@@ -33,10 +34,10 @@
 
 #include <import/ebmbtree.h>
 #include <import/ebsttree.h>
+#include <import/ebistree.h>
 
 #include <haproxy/arg.h>
 #include <haproxy/proto_tcp.h>
-#include <proto/proxy.h>
 #include <haproxy/sample.h>
 #include <proto/stream.h>
 #include <haproxy/stick_table.h>
diff --git a/src/stream.c b/src/stream.c
index eab3356..4bf1bdc 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -14,6 +14,8 @@
 #include <unistd.h>
 #include <fcntl.h>
 
+#include <import/ebistree.h>
+
 #include <haproxy/acl.h>
 #include <haproxy/action.h>
 #include <haproxy/applet.h>
@@ -38,6 +40,7 @@
 #include <haproxy/htx.h>
 #include <haproxy/log.h>
 #include <haproxy/pool.h>
+#include <haproxy/proxy.h>
 #include <haproxy/session.h>
 #include <haproxy/stats-t.h>
 #include <haproxy/stream_interface.h>
@@ -52,7 +55,6 @@
 #include <haproxy/freq_ctr.h>
 #include <proto/stream.h>
 #include <haproxy/pipe.h>
-#include <proto/proxy.h>
 #include <proto/queue.h>
 #include <proto/server.h>
 #include <haproxy/stick_table.h>
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 6b6b76d..67477a5 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -25,6 +25,7 @@
 #include <haproxy/connection.h>
 #include <haproxy/dynbuf.h>
 #include <haproxy/http_htx.h>
+#include <haproxy/proxy.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/tools.h>
 #include <haproxy/ticks.h>
@@ -32,7 +33,6 @@
 #include <haproxy/task.h>
 
 #include <haproxy/pipe.h>
-#include <proto/proxy.h>
 #include <proto/stream.h>
 
 #include <haproxy/pipe-t.h>
diff --git a/src/task.c b/src/task.c
index f055ebb..368c3d0 100644
--- a/src/task.c
+++ b/src/task.c
@@ -23,7 +23,6 @@
 
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
-#include <proto/proxy.h>
 #include <proto/stream.h>
 
 DECLARE_POOL(pool_head_task,    "task",    sizeof(struct task));
diff --git a/src/tcp_rules.c b/src/tcp_rules.c
index a02e25f..750108b 100644
--- a/src/tcp_rules.c
+++ b/src/tcp_rules.c
@@ -19,6 +19,7 @@
 #include <haproxy/global.h>
 #include <haproxy/list.h>
 #include <haproxy/log.h>
+#include <haproxy/proxy.h>
 #include <haproxy/sample.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/tcp_rules.h>
@@ -28,7 +29,6 @@
 
 #include <haproxy/arg-t.h>
 
-#include <proto/proxy.h>
 #include <haproxy/stick_table.h>
 #include <proto/stream.h>