#ifndef _PROTO_PATTERN_H
#define _PROTO_PATTERN_H
+#include <string.h>
+
#include <common/config.h>
#include <common/standard.h>
#include <types/pattern.h>
*/
int pattern_register(struct pattern_expr *expr, char *text, struct sample_storage *smp, struct pattern **pattern, int patflags, char **err);
+/* return the PAT_MATCH_* index for match name "name", or < 0 if not found */
+static inline int pat_find_match_name(const char *name)
+{
+ int i;
+
+ for (i = 0; i < PAT_MATCH_NUM; i++)
+ if (strcmp(name, pat_match_names[i]) == 0)
+ return i;
+ return -1;
+}
+
/* This function executes a pattern match on a sample. It applies pattern <expr>
* to sample <smp>. If <sample> is not NULL, a pointer to an optional sample
* associated to the matching patterned will be put there. The function returns
.list = LIST_HEAD_INIT(acl_keywords.list)
};
-/* return the PAT_MATCH_* index for match name "name", or < 0 if not found */
-static int acl_find_match_name(const char *name)
-{
- int i;
-
- for (i = 0; i < PAT_MATCH_NUM; i++)
- if (strcmp(name, pat_match_names[i]) == 0)
- return i;
- return -1;
-}
-
/* input values are 0 or 3, output is the same */
static inline enum acl_test_res pat2acl(enum pat_match_res res)
{
goto out_free_expr;
}
- idx = acl_find_match_name(args[1]);
+ idx = pat_find_match_name(args[1]);
if (idx < 0) {
memprintf(err, "unknown matching method '%s' when parsing ACL expression", args[1]);
goto out_free_expr;