|
|
@ -18,6 +18,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
typedef struct f2b_regex_t { |
|
|
|
typedef struct f2b_regex_t { |
|
|
|
struct f2b_regex_t *next; |
|
|
|
struct f2b_regex_t *next; |
|
|
|
|
|
|
|
char pattern[PATTERN_MAX]; |
|
|
|
int matches; |
|
|
|
int matches; |
|
|
|
pcre *regex; |
|
|
|
pcre *regex; |
|
|
|
pcre_extra *data; |
|
|
|
pcre_extra *data; |
|
|
@ -30,6 +31,7 @@ struct _config { |
|
|
|
bool study; |
|
|
|
bool study; |
|
|
|
bool usejit; |
|
|
|
bool usejit; |
|
|
|
f2b_regex_t *regexps; |
|
|
|
f2b_regex_t *regexps; |
|
|
|
|
|
|
|
f2b_regex_t *statp; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
cfg_t * |
|
|
|
cfg_t * |
|
|
@ -115,6 +117,7 @@ append(cfg_t *cfg, const char *pattern) { |
|
|
|
|
|
|
|
|
|
|
|
regex->next = cfg->regexps; |
|
|
|
regex->next = cfg->regexps; |
|
|
|
cfg->regexps = regex; |
|
|
|
cfg->regexps = regex; |
|
|
|
|
|
|
|
snprintf(regex->pattern, sizeof(regex->pattern), "%s", pattern); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -126,6 +129,23 @@ ready(cfg_t *cfg) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool |
|
|
|
|
|
|
|
stats(cfg_t *cfg, int *matches, char **pattern, bool reset) { |
|
|
|
|
|
|
|
assert(cfg != NULL); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (reset) |
|
|
|
|
|
|
|
cfg->statp = cfg->regexps; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (cfg->statp) { |
|
|
|
|
|
|
|
*matches = cfg->statp->matches; |
|
|
|
|
|
|
|
*pattern = cfg->statp->pattern; |
|
|
|
|
|
|
|
cfg->statp = cfg->statp->next; |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const char * |
|
|
|
const char * |
|
|
|
error(cfg_t *cfg) { |
|
|
|
error(cfg_t *cfg) { |
|
|
|
assert(cfg != NULL); |
|
|
|
assert(cfg != NULL); |
|
|
|