X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=postlicyd%2Ffilter.h;h=39c311966b4e5e74803bb343a255b3e904250c8e;hb=951c359eed1ce1d6894a3bf10855807f4c792978;hp=dcbaecbaba41c4c0dc581b091fdff220c5c5f53b;hpb=aecafec904f393ee0ab902272a947d8be5bec36f;p=apps%2Fpfixtools.git diff --git a/postlicyd/filter.h b/postlicyd/filter.h index dcbaecb..39c3119 100644 --- a/postlicyd/filter.h +++ b/postlicyd/filter.h @@ -52,9 +52,13 @@ typedef struct filter_hook_t { filter_result_t type; char *value; + int counter; + int cost; + unsigned postfix:1; unsigned async:1; int filter_id; + } filter_hook_t; ARRAY(filter_hook_t) @@ -82,13 +86,24 @@ typedef struct filter_t { } filter_t; ARRAY(filter_t) +#define MAX_COUNTERS (64) + /** Context of the query. To be filled with data to use when * performing asynchronous filtering. */ typedef struct filter_context_t { + /* filter context + */ const filter_t *current_filter; void *contexts[FTK_count]; + /* message context + */ + char instance[64]; + uint32_t counters[MAX_COUNTERS]; + + /* connection context + */ void *data; } filter_context_t; @@ -247,16 +262,18 @@ bool filter_test(const filter_t *filter, const query_t *query, } else if (param->value_len == 1 && param->value[0] == '0') { \ (Dest) = false; \ } else if (param->value_len == 4 \ - && ascii_tolower(param->value[0]) == 't') { \ - (Dest) = ascii_tolower(param->value[1]) == 'r' \ - && ascii_tolower(param->value[2]) == 'u' \ - && ascii_tolower(param->value[3]) == 'e'; \ + && ascii_tolower(param->value[0]) == 't' \ + && ascii_tolower(param->value[1]) == 'r' \ + && ascii_tolower(param->value[2]) == 'u' \ + && ascii_tolower(param->value[3]) == 'e') { \ + (Dest) = true; \ } else if (param->value_len == 5 \ - && ascii_tolower(param->value[0]) == 'f') { \ - (Dest) = ascii_tolower(param->value[1]) == 'a' \ - && ascii_tolower(param->value[2]) == 'l' \ - && ascii_tolower(param->value[3]) == 's' \ - && ascii_tolower(param->value[4]) == 'e'; \ + && ascii_tolower(param->value[0]) == 'f' \ + && ascii_tolower(param->value[1]) == 'a' \ + && ascii_tolower(param->value[2]) == 'l' \ + && ascii_tolower(param->value[3]) == 's' \ + && ascii_tolower(param->value[4]) == 'e') { \ + (Dest) = false; \ } else { \ PARSE_CHECK(false, "invalid %s value %.*s", atokens[ATK_ ## Param],\ param->value_len, param->value); \ @@ -273,6 +290,9 @@ void filter_context_prepare(filter_context_t *context, void* qctx); __attribute__((nonnull)) void filter_context_wipe(filter_context_t *context); +__attribute__((nonnull)) +void filter_context_clean(filter_context_t *context); + __attribute__((nonnull)) void filter_post_async_result(filter_context_t *context, filter_result_t result);