24
24
#ifndef _REGEX_LIST_H
25
25
#define _REGEX_LIST_H
28
#define massert(x) (void)(0)
30
/*debug version, massert enabled*/
32
#define __massert_fail(expr,file,line) (void)cli_errmsg("Assertion failed at %s:%d\n %s\n",file,line,expr)
34
#define massert(expr) ((void) ((expr) ? (void)0 : (__massert_fail (#expr,__FILE__,__LINE__))))
37
27
#include "phishcheck.h"
38
28
#include "readdb.h"
39
29
#include "matcher.h"
40
30
#include <zlib.h> /* for gzFile */
42
struct tree_node** data;
34
uint32_t end_fast[256];
39
struct regex_list_ht {
40
struct regex_list *head;
41
struct regex_list *tail;
47
44
struct regex_matcher {
48
struct cli_matcher* root_hosts;
49
struct tree_node* root_regex;
50
struct tree_node* root_regex_hostonly;
51
struct node_stack node_stack;
52
struct node_stack node_stack_alt;
53
size_t root_hosts_cnt;
45
struct hashtable suffix_hash;
47
struct regex_list_ht *suffix_regexes;
50
struct cli_matcher suffixes;
51
struct cli_matcher md5_hashes;
52
struct filter md5_filter;
59
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);
59
int cli_build_regex_list(struct regex_matcher* matcher);
60
int regex_list_add_pattern(struct regex_matcher *matcher, char *pattern);
61
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);
60
62
int init_regex_list(struct regex_matcher* matcher);
61
63
int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int options,int is_whitelist,struct cli_dbio *dbio);
62
64
void regex_list_cleanup(struct regex_matcher* matcher);
63
65
void regex_list_done(struct regex_matcher* matcher);
64
66
int is_regex_ok(struct regex_matcher* matcher);
67
long SO_search(const struct filter *m, const unsigned char *data, unsigned long len);