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

This one was not easy because it was embarking many includes with it,
which other files would automatically find. At least global.h, arg.h
and tools.h were identified. 93 total locations were identified, 8
additional includes had to be added.

In the rare files where it was possible to finalize the sorting of
includes by adjusting only one or two extra lines, it was done. But
all files would need to be rechecked and cleaned up now.

It was the last set of files in types/ and proto/ and these directories
must not be reused anymore.
diff --git a/contrib/debug/flags.c b/contrib/debug/flags.c
index 15136a3..e1dfee9 100644
--- a/contrib/debug/flags.c
+++ b/contrib/debug/flags.c
@@ -4,7 +4,7 @@
 #include <haproxy/channel-t.h>
 #include <haproxy/connection-t.h>
 #include <haproxy/http_ana-t.h>
-#include <types/stream.h>
+#include <haproxy/stream-t.h>
 #include <haproxy/stream_interface-t.h>
 #include <haproxy/task-t.h>
 
diff --git a/contrib/modsecurity/modsec_wrapper.c b/contrib/modsecurity/modsec_wrapper.c
index b5840c3..17fe461 100644
--- a/contrib/modsecurity/modsec_wrapper.c
+++ b/contrib/modsecurity/modsec_wrapper.c
@@ -16,16 +16,14 @@
 #include <stdio.h>
 #include <stdarg.h>
 
+#include <haproxy/arg.h>
 #include <haproxy/global.h>
 #include <haproxy/hlua.h>
 #include <haproxy/log.h>
 #include <haproxy/spoe.h>
+#include <haproxy/stream-t.h>
 #include <haproxy/time.h>
 
-#include <types/stream.h>
-
-#include <haproxy/arg.h>
-
 #include <api.h>
 
 #include "modsec_wrapper.h"
diff --git a/contrib/prometheus-exporter/service-prometheus.c b/contrib/prometheus-exporter/service-prometheus.c
index 52cac08..bc968d9 100644
--- a/contrib/prometheus-exporter/service-prometheus.c
+++ b/contrib/prometheus-exporter/service-prometheus.c
@@ -34,7 +34,7 @@
 #include <haproxy/server.h>
 #include <haproxy/ssl_sock.h>
 #include <haproxy/stats.h>
-#include <proto/stream.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
 
diff --git a/include/haproxy/applet-t.h b/include/haproxy/applet-t.h
index 7ce112a..08467fc 100644
--- a/include/haproxy/applet-t.h
+++ b/include/haproxy/applet-t.h
@@ -28,11 +28,10 @@
 #include <haproxy/hlua-t.h>
 #include <haproxy/obj_type-t.h>
 #include <haproxy/proxy-t.h>
+#include <haproxy/stream-t.h>
 #include <haproxy/api-t.h>
 #include <haproxy/xref-t.h>
 
-#include <types/stream.h>
-
 /* flags for appctx->state */
 #define APPLET_WANT_DIE     0x01  /* applet was running and requested to die */
 
diff --git a/include/haproxy/backend.h b/include/haproxy/backend.h
index 5f6acaa..a5e3b46 100644
--- a/include/haproxy/backend.h
+++ b/include/haproxy/backend.h
@@ -26,8 +26,8 @@
 #include <haproxy/api.h>
 #include <haproxy/proxy-t.h>
 #include <haproxy/server-t.h>
+#include <haproxy/stream-t.h>
 #include <haproxy/time.h>
-#include <types/stream.h>
 
 int assign_server(struct stream *s);
 int assign_server_address(struct stream *s);
diff --git a/include/haproxy/channel.h b/include/haproxy/channel.h
index 96f076e..5484d43 100644
--- a/include/haproxy/channel.h
+++ b/include/haproxy/channel.h
@@ -27,13 +27,13 @@
 #include <haproxy/dynbuf.h>
 #include <haproxy/global.h>
 #include <haproxy/htx.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface-t.h>
 #include <haproxy/task.h>
+#include <haproxy/tools-t.h>
 #include <haproxy/ticks.h>
 #include <haproxy/time.h>
 
-#include <proto/stream.h>
-#include <types/stream.h>
 
 /* perform minimal intializations, report 0 in case of error, 1 if OK. */
 int init_channel();
diff --git a/include/haproxy/cli.h b/include/haproxy/cli.h
index 6257c24..3a4525c 100644
--- a/include/haproxy/cli.h
+++ b/include/haproxy/cli.h
@@ -27,7 +27,7 @@
 #include <haproxy/channel-t.h>
 #include <haproxy/cli-t.h>
 #include <haproxy/global.h>
-#include <types/stream.h>
+#include <haproxy/stream-t.h>
 
 
 void cli_register_kw(struct cli_kw_list *kw_list);
diff --git a/include/haproxy/fcgi-app.h b/include/haproxy/fcgi-app.h
index 23f29f1..99f0d58 100644
--- a/include/haproxy/fcgi-app.h
+++ b/include/haproxy/fcgi-app.h
@@ -24,7 +24,7 @@
 
 #include <haproxy/fcgi-app-t.h>
 #include <haproxy/proxy-t.h>
-#include <types/stream.h>
+#include <haproxy/stream-t.h>
 
 struct fcgi_app *fcgi_app_find_by_name(const char *name);
 struct fcgi_flt_conf *find_px_fcgi_conf(struct proxy *px);
