MEDIUM: actions: pass a new "flags" argument to custom actions

Since commit bc4c1ac ("MEDIUM: http/tcp: permit to resume http and tcp
custom actions"), some actions may yield and be called back when new
information are available. Unfortunately some of them may continue to
yield because they simply don't know that it's the last call from the
rule set. For this reason we'll need to pass a flag to the custom
action to pass such information and possibly other at the same time.
diff --git a/include/types/action.h b/include/types/action.h
index b7e1063..5a581c7 100644
--- a/include/types/action.h
+++ b/include/types/action.h
@@ -46,6 +46,11 @@
 	ACT_RET_PRS_ERR,   /* abort processing. */
 };
 
+/* flags passed to custom actions */
+enum act_flag {
+	ACT_FLAG_NONE  = 0x00000000,  /* no flag */
+};
+
 enum act_name {
 	ACT_CUSTOM = 0,
 
@@ -91,8 +96,8 @@
 	enum act_name action;                  /* ACT_ACTION_* */
 	enum act_from from;                    /* ACT_F_* */
 	short deny_status;                     /* HTTP status to return to user when denying */
-	enum act_return (*action_ptr)(struct act_rule *rule, struct proxy *px,
-	                              struct session *sess, struct stream *s); /* ptr to custom action */
+	enum act_return (*action_ptr)(struct act_rule *rule, struct proxy *px,  /* ptr to custom action */
+	                              struct session *sess, struct stream *s, int flags);
 	struct action_kw *kw;
 	union {
 		struct {
diff --git a/src/hlua.c b/src/hlua.c
index a4e7fbe..c641c78 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -4469,7 +4469,7 @@
  * because the LUA returns a yield.
  */
 static enum act_return hlua_action(struct act_rule *rule, struct proxy *px,
-                                   struct session *sess, struct stream *s)
+                                   struct session *sess, struct stream *s, int flags)
 {
 	char **arg;
 	unsigned int analyzer;
diff --git a/src/proto_http.c b/src/proto_http.c
index 104df20..d04c15f 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -3709,7 +3709,7 @@
 			}
 
 		case ACT_CUSTOM:
-			switch (rule->action_ptr(rule, px, s->sess, s)) {
+			switch (rule->action_ptr(rule, px, s->sess, s, 0)) {
 			case ACT_RET_ERR:
 			case ACT_RET_CONT:
 				break;
@@ -3991,7 +3991,7 @@
 			return HTTP_RULE_RES_DONE;
 
 		case ACT_CUSTOM:
-			switch (rule->action_ptr(rule, px, s->sess, s)) {
+			switch (rule->action_ptr(rule, px, s->sess, s, 0)) {
 			case ACT_RET_ERR:
 			case ACT_RET_CONT:
 				break;
@@ -12382,7 +12382,7 @@
  * occurs the action is canceled, but the rule processing continue.
  */
 enum act_return http_action_set_req_line(struct act_rule *rule, struct proxy *px,
-                                         struct session *sess, struct stream *s)
+                                         struct session *sess, struct stream *s, int flags)
 {
 	chunk_reset(&trash);
 
@@ -12397,7 +12397,7 @@
 
 /* This function is just a compliant action wrapper for "set-status". */
 enum act_return action_http_set_status(struct act_rule *rule, struct proxy *px,
-                                       struct session *sess, struct stream *s)
+                                       struct session *sess, struct stream *s, int flags)
 {
 	http_set_status(rule->arg.status.code, s);
 	return ACT_RET_CONT;
@@ -12495,7 +12495,7 @@
  * processing continues.
  */
 enum act_return http_action_req_capture(struct act_rule *rule, struct proxy *px,
-                                        struct session *sess, struct stream *s)
+                                        struct session *sess, struct stream *s, int flags)
 {
 	struct sample *key;
 	struct cap_hdr *h = rule->arg.cap.hdr;
@@ -12527,7 +12527,7 @@
  * error occurs the action is cancelled, but the rule processing continues.
  */
 enum act_return http_action_req_capture_by_id(struct act_rule *rule, struct proxy *px,
-                                              struct session *sess, struct stream *s)
+                                              struct session *sess, struct stream *s, int flags)
 {
 	struct sample *key;
 	struct cap_hdr *h;
@@ -12695,7 +12695,7 @@
  * error occurs the action is cancelled, but the rule processing continues.
  */
 enum act_return http_action_res_capture_by_id(struct act_rule *rule, struct proxy *px,
-                                              struct session *sess, struct stream *s)
+                                              struct session *sess, struct stream *s, int flags)
 {
 	struct sample *key;
 	struct cap_hdr *h;
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 2ea7161..baac91a 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -1165,7 +1165,7 @@
 				/* Custom keywords. */
 				if (!rule->action_ptr)
 					continue;
-				switch (rule->action_ptr(rule, s->be, s->sess, s)) {
+				switch (rule->action_ptr(rule, s->be, s->sess, s, 0)) {
 				case ACT_RET_ERR:
 				case ACT_RET_CONT:
 					continue;
@@ -1294,7 +1294,7 @@
 				/* Custom keywords. */
 				if (!rule->action_ptr)
 					continue;
-				switch (rule->action_ptr(rule, s->be, s->sess, s)) {
+				switch (rule->action_ptr(rule, s->be, s->sess, s, 0)) {
 				case ACT_RET_ERR:
 				case ACT_RET_CONT:
 					continue;
@@ -1382,7 +1382,7 @@
 				/* Custom keywords. */
 				if (rule->action_ptr)
 					break;
-				switch (rule->action_ptr(rule, sess->fe, sess, NULL)) {
+				switch (rule->action_ptr(rule, sess->fe, sess, NULL, 0)) {
 				case ACT_RET_YIELD:
 					/* yield is not allowed at this point. If this return code is
 					 * used it is a bug, so I prefer to abort the process.
diff --git a/src/stick_table.c b/src/stick_table.c
index c3b76ad..3328616 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -1313,7 +1313,7 @@
 
 /* Always returns 1. */
 static enum act_return action_inc_gpc0(struct act_rule *rule, struct proxy *px,
-                                       struct session *sess, struct stream *s)
+                                       struct session *sess, struct stream *s, int flags)
 {
 	void *ptr;
 	struct stksess *ts;
@@ -1382,7 +1382,7 @@
 
 /* Always returns 1. */
 static enum act_return action_set_gpt0(struct act_rule *rule, struct proxy *px,
-                                       struct session *sess, struct stream *s)
+                                       struct session *sess, struct stream *s, int flags)
 {
 	void *ptr;
 	struct stksess *ts;
diff --git a/src/vars.c b/src/vars.c
index d20839c..a20dc8b 100644
--- a/src/vars.c
+++ b/src/vars.c
@@ -481,7 +481,7 @@
 
 /* Always returns ACT_RET_CONT even if an error occurs. */
 static enum act_return action_store(struct act_rule *rule, struct proxy *px,
-                                    struct session *sess, struct stream *s)
+                                    struct session *sess, struct stream *s, int flags)
 {
 	struct sample smp;
 	int dir;