mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
MINOR: actions: Rename the act_flag enum into act_opt
The flags in the act_flag enum have been renamed act_opt. It means ACT_OPT prefix is used instead of ACT_FLAG. The purpose of this patch is to reserve the action flags for the actions configuration.
This commit is contained in:
parent
cd26e8a2ec
commit
105ba6cc54
@ -52,11 +52,11 @@ enum act_parse_ret {
|
|||||||
ACT_RET_PRS_ERR, /* abort processing. */
|
ACT_RET_PRS_ERR, /* abort processing. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* flags passed to custom actions */
|
/* Option flags passed to custom actions */
|
||||||
enum act_flag {
|
enum act_opt {
|
||||||
ACT_FLAG_NONE = 0x00000000, /* no flag */
|
ACT_OPT_NONE = 0x00000000, /* no flag */
|
||||||
ACT_FLAG_FINAL = 0x00000001, /* last call, cannot yield */
|
ACT_OPT_FINAL = 0x00000001, /* last call, cannot yield */
|
||||||
ACT_FLAG_FIRST = 0x00000002, /* first call for this action */
|
ACT_OPT_FIRST = 0x00000002, /* first call for this action */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* known actions to be used without any action function pointer. This enum is
|
/* known actions to be used without any action function pointer. This enum is
|
||||||
@ -112,7 +112,7 @@ struct act_rule {
|
|||||||
enum act_name action; /* ACT_ACTION_* */
|
enum act_name action; /* ACT_ACTION_* */
|
||||||
enum act_from from; /* ACT_F_* */
|
enum act_from from; /* ACT_F_* */
|
||||||
enum act_return (*action_ptr)(struct act_rule *rule, struct proxy *px, /* 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 session *sess, struct stream *s, int opts);
|
||||||
int (*check_ptr)(struct act_rule *rule, struct proxy *px, char **err); /* ptr to check function */
|
int (*check_ptr)(struct act_rule *rule, struct proxy *px, char **err); /* ptr to check function */
|
||||||
void (*release_ptr)(struct act_rule *rule); /* ptr to release function */
|
void (*release_ptr)(struct act_rule *rule); /* ptr to release function */
|
||||||
struct action_kw *kw;
|
struct action_kw *kw;
|
||||||
|
@ -4538,7 +4538,7 @@ spoe_send_group(struct act_rule *rule, struct proxy *px,
|
|||||||
if (ret == 1)
|
if (ret == 1)
|
||||||
return ACT_RET_CONT;
|
return ACT_RET_CONT;
|
||||||
else if (ret == 0) {
|
else if (ret == 0) {
|
||||||
if (flags & ACT_FLAG_FINAL) {
|
if (flags & ACT_OPT_FINAL) {
|
||||||
SPOE_PRINTF(stderr, "%d.%06d [SPOE/%-15s] %s: stream=%p"
|
SPOE_PRINTF(stderr, "%d.%06d [SPOE/%-15s] %s: stream=%p"
|
||||||
" - failed to process group '%s': interrupted by caller\n",
|
" - failed to process group '%s': interrupted by caller\n",
|
||||||
(int)now.tv_sec, (int)now.tv_usec,
|
(int)now.tv_sec, (int)now.tv_usec,
|
||||||
|
@ -6221,7 +6221,7 @@ static enum act_return hlua_action(struct act_rule *rule, struct proxy *px,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Execute the function. */
|
/* Execute the function. */
|
||||||
switch (hlua_ctx_resume(s->hlua, !(flags & ACT_FLAG_FINAL))) {
|
switch (hlua_ctx_resume(s->hlua, !(flags & ACT_OPT_FINAL))) {
|
||||||
/* finished. */
|
/* finished. */
|
||||||
case HLUA_E_OK:
|
case HLUA_E_OK:
|
||||||
if (!consistency_check(s, dir, &s->hlua->cons)) {
|
if (!consistency_check(s, dir, &s->hlua->cons)) {
|
||||||
|
@ -2927,7 +2927,7 @@ static enum rule_result http_req_get_intercept_rule(struct proxy *px, struct lis
|
|||||||
struct http_hdr_ctx ctx;
|
struct http_hdr_ctx ctx;
|
||||||
const char *auth_realm;
|
const char *auth_realm;
|
||||||
enum rule_result rule_ret = HTTP_RULE_RES_CONT;
|
enum rule_result rule_ret = HTTP_RULE_RES_CONT;
|
||||||
int act_flags = 0;
|
int act_opts = 0;
|
||||||
int early_hints = 0;
|
int early_hints = 0;
|
||||||
|
|
||||||
htx = htxbuf(&s->req.buf);
|
htx = htxbuf(&s->req.buf);
|
||||||
@ -2963,7 +2963,7 @@ static enum rule_result http_req_get_intercept_rule(struct proxy *px, struct lis
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
act_flags |= ACT_FLAG_FIRST;
|
act_opts |= ACT_OPT_FIRST;
|
||||||
resume_execution:
|
resume_execution:
|
||||||
if (early_hints && rule->action != ACT_HTTP_EARLY_HINT) {
|
if (early_hints && rule->action != ACT_HTTP_EARLY_HINT) {
|
||||||
early_hints = 0;
|
early_hints = 0;
|
||||||
@ -2978,9 +2978,9 @@ static enum rule_result http_req_get_intercept_rule(struct proxy *px, struct lis
|
|||||||
if ((s->req.flags & CF_READ_ERROR) ||
|
if ((s->req.flags & CF_READ_ERROR) ||
|
||||||
((s->req.flags & (CF_SHUTR|CF_READ_NULL)) &&
|
((s->req.flags & (CF_SHUTR|CF_READ_NULL)) &&
|
||||||
(px->options & PR_O_ABRT_CLOSE)))
|
(px->options & PR_O_ABRT_CLOSE)))
|
||||||
act_flags |= ACT_FLAG_FINAL;
|
act_opts |= ACT_OPT_FINAL;
|
||||||
|
|
||||||
switch (rule->action_ptr(rule, px, sess, s, act_flags)) {
|
switch (rule->action_ptr(rule, px, sess, s, act_opts)) {
|
||||||
case ACT_RET_CONT:
|
case ACT_RET_CONT:
|
||||||
break;
|
break;
|
||||||
case ACT_RET_STOP:
|
case ACT_RET_STOP:
|
||||||
@ -3341,7 +3341,7 @@ static enum rule_result http_res_get_intercept_rule(struct proxy *px, struct lis
|
|||||||
struct act_rule *rule;
|
struct act_rule *rule;
|
||||||
struct http_hdr_ctx ctx;
|
struct http_hdr_ctx ctx;
|
||||||
enum rule_result rule_ret = HTTP_RULE_RES_CONT;
|
enum rule_result rule_ret = HTTP_RULE_RES_CONT;
|
||||||
int act_flags = 0;
|
int act_opts = 0;
|
||||||
|
|
||||||
htx = htxbuf(&s->res.buf);
|
htx = htxbuf(&s->res.buf);
|
||||||
|
|
||||||
@ -3376,7 +3376,7 @@ static enum rule_result http_res_get_intercept_rule(struct proxy *px, struct lis
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
act_flags |= ACT_FLAG_FIRST;
|
act_opts |= ACT_OPT_FIRST;
|
||||||
resume_execution:
|
resume_execution:
|
||||||
|
|
||||||
/* Always call the action function if defined */
|
/* Always call the action function if defined */
|
||||||
@ -3384,9 +3384,9 @@ resume_execution:
|
|||||||
if ((s->req.flags & CF_READ_ERROR) ||
|
if ((s->req.flags & CF_READ_ERROR) ||
|
||||||
((s->req.flags & (CF_SHUTR|CF_READ_NULL)) &&
|
((s->req.flags & (CF_SHUTR|CF_READ_NULL)) &&
|
||||||
(px->options & PR_O_ABRT_CLOSE)))
|
(px->options & PR_O_ABRT_CLOSE)))
|
||||||
act_flags |= ACT_FLAG_FINAL;
|
act_opts |= ACT_OPT_FINAL;
|
||||||
|
|
||||||
switch (rule->action_ptr(rule, px, sess, s, act_flags)) {
|
switch (rule->action_ptr(rule, px, sess, s, act_opts)) {
|
||||||
case ACT_RET_CONT:
|
case ACT_RET_CONT:
|
||||||
break;
|
break;
|
||||||
case ACT_RET_STOP:
|
case ACT_RET_STOP:
|
||||||
|
@ -987,7 +987,7 @@ enum act_return process_use_service(struct act_rule *rule, struct proxy *px,
|
|||||||
struct appctx *appctx;
|
struct appctx *appctx;
|
||||||
|
|
||||||
/* Initialises the applet if it is required. */
|
/* Initialises the applet if it is required. */
|
||||||
if (flags & ACT_FLAG_FIRST) {
|
if (flags & ACT_OPT_FIRST) {
|
||||||
/* Register applet. this function schedules the applet. */
|
/* Register applet. this function schedules the applet. */
|
||||||
s->target = &rule->applet.obj_type;
|
s->target = &rule->applet.obj_type;
|
||||||
if (unlikely(!si_register_handler(&s->si[1], objt_applet(s->target))))
|
if (unlikely(!si_register_handler(&s->si[1], objt_applet(s->target))))
|
||||||
|
@ -104,7 +104,7 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
struct stksess *ts;
|
struct stksess *ts;
|
||||||
struct stktable *t;
|
struct stktable *t;
|
||||||
int partial;
|
int partial;
|
||||||
int act_flags = 0;
|
int act_opts = 0;
|
||||||
|
|
||||||
DBG_TRACE_ENTER(STRM_EV_STRM_ANA|STRM_EV_TCP_ANA, s);
|
DBG_TRACE_ENTER(STRM_EV_STRM_ANA|STRM_EV_TCP_ANA, s);
|
||||||
|
|
||||||
@ -151,15 +151,15 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
act_flags |= ACT_FLAG_FIRST;
|
act_opts |= ACT_OPT_FIRST;
|
||||||
resume_execution:
|
resume_execution:
|
||||||
|
|
||||||
/* Always call the action function if defined */
|
/* Always call the action function if defined */
|
||||||
if (rule->action_ptr) {
|
if (rule->action_ptr) {
|
||||||
if (partial & SMP_OPT_FINAL)
|
if (partial & SMP_OPT_FINAL)
|
||||||
act_flags |= ACT_FLAG_FINAL;
|
act_opts |= ACT_OPT_FINAL;
|
||||||
|
|
||||||
switch (rule->action_ptr(rule, s->be, s->sess, s, act_flags)) {
|
switch (rule->action_ptr(rule, s->be, s->sess, s, act_opts)) {
|
||||||
case ACT_RET_CONT:
|
case ACT_RET_CONT:
|
||||||
break;
|
break;
|
||||||
case ACT_RET_STOP:
|
case ACT_RET_STOP:
|
||||||
@ -303,7 +303,7 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
struct session *sess = s->sess;
|
struct session *sess = s->sess;
|
||||||
struct act_rule *rule;
|
struct act_rule *rule;
|
||||||
int partial;
|
int partial;
|
||||||
int act_flags = 0;
|
int act_opts = 0;
|
||||||
|
|
||||||
DBG_TRACE_ENTER(STRM_EV_STRM_ANA|STRM_EV_TCP_ANA, s);
|
DBG_TRACE_ENTER(STRM_EV_STRM_ANA|STRM_EV_TCP_ANA, s);
|
||||||
|
|
||||||
@ -354,14 +354,14 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
act_flags |= ACT_FLAG_FIRST;
|
act_opts |= ACT_OPT_FIRST;
|
||||||
resume_execution:
|
resume_execution:
|
||||||
/* Always call the action function if defined */
|
/* Always call the action function if defined */
|
||||||
if (rule->action_ptr) {
|
if (rule->action_ptr) {
|
||||||
if (partial & SMP_OPT_FINAL)
|
if (partial & SMP_OPT_FINAL)
|
||||||
act_flags |= ACT_FLAG_FINAL;
|
act_opts |= ACT_OPT_FINAL;
|
||||||
|
|
||||||
switch (rule->action_ptr(rule, s->be, s->sess, s, act_flags)) {
|
switch (rule->action_ptr(rule, s->be, s->sess, s, act_opts)) {
|
||||||
case ACT_RET_CONT:
|
case ACT_RET_CONT:
|
||||||
break;
|
break;
|
||||||
case ACT_RET_STOP:
|
case ACT_RET_STOP:
|
||||||
@ -486,7 +486,7 @@ int tcp_exec_l4_rules(struct session *sess)
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
/* Always call the action function if defined */
|
/* Always call the action function if defined */
|
||||||
if (rule->action_ptr) {
|
if (rule->action_ptr) {
|
||||||
switch (rule->action_ptr(rule, sess->fe, sess, NULL, ACT_FLAG_FINAL | ACT_FLAG_FIRST)) {
|
switch (rule->action_ptr(rule, sess->fe, sess, NULL, ACT_OPT_FINAL | ACT_OPT_FIRST)) {
|
||||||
case ACT_RET_YIELD:
|
case ACT_RET_YIELD:
|
||||||
/* yield is not allowed at this point. If this return code is
|
/* yield is not allowed at this point. If this return code is
|
||||||
* used it is a bug, so I prefer to abort the process.
|
* used it is a bug, so I prefer to abort the process.
|
||||||
@ -588,7 +588,7 @@ int tcp_exec_l5_rules(struct session *sess)
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
/* Always call the action function if defined */
|
/* Always call the action function if defined */
|
||||||
if (rule->action_ptr) {
|
if (rule->action_ptr) {
|
||||||
switch (rule->action_ptr(rule, sess->fe, sess, NULL, ACT_FLAG_FINAL | ACT_FLAG_FIRST)) {
|
switch (rule->action_ptr(rule, sess->fe, sess, NULL, ACT_OPT_FINAL | ACT_OPT_FIRST)) {
|
||||||
case ACT_RET_YIELD:
|
case ACT_RET_YIELD:
|
||||||
/* yield is not allowed at this point. If this return code is
|
/* yield is not allowed at this point. If this return code is
|
||||||
* used it is a bug, so I prefer to abort the process.
|
* used it is a bug, so I prefer to abort the process.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user