| 1 | #ifndef FILTER_H |
| 2 | #define FILTER_H |
| 3 | |
| 4 | /* A filter expression consists in nested AND, OR and NOT expressions |
| 5 | involving boolean relation (>, >=, =, !=, <, <=) between event fields and |
| 6 | specific values. It is compiled into an efficient data structure which |
| 7 | is used in functions to check if a given event or tracefile satisfies the |
| 8 | filter. |
| 9 | |
| 10 | The grammar for filters is: |
| 11 | |
| 12 | filter = expression |
| 13 | |
| 14 | expression = "(" expression ")" | "!" expression | |
| 15 | expression "&&" expression | expression "||" expression | |
| 16 | simpleExpression |
| 17 | |
| 18 | simpleExpression = fieldPath op value |
| 19 | |
| 20 | fieldPath = fieldComponent [ "." fieldPath ] |
| 21 | |
| 22 | fieldComponent = name [ "[" integer "]" ] |
| 23 | |
| 24 | value = integer | double | string |
| 25 | |
| 26 | */ |
| 27 | |
| 28 | |
| 29 | typedef struct _lttv_filter lttv_filter; |
| 30 | |
| 31 | |
| 32 | /* Compile the filter expression into an efficient data structure */ |
| 33 | |
| 34 | lttv_filter *lttv_filter_new(char *expression, lttv_trace *t); |
| 35 | |
| 36 | |
| 37 | /* Check if the tracefile or event satisfies the filter. The arguments are |
| 38 | declared as void * to allow these functions to be used as hooks. */ |
| 39 | |
| 40 | bool lttv_filter_tracefile(void *filter, void *tracefile); |
| 41 | |
| 42 | bool lttv_filter_event(void *filter, void *event); |
| 43 | |
| 44 | #endif // FILTER_H |
| 45 | |