]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: sample: add a new SMP_SRC_CONST sample capability
authorWilly Tarreau <w@1wt.eu>
Fri, 26 Mar 2021 10:56:11 +0000 (11:56 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 26 Mar 2021 15:23:45 +0000 (16:23 +0100)
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.

include/haproxy/sample-t.h
src/sample.c

index d11c411dde4a450520d7ffaacbca6151ed49ad91..76b365ab1a2bc8d668ec1e2af6c9af4883a573bb 100644 (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 */
index b05259bbb73fe2902ea45fc3af7747b49c9108a0..32255cb21a5d6b5e728c337927b3b13b21a1eda1 100644 (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 |