mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-01 11:01:46 +00:00
511e9475f2
The goal of these patch is to simplify the prototype of "pat_pattern_*()" functions. I want to replace the argument "char **args" by a simple "char *arg" and remove the "opaque" argument. "pat_parse_int()" and "pat_parse_dotted_ver()" are the unique pattern parser using the "opaque" argument and using more than one string argument of the char **args. These specificities are only used with ACL. Other systems using this pattern parser (MAP and CLI) just use one string for describing a range. This two functions can read a range, but the min and the max must y specified. This patch extends the syntax to describe a range with implicit min and max. This is used for operators like "lt", "le", "gt", and "ge". the syntax is the following: ":x" -> no min to "x" "x:" -> "x" to no max This patch moves the parsing of the comparison operator from the functions "pat_parse_int()" and "pat_parse_dotted_ver()" to the acl parser. The acl parser read the operator and the values and build a volatile string readable by the functions "pat_parse_int()" and "pat_parse_dotted_ver()". The transformation is done with these rules: If the parser is "pat_parse_int()": "eq x" -> "x" "le x" -> ":x" "lt x" -> ":y" (with y = x - 1) "ge x" -> "x:" "gt x" -> "y:" (with y = x + 1) If the parser is "pat_parse_dotted_ver()": "eq x.y" -> "x.y" "le x.y" -> ":x.y" "lt x.y" -> ":w.z" (with w.z = x.y - 1) "ge x.y" -> "x.y:" "gt x.y" -> "w.z:" (with w.z = x.y + 1) Note that, if "y" is not present, assume that is "0". Now "pat_parse_int()" and "pat_parse_dotted_ver()" accept only one pattern and the variable "opaque" is no longer used. The prototype of the pattern parsers can be changed. |
||
---|---|---|
.. | ||
common | ||
import | ||
proto | ||
types |