X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=postlicyd%2Ffilter.h;h=c2c7a4f0a57614e0280f52ab56dff09f756fbb53;hb=81227d766b6cd49042c042ac18c66bd9ec661d47;hp=10effbc8d8026d76de2b21b2b8b26ca95f322f84;hpb=2ccc447e21a3e0836594c9c77162489f9f72be1e;p=apps%2Fpfixtools.git diff --git a/postlicyd/filter.h b/postlicyd/filter.h index 10effbc..c2c7a4f 100644 --- a/postlicyd/filter.h +++ b/postlicyd/filter.h @@ -43,6 +43,7 @@ #include "query.h" #include "array.h" + typedef filter_token filter_type_t; typedef hook_token filter_result_t; typedef param_token filter_param_id_t; @@ -51,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) @@ -81,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; @@ -119,6 +135,10 @@ typedef void (*filter_context_destructor_t)(void*); typedef void (*filter_async_handler_t)(filter_context_t *context, const filter_hook_t *result); +/** Number of filter currently running. + */ +extern uint32_t filter_running; + /* Registration. */ @@ -268,6 +288,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);