MEDIUM: checks: Parse custom action rules in tcp-checks
Register the custom action rules "set-var" and "unset-var", that will
call the parse_store() command upon parsing.
These rules are thus built and integrated to the tcp-check ruleset, but
have no further effect for the moment.
diff --git a/include/types/action.h b/include/types/action.h
index 3298770..1a5a594 100644
--- a/include/types/action.h
+++ b/include/types/action.h
@@ -34,6 +34,7 @@
ACT_F_TCP_RES_CNT, /* tcp-response content */
ACT_F_HTTP_REQ, /* http-request */
ACT_F_HTTP_RES, /* http-response */
+ ACT_F_TCP_CHK, /* tcp-check. */
};
enum act_return {
diff --git a/include/types/checks.h b/include/types/checks.h
index b980faa..d848e6c 100644
--- a/include/types/checks.h
+++ b/include/types/checks.h
@@ -256,12 +256,17 @@
int min_recv; /* Minimum amount of data before an expect can be applied. (default: -1, ignored) */
};
+struct tcpcheck_action_kw {
+ struct act_rule *rule;
+};
+
/* possible actions for tcpcheck_rule->action */
enum tcpcheck_rule_type {
TCPCHK_ACT_SEND = 0, /* send action, regular string format */
TCPCHK_ACT_EXPECT, /* expect action, either regular or binary string */
TCPCHK_ACT_CONNECT, /* connect action, to probe a new port */
TCPCHK_ACT_COMMENT, /* no action, simply a comment used for logs */
+ TCPCHK_ACT_ACTION_KW, /* custom registered action_kw rule. */
};
struct tcpcheck_rule {
@@ -273,6 +278,7 @@
struct tcpcheck_connect connect; /* Connect rule. */
struct tcpcheck_send send; /* Send rule. */
struct tcpcheck_expect expect; /* Expected pattern. */
+ struct tcpcheck_action_kw action_kw; /* Custom action. */
};
};
diff --git a/include/types/sample.h b/include/types/sample.h
index e5c2c29..2292b36 100644
--- a/include/types/sample.h
+++ b/include/types/sample.h
@@ -99,6 +99,7 @@
SMP_CKP_FE_HRS_HDR, /* FE HTTP response headers (rules, headers) */
SMP_CKP_FE_HRS_BDY, /* FE HTTP response body */
SMP_CKP_FE_LOG_END, /* FE log at the end of the txn/stream */
+ SMP_CKP_BE_CHK_RUL, /* BE tcp-check rules */
SMP_CKP_ENTRIES /* nothing after this */
};
@@ -164,16 +165,18 @@
SMP_VAL_FE_HRS_HDR = 1 << SMP_CKP_FE_HRS_HDR, /* FE HTTP response headers (rules, headers) */
SMP_VAL_FE_HRS_BDY = 1 << SMP_CKP_FE_HRS_BDY, /* FE HTTP response body */
SMP_VAL_FE_LOG_END = 1 << SMP_CKP_FE_LOG_END, /* FE log at the end of the txn/stream */
+ SMP_VAL_BE_CHK_RUL = 1 << SMP_CKP_BE_CHK_RUL, /* BE tcp-check rule */
/* a few combinations to decide what direction to try to fetch (useful for logs) */
SMP_VAL_REQUEST = SMP_VAL_FE_CON_ACC | SMP_VAL_FE_SES_ACC | SMP_VAL_FE_REQ_CNT |
SMP_VAL_FE_HRQ_HDR | SMP_VAL_FE_HRQ_BDY | SMP_VAL_FE_SET_BCK |
SMP_VAL_BE_REQ_CNT | SMP_VAL_BE_HRQ_HDR | SMP_VAL_BE_HRQ_BDY |
- SMP_VAL_BE_SET_SRV,
+ SMP_VAL_BE_SET_SRV | SMP_VAL_BE_CHK_RUL,
SMP_VAL_RESPONSE = SMP_VAL_BE_SRV_CON | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR |
SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT |
- SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | SMP_VAL_FE_LOG_END,
+ SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | SMP_VAL_FE_LOG_END |
+ SMP_VAL_BE_CHK_RUL,
};
extern const unsigned int fetch_cap[SMP_SRC_ENTRIES];