Add automatically compiled PCRE2_REGEX config parameter type

The regex strings are compiled automatically. During file parsing,
the string is compiled once using default settings to check that
the pattern is valid. Once a module asks for the compiled pcre2_code,
the pattern is compiled again with module given settings.

The regex string in the config file should be enclosed within '/ ... /'
This commit is contained in:
Esa Korhonen
2017-05-29 11:09:13 +03:00
parent 53a2139bb9
commit 47b7f1c69c
3 changed files with 191 additions and 16 deletions

View File

@ -84,7 +84,8 @@ enum mxs_module_param_type
MXS_MODULE_PARAM_PATH, /**< Path to a file or a directory */
MXS_MODULE_PARAM_SERVICE, /**< Service name */
MXS_MODULE_PARAM_SERVER, /**< Server name */
MXS_MODULE_PARAM_SERVERLIST /**< List of server names, separated by ',' */
MXS_MODULE_PARAM_SERVERLIST, /**< List of server names, separated by ',' */
MXS_MODULE_PARAM_REGEX /**< A regex string enclosed in '/' */
};
/** Maximum and minimum values for integer types */
@ -246,6 +247,8 @@ static inline const char* mxs_module_param_type_to_string(enum mxs_module_param_
return "server";
case MXS_MODULE_PARAM_SERVERLIST:
return "serverlist";
case MXS_MODULE_PARAM_REGEX:
return "regular expression";
default:
ss_dassert(!true);
return "unknown";