diff --git a/include/haproxy/filters.h b/include/haproxy/filters.h
index 74b4ce9..48d3c25 100644
--- a/include/haproxy/filters.h
+++ b/include/haproxy/filters.h
@@ -25,7 +25,7 @@
 #include <haproxy/filters-t.h>
 #include <haproxy/http_ana-t.h>
 #include <haproxy/proxy-t.h>
-#include <types/stream.h>
+#include <haproxy/stream-t.h>
 
 extern const char *trace_flt_id;
 extern const char *http_comp_flt_id;
diff --git a/include/haproxy/frontend.h b/include/haproxy/frontend.h
index 114d877..eb986fb 100644
--- a/include/haproxy/frontend.h
+++ b/include/haproxy/frontend.h
@@ -22,7 +22,7 @@
 #ifndef _HAPROXY_FRONTEND_H
 #define _HAPROXY_FRONTEND_H
 
-#include <types/stream.h>
+#include <haproxy/stream-t.h>
 
 int frontend_accept(struct stream *s);
 
diff --git a/include/haproxy/http_ana.h b/include/haproxy/http_ana.h
index 6bf4a5a..ce28a7c 100644
--- a/include/haproxy/http_ana.h
+++ b/include/haproxy/http_ana.h
@@ -26,7 +26,7 @@
 #include <haproxy/channel-t.h>
 #include <haproxy/http_ana-t.h>
 #include <haproxy/htx-t.h>
-#include <types/stream.h>
+#include <haproxy/stream-t.h>
 
 extern struct pool_head *pool_head_uniqueid;
 extern struct pool_head *pool_head_http_txn;
diff --git a/include/haproxy/log.h b/include/haproxy/log.h
index 1092920..8eab64f 100644
--- a/include/haproxy/log.h
+++ b/include/haproxy/log.h
@@ -28,8 +28,8 @@
 #include <haproxy/log-t.h>
 #include <haproxy/pool-t.h>
 #include <haproxy/proxy-t.h>
+#include <haproxy/stream.h>
 #include <haproxy/thread-t.h>
-#include <proto/stream.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 d42b250..0946c40 100644
--- a/include/haproxy/obj_type.h
+++ b/include/haproxy/obj_type.h
@@ -31,7 +31,7 @@
 #include <haproxy/pool.h>
 #include <haproxy/proxy-t.h>
 #include <haproxy/server-t.h>
-#include <types/stream.h>
+#include <haproxy/stream-t.h>
 #include <haproxy/stream_interface-t.h>
 
 static inline enum obj_type obj_type(const enum obj_type *t)
diff --git a/include/haproxy/payload.h b/include/haproxy/payload.h
index da5b4e1..f91817a 100644
--- a/include/haproxy/payload.h
+++ b/include/haproxy/payload.h
@@ -24,7 +24,7 @@
 
 #include <haproxy/api.h>
 #include <haproxy/sample-t.h>
-#include <types/stream.h>
+#include <haproxy/stream-t.h>
 
 int fetch_rdp_cookie_name(struct stream *s, struct sample *smp, const char *cname, int clen);
 int val_payload_lv(struct arg *arg, char **err_msg);
diff --git a/include/haproxy/peers.h b/include/haproxy/peers.h
index 958123a..636b5c8 100644
--- a/include/haproxy/peers.h
+++ b/include/haproxy/peers.h
@@ -27,10 +27,10 @@
 #include <haproxy/obj_type.h>
 #include <haproxy/peers-t.h>
 #include <haproxy/proxy-t.h>
+#include <haproxy/stick_table-t.h>
+#include <haproxy/stream-t.h>
 #include <haproxy/time.h>
 
-#include <haproxy/stick_table-t.h>
-#include <types/stream.h>
 
 extern struct peers *cfg_peers;
 
diff --git a/include/haproxy/queue.h b/include/haproxy/queue.h
index ef61c0d..19e1c51 100644
--- a/include/haproxy/queue.h
+++ b/include/haproxy/queue.h
@@ -28,7 +28,7 @@
 #include <haproxy/proxy-t.h>
 #include <haproxy/queue-t.h>
 #include <haproxy/server-t.h>
-#include <types/stream.h>
+#include <haproxy/stream-t.h>
 
 extern struct pool_head *pool_head_pendconn;
 
diff --git a/include/haproxy/spoe-t.h b/include/haproxy/spoe-t.h
index 9b0df17..bd9bdb2 100644
--- a/include/haproxy/spoe-t.h
+++ b/include/haproxy/spoe-t.h
@@ -31,9 +31,9 @@
 #include <haproxy/list-t.h>
 #include <haproxy/proxy-t.h>
 #include <haproxy/sample-t.h>
+#include <haproxy/stream-t.h>
 #include <haproxy/task-t.h>
 #include <haproxy/thread-t.h>
-#include <types/stream.h>
 
 /* Type of list of messages */
 #define SPOE_MSGS_BY_EVENT 0x01
