MAJOR: filters: Adapt filters API to be compatible with the HTX represenation

First, to be called on HTX streams, a filter must explicitly be declared as
compatible by setting the flag STRM_FLT_FL_HAS_FILTERS on the filter's config at
HAProxy startup. This flag is checked when a filter implementation is attached
to a stream.

Then, some changes have been made on HTTP callbacks. The callback http_payload
has been added to filter HTX data. It will be called on HTX streams only. It
replaces the callbacks http_data, http_chunk_trailers and http_forward_data,
called on legacy HTTP streams only and marked as deprecated. The documention
(once updated)) will give all information to implement this new callback. Other
HTTP callbacks will be called for HTX and HTTP legacy streams. So it is the
filter's responsibility to known which kind of data it handles. The macro
IS_HTX_STRM should be used in such cases.

There is at least a noticeable changes in the way data are forwarded. In HTX,
after the call to the callback http_headers, all the headers are considered as
forwarded. So, in http_payload, only the body and eventually the trailers will
be filtered.
diff --git a/include/types/filters.h b/include/types/filters.h
index c460e79..f52592d 100644
--- a/include/types/filters.h
+++ b/include/types/filters.h
@@ -120,14 +120,17 @@
  *                          headers was parsed and analyzed.
  *                          Returns a negative value if an error occurs, 0 if
  *                          it needs to wait, any other value otherwise.
+ *  - http_payload        : Called when some data can be consumed.
+ *                          Returns a negative value if an error occurs, else
+ *                          the number of forwarded bytes.
  *  - http_data           : Called when unparsed body data are available.
  *                          Returns a negative value if an error occurs, else
- *                          the number of consumed bytes.
+ *                          the number of consumed bytes. [DEPRECATED]
  *  - http_chunk_trailers : Called when part of trailer headers of a
  *                          chunk-encoded request/response are ready to be
  *                          processed.
  *                          Returns a negative value if an error occurs, any
- *                          other value otherwise.
+ *                          other value otherwise. [DEPRECATED]
  *  - http_end            : Called when all the request/response has been
  *                          processed and all body data has been forwarded.
  *                          Returns a negative value if an error occurs, 0 if
@@ -143,7 +146,7 @@
  *                          Returns nothing.
  *  - http_forward_data   : Called when some data can be consumed.
  *                          Returns a negative value if an error occurs, else
- *                          the number of forwarded bytes.
+ *                          the number of forwarded bytes. [DEPRECATED]
  *  - tcp_data            : Called when unparsed data are available.
  *                          Returns a negative value if an error occurs, else
  *                          the number of consumed bytes.
@@ -181,10 +184,12 @@
 	 * HTTP callbacks
 	 */
 	int  (*http_headers)       (struct stream *s, struct filter *f, struct http_msg *msg);
-	int  (*http_data)          (struct stream *s, struct filter *f, struct http_msg *msg);
-	int  (*http_chunk_trailers)(struct stream *s, struct filter *f, struct http_msg *msg);
+	int  (*http_payload)       (struct stream *s, struct filter *f, struct http_msg *msg,
+				    unsigned int offset, unsigned int len);
 	int  (*http_end)           (struct stream *s, struct filter *f, struct http_msg *msg);
-	int  (*http_forward_data)  (struct stream *s, struct filter *f, struct http_msg *msg,
+	int  (*http_data)          (struct stream *s, struct filter *f, struct http_msg *msg); // DEPRECATED
+	int  (*http_chunk_trailers)(struct stream *s, struct filter *f, struct http_msg *msg); // DEPRECATED
+	int  (*http_forward_data)  (struct stream *s, struct filter *f, struct http_msg *msg,  // DEPRECATED
 				    unsigned int len);
 
 	void (*http_reset)         (struct stream *s, struct filter *f, struct http_msg *msg);
@@ -199,12 +204,14 @@
 				 unsigned int len);
 };
 
+/* Flags set on a filter config */
+#define FLT_CFG_FL_HTX    0x00000001  /* The filter can filter HTX streams */
+
 /* Flags set on a filter instance */
 #define FLT_FL_IS_BACKEND_FILTER  0x0001 /* The filter is a backend filter */
 #define FLT_FL_IS_REQ_DATA_FILTER 0x0002 /* The filter will parse data on the request channel */
 #define FLT_FL_IS_RSP_DATA_FILTER 0x0004 /* The filter will parse data on the response channel */
 
-
 /* Flags set on the stream, common to all filters attached to its stream */
 #define STRM_FLT_FL_HAS_FILTERS          0x0001 /* The stream has at least one filter */
 
@@ -217,6 +224,7 @@
 	struct flt_ops *ops;  /* The filter callbacks */
 	void           *conf; /* The filter configuration */
 	struct list     list; /* Next filter for the same proxy */
+	unsigned int    flags; /* FLT_CFG_FL_* */
 };
 
 /*
@@ -236,6 +244,7 @@
 	                                    * 0: request channel, 1: response channel */
 	unsigned int    fwd[2];            /* Offset, relative to buf->p, to the next byte to forward for a specific channel
 	                                    * 0: request channel, 1: response channel */
+	unsigned long long offset[2];
 	unsigned int    pre_analyzers;     /* bit field indicating analyzers to pre-process */
 	unsigned int    post_analyzers;    /* bit field indicating analyzers to post-process */
 	struct list     list;              /* Next filter for the same proxy/stream */
@@ -253,6 +262,7 @@
 	unsigned short flags;                 /* STRM_FL_* */
 	unsigned char  nb_req_data_filters;   /* Number of data filters registered on the request channel */
 	unsigned char  nb_rsp_data_filters;   /* Number of data filters registered on the response channel */
+	unsigned long long offset[2];
 };
 
 #endif /* _TYPES_FILTERS_H */