REORG: include: move common/buffer.h to haproxy/dynbuf{,-t}.h

The pretty confusing "buffer.h" was in fact not the place to look for
the definition of "struct buffer" but the one responsible for dynamic
buffer allocation. As such it defines the struct buffer_wait and the
few functions to allocate a buffer or wait for one.

This patch moves it renaming it to dynbuf.h. The type definition was
moved to its own file since it's included in a number of other structs.

Doing this cleanup revealed that a significant number of files used to
rely on this one to inherit struct buffer through it but didn't need
anything from this file at all.
diff --git a/include/common/h1.h b/include/common/h1.h
index 1295b14..205a25c 100644
--- a/include/common/h1.h
+++ b/include/common/h1.h
@@ -23,8 +23,8 @@
 #define _COMMON_H1_H
 
 #include <haproxy/api.h>
+#include <haproxy/dynbuf.h>
 #include <haproxy/intops.h>
-#include <common/buffer.h>
 #include <common/http.h>
 #include <common/http-hdr.h>
 #include <import/ist.h>
diff --git a/include/haproxy/dynbuf-t.h b/include/haproxy/dynbuf-t.h
new file mode 100644
index 0000000..451d58c
--- /dev/null
+++ b/include/haproxy/dynbuf-t.h
@@ -0,0 +1,42 @@
+/*
+ * include/haproxy/dynbuf-t.h
+ * Structure definitions for dynamic buffer management.
+ *
+ * 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
+ * License as published by the Free Software Foundation, version 2.1
+ * exclusively.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef _HAPROXY_DYNBUF_T_H
+#define _HAPROXY_DYNBUF_T_H
+
+#include <haproxy/list-t.h>
+
+/* an element of the <buffer_wq> list. It represents an object that need to
+ * acquire a buffer to continue its process. */
+struct buffer_wait {
+	void *target;              /* The waiting object that should be woken up */
+	int (*wakeup_cb)(void *);  /* The function used to wake up the <target>, passed as argument */
+	struct mt_list list;        /* Next element in the <buffer_wq> list */
+};
+
+#endif /* _HAPROXY_DYNBUF_T_H */
+
+/*
+ * Local variables:
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ * End:
+ */
diff --git a/include/common/buffer.h b/include/haproxy/dynbuf.h
similarity index 89%
rename from include/common/buffer.h
rename to include/haproxy/dynbuf.h
index 4e19c22..01a784d 100644
--- a/include/common/buffer.h
+++ b/include/haproxy/dynbuf.h
@@ -1,8 +1,8 @@
 /*
- * include/common/buffer.h
- * Buffer management definitions, macros and inline functions.
+ * include/haproxy/dynbuf.h
+ * Buffer management functions.
  *
- * Copyright (C) 2000-2012 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,30 +19,22 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _COMMON_BUFFER_H
-#define _COMMON_BUFFER_H
+#ifndef _HAPROXY_DYNBUF_H
+#define _HAPROXY_DYNBUF_H
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <import/ist.h>
+#include <haproxy/activity.h>
 #include <haproxy/api.h>
 #include <haproxy/buf.h>
 #include <haproxy/chunk.h>
-#include <import/ist.h>
-#include <haproxy/istbuf.h>
+#include <haproxy/dynbuf-t.h>
+#include <haproxy/list-t.h>
 #include <haproxy/pool.h>
 
-#include <haproxy/activity.h>
-
-/* an element of the <buffer_wq> list. It represents an object that need to
- * acquire a buffer to continue its process. */
-struct buffer_wait {
-	void *target;              /* The waiting object that should be woken up */
-	int (*wakeup_cb)(void *);  /* The function used to wake up the <target>, passed as argument */
-	struct mt_list list;        /* Next element in the <buffer_wq> list */
-};
-
 extern struct pool_head *pool_head_buffer;
 extern struct mt_list buffer_wq;
 __decl_thread(extern HA_SPINLOCK_T buffer_wq_lock);
@@ -210,7 +202,7 @@
 }
 
 
