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

This one is particularly tricky to move because everyone uses it
and it depends on a lot of other types. For example it cannot include
arg-t.h and must absolutely only rely on forward declarations to avoid
dependency loops between vars -> sample_data -> arg. In order to address
this one, it would be nice to split the sample_data part out of sample.h.
diff --git a/contrib/mod_defender/defender.h b/contrib/mod_defender/defender.h
index 088416e..59241b2 100644
--- a/contrib/mod_defender/defender.h
+++ b/contrib/mod_defender/defender.h
@@ -12,7 +12,7 @@
 #ifndef __DEFENDER_H__
 #define __DEFENDER_H__
 
-#include <types/sample.h>
+#include <haproxy/sample-t.h>
 
 struct defender_request {
 	struct sample clientip;
diff --git a/contrib/prometheus-exporter/service-prometheus.c b/contrib/prometheus-exporter/service-prometheus.c
index cdced56..fa36aa7 100644
--- a/contrib/prometheus-exporter/service-prometheus.c
+++ b/contrib/prometheus-exporter/service-prometheus.c
@@ -31,7 +31,7 @@
 #include <haproxy/compression.h>
 #include <haproxy/pipe.h>
 #include <proto/proxy.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 #include <proto/server.h>
 #include <proto/ssl_sock.h>
 #include <proto/stats.h>
diff --git a/include/haproxy/auth.h b/include/haproxy/auth.h
index 3eafa41..d7ec2f7 100644
--- a/include/haproxy/auth.h
+++ b/include/haproxy/auth.h
@@ -17,7 +17,7 @@
 #include <haproxy/auth-t.h>
 #include <haproxy/api.h>
 #include <haproxy/pattern-t.h>
-#include <types/sample.h>
+#include <haproxy/sample-t.h>
 
 extern struct userlist *userlist;
 
diff --git a/include/haproxy/map-t.h b/include/haproxy/map-t.h
index 902b064..d6085ee 100644
--- a/include/haproxy/map-t.h
+++ b/include/haproxy/map-t.h
@@ -23,7 +23,7 @@
 #define _HAPROXY_MAP_T_H
 
 #include <haproxy/pattern-t.h>
-#include <types/sample.h>
+#include <haproxy/sample-t.h>
 
 struct map_descriptor {
 	struct sample_conv *conv;      /* original converter descriptor */
diff --git a/include/haproxy/map.h b/include/haproxy/map.h
index 140148c..3ec3418 100644
--- a/include/haproxy/map.h
+++ b/include/haproxy/map.h
@@ -23,7 +23,7 @@
 #define _HAPROXY_MAP_H
 
 #include <haproxy/map-t.h>
-#include <types/sample.h>
+#include <haproxy/sample-t.h>
 
 /* maps output sample parser */
 int map_parse_ip(const char *text, struct sample_data *data);
diff --git a/include/haproxy/pattern-t.h b/include/haproxy/pattern-t.h
index 7787ec3..a977527 100644
--- a/include/haproxy/pattern-t.h
+++ b/include/haproxy/pattern-t.h
@@ -29,7 +29,7 @@
 #include <haproxy/thread-t.h>
 #include <haproxy/api-t.h>
 
-#include <types/sample.h>
+#include <haproxy/sample-t.h>
 
 
 /* Pattern matching function result.
diff --git a/include/haproxy/payload.h b/include/haproxy/payload.h
index a99adf0..da5b4e1 100644
--- a/include/haproxy/payload.h
+++ b/include/haproxy/payload.h
@@ -23,7 +23,7 @@
 #define _HAPROXY_PAYLOAD_H
 
 #include <haproxy/api.h>
-#include <types/sample.h>
+#include <haproxy/sample-t.h>
 #include <types/stream.h>
 
 int fetch_rdp_cookie_name(struct stream *s, struct sample *smp, const char *cname, int clen);
diff --git a/include/types/sample.h b/include/haproxy/sample-t.h
similarity index 98%
rename from include/types/sample.h
rename to include/haproxy/sample-t.h
index 0bec0c4..9403d7b 100644
--- a/include/types/sample.h
+++ b/include/haproxy/sample-t.h
@@ -1,5 +1,5 @@
 /*
- * include/types/sample.h
+ * include/haproxy/sample-t.h
  * Macros, variables and structures for sample management.
  *
  * Copyright (C) 2009-2010 EXCELIANCE, Emeric Brun <ebrun@exceliance.fr>
@@ -20,18 +20,17 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _TYPES_SAMPLE_H
-#define _TYPES_SAMPLE_H
+#ifndef _HAPROXY_SAMPLE_T_H
+#define _HAPROXY_SAMPLE_T_H
 
 #include <sys/socket.h>
 #include <netinet/in.h>
 
+#include <haproxy/api-t.h>
 #include <haproxy/buf-t.h>
 #include <haproxy/http-t.h>
 #include <haproxy/list-t.h>
 
-struct arg;
-
 /* input and output sample types */
 enum {
 	SMP_T_ANY = 0,   /* any type */
@@ -179,8 +178,6 @@
 	                     SMP_VAL_BE_CHK_RUL,
 };
 
-extern const unsigned int fetch_cap[SMP_SRC_ENTRIES];
-
 /* Sample fetch options are passed to sample fetch functions to add precision
  * about what is desired :
  *   - fetch direction (req/resp)
@@ -213,6 +210,7 @@
 /* needed below */
 struct session;
 struct stream;
+struct arg;
 
 /* a sample context might be used by any sample fetch function in order to
  * store information needed across multiple calls (eg: restart point for a
@@ -326,6 +324,5 @@
 };
 
 typedef int (*sample_cast_fct)(struct sample *smp);
-extern sample_cast_fct sample_casts[SMP_TYPES][SMP_TYPES];
 
-#endif /* _TYPES_SAMPLE_H */
+#endif /* _HAPROXY_SAMPLE_T_H */
diff --git a/include/proto/sample.h b/include/haproxy/sample.h
similarity index 94%
rename from include/proto/sample.h
rename to include/haproxy/sample.h
index b4d52c5..1c30fd4 100644
--- a/include/proto/sample.h
+++ b/include/haproxy/sample.h
@@ -1,5 +1,5 @@
 /*
- * include/proto/sample.h
+ * include/haproxy/sample.h
  * Functions for samples management.
  *
  * Copyright (C) 2009-2010 EXCELIANCE, Emeric Brun <ebrun@exceliance.fr>
@@ -20,12 +20,16 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _PROTO_SAMPLE_H
-#define _PROTO_SAMPLE_H
+#ifndef _HAPROXY_SAMPLE_H
+#define _HAPROXY_SAMPLE_H
 
-#include <types/sample.h>
+#include <haproxy/arg-t.h>
+#include <haproxy/api.h>
+#include <haproxy/sample-t.h>
 #include <types/stick_table.h>
 
+extern sample_cast_fct sample_casts[SMP_TYPES][SMP_TYPES];
+extern const unsigned int fetch_cap[SMP_SRC_ENTRIES];
 extern const char *smp_to_type[SMP_TYPES];
 
 struct sample_expr *sample_parse_expr(char **str, int *idx, const char *file, int line, char **err, struct arg_list *al, char **endptr);
@@ -170,4 +174,4 @@
 	return smp && (smp_is_rw(smp) || smp_dup(smp));
 }
 
-#endif /* _PROTO_SAMPLE_H */
+#endif /* _HAPROXY_SAMPLE_H */
diff --git a/include/proto/acl.h b/include/proto/acl.h
index 28b49c4..56ae228 100644
--- a/include/proto/acl.h
+++ b/include/proto/acl.h
@@ -24,7 +24,6 @@
 
 #include <haproxy/api.h>
 #include <types/acl.h>
-#include <proto/sample.h>
 
 /*
  * FIXME: we need destructor functions too !
diff --git a/include/proto/http_fetch.h b/include/proto/http_fetch.h
index e631bc0..3a7261a 100644
--- a/include/proto/http_fetch.h
+++ b/include/proto/http_fetch.h
@@ -27,7 +27,7 @@
 #include <haproxy/arg-t.h>
 #include <types/channel.h>
 #include <types/checks.h>
-#include <types/sample.h>
+#include <haproxy/sample-t.h>
 
 struct htx *smp_prefetch_htx(struct sample *smp, struct channel *chn, struct check *check, int vol);
 int val_hdr(struct arg *arg, char **err_msg);
diff --git a/include/proto/protocol_buffers.h b/include/proto/protocol_buffers.h
index 3e1571a..16ccee5 100644
--- a/include/proto/protocol_buffers.h
+++ b/include/proto/protocol_buffers.h
@@ -24,8 +24,8 @@
 
 #include <inttypes.h>
 #include <haproxy/arg-t.h>
+#include <haproxy/sample-t.h>
 #include <types/protocol_buffers.h>
-#include <proto/sample.h>
 
 #define PBUF_VARINT_DONT_STOP_BIT       7
 #define PBUF_VARINT_DONT_STOP_BITMASK  (1 << PBUF_VARINT_DONT_STOP_BIT)
diff --git a/include/proto/spoe.h b/include/proto/spoe.h
index 584b38a..d9e9098 100644
--- a/include/proto/spoe.h
+++ b/include/proto/spoe.h
@@ -23,11 +23,10 @@
 #define _PROTO_SPOE_H
 
 #include <haproxy/intops.h>
+#include <haproxy/sample-t.h>
 
 #include <types/spoe.h>
 
-#include <proto/sample.h>
-
 
 /* Encode a buffer. Its length <len> is encoded as a varint, followed by a copy
  * of <str>. It must have enough space in <*buf> to encode the buffer, else an
diff --git a/include/types/checks.h b/include/types/checks.h
index 80f6321..9b914d0 100644
--- a/include/types/checks.h
+++ b/include/types/checks.h
@@ -24,7 +24,7 @@
 
 #include <types/connection.h>
 #include <types/proxy.h>
-#include <types/sample.h>
+#include <haproxy/sample-t.h>
 #include <types/server.h>
 #include <types/session.h>
 #include <types/task.h>
diff --git a/include/types/protocol_buffers.h b/include/types/protocol_buffers.h
index 8509b01..35e8444 100644
--- a/include/types/protocol_buffers.h
+++ b/include/types/protocol_buffers.h
@@ -68,6 +68,7 @@
 	size_t sz;
 };
 
+struct sample;
 struct protobuf_parser_def {
 	int (*skip)(unsigned char **pos, size_t *left, size_t vlen);
 	int (*smp_store)(struct sample *, int type,
diff --git a/include/types/proxy.h b/include/types/proxy.h
index af33021..a72232f 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -44,7 +44,7 @@
 #include <types/filters.h>
 #include <haproxy/freq_ctr-t.h>
 #include <types/log.h>
-#include <types/sample.h>
+#include <haproxy/sample-t.h>
 #include <types/server.h>
 #include <types/stick_table.h>
 
diff --git a/include/types/spoe.h b/include/types/spoe.h
index f08b9ad..fdaba93 100644
--- a/include/types/spoe.h
+++ b/include/types/spoe.h
@@ -32,7 +32,7 @@
 #include <haproxy/freq_ctr-t.h>
 #include <types/log.h>
 #include <types/proxy.h>
-#include <types/sample.h>
+#include <haproxy/sample-t.h>
 #include <types/stream.h>
 #include <types/task.h>
 
diff --git a/include/types/stick_table.h b/include/types/stick_table.h
index e345048..0ee7b95 100644
--- a/include/types/stick_table.h
+++ b/include/types/stick_table.h
@@ -33,7 +33,7 @@
 #include <haproxy/pool-t.h>
 #include <haproxy/freq_ctr-t.h>
 #include <types/peers.h>
-#include <types/sample.h>
+#include <haproxy/sample-t.h>
 
 /* The types of extra data we can store in a stick table */
 enum {
diff --git a/include/types/vars.h b/include/types/vars.h
index 62b944b..d8ec71c 100644
--- a/include/types/vars.h
+++ b/include/types/vars.h
@@ -4,7 +4,7 @@
 #include <haproxy/list-t.h>
 #include <haproxy/thread.h>
 
-#include <types/sample.h>
+#include <haproxy/sample-t.h>
 
 enum vars_scope {
 	SCOPE_SESS = 0,
diff --git a/src/51d.c b/src/51d.c
index ceff828..2309592 100644
--- a/src/51d.c
+++ b/src/51d.c
@@ -12,7 +12,7 @@
 #include <proto/http_fetch.h>
 #include <proto/log.h>
 #include <proto/http_ana.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 #include <import/xxhash.h>
 #include <import/lru.h>
 #include <51Degrees.h>
diff --git a/src/acl.c b/src/acl.c
index 17a5e10..d2187e8 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -28,7 +28,7 @@
 #include <proto/channel.h>
 #include <proto/log.h>
 #include <proto/proxy.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 #include <proto/stick_table.h>
 
 #include <import/ebsttree.h>
diff --git a/src/backend.c b/src/backend.c
index 6c6c26d..e12f207 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -49,7 +49,7 @@
 #include <proto/proto_tcp.h>
 #include <proto/proxy.h>
 #include <proto/queue.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 #include <proto/server.h>
 #include <proto/session.h>
 #include <proto/stream.h>
diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c
index d2bd8d4..0e255af 100644
--- a/src/cfgparse-listen.c
+++ b/src/cfgparse-listen.c
@@ -19,6 +19,7 @@
 #include <haproxy/http_htx.h>
 #include <haproxy/http_rules.h>
 #include <haproxy/listener.h>
+#include <haproxy/sample.h>
 #include <types/stats.h>
 
 #include <proto/acl.h>
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 1dfdbc2..6c675c4 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -74,7 +74,7 @@
 #include <proto/http_ana.h>
 #include <proto/proxy.h>
 #include <proto/peers.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 #include <proto/session.h>
 #include <proto/server.h>
 #include <proto/stream.h>
diff --git a/src/checks.c b/src/checks.c
index 2e4c4b0..d742969 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -68,7 +68,7 @@
 #include <proto/log.h>
 #include <haproxy/proto_udp.h>
 #include <proto/ssl_sock.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 
 static int tcpcheck_get_step_id(struct check *, struct tcpcheck_rule *);
 
diff --git a/src/cli.c b/src/cli.c
index 69f1ec4..f5f197f 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -34,6 +34,7 @@
 #include <haproxy/listener.h>
 #include <haproxy/mworker-t.h>
 #include <haproxy/pattern-t.h>
+#include <haproxy/sample-t.h>
 #include <haproxy/tools.h>
 #include <haproxy/ticks.h>
 #include <haproxy/time.h>
@@ -58,7 +59,6 @@
 #include <haproxy/pipe.h>
 #include <haproxy/protocol.h>
 #include <proto/proxy.h>
-#include <proto/sample.h>
 #include <proto/session.h>
 #include <proto/stream.h>
 #include <proto/server.h>
diff --git a/src/connection.c b/src/connection.c
index afe881c..5652a25 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -23,7 +23,7 @@
 #include <haproxy/fd.h>
 #include <proto/proto_tcp.h>
 #include <proto/stream_interface.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 #include <proto/ssl_sock.h>
 
 
diff --git a/src/da.c b/src/da.c
index 8ff5bfa..aef12a2 100644
--- a/src/da.c
+++ b/src/da.c
@@ -10,7 +10,7 @@
 #include <proto/http_fetch.h>
 #include <proto/log.h>
 #include <proto/http_ana.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 #include <dac.h>
 
 static struct {
diff --git a/src/dns.c b/src/dns.c
index 32c4efa..e176b78 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -25,6 +25,7 @@
 #include <haproxy/dns.h>
 #include <haproxy/errors.h>
 #include <haproxy/http_rules.h>
+#include <haproxy/sample.h>
 #include <haproxy/time.h>
 #include <haproxy/ticks.h>
 #include <haproxy/net_helper.h>
@@ -40,7 +41,6 @@
 #include <haproxy/fd.h>
 #include <proto/http_ana.h>
 #include <proto/log.h>
-#include <proto/sample.h>
 #include <proto/server.h>
 #include <proto/task.h>
 #include <haproxy/proto_udp.h>
diff --git a/src/fcgi-app.c b/src/fcgi-app.c
index d9f6bdb..6d02e89 100644
--- a/src/fcgi-app.c
+++ b/src/fcgi-app.c
@@ -16,6 +16,7 @@
 #include <haproxy/errors.h>
 #include <haproxy/http_htx.h>
 #include <haproxy/regex.h>
+#include <haproxy/sample.h>
 #include <haproxy/tools.h>
 
 #include <types/global.h>
@@ -26,7 +27,6 @@
 #include <proto/http_fetch.h>
 #include <proto/log.h>
 #include <proto/proxy.h>
-#include <proto/sample.h>
 #include <proto/server.h>
 #include <proto/session.h>
 
diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c
index c081e27..5ab6a01 100644
--- a/src/flt_http_comp.c
+++ b/src/flt_http_comp.c
@@ -18,15 +18,14 @@
 #include <common/cfgparse.h>
 #include <haproxy/htx.h>
 #include <haproxy/list.h>
+#include <haproxy/sample.h>
 #include <haproxy/tools.h>
 
 #include <types/filters.h>
 #include <types/proxy.h>
-#include <types/sample.h>
 
 #include <proto/filters.h>
 #include <proto/http_ana.h>
-#include <proto/sample.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 9f69f9f..010dac2 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -17,6 +17,7 @@
 #include <common/cfgparse.h>
 #include <haproxy/frontend.h>
 #include <haproxy/http_rules.h>
+#include <haproxy/sample.h>
 #include <haproxy/thread.h>
 #include <haproxy/pool.h>
 #include <haproxy/time.h>
@@ -33,7 +34,6 @@
 #include <proto/log.h>
 #include <proto/http_ana.h>
 #include <proto/proxy.h>
-#include <proto/sample.h>
 #include <proto/session.h>
 #include <proto/signal.h>
 #include <proto/spoe.h>
diff --git a/src/frontend.c b/src/frontend.c
index 0be2929..00c31d8 100644
--- a/src/frontend.c
+++ b/src/frontend.c
@@ -25,6 +25,7 @@
 #include <haproxy/api.h>
 #include <haproxy/chunk.h>
 #include <haproxy/frontend.h>
+#include <haproxy/sample.h>
 #include <haproxy/tools.h>
 #include <haproxy/time.h>
 
@@ -38,7 +39,6 @@
 #include <proto/proto_tcp.h>
 #include <proto/http_ana.h>
 #include <proto/proxy.h>
-#include <proto/sample.h>
 #include <proto/stream.h>
 #include <proto/stream_interface.h>
 #include <proto/task.h>
diff --git a/src/haproxy.c b/src/haproxy.c
index 9e6627c..60c5f65 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -98,6 +98,7 @@
 #include <haproxy/net_helper.h>
 #include <haproxy/openssl-compat.h>
 #include <haproxy/pattern.h>
+#include <haproxy/sample.h>
 #include <haproxy/regex.h>
 #include <haproxy/tools.h>
 #include <haproxy/time.h>
diff --git a/src/hlua.c b/src/hlua.c
index 69d84bd..5b670c7 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -37,6 +37,7 @@
 #include <haproxy/obj_type.h>
 #include <haproxy/pattern.h>
 #include <haproxy/payload.h>
+#include <haproxy/sample.h>
 #include <haproxy/tools.h>
 
 #include <types/cli.h>
@@ -52,7 +53,6 @@
 #include <proto/http_fetch.h>
 #include <proto/queue.h>
 #include <proto/http_ana.h>
-#include <proto/sample.h>
 #include <proto/server.h>
 #include <proto/session.h>
 #include <proto/stream.h>
diff --git a/src/http_act.c b/src/http_act.c
index f2b803e..0549bc0 100644
--- a/src/http_act.c
+++ b/src/http_act.c
@@ -26,6 +26,7 @@
 #include <haproxy/pattern.h>
 #include <haproxy/pool.h>
 #include <haproxy/regex.h>
+#include <haproxy/sample.h>
 #include <haproxy/tools.h>
 #include <common/uri_auth.h>
 #include <haproxy/version.h>
diff --git a/src/http_conv.c b/src/http_conv.c
index da7d53f..730809a 100644
--- a/src/http_conv.c
+++ b/src/http_conv.c
@@ -20,6 +20,7 @@
 #include <haproxy/chunk.h>
 #include <haproxy/http.h>
 #include <haproxy/pool.h>
+#include <haproxy/sample.h>
 #include <haproxy/tools.h>
 #include <haproxy/version.h>
 
@@ -27,7 +28,6 @@
 #include <types/global.h>
 
 #include <haproxy/arg.h>
-#include <proto/sample.h>
 #include <proto/stream.h>
 
 static int smp_check_http_date_unit(struct arg *args, struct sample_conv *conv,
diff --git a/src/http_fetch.c b/src/http_fetch.c
index e85978b..634847a 100644
--- a/src/http_fetch.c
+++ b/src/http_fetch.c
@@ -27,6 +27,7 @@
 #include <haproxy/htx.h>
 #include <haproxy/obj_type.h>
 #include <haproxy/pool.h>
+#include <haproxy/sample.h>
 #include <haproxy/tools.h>
 #include <haproxy/version.h>
 
@@ -38,7 +39,6 @@
 #include <proto/http_fetch.h>
 #include <proto/log.h>
 #include <proto/http_ana.h>
-#include <proto/sample.h>
 #include <proto/stream.h>
 
 
diff --git a/src/http_htx.c b/src/http_htx.c
index 8524d8a..d018ca5 100644
--- a/src/http_htx.c
+++ b/src/http_htx.c
@@ -16,6 +16,7 @@
 
 #include <haproxy/api.h>
 #include <haproxy/regex.h>
+#include <haproxy/sample.h>
 #include <types/global.h>
 
 #include <common/cfgparse.h>
@@ -26,7 +27,6 @@
 
 #include <haproxy/arg.h>
 #include <proto/http_fetch.h>
-#include <proto/sample.h>
 
 struct buffer http_err_chunks[HTTP_ERR_SIZE];
 struct http_reply http_err_replies[HTTP_ERR_SIZE];
diff --git a/src/http_rules.c b/src/http_rules.c
index 2ec91d9..79c9936 100644
--- a/src/http_rules.c
+++ b/src/http_rules.c
@@ -32,7 +32,7 @@
 #include <proto/acl.h>
 #include <haproxy/arg.h>
 #include <proto/http_ana.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 
 
 /* List head of all known action keywords for "http-request" */
diff --git a/src/listener.c b/src/listener.c
index 152473e..3f6230f 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -36,7 +36,7 @@
 #include <proto/log.h>
 #include <haproxy/protocol.h>
 #include <haproxy/proto_sockpair.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 #include <proto/stream.h>
 #include <proto/task.h>
 
diff --git a/src/log.c b/src/log.c
index 7c62f6d..2bc0990 100644
--- a/src/log.c
+++ b/src/log.c
@@ -40,7 +40,7 @@
 #include <haproxy/fd.h>
 #include <proto/log.h>
 #include <haproxy/ring.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 #include <haproxy/sink.h>
 #include <proto/ssl_sock.h>
 #include <proto/stream.h>
diff --git a/src/map.c b/src/map.c
index 0066257..33f24dd 100644
--- a/src/map.c
+++ b/src/map.c
@@ -28,7 +28,7 @@
 #include <proto/cli.h>
 #include <proto/log.h>
 #include <proto/stream_interface.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 
 /* Parse an IPv4 or IPv6 address and store it into the sample.
  * The output type is IPv4 or IPv6.
diff --git a/src/pattern.c b/src/pattern.c
index e6250b3..9397234 100644
--- a/src/pattern.c
+++ b/src/pattern.c
@@ -23,7 +23,7 @@
 #include <types/global.h>
 
 #include <proto/log.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 
 #include <import/ebsttree.h>
 #include <import/lru.h>
diff --git a/src/payload.c b/src/payload.c
index 3d176d6..af4ae1c 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -22,7 +22,7 @@
 #include <haproxy/arg.h>
 #include <proto/channel.h>
 #include <proto/connection.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 #include <proto/http_ana.h>
 
 
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 2988007..de001c2 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -36,6 +36,7 @@
 #include <haproxy/http_rules.h>
 #include <haproxy/list.h>
 #include <haproxy/listener.h>
+#include <haproxy/sample.h>
 #include <haproxy/tools.h>
 #include <haproxy/namespace.h>
 
@@ -53,7 +54,6 @@
 #include <proto/http_ana.h>
 #include <proto/proto_tcp.h>
 #include <proto/proxy.h>
-#include <proto/sample.h>
 #include <proto/server.h>
 #include <proto/task.h>
 #include <proto/tcp_rules.h>
diff --git a/src/queue.c b/src/queue.c
index 8386399..bbf11e2 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -72,13 +72,13 @@
 #include <haproxy/api.h>
 #include <haproxy/http_rules.h>
 #include <haproxy/pool.h>
+#include <haproxy/sample.h>
 #include <haproxy/time.h>
 #include <haproxy/thread.h>
 #include <import/eb32tree.h>
 
 #include <proto/http_ana.h>
 #include <proto/queue.h>
-#include <proto/sample.h>
 #include <proto/server.h>
 #include <proto/stream.h>
 #include <proto/stream_interface.h>
diff --git a/src/sample.c b/src/sample.c
index c13a1ea..871db00 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -26,6 +26,7 @@
 #include <haproxy/http.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/regex.h>
+#include <haproxy/sample.h>
 #include <haproxy/tools.h>
 #include <common/uri_auth.h>
 #include <haproxy/base64.h>
@@ -34,7 +35,6 @@
 #include <proto/log.h>
 #include <proto/proxy.h>
 #include <proto/protocol_buffers.h>
-#include <proto/sample.h>
 #include <haproxy/sink.h>
 #include <proto/stick_table.h>
 #include <proto/vars.h>
diff --git a/src/server.c b/src/server.c
index 468814c..ae4f044 100644
--- a/src/server.c
+++ b/src/server.c
@@ -22,6 +22,7 @@
 #include <haproxy/dns.h>
 #include <haproxy/errors.h>
 #include <haproxy/namespace.h>
+#include <haproxy/sample.h>
 #include <haproxy/time.h>
 
 #include <types/applet.h>
@@ -37,7 +38,6 @@
 #include <haproxy/port_range.h>
 #include <haproxy/protocol.h>
 #include <proto/queue.h>
-#include <proto/sample.h>
 #include <proto/server.h>
 #include <proto/stream.h>
 #include <proto/stream_interface.h>
diff --git a/src/ssl_sample.c b/src/ssl_sample.c
index f27b2e6..509b0c5 100644
--- a/src/ssl_sample.c
+++ b/src/ssl_sample.c
@@ -24,16 +24,15 @@
 #include <haproxy/buf-t.h>
 #include <haproxy/obj_type.h>
 #include <haproxy/openssl-compat.h>
+#include <haproxy/sample.h>
 #include <haproxy/ssl_utils.h>
 #include <haproxy/tools.h>
 
-#include <types/sample.h>
 #include <types/ssl_sock.h>
 
 #include <proto/acl.h>
 #include <haproxy/arg.h>
 #include <proto/ssl_sock.h>
-#include <proto/sample.h>
 
 
 /***** Below are some sample fetching functions for ACL/patterns *****/
diff --git a/src/stats.c b/src/stats.c
index b0ee434..6e53934 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -60,7 +60,6 @@
 #include <proto/log.h>
 #include <haproxy/pipe.h>
 #include <proto/proxy.h>
-#include <proto/sample.h>
 #include <proto/session.h>
 #include <proto/ssl_sock.h>
 #include <proto/stream.h>
diff --git a/src/stick_table.c b/src/stick_table.c
index 011a6a3..7026e39 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -36,7 +36,7 @@
 #include <proto/http_ana.h>
 #include <proto/proto_tcp.h>
 #include <proto/proxy.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 #include <proto/stream.h>
 #include <proto/stream_interface.h>
 #include <proto/stick_table.h>
diff --git a/src/stream.c b/src/stream.c
index 8e76979..b3e7148 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -55,7 +55,6 @@
 #include <proto/proxy.h>
 #include <proto/queue.h>
 #include <proto/server.h>
-#include <proto/sample.h>
 #include <proto/stick_table.h>
 #include <proto/stream_interface.h>
 #include <proto/task.h>
diff --git a/src/tcp_rules.c b/src/tcp_rules.c
index 6cd87ef..6a878fb 100644
--- a/src/tcp_rules.c
+++ b/src/tcp_rules.c
@@ -14,6 +14,7 @@
 #include <haproxy/capture-t.h>
 #include <common/cfgparse.h>
 #include <haproxy/list.h>
+#include <haproxy/sample.h>
 #include <haproxy/tools.h>
 #include <haproxy/ticks.h>
 #include <haproxy/time.h>
@@ -27,7 +28,6 @@
 #include <proto/connection.h>
 #include <proto/log.h>
 #include <proto/proxy.h>
-#include <proto/sample.h>
 #include <proto/stick_table.h>
 #include <proto/stream.h>
 #include <proto/stream_interface.h>
diff --git a/src/vars.c b/src/vars.c
index 8cc4c48..f69dbbb 100644
--- a/src/vars.c
+++ b/src/vars.c
@@ -5,12 +5,12 @@
 #include <haproxy/http.h>
 #include <haproxy/http_rules.h>
 #include <haproxy/list.h>
+#include <haproxy/sample.h>
 
 #include <types/vars.h>
 
 #include <haproxy/arg.h>
 #include <proto/http_ana.h>
-#include <proto/sample.h>
 #include <proto/stream.h>
 #include <proto/tcp_rules.h>
 #include <proto/vars.h>
diff --git a/src/wurfl.c b/src/wurfl.c
index 78288be..43cedf5 100644
--- a/src/wurfl.c
+++ b/src/wurfl.c
@@ -12,7 +12,7 @@
 #include <proto/log.h>
 #include <proto/http_ana.h>
 #include <proto/http_fetch.h>
-#include <proto/sample.h>
+#include <haproxy/sample.h>
 #include <import/ebsttree.h>
 #include <import/ebmbtree.h>