[PAT_MATCH_INT] = pat_parse_int,
[PAT_MATCH_IP] = pat_parse_ip,
[PAT_MATCH_BIN] = pat_parse_bin,
- [PAT_MATCH_LEN] = pat_parse_len,
+ [PAT_MATCH_LEN] = pat_parse_int,
[PAT_MATCH_STR] = pat_parse_str,
[PAT_MATCH_BEG] = pat_parse_str,
[PAT_MATCH_SUB] = pat_parse_str,
int pat_parse_str(const char *text, struct pattern *pattern, char **err)
{
pattern->type = SMP_T_STR;
- pattern->expect_type = SMP_T_STR;
pattern->ptr.str = (char *)text;
pattern->len = strlen(text);
return 1;
struct chunk *trash;
pattern->type = SMP_T_BIN;
- pattern->expect_type = SMP_T_BIN;
trash = get_trash_chunk();
pattern->len = trash->size;
pattern->ptr.str = trash->str;
pattern->ptr.reg = (struct my_regex *)trash->str;
pattern->ptr.reg->regstr = (char *)text;
- pattern->expect_type = SMP_T_STR;
return 1;
}
const char *ptr = text;
pattern->type = SMP_T_UINT;
- pattern->expect_type = SMP_T_UINT;
/* Empty string is not valid */
if (!*text)
return 0;
}
-int pat_parse_len(const char *text, struct pattern *pattern, char **err)
-{
- int ret;
-
- ret = pat_parse_int(text, pattern, err);
- pattern->expect_type = SMP_T_STR;
- return ret;
-}
-
/* Parse a range of positive 2-component versions delimited by either ':' or
* '-'. The version consists in a major and a minor, both of which must be
* smaller than 65536, because internally they will be represented as a 32-bit
const char *ptr = text;
pattern->type = SMP_T_UINT;
- pattern->expect_type = SMP_T_UINT;
/* Search ':' or '-' separator. */
while (*ptr != '\0' && *ptr != ':' && *ptr != '-')
*/
int pat_parse_ip(const char *text, struct pattern *pattern, char **err)
{
- pattern->expect_type = SMP_T_ADDR;
if (str2net(text, &pattern->val.ipv4.addr, &pattern->val.ipv4.mask)) {
pattern->type = SMP_T_IPV4;
return 1;
struct pattern_list *lst;
struct pattern *pattern;
- /* convert input to string */
- if (!sample_convert(smp, SMP_T_STR))
- return NULL;
-
/* Lookup a string in the expression's pattern tree. */
if (!eb_is_empty(&expr->pattern_tree)) {
/* we may have to force a trailing zero on the test pattern */
struct pattern_list *lst;
struct pattern *pattern;
- /* Convert input to binary. */
- if (!sample_convert(smp, SMP_T_BIN))
- return NULL;
-
/* Look in the list. */
list_for_each_entry(lst, &expr->patterns, list) {
pattern = &lst->pat;
struct pattern_list *lst;
struct pattern *pattern;
- /* convert input to string */
- if (!sample_convert(smp, SMP_T_STR))
- return NULL;
-
/* look in the list */
list_for_each_entry(lst, &expr->patterns, list) {
pattern = &lst->pat;
struct pattern_list *lst;
struct pattern *pattern;
- /* convert input to string */
- if (!sample_convert(smp, SMP_T_STR))
- return NULL;
-
list_for_each_entry(lst, &expr->patterns, list) {
pattern = &lst->pat;
struct pattern_list *lst;
struct pattern *pattern;
- /* convert input to string */
- if (!sample_convert(smp, SMP_T_STR))
- return NULL;
-
list_for_each_entry(lst, &expr->patterns, list) {
pattern = &lst->pat;
struct pattern_list *lst;
struct pattern *pattern;
- /* convert input to string */
- if (!sample_convert(smp, SMP_T_STR))
- return NULL;
-
list_for_each_entry(lst, &expr->patterns, list) {
pattern = &lst->pat;
struct pattern_list *lst;
struct pattern *pattern;
- /* convert input to string */
- if (!sample_convert(smp, SMP_T_STR))
- return NULL;
-
list_for_each_entry(lst, &expr->patterns, list) {
pattern = &lst->pat;
if (match_word(smp, pattern, make_4delim('/', '?', '?', '?')))
struct pattern_list *lst;
struct pattern *pattern;
- /* convert input to string */
- if (!sample_convert(smp, SMP_T_STR))
- return NULL;
-
list_for_each_entry(lst, &expr->patterns, list) {
pattern = &lst->pat;
if (match_word(smp, pattern, make_4delim('/', '?', '.', ':')))
struct pattern_list *lst;
struct pattern *pattern;
- /* convert input to integer */
- if (!sample_convert(smp, SMP_T_UINT))
- return NULL;
-
list_for_each_entry(lst, &expr->patterns, list) {
pattern = &lst->pat;
if ((!pattern->val.range.min_set || pattern->val.range.min <= smp->data.uint) &&
struct pattern_list *lst;
struct pattern *pattern;
- /* convert input to string */
- if (!sample_convert(smp, SMP_T_STR))
- return NULL;
-
list_for_each_entry(lst, &expr->patterns, list) {
pattern = &lst->pat;
if ((!pattern->val.range.min_set || pattern->val.range.min <= smp->data.str.len) &&
struct pattern_list *lst;
struct pattern *pattern;
- /* convert input to addr */
- if (!sample_convert(smp, SMP_T_ADDR))
- return NULL;
-
/* The input sample is IPv4. Try to match in the trees. */
if (smp->type == SMP_T_IPV4) {
/* Lookup an IPv4 address in the expression's pattern tree using
return &static_pattern;
}
+ /* convert input to string */
+ if (!sample_convert(smp, head->expect_type))
+ return NULL;
+
list_for_each_entry(list, &head->head, list) {
pat = head->match(smp, list->expr, fill);
if (pat)