diff --git a/include/types/stream.h b/include/haproxy/stream-t.h
similarity index 97%
rename from include/types/stream.h
rename to include/haproxy/stream-t.h
index 8e71049..9d8c1fe 100644
--- a/include/types/stream.h
+++ b/include/haproxy/stream-t.h
@@ -1,8 +1,8 @@
 /*
- * include/types/stream.h
+ * include/haproxy/stream-t.h
  * This file defines everything related to streams.
  *
- * Copyright (C) 2000-2015 Willy Tarreau - w@1wt.eu
+ * Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -19,16 +19,13 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _TYPES_STREAM_H
-#define _TYPES_STREAM_H
-
+#ifndef _HAPROXY_STREAM_T_H
+#define _HAPROXY_STREAM_T_H
 
 #include <sys/time.h>
-#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#include <haproxy/api-t.h>
 #include <haproxy/channel-t.h>
 #include <haproxy/dynbuf-t.h>
 #include <haproxy/filters-t.h>
@@ -40,11 +37,12 @@
 #include <haproxy/queue-t.h>
 #include <haproxy/server-t.h>
 #include <haproxy/session-t.h>
+#include <haproxy/stick_table-t.h>
 #include <haproxy/stream_interface-t.h>
+#include <haproxy/task-t.h>
+#include <haproxy/api-t.h>
 #include <haproxy/vars-t.h>
 
-#include <haproxy/task-t.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 */
@@ -195,7 +193,7 @@
 	} dns_ctx;                              /* context information for DNS resolution */
 };
 
