#ifndef EVENT_FILTER_H
#define EVENT_FILTER_H
struct event;
struct event_filter_field {
const char *key;
const char *value;
};
struct event_filter_query {
/* NULL-terminated list of categories */
const char *const *categories;
/* key=NULL-terminated list of key=value fields */
/* event name */
const char *name;
/* source filename:line */
const char *source_filename;
unsigned int source_linenum;
/* context associated with this query. This is returned when iterating
through matched queries. If NULL, the iteration won't return this
query. */
void *context;
};
struct event_filter *event_filter_create(void);
/* Add a new query to the filter. All of the categories and fields in the query
need to match, so they're ANDed together. Separate queries are ORed
together. */
const struct event_filter_query *query);
/* Add queries from source filter to destination filter. */
const struct event_filter *src);
/* Export the filter into a tabescaped string, so its fields are separated
with TABs and there are no NUL, CR or LF characters. The context pointers
aren't exported. */
/* Add queries to the filter from the given string. The string is expected to
be generated by event_filter_export(). Returns TRUE on success, FALSE on
invalid string. */
const char **error_r);
/* Same as event_filter_import(), but string is already split into an array
of strings via *_strsplit_tabescaped(). */
const char *const *args,
const char **error_r);
/* Returns TRUE if the event matches the event filter. */
/* Same as event_filter_match(), but use the given source filename:linenum
instead of taking it from the event. */
const char *source_filename,
unsigned int source_linenum);
/* Iterate through all queries that match the event. */
struct event_filter_match_iter *
/* Return context for the query that matched, or NULL when there are no more
matches. */
void event_filter_init(void);
void event_filter_deinit(void);
#endif