MEDIUM: filters: Add pre and post analyzer callbacks

'channel_analyze' callback has been removed. Now, there are 2 callbacks to
surround calls to analyzers:

  * channel_pre_analyze: Called BEFORE all filterable analyzers. it can be
    called many times for the same analyzer, once at each loop until the
    analyzer finishes its processing. This callback is resumable, it returns a
    negative value if an error occurs, 0 if it needs to wait, any other value
    otherwise.

  * channel_post_analyze: Called AFTER all filterable analyzers. Here, AFTER
    means when an analyzer finishes its processing. This callback is NOT
    resumable, it returns a negative value if an error occurs, any other value
    otherwise.

Pre and post analyzer callbacks are not automatically called. 'pre_analyzers'
and 'post_analyzers' bit fields in the filter structure must be set to the right
value using AN_* flags (see include/types/channel.h).

The flag AN_RES_ALL has been added (AN_REQ_ALL already exists) to ease the life
of filter developers. AN_REQ_ALL and AN_RES_ALL include all filterable
analyzers.
diff --git a/src/filters.c b/src/filters.c
index 051aa48..139440d 100644
--- a/src/filters.c
+++ b/src/filters.c
@@ -656,20 +656,23 @@
 }
 
 /*
- * Calls 'channel_analyze' callback for all filters attached to a stream. This
- * function is called before each analyzer attached to a channel, expects
- * analyzers responsible for data sending. 'channel_analyze' callback is
- * resumable, so this function returns 0 if an error occurs or if it needs to
- * wait, any other value otherwise.
+ * Calls 'channel_pre_analyze' callback for all filters attached to a
+ * stream. This function is called BEFORE each analyzer attached to a channel,
+ * expects analyzers responsible for data sending. 'channel_pre_analyze'
+ * callback is resumable, so this function returns 0 if an error occurs or if it
+ * needs to wait, any other value otherwise.
+ *
+ * Note this function can be called many times for the same analyzer. In fact,
+ * it is called until the analyzer finishes its processing.
  */
 int
-flt_analyze(struct stream *s, struct channel *chn, unsigned int an_bit)
+flt_pre_analyze(struct stream *s, struct channel *chn, unsigned int an_bit)
 {
 	int ret = 1;
 
 	RESUME_FILTER_LOOP(s, chn) {
-		if (FLT_OPS(filter)->channel_analyze) {
-			ret = FLT_OPS(filter)->channel_analyze(s, filter, chn, an_bit);
+		if (FLT_OPS(filter)->channel_pre_analyze && (filter->pre_analyzers & an_bit)) {
+			ret = FLT_OPS(filter)->channel_pre_analyze(s, filter, chn, an_bit);
 			if (ret <= 0)
 				BREAK_EXECUTION(s, chn, check_result);
 		}
@@ -680,6 +683,31 @@
 }
 
 /*
+ * Calls 'channel_post_analyze' callback for all filters attached to a
+ * stream. This function is called AFTER each analyzer attached to a channel,
+ * expects analyzers responsible for data sending. 'channel_post_analyze'
+ * callback is NOT resumable, so this function returns a 0 if an error occurs,
+ * any other value otherwise.
+ *
+ * Here, AFTER means when the analyzer finishes its processing.
+ */
+int
+flt_post_analyze(struct stream *s, struct channel *chn, unsigned int an_bit)
+{
+	struct filter *filter;
+	int            ret = 1;
+
+	list_for_each_entry(filter, &strm_flt(s)->filters, list) {
+		if (FLT_OPS(filter)->channel_post_analyze &&  (filter->post_analyzers & an_bit)) {
+			ret = FLT_OPS(filter)->channel_post_analyze(s, filter, chn, an_bit);
+			if (ret < 0)
+				break;
+		}
+	}
+	return handle_analyzer_result(s, chn, 0, ret);
+}
+
+/*
  * This function is the AN_FLT_HTTP_HDRS analyzer, used to filter HTTP headers
  * or a request or a response. Returns 0 if an error occurs or if it needs to
  * wait, any other value otherwise.