MINOR: sample: add a new SMP_SRC_CONST sample capability

This level indicates that everything it constant in the expression during
the whole process' life and that it may safely be used at config parsing
time.
This commit is contained in:
Willy Tarreau 2021-03-26 11:56:11 +01:00
parent 77e6a4ef0f
commit be2159b946
2 changed files with 10 additions and 0 deletions

View File

@ -45,6 +45,7 @@ enum {
* use and are not meant to be known outside the sample management code.
*/
enum {
SMP_SRC_CONST, /* constat elements known at configuration time */
SMP_SRC_INTRN, /* internal context-less information */
SMP_SRC_LISTN, /* listener which accepted the connection */
SMP_SRC_FTEND, /* frontend which accepted the connection */
@ -105,6 +106,7 @@ enum {
* stored in smp->use.
*/
enum {
SMP_USE_CONST = 1 << SMP_SRC_CONST, /* constant values known at config time */
SMP_USE_INTRN = 1 << SMP_SRC_INTRN, /* internal context-less information */
SMP_USE_LISTN = 1 << SMP_SRC_LISTN, /* listener which accepted the connection */
SMP_USE_FTEND = 1 << SMP_SRC_FTEND, /* frontend which accepted the connection */

View File

@ -70,6 +70,14 @@ static struct sample_conv_kw_list sample_convs = {
};
const unsigned int fetch_cap[SMP_SRC_ENTRIES] = {
[SMP_SRC_CONST] = (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_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_BE_CHK_RUL),
[SMP_SRC_INTRN] = (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 |