@@ -140,6 +140,17 @@ with the word ``else``. The following example illustrates this::
140140The ``else `` clause is not a condition, and does not take any flags, it is
141141of course optional, but when specified must be followed by at least one operator.
142142
143+ State variables
144+ ---------------
145+
146+ A set of state variables are also available for both conditions and operators.
147+ There are currently 16 flag states, 4 8-bit integers and one 16-bit integer states.
148+ These states are all transactional, meaning they are usable and persistent across
149+ all hooks.
150+
151+ The flag states are numbers 0-15, the 8-bit integer states are numbered 0-3, and the
152+ one 16-bit integer state is number 0.
153+
143154Conditions
144155----------
145156
@@ -457,9 +468,10 @@ As a special matcher, the inbound IP addresses can be matched against a list of
457468
458469 cond %{INBOUND:REMOTE-ADDR} {192.168.201.0/24,10.0.0.0/8}
459470
460- Note that this will not work against the non-IP based conditions, such as the protocol families,
461- and the configuration parser will error out. The format here is very specific, in particular no
462- white spaces are allowed between the ranges.
471+ .. note ::
472+ This will not work against the non-IP based conditions, such as the protocol families,
473+ and the configuration parser will error out. The format here is very specific, in particular no
474+ white spaces are allowed between the ranges.
463475
464476IP
465477~~
@@ -569,6 +581,36 @@ RANDOM
569581
570582Generates a random integer from ``0 `` up to (but not including) ``<n> ``. Mathematically, ``[0,n) `` or ``0 <= r < n ``.
571583
584+ STATE-FLAG
585+ ~~~~~~~~~~
586+ ::
587+
588+ cond %{STATE-FLAG:<n>}
589+
590+ This condition allows you to check the state of a flag. The ``<n> `` is the
591+ number of the flag, from 0 to 15. This condition returns a ``true `` or
592+ ``false `` value, depending on the state of the flag.
593+
594+ STATE-INT8
595+ ~~~~~~~~~~
596+ ::
597+
598+ cond %{STATE-INT8:<n>}
599+
600+ This condition allows you to check the state of an 8-bit unsigned integer.
601+ The ``<n> `` is the number of the integer, from 0 to 3. The current value of
602+ the state integer is returned, and all 4 integers are initialized to 0.
603+
604+ STATE-INT16
605+ ~~~~~~~~~~~
606+ ::
607+
608+ cond %{STATE-INT16<:0>}
609+
610+ This condition allows you to check the state of an 16-bit unsigned integer.
611+ There's only one such integer, and its value is returned from this condition.
612+ As such, the index, ``0 ``, is optional here.
613+
572614STATUS
573615~~~~~~
574616::
@@ -920,6 +962,38 @@ location automatically. This operator supports `String concatenations`_ for
920962``READ_RESPONSE_HDR_HOOK `` (the default when the plugin is global), the
921963``SEND_RESPONSE_HDR_HOOK ``, or the ``REMAP_PSEUDO_HOOK ``.
922964
965+ set-state-flag
966+ ~~~~~~~~~~~~~~
967+ ::
968+
969+ set-state-flag <n> <value>
970+
971+ This operator allows you to set the state of a flag. The ``<n> `` is the
972+ number of the flag, from 0 to 15. The ``<value> `` is either ``true `` or ``false ``,
973+ turning the flag on or off.
974+
975+ set-state-int8
976+ ~~~~~~~~~~~~~~
977+ ::
978+
979+ set-state-int8 <n> <value>
980+
981+ This operator allows you to set the state of an 8-bit unsigned integer.
982+ The ``<n> `` is the number of the integer, from 0 to 3. The ``<value> `` is an
983+ unsigned 8-bit integer, 0-255. It can also be a condition, in which case the
984+ value of the condition is used.
985+
986+ set-state-int16
987+ ~~~~~~~~~~~~~~~
988+ ::
989+
990+ set-state-int16 0 <value>
991+
992+ This operator allows you to set the state of a 16-bit unsigned integer.
993+ The ``<value> `` is an unsigned 16-bit integer as well, 0-65535. It can also
994+ be a condition, in which case thevalue of the condition is used. The index,
995+ 0, is always required eventhough there is only one 16-bit integer state variable.
996+
923997set-status
924998~~~~~~~~~~
925999::
@@ -1438,6 +1512,11 @@ could each be tagged with a consistent name to make finding logs easier.::
14381512
14391513(Then in :file: `logging.yaml `, log ``%<{@PropertyName}cqh> ``)
14401514
1515+ .. note ::
1516+ With the new ``state-flag ``, ``state-int8 `` and ``state-int16 `` operators, you can
1517+ sometimes avoid setting internal ``@ `` headers for passing information between hooks.
1518+ These internal state variables are much more efficient than setting and reading headers.
1519+
14411520Remove Client Query Parameters
14421521------------------------------------
14431522
0 commit comments