bd912dd8 |
/*
* Match a string against a list of patterns/regexes.
* |
2023340a |
* Copyright (C) 2007-2008 Sourcefire, Inc.
*
* Authors: Török Edvin |
bd912dd8 |
*
* This program is free software; you can redistribute it and/or modify |
2023340a |
* it under the terms of the GNU General Public License version 2 as |
38a00199 |
* published by the Free Software Foundation. |
bd912dd8 |
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef _REGEX_LIST_H
#define _REGEX_LIST_H
|
b5341ac0 |
#include "phishcheck.h" |
e8ae4fae |
#include "readdb.h"
#include "matcher.h" |
056d95dc |
#include <zlib.h> /* for gzFile */ |
2e11bcdf |
|
0728972e |
#include "mpool.h"
|
2e11bcdf |
struct filter {
uint32_t B[65536];
uint32_t end_fast[256];
uint32_t end[65536];
unsigned long m; |
bd912dd8 |
};
|
a2d14e06 |
struct regex_list_ht {
struct regex_list *head;
struct regex_list *tail;
};
|
bd912dd8 |
struct regex_matcher { |
2e11bcdf |
struct hashtable suffix_hash;
size_t suffix_cnt; |
a2d14e06 |
struct regex_list_ht *suffix_regexes; |
d4e1cb47 |
size_t root_regex_idx; |
10290ba3 |
size_t regex_cnt; |
9ee053fe |
regex_t **all_pregs; |
2e11bcdf |
struct cli_matcher suffixes; |
4e46d65d |
struct cli_matcher sha256_hashes; |
a3d029b9 |
struct cli_matcher hostkey_prefix; |
2e11bcdf |
struct filter filter; |
0728972e |
#ifdef USE_MPOOL |
47d40feb |
mpool_t *mempool; |
0728972e |
#endif |
2e11bcdf |
int list_inited:2;
int list_loaded:2;
int list_built:2; |
bd912dd8 |
};
|
2e11bcdf |
int cli_build_regex_list(struct regex_matcher* matcher); |
3dcc2d78 |
int regex_list_add_pattern(struct regex_matcher *matcher, char *pattern); |
2e11bcdf |
int regex_list_match(struct regex_matcher* matcher, char* real_url,const char* display_url,const struct pre_fixup_info* pre_fixup, int hostOnly,const char **info, int is_whitelist); |
bd912dd8 |
int init_regex_list(struct regex_matcher* matcher); |
03527bee |
int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int *signo,unsigned int options,int is_whitelist,struct cli_dbio *dbio); |
bd912dd8 |
void regex_list_cleanup(struct regex_matcher* matcher);
void regex_list_done(struct regex_matcher* matcher);
int is_regex_ok(struct regex_matcher* matcher); |
063ddd53 |
long SO_search(const struct filter *m, const unsigned char *data, unsigned long len); |
3da4dd4c |
|
bd912dd8 |
#endif
|