-#endif /* _TYPES_STREAM_H */
+#endif /* _HAPROXY_STREAM_T_H */
 
 /*
  * Local variables:
diff --git a/include/proto/stream.h b/include/haproxy/stream.h
similarity index 97%
rename from include/proto/stream.h
rename to include/haproxy/stream.h
index be6fcd2..d9f2e18 100644
--- a/include/proto/stream.h
+++ b/include/haproxy/stream.h
@@ -1,8 +1,8 @@
 /*
- * include/proto/stream.h
+ * include/haproxy/stream.h
  * This file defines everything related to streams.
  *
- * Copyright (C) 2000-2010 Willy Tarreau - w@1wt.eu
+ * Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -19,20 +19,20 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _PROTO_STREAM_H
-#define _PROTO_STREAM_H
+#ifndef _HAPROXY_STREAM_H
+#define _HAPROXY_STREAM_H
 
 #include <haproxy/action-t.h>
 #include <haproxy/api.h>
-#include <haproxy/pool.h>
-#include <types/stream.h>
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
 #include <haproxy/obj_type.h>
+#include <haproxy/pool-t.h>
 #include <haproxy/queue.h>
 #include <haproxy/stick_table.h>
-#include <haproxy/task.h>
-#include <haproxy/trace.h>
+#include <haproxy/stream-t.h>
+#include <haproxy/task-t.h>
+#include <haproxy/trace-t.h>
 
 extern struct trace_source trace_strm;
 
@@ -418,7 +418,7 @@
 void service_keywords_register(struct action_kw_list *kw_list);
 void list_services(FILE *out);
 
-#endif /* _PROTO_STREAM_H */
+#endif /* _HAPROXY_STREAM_H */
 
 /*
  * Local variables:
diff --git a/include/haproxy/stream_interface.h b/include/haproxy/stream_interface.h
index 653ae39..f3e60b7 100644
--- a/include/haproxy/stream_interface.h
+++ b/include/haproxy/stream_interface.h
@@ -26,8 +26,8 @@
 #include <haproxy/api.h>
 #include <haproxy/channel.h>
 #include <haproxy/connection.h>
+#include <haproxy/stream-t.h>
 #include <haproxy/stream_interface-t.h>
-#include <types/stream.h>
 
 
 extern struct si_ops si_embedded_ops;
diff --git a/include/haproxy/tcp_rules.h b/include/haproxy/tcp_rules.h
index d808062..57073f4 100644
--- a/include/haproxy/tcp_rules.h
+++ b/include/haproxy/tcp_rules.h
@@ -25,7 +25,7 @@
 #include <haproxy/action-t.h>
 #include <haproxy/api.h>
 #include <haproxy/session-t.h>
-#include <types/stream.h>
+#include <haproxy/stream-t.h>
 
 int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit);
 int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit);
diff --git a/include/haproxy/vars.h b/include/haproxy/vars.h
index b13e82d..0b73b36 100644
--- a/include/haproxy/vars.h
+++ b/include/haproxy/vars.h
@@ -22,8 +22,8 @@
 #ifndef _HAPROXY_VARS_H
 #define _HAPROXY_VARS_H
 
-#include <types/stream.h>
 #include <haproxy/session-t.h>
+#include <haproxy/stream-t.h>
 #include <haproxy/api-t.h>
 #include <haproxy/vars-t.h>
 
diff --git a/src/applet.c b/src/applet.c
index e27e2a6..3ec106c 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -17,9 +17,9 @@
 #include <haproxy/api.h>
 #include <haproxy/channel.h>
 #include <haproxy/list.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
-#include <proto/stream.h>
 
 unsigned int nb_applets = 0;
 
diff --git a/src/backend.c b/src/backend.c
index e4b677a..4927b01 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -43,10 +43,12 @@
 #include <haproxy/server.h>
 #include <haproxy/session.h>
 #include <haproxy/ssl_sock.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
 #include <haproxy/ticks.h>
 #include <haproxy/time.h>
+#include <haproxy/trace.h>
 #include <haproxy/namespace.h>
 
 #include <haproxy/global.h>
@@ -55,7 +57,6 @@
 #include <haproxy/protocol.h>
 #include <haproxy/proto_tcp.h>
 #include <haproxy/sample.h>
-#include <proto/stream.h>
 
 #define TRACE_SOURCE &trace_strm
 
diff --git a/src/cache.c b/src/cache.c
index e95493a..ba96ede 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -21,12 +21,11 @@
 #include <haproxy/log.h>
 #include <haproxy/proxy.h>
 #include <haproxy/shctx.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <import/eb32tree.h>
 #include <import/sha1.h>
 
-#include <proto/stream.h>
-
 
 #include <common/cfgparse.h>
 #include <haproxy/hash.h>
diff --git a/src/cfgparse-global.c b/src/cfgparse-global.c
index 2120b63..8126172 100644
--- a/src/cfgparse-global.c
+++ b/src/cfgparse-global.c
@@ -13,6 +13,7 @@
 
 #include <common/cfgparse.h>
 #include <haproxy/compression.h>
+#include <haproxy/global.h>
 
 /*
  * parse a line in a <global> section. Returns the error code, 0 if OK, or
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 49ef69d..a983e5a 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -77,8 +77,8 @@
 #include <haproxy/protocol.h>
 #include <haproxy/peers.h>
 #include <haproxy/sample.h>
-#include <proto/stream.h>
 #include <haproxy/stick_table.h>
+#include <haproxy/stream.h>
 #include <haproxy/tcp_rules.h>
 
 
diff --git a/src/cli.c b/src/cli.c
index 07d3631..c39cbb6 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -45,6 +45,7 @@
 #include <haproxy/server.h>
 #include <haproxy/session.h>
 #include <haproxy/stats-t.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
 #include <haproxy/tools.h>
@@ -61,7 +62,6 @@
 #include <haproxy/freq_ctr.h>
 #include <haproxy/pipe.h>
 #include <haproxy/protocol.h>
-#include <proto/stream.h>
 
 #define PAYLOAD_PATTERN "<<"
 
diff --git a/src/compression.c b/src/compression.c
index f77292c..cd548fc 100644
--- a/src/compression.c
+++ b/src/compression.c
@@ -29,6 +29,7 @@
 #include <haproxy/api.h>
 #include <haproxy/dynbuf.h>
 #include <common/cfgparse.h>
+#include <haproxy/stream.h>
 #include <haproxy/thread.h>
 #include <haproxy/pool.h>
 
@@ -37,7 +38,6 @@
 
 #include <haproxy/compression.h>
 #include <haproxy/freq_ctr.h>
-#include <proto/stream.h>
 
 
 #if defined(USE_ZLIB)
diff --git a/src/filters.c b/src/filters.c
index b658739..f0bfcf5 100644
--- a/src/filters.c
+++ b/src/filters.c
@@ -13,19 +13,19 @@
 #include <haproxy/api.h>
 #include <haproxy/buf-t.h>
 #include <common/cfgparse.h>
+#include <haproxy/compression.h>
 #include <haproxy/errors.h>
 #include <haproxy/filters.h>
 #include <haproxy/flt_http_comp.h>
-#include <haproxy/http_ana-t.h>
+#include <haproxy/http_ana.h>
 #include <haproxy/http_htx.h>
 #include <haproxy/htx.h>
 #include <haproxy/namespace.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/tools.h>
+#include <haproxy/trace.h>
 
-#include <haproxy/compression.h>
-#include <haproxy/http_ana.h>
-#include <proto/stream.h>
 
 #define TRACE_SOURCE &trace_strm
 
diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c
index db758d1..30b5aad 100644
--- a/src/flt_http_comp.c
+++ b/src/flt_http_comp.c
@@ -22,10 +22,9 @@
 #include <haproxy/list.h>
 #include <haproxy/proxy-t.h>
 #include <haproxy/sample.h>
+#include <haproxy/stream.h>
 #include <haproxy/tools.h>
 
-#include <proto/stream.h>
-
 const char *http_comp_flt_id = "compression filter";
 
 struct flt_ops comp_ops;
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index 47a43e6..25c075b 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -14,10 +14,13 @@
 
 #include <haproxy/acl.h>
 #include <haproxy/action-t.h>
+#include <haproxy/arg.h>
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
 #include <haproxy/filters.h>
+#include <haproxy/freq_ctr.h>
 #include <haproxy/frontend.h>
+#include <haproxy/global.h>
 #include <haproxy/http_rules.h>
 #include <haproxy/log.h>
 #include <haproxy/sample.h>
@@ -27,18 +30,13 @@
 #include <haproxy/proxy.h>
 #include <haproxy/session.h>
 #include <haproxy/spoe.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
 #include <haproxy/tcp_rules.h>
 #include <haproxy/time.h>
 #include <haproxy/vars.h>
 
-#include <haproxy/arg-t.h>
-#include <haproxy/global.h>
-
-#include <haproxy/arg.h>
-#include <haproxy/freq_ctr.h>
-#include <proto/stream.h>
 
 #if defined(DEBUG_SPOE) || defined(DEBUG_FULL)
 #define SPOE_PRINTF(x...) fprintf(x)
diff --git a/src/flt_trace.c b/src/flt_trace.c
index 940ddd2..b0e448a 100644
--- a/src/flt_trace.c
+++ b/src/flt_trace.c
@@ -15,19 +15,16 @@
 #include <haproxy/api.h>
 #include <haproxy/channel-t.h>
 #include <haproxy/filters.h>
+#include <haproxy/global.h>
 #include <haproxy/http_ana-t.h>
 #include <haproxy/http_htx.h>
 #include <haproxy/htx.h>
 #include <haproxy/log.h>
 #include <haproxy/proxy-t.h>
+#include <haproxy/stream.h>
 #include <haproxy/tools.h>
 #include <haproxy/time.h>
 
-#include <haproxy/global.h>
-#include <types/stream.h>
-
-#include <proto/stream.h>
-
 const char *trace_flt_id = "trace filter";
 
 struct flt_ops trace_ops;
diff --git a/src/frontend.c b/src/frontend.c
index 78dc964..b819f5b 100644
--- a/src/frontend.c
+++ b/src/frontend.c
@@ -30,6 +30,7 @@
 #include <haproxy/log.h>
 #include <haproxy/proxy.h>
 #include <haproxy/sample.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
 #include <haproxy/tools.h>
@@ -40,7 +41,6 @@
 #include <haproxy/arg.h>
 #include <haproxy/fd.h>
 #include <haproxy/proto_tcp.h>
-#include <proto/stream.h>
 
 /* Finish a stream accept() for a proxy (TCP or HTTP). It returns a negative
  * value in case of a critical failure which must cause the listener to be
diff --git a/src/h1_htx.c b/src/h1_htx.c
index b27ddca..f6f21f2 100644
--- a/src/h1_htx.c
+++ b/src/h1_htx.c
@@ -12,6 +12,7 @@
 
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
+#include <haproxy/global.h>
 #include <haproxy/h1.h>
 #include <haproxy/h1_htx.h>
 #include <haproxy/http.h>
diff --git a/src/haproxy.c b/src/haproxy.c
index f1478b2..043625f 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -111,6 +111,7 @@
 #include <haproxy/session.h>
 #include <haproxy/signal.h>
 #include <haproxy/ssl_sock.h>
+#include <haproxy/stream.h>
 #include <haproxy/tools.h>
 #include <haproxy/time.h>
 #include <haproxy/uri_auth-t.h>
@@ -126,7 +127,6 @@
 #include <haproxy/arg.h>
 #include <haproxy/fd.h>
 #include <haproxy/protocol.h>
-#include <proto/stream.h>
 
 /* array of init calls for older platforms */
 DECLARE_INIT_STAGES;
