/* Copyright (c) 2017-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "llist.h"
#include "str.h"
#include "strescape.h"
#include "wildcard-match.h"
#include "lib-event-private.h"
#include "event-filter.h"
enum event_filter_code {
};
struct event_filter_category {
const char *name;
/* Pointer to the event_category. NULL if the category isn't
registered yet. If it becomes registered, this will be filled out
by the category register callback. */
};
struct event_filter_query_internal {
unsigned int categories_count;
unsigned int fields_count;
const char *name;
const char *source_filename;
unsigned int source_linenum;
void *context;
};
struct event_filter {
int refcount;
bool named_queries_only;
};
{
return filter;
}
{
}
{
return;
return;
}
static void
struct event_filter_query_internal *int_query,
const char *const *categories)
{
unsigned int i;
if (categories_count == 0)
return;
/* copy strings */
for (i = 0; i < categories_count; i++) {
}
}
static void
struct event_filter_query_internal *int_query,
const struct event_filter_field *fields)
{
unsigned int i, count;
if (count == 0)
return;
for (i = 0; i < count; i++) {
/* Filter currently supports only comparing strings
and numbers. */
/* not a number - no problem */
}
}
}
const struct event_filter_query *query)
{
else
}
const struct event_filter *src)
{
unsigned int i;
if (int_query->categories_count > 0) {
for (i = 0; i < int_query->categories_count; i++) {
}
}
if (int_query->fields_count > 0) {
for (i = 0; i < int_query->fields_count; i++) {
}
}
} T_END;
}
static void
{
unsigned int i;
}
}
for (i = 0; i < query->categories_count; i++) {
}
for (i = 0; i < query->fields_count; i++) {
}
}
{
if (!first)
}
}
const char **error_r)
{
return event_filter_import_unescaped(filter,
}
const char *const *args,
const char **error_r)
{
bool changed;
if (arg[0] == '\0') {
/* finish the query */
if (array_count(&categories) > 0) {
}
if (array_count(&fields) > 0) {
}
/* start the next query */
continue;
}
arg++;
switch (code) {
case EVENT_FILTER_CODE_NAME:
break;
case EVENT_FILTER_CODE_SOURCE:
i++;
*error_r = "Source line number missing";
return FALSE;
}
*error_r = "Invalid Source line number";
return FALSE;
}
break;
break;
case EVENT_FILTER_CODE_FIELD: {
i++;
*error_r = "Field value missing";
return FALSE;
}
break;
}
}
}
if (changed) {
*error_r = "Expected TAB at the end";
return FALSE;
}
return TRUE;
}
static bool
{
if (*catp == wanted_category)
return TRUE;
}
}
/* try also the parent events */
}
return FALSE;
}
static bool
{
if (query->has_unregistered_categories) {
/* At least one of the categories in the filter hasn't even
been registered yet. This filter can't match. */
return FALSE;
}
for (unsigned int i = 0; i < query->categories_count; i++) {
return FALSE;
}
return TRUE;
}
static bool
{
/* wanted_field has the value in all available formats */
return FALSE;
}
switch (field->value_type) {
/* there's no point to support matching exact timestamps */
return FALSE;
}
i_unreached();
}
static bool
{
for (unsigned int i = 0; i < query->fields_count; i++) {
return FALSE;
}
return TRUE;
}
static bool
unsigned int source_linenum)
{
return FALSE;
}
source_filename == NULL ||
return FALSE;
}
return FALSE;
return FALSE;
return TRUE;
}
static bool
{
/* No debug logging is enabled. Only named events may be wanted
for stats. This event doesn't have a name, so we don't need
to check any further. */
return FALSE;
}
return TRUE;
}
{
}
const char *source_filename,
unsigned int source_linenum)
{
return FALSE;
return TRUE;
}
return FALSE;
}
struct event_filter_match_iter {
unsigned int idx;
};
struct event_filter_match_iter *
{
return iter;
}
{
unsigned int count;
}
return NULL;
}
{
}
static void
struct event_category *category)
{
for (unsigned int i = 0; i < query->categories_count; i++) {
}
}
}
static void
struct event_category *category)
{
}
static void
struct event_category *category)
{
if (!query->has_unregistered_categories)
return;
for (unsigned int i = 0; i < query->categories_count; i++) {
continue;
else
}
}
static void
struct event_category *category)
{
}
{
if (!category->registered)
else
}
}
void event_filter_init(void)
{
}
void event_filter_deinit(void)
{
}