blob: 6626a0641dda88558870b26808f2053b445487f5 (
plain)
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
|
#ifndef SH_FILTER_H
#define SH_FILTER_H
/* Filtering
*/
#define SH_FILT_NUM 32
#define SH_FILT_OR 0
#define SH_FILT_AND 1
#define SH_FILT_NOT 2
#define SH_FILT_INIT { 0, { NULL }, 0, { NULL }, 0, { NULL }}
/* Pattern storage is of type void since it may be a char*
* or a regex_t*
*/
typedef struct _sh_filter_type
{
int for_c;
void * for_v[SH_FILT_NUM];
int fand_c;
void * fand_v[SH_FILT_NUM];
int fnot_c;
void * fnot_v[SH_FILT_NUM];
} sh_filter_type;
int sh_filter_add (const char * str, sh_filter_type * filter, int type);
void sh_filter_free (sh_filter_type * filter);
int sh_filter_filter (const char * message, sh_filter_type * filter);
sh_filter_type * sh_filter_alloc(void);
#endif
|