diff --git a/src/hlua.c b/src/hlua.c
index 57e015c..ef41e7d 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -25,6 +25,7 @@
 #include <haproxy/api.h>
 #include <import/ebpttree.h>
 
+#include <haproxy/arg.h>
 #include <common/cfgparse.h>
 #include <haproxy/channel.h>
 #include <haproxy/cli.h>
@@ -48,15 +49,13 @@
 #include <haproxy/server-t.h>
 #include <haproxy/session.h>
 #include <haproxy/stats-t.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
 #include <haproxy/tcp_rules.h>
 #include <haproxy/tools.h>
 #include <haproxy/vars.h>
 
-#include <haproxy/arg.h>
-#include <proto/stream.h>
-
 /* Lua uses longjmp to perform yield or throwing errors. This
  * macro is used only for identifying the function that can
  * not return because a longjmp is executed.
diff --git a/src/http_ana.c b/src/http_ana.c
index c0b3dd4..c4973e8 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -15,6 +15,7 @@
 #include <haproxy/backend.h>
 #include <haproxy/api.h>
 #include <haproxy/base64.h>
+#include <haproxy/capture-t.h>
 #include <haproxy/channel.h>
 #include <haproxy/check.h>
 #include <haproxy/connection.h>
@@ -29,13 +30,12 @@
 #include <haproxy/regex.h>
 #include <haproxy/server-t.h>
 #include <haproxy/stats.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
+#include <haproxy/trace.h>
 #include <haproxy/uri_auth-t.h>
 #include <haproxy/vars.h>
 
-#include <haproxy/capture-t.h>
-
-#include <proto/stream.h>
 
 #define TRACE_SOURCE &trace_strm
 
diff --git a/src/http_conv.c b/src/http_conv.c
index bee2f90..c9f0ffa 100644
--- a/src/http_conv.c
+++ b/src/http_conv.c
@@ -16,19 +16,17 @@
 #include <string.h>
 #include <time.h>
 
+#include <haproxy/arg.h>
 #include <haproxy/api.h>
+#include <haproxy/capture-t.h>
 #include <haproxy/chunk.h>
 #include <haproxy/http.h>
 #include <haproxy/pool.h>
 #include <haproxy/sample.h>
+#include <haproxy/stream.h>
 #include <haproxy/tools.h>
 #include <haproxy/version.h>
 
-#include <haproxy/capture-t.h>
-
-#include <haproxy/arg.h>
-#include <proto/stream.h>
-
 static int smp_check_http_date_unit(struct arg *args, struct sample_conv *conv,
                                     const char *file, int line, char **err)
 {
diff --git a/src/http_fetch.c b/src/http_fetch.c
index 812ede5..c2b8288 100644
--- a/src/http_fetch.c
+++ b/src/http_fetch.c
@@ -16,6 +16,7 @@
 #include <string.h>
 #include <time.h>
 
+#include <haproxy/arg.h>
 #include <haproxy/auth.h>
 #include <haproxy/api.h>
 #include <haproxy/base64.h>
@@ -33,12 +34,10 @@
 #include <haproxy/obj_type.h>
 #include <haproxy/pool.h>
 #include <haproxy/sample.h>
+#include <haproxy/stream.h>
 #include <haproxy/tools.h>
 #include <haproxy/version.h>
 
-#include <haproxy/arg.h>
-#include <proto/stream.h>
-
 
 /* this struct is used between calls to smp_fetch_hdr() or smp_fetch_cookie() */
 static THREAD_LOCAL struct http_hdr_ctx static_http_hdr_ctx;
