MEDIUM: actions: Add standard return code for the action API
Action function can return 3 status:
- error if the action encounter fatal error (like out of memory)
- yield if the action must terminate his work later
- continue in other cases
diff --git a/include/types/action.h b/include/types/action.h
index 09c14c5..713631e 100644
--- a/include/types/action.h
+++ b/include/types/action.h
@@ -32,6 +32,12 @@
ACT_F_HTTP_RES, /* http-response */
};
+enum act_return {
+ ACT_RET_CONT, /* continue processing. */
+ ACT_RET_YIELD, /* call me again. */
+ ACT_RET_ERR, /* processing error. */
+};
+
enum act_name {
ACT_ACTION_CONT = 0,
ACT_ACTION_STOP,
@@ -78,8 +84,8 @@
enum act_name action; /* ACT_ACTION_* */
enum act_from from; /* ACT_F_* */
short deny_status; /* HTTP status to return to user when denying */
- int (*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,
+ struct session *sess, struct stream *s); /* ptr to custom action */
union {
struct {
char *realm;