| Line | |
|---|
| 1 | #ifndef SH_FILTER_H
|
|---|
| 2 | #define SH_FILTER_H
|
|---|
| 3 |
|
|---|
| 4 | /* Filtering
|
|---|
| 5 | */
|
|---|
| 6 |
|
|---|
| 7 | #define SH_FILT_NUM 32
|
|---|
| 8 | #define SH_FILT_OR 0
|
|---|
| 9 | #define SH_FILT_AND 1
|
|---|
| 10 | #define SH_FILT_NOT 2
|
|---|
| 11 | #define SH_FILT_INIT { 0, { NULL }, 0, { NULL }, 0, { NULL }}
|
|---|
| 12 |
|
|---|
| 13 | /* Pattern storage is of type void since it may be a char*
|
|---|
| 14 | * or a regex_t*
|
|---|
| 15 | */
|
|---|
| 16 | typedef struct _sh_filter_type
|
|---|
| 17 | {
|
|---|
| 18 | int for_c;
|
|---|
| 19 | void * for_v[SH_FILT_NUM];
|
|---|
| 20 | int fand_c;
|
|---|
| 21 | void * fand_v[SH_FILT_NUM];
|
|---|
| 22 | int fnot_c;
|
|---|
| 23 | void * fnot_v[SH_FILT_NUM];
|
|---|
| 24 |
|
|---|
| 25 | } sh_filter_type;
|
|---|
| 26 |
|
|---|
| 27 | int sh_filter_add (const char * str, sh_filter_type * filter, int type);
|
|---|
| 28 |
|
|---|
| 29 | void sh_filter_free (sh_filter_type * filter);
|
|---|
| 30 |
|
|---|
| 31 | int sh_filter_filter (const char * message, sh_filter_type * filter);
|
|---|
| 32 |
|
|---|
| 33 | sh_filter_type * sh_filter_alloc(void);
|
|---|
| 34 |
|
|---|
| 35 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.