-#endif /* _COMMON_BUFFER_H */
+#endif /* _HAPROXY_DYNBUF_H */
 
 /*
  * Local variables:
diff --git a/include/proto/channel.h b/include/proto/channel.h
index a36b63a..d343c02 100644
--- a/include/proto/channel.h
+++ b/include/proto/channel.h
@@ -29,6 +29,7 @@
 
 #include <haproxy/api.h>
 #include <haproxy/chunk.h>
+#include <haproxy/dynbuf.h>
 #include <common/htx.h>
 #include <common/ticks.h>
 #include <haproxy/time.h>
diff --git a/include/proto/session.h b/include/proto/session.h
index 866217e..a52e982 100644
--- a/include/proto/session.h
+++ b/include/proto/session.h
@@ -23,7 +23,6 @@
 #define _PROTO_SESSION_H
 
 #include <haproxy/api.h>
-#include <common/buffer.h>
 #include <haproxy/pool.h>
 
 #include <types/global.h>
diff --git a/include/proto/trace.h b/include/proto/trace.h
index 7a2b5e7..f16763d 100644
--- a/include/proto/trace.h
+++ b/include/proto/trace.h
@@ -23,7 +23,6 @@
 #define _PROTO_TRACE_H
 
 #include <haproxy/api.h>
-#include <common/buffer.h>
 #include <common/standard.h>
 #include <import/ist.h>
 #include <haproxy/list.h>
diff --git a/include/types/applet.h b/include/types/applet.h
index ac7f38d..7b21f9a 100644
--- a/include/types/applet.h
+++ b/include/types/applet.h
@@ -23,13 +23,13 @@
 #define _TYPES_APPLET_H
 
 #include <haproxy/api-t.h>
+#include <haproxy/buf.h>
+#include <haproxy/dynbuf-t.h>
 #include <haproxy/freq_ctr-t.h>
 #include <types/hlua.h>
 #include <types/obj_type.h>
 #include <types/proxy.h>
 #include <types/stream.h>
-#include <common/buffer.h>
-#include <haproxy/chunk.h>
 #include <common/xref.h>
 
 struct appctx;
diff --git a/include/types/channel.h b/include/types/channel.h
index 863c3fb..d3823f2 100644
--- a/include/types/channel.h
+++ b/include/types/channel.h
@@ -23,7 +23,7 @@
 #define _TYPES_CHANNEL_H
 
 #include <haproxy/api-t.h>
-#include <common/buffer.h>
+#include <haproxy/buf-t.h>
 
 /* The CF_* macros designate Channel Flags, which may be ORed in the bit field
  * member 'flags' in struct channel. Here we have several types of flags :
diff --git a/include/types/compression.h b/include/types/compression.h
index fc2ad26..1604909 100644
--- a/include/types/compression.h
+++ b/include/types/compression.h
@@ -32,7 +32,7 @@
 #include <zlib.h>
 #endif
 
-#include <common/buffer.h>
+#include <haproxy/buf-t.h>
 
 struct comp {
 	struct comp_algo *algos;
diff --git a/include/types/sink.h b/include/types/sink.h
index 3feb05d..aad6ba7 100644
--- a/include/types/sink.h
+++ b/include/types/sink.h
@@ -23,8 +23,8 @@
 #define _TYPES_SINK_H
 
 #include <haproxy/api-t.h>
-#include <common/buffer.h>
 #include <import/ist.h>
+#include <haproxy/api.h>
 
 /* A sink may be of 4 distinct types :
  *   - file descriptor (such as stdout)
diff --git a/include/types/spoe.h b/include/types/spoe.h
index 42b4bd5..f08b9ad 100644
--- a/include/types/spoe.h
+++ b/include/types/spoe.h
@@ -24,7 +24,7 @@
 
 #include <sys/time.h>
 
-#include <common/buffer.h>
+#include <haproxy/dynbuf-t.h>
 #include <haproxy/list-t.h>
 #include <haproxy/thread.h>
 
diff --git a/include/types/ssl_sock.h b/include/types/ssl_sock.h
index 27633ec..ca41ffc 100644
--- a/include/types/ssl_sock.h
+++ b/include/types/ssl_sock.h
@@ -31,7 +31,7 @@
 #include <types/ssl_ckch.h>
 #include <types/ssl_crtlist.h>
 
-#include <common/buffer.h>
+#include <haproxy/buf-t.h>
 #include <haproxy/thread.h>
 #include <haproxy/list-t.h>
 #include <haproxy/openssl-compat.h>
diff --git a/include/types/stream.h b/include/types/stream.h
index 37bdb96..08e0f12 100644
--- a/include/types/stream.h
+++ b/include/types/stream.h
@@ -29,6 +29,7 @@
 #include <arpa/inet.h>
 
 #include <haproxy/api-t.h>
+#include <haproxy/dynbuf-t.h>
 #include <haproxy/list-t.h>
 
 #include <types/channel.h>
diff --git a/include/types/trace.h b/include/types/trace.h
index c119ab3..2114d41 100644
--- a/include/types/trace.h
+++ b/include/types/trace.h
@@ -23,7 +23,6 @@
 #define _TYPES_TRACE_H
 
 #include <haproxy/api-t.h>
-#include <common/buffer.h>
 #include <import/ist.h>
 #include <haproxy/list-t.h>
 #include <types/sink.h>