forked from cathugger/mkp224o
-
Notifications
You must be signed in to change notification settings - Fork 0
/
filters.h
96 lines (65 loc) · 1.26 KB
/
filters.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef INTFILTER
# define BINFILTER
#endif
#ifdef PCRE2FILTER
# undef BINFILTER
# undef INTFILTER
#endif
#ifdef INTFILTER
# ifdef BINSEARCH
# ifndef BESORT
# define OMITMASK
# endif
# endif
#endif
#ifdef OMITMASK
# define EXPANDMASK
#endif
// whether binfilter struct is needed
#ifdef BINFILTER
# define NEEDBINFILTER
#endif
#ifdef INTFILTER
# define NEEDBINFILTER
#endif
#ifdef NEEDBINFILTER
# ifndef BINFILTERLEN
# define BINFILTERLEN PUBLIC_LEN
# endif
struct binfilter {
u8 f[BINFILTERLEN];
size_t len; // real len minus one
u8 mask;
} ;
VEC_STRUCT(bfiltervec,struct binfilter);
#ifdef BINFILTER
extern struct bfiltervec filters;
#endif
#endif // NEEDBINFILTER
#ifdef INTFILTER
struct intfilter {
IFT f;
# ifndef OMITMASK
IFT m;
# endif
} ;
VEC_STRUCT(ifiltervec,struct intfilter);
extern struct ifiltervec filters;
# ifdef OMITMASK
extern IFT ifiltermask;
# endif
#endif // INTFILTER
#ifdef PCRE2FILTER
#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h>
struct pcre2filter {
char *str;
pcre2_code *re;
} ;
VEC_STRUCT(pfiltervec,struct pcre2filter);
extern struct pfiltervec filters;
#endif // PCRE2FILTER
extern int flattened;
extern void filters_init(void);
extern void filters_add(const char *filter);
extern size_t filters_count(void);