diff --git a/src/http_rules.c b/src/http_rules.c
index 40ffb71..e4506f9 100644
--- a/src/http_rules.c
+++ b/src/http_rules.c
@@ -21,6 +21,7 @@
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
 #include <haproxy/chunk.h>
+#include <haproxy/global.h>
 #include <haproxy/http.h>
 #include <haproxy/http_rules.h>
 #include <haproxy/pool.h>
diff --git a/src/listener.c b/src/listener.c
index 1779642..a7ff803 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -27,6 +27,7 @@
 #include <haproxy/list.h>
 #include <haproxy/listener.h>
 #include <haproxy/log.h>
+#include <haproxy/stream.h>
 #include <haproxy/task.h>
 #include <haproxy/tools.h>
 #include <haproxy/time.h>
@@ -38,7 +39,6 @@
 #include <haproxy/protocol.h>
 #include <haproxy/proto_sockpair.h>
 #include <haproxy/sample.h>
-#include <proto/stream.h>
 
 /* List head of all known bind keywords */
 static struct bind_kw_list bind_keywords = {
diff --git a/src/log.c b/src/log.c
index 4027db2..8c2334a 100644
--- a/src/log.c
+++ b/src/log.c
@@ -31,6 +31,7 @@
 #include <haproxy/http.h>
 #include <haproxy/log.h>
 #include <haproxy/ssl_sock.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/tools.h>
 #include <haproxy/time.h>
@@ -42,7 +43,6 @@
 #include <haproxy/ring.h>
 #include <haproxy/sample.h>
 #include <haproxy/sink.h>
-#include <proto/stream.h>
 
 struct log_fmt {
 	char *name;
diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c
index 5664b88..dc4bab1 100644
--- a/src/mux_fcgi.c
+++ b/src/mux_fcgi.c
@@ -27,9 +27,8 @@
 #include <haproxy/regex.h>
 #include <haproxy/session-t.h>
 #include <haproxy/ssl_sock.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
-
-#include <proto/stream.h>
 #include <haproxy/trace.h>
 
 /* FCGI Connection flags (32 bits) */
diff --git a/src/mux_h1.c b/src/mux_h1.c
index c2896b4..cffdd60 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -26,7 +26,7 @@
 #include <haproxy/http_htx.h>
 #include <haproxy/log.h>
 #include <haproxy/session-t.h>
-#include <proto/stream.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/trace.h>
 
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 34caea3..44a4332 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -10,6 +10,7 @@
  *
  */
 
+#include <import/eb32tree.h>
 #include <haproxy/api.h>
 #include <haproxy/istbuf.h>
 #include <common/cfgparse.h>
@@ -23,10 +24,9 @@
 #include <haproxy/htx.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/session-t.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/trace.h>
-#include <proto/stream.h>
-#include <import/eb32tree.h>
 
 
 /* dummy streams returned for closed, error, refused, idle and states */
diff --git a/src/mux_pt.c b/src/mux_pt.c
index 08d6cea..bbfcf5b 100644
--- a/src/mux_pt.c
+++ b/src/mux_pt.c
@@ -13,8 +13,8 @@
 #include <haproxy/api.h>
 #include <haproxy/buf.h>
 #include <haproxy/connection.h>
+#include <haproxy/stream.h>
 #include <haproxy/task.h>
-#include <proto/stream.h>
 
 struct mux_pt_ctx {
 	struct conn_stream *cs;
diff --git a/src/mworker-prog.c b/src/mworker-prog.c
index 800624f..f6e61ed 100644
--- a/src/mworker-prog.c
+++ b/src/mworker-prog.c
@@ -23,8 +23,10 @@
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
 #include <haproxy/errors.h>
+#include <haproxy/global.h>
 #include <haproxy/log.h>
 #include <haproxy/mworker.h>
+#include <haproxy/task.h>
 
 
 static int use_program = 0; /* do we use the program section ? */
diff --git a/src/mworker.c b/src/mworker.c
index 9546b26..9dd9f33 100644
--- a/src/mworker.c
+++ b/src/mworker.c
@@ -20,6 +20,8 @@
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
 #include <haproxy/cli.h>
+#include <haproxy/fd.h>
+#include <haproxy/global.h>
 #include <haproxy/list.h>
 #include <haproxy/listener.h>
 #include <haproxy/log.h>
@@ -27,14 +29,10 @@
 #include <haproxy/peers.h>
 #include <haproxy/proxy-t.h>
 #include <haproxy/signal.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/version.h>
 
-#include <haproxy/global.h>
-
-#include <haproxy/fd.h>
-#include <proto/stream.h>
-
 
 #if defined(USE_SYSTEMD)
 #include <systemd/sd-daemon.h>
diff --git a/src/namespace.c b/src/namespace.c
index 8b7190c..59d03c2 100644
--- a/src/namespace.c
+++ b/src/namespace.c
@@ -11,10 +11,11 @@
 #include <string.h>
 
 #include <haproxy/api.h>
-#include <haproxy/namespace.h>
-#include <haproxy/hash.h>
 #include <haproxy/errors.h>
+#include <haproxy/global.h>
+#include <haproxy/hash.h>
 #include <haproxy/log.h>
+#include <haproxy/namespace.h>
 #include <haproxy/signal.h>
 
 /* Opens the namespace <ns_name> and returns the FD or -1 in case of error
diff --git a/src/peers.c b/src/peers.c
index 933f8ba..dca5619 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -25,6 +25,7 @@
 #include <haproxy/channel.h>
 #include <haproxy/cli.h>
 #include <haproxy/dict.h>
+#include <haproxy/fd.h>
 #include <haproxy/frontend.h>
 #include <haproxy/log.h>
 #include <haproxy/net_helper.h>
@@ -35,15 +36,13 @@
 #include <haproxy/session-t.h>
 #include <haproxy/signal.h>
 #include <haproxy/stats-t.h>
+#include <haproxy/stick_table.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/time.h>
 #include <haproxy/tools.h>
 #include <haproxy/thread.h>
 
-#include <haproxy/fd.h>
-#include <proto/stream.h>
-#include <haproxy/stick_table.h>
-
 
 /*******************************/
 /* Current peer learning state */
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 4ca4100..2a259f8 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -43,11 +43,10 @@
 #include <haproxy/proxy-t.h>
 #include <haproxy/sample.h>
 #include <haproxy/server.h>
+#include <haproxy/stream-t.h>
 #include <haproxy/tools.h>
 #include <haproxy/namespace.h>
 
-#include <types/stream.h>
-
 #include <haproxy/arg.h>
 #include <haproxy/fd.h>
 #include <haproxy/port_range.h>
diff --git a/src/proxy.c b/src/proxy.c
index 12cbd46..e13c4ed 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -33,6 +33,7 @@
 #include <haproxy/proxy.h>
 #include <haproxy/server-t.h>
 #include <haproxy/stats-t.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
 #include <haproxy/time.h>
@@ -45,7 +46,6 @@
 #include <haproxy/fd.h>
 #include <haproxy/proto_tcp.h>
 #include <haproxy/signal.h>
-#include <proto/stream.h>
 
 
 int listeners;	/* # of proxy listeners, set by cfgparse */
diff --git a/src/queue.c b/src/queue.c
index c2853a9..3cc8aea 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -69,6 +69,7 @@
  *   - a pendconn doesn't switch between queues, it stays where it is.
  */
 
+#include <import/eb32tree.h>
 #include <haproxy/backend.h>
 #include <haproxy/api.h>
 #include <haproxy/http_rules.h>
@@ -76,14 +77,12 @@
 #include <haproxy/queue.h>
 #include <haproxy/sample.h>
 #include <haproxy/server-t.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
 #include <haproxy/tcp_rules.h>
 #include <haproxy/time.h>
 #include <haproxy/thread.h>
-#include <import/eb32tree.h>
-
-#include <proto/stream.h>
 
 
 #define NOW_OFFSET_BOUNDARY()          ((now_ms - (TIMER_LOOK_BACK >> 12)) & 0xfffff)
diff --git a/src/regex.c b/src/regex.c
index 3510f72..1c3c55f 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -15,6 +15,7 @@
 #include <string.h>
 
 #include <haproxy/api.h>
+#include <haproxy/global.h>
 #include <haproxy/log.h>
 #include <haproxy/regex.h>
 #include <haproxy/tools.h>
diff --git a/src/server.c b/src/server.c
index 63aa6ea..32aa72e 100644
--- a/src/server.c
+++ b/src/server.c
@@ -32,13 +32,13 @@
 #include <haproxy/sample.h>
 #include <haproxy/server.h>
 #include <haproxy/stats-t.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
 #include <haproxy/time.h>
 
 #include <haproxy/port_range.h>
 #include <haproxy/protocol.h>
-#include <proto/stream.h>
 #include <netinet/tcp.h>
 
 #include <import/ebsttree.h>
diff --git a/src/session.c b/src/session.c
index 7066a8f..02b0212 100644
--- a/src/session.c
+++ b/src/session.c
@@ -22,7 +22,6 @@
 #include <haproxy/tcp_rules.h>
 #include <haproxy/vars.h>
 
-#include <proto/stream.h>
 
 DECLARE_POOL(pool_head_session, "session", sizeof(struct session));
 DECLARE_POOL(pool_head_sess_srv_list, "session server list",
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 4cbe2dc..be3cd16 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -64,6 +64,7 @@
 #include <haproxy/ssl_sock.h>
 #include <haproxy/ssl_utils.h>
 #include <haproxy/stats-t.h>
+#include <haproxy/stream-t.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
 #include <haproxy/tools.h>
@@ -79,7 +80,6 @@
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
 #include <haproxy/proto_tcp.h>
-#include <proto/stream.h>
 
 /* ***** READ THIS before adding code here! *****
  *
diff --git a/src/stats.c b/src/stats.c
index 21d8dad..558e48f 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -50,6 +50,7 @@
 #include <haproxy/session.h>
 #include <haproxy/ssl_sock.h>
 #include <haproxy/stats.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
 #include <haproxy/tools.h>
@@ -62,7 +63,6 @@
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
 #include <haproxy/pipe.h>
-#include <proto/stream.h>
 
 /* status codes available for the stats admin page (strictly 4 chars length) */
 const char *stat_status_codes[STAT_STATUS_SIZE] = {
diff --git a/src/stick_table.c b/src/stick_table.c
index 03f6ca4..821ab98 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -26,6 +26,7 @@
 #include <haproxy/peers.h>
 #include <haproxy/proxy.h>
 #include <haproxy/stats-t.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
 #include <haproxy/tcp_rules.h>
@@ -39,7 +40,6 @@
 #include <haproxy/arg.h>
 #include <haproxy/proto_tcp.h>
 #include <haproxy/sample.h>
-#include <proto/stream.h>
 #include <haproxy/stick_table.h>
 
 /* structure used to return a table key built from a sample */
diff --git a/src/stream.c b/src/stream.c
index 52fcf9b..ecc65ac 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -46,16 +46,17 @@
 #include <haproxy/server.h>
 #include <haproxy/session.h>
 #include <haproxy/stats-t.h>
+#include <haproxy/stream.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
 #include <haproxy/tcp_rules.h>
+#include <haproxy/trace.h>
 #include <haproxy/vars.h>
 
 #include <haproxy/activity.h>
 #include <haproxy/arg.h>
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
-#include <proto/stream.h>
 #include <haproxy/pipe.h>
 #include <haproxy/stick_table.h>
 
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 67477a5..1d6cf51 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -26,6 +26,7 @@
 #include <haproxy/dynbuf.h>
 #include <haproxy/http_htx.h>
 #include <haproxy/proxy.h>
+#include <haproxy/stream-t.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/tools.h>
 #include <haproxy/ticks.h>
@@ -33,7 +34,6 @@
 #include <haproxy/task.h>
 
 #include <haproxy/pipe.h>
-#include <proto/stream.h>
 
 #include <haproxy/pipe-t.h>
 
diff --git a/src/task.c b/src/task.c
index 368c3d0..bcf18b2 100644
--- a/src/task.c
+++ b/src/task.c
@@ -15,6 +15,7 @@
 #include <haproxy/api.h>
 #include <haproxy/pool.h>
 #include <haproxy/list.h>
+#include <haproxy/stream.h>
 #include <haproxy/task.h>
 #include <haproxy/tools.h>
 #include <haproxy/time.h>
@@ -23,7 +24,6 @@
 
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
-#include <proto/stream.h>
 
 DECLARE_POOL(pool_head_task,    "task",    sizeof(struct task));
 DECLARE_POOL(pool_head_tasklet, "tasklet", sizeof(struct tasklet));
diff --git a/src/tcp_rules.c b/src/tcp_rules.c
index 750108b..5966fce 100644
--- a/src/tcp_rules.c
+++ b/src/tcp_rules.c
@@ -11,6 +11,7 @@
  */
 #include <haproxy/acl.h>
 #include <haproxy/action.h>
+#include <haproxy/arg-t.h>
 #include <haproxy/api.h>
 #include <haproxy/capture-t.h>
 #include <common/cfgparse.h>
@@ -21,16 +22,15 @@
 #include <haproxy/log.h>
 #include <haproxy/proxy.h>
 #include <haproxy/sample.h>
+#include <haproxy/stick_table.h>
+#include <haproxy/stream-t.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/tcp_rules.h>
 #include <haproxy/tools.h>
 #include <haproxy/ticks.h>
 #include <haproxy/time.h>
+#include <haproxy/trace.h>
 
-#include <haproxy/arg-t.h>
-
-#include <haproxy/stick_table.h>
-#include <proto/stream.h>
 
 #define TRACE_SOURCE &trace_strm
 
diff --git a/src/vars.c b/src/vars.c
index b26d60f..53afe1a 100644
--- a/src/vars.c
+++ b/src/vars.c
@@ -1,17 +1,18 @@
 #include <ctype.h>
 
+#include <haproxy/arg.h>
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
 #include <haproxy/check.h>
+#include <haproxy/global.h>
 #include <haproxy/http.h>
 #include <haproxy/http_rules.h>
 #include <haproxy/list.h>
 #include <haproxy/sample.h>
+#include <haproxy/stream-t.h>
 #include <haproxy/tcp_rules.h>
 #include <haproxy/vars.h>
 
-#include <haproxy/arg.h>
-#include <proto/stream.h>
 
 /* This contains a pool of struct vars */
 DECLARE_STATIC_POOL(var_pool, "vars", sizeof(struct var));