コード例 #1
0
ファイル: filter-op.c プロジェクト: gyula/syslog-ng-3.5
static void
fop_free(FilterExprNode *s)
{
  FilterOp *self = (FilterOp *) s;

  filter_expr_unref(self->left);
  filter_expr_unref(self->right);
}
コード例 #2
0
ファイル: test_tags.c プロジェクト: Achint08/syslog-ng
void
test_filters(gboolean not)
{
  LogMessage *msg = log_msg_new_empty();
  FilterExprNode *f = filter_tags_new(NULL);
  guint i;
  GList *l = NULL;

  test_msg("=== filter tests %s===\n", not ? "not " : "");

  for (i = 1; i < FILTER_TAGS; i += 3)
    l = g_list_prepend(l, get_tag_by_id(i));

  filter_tags_add(f, l);
  f->comp = not;

  for (i = 0; i < FILTER_TAGS; i++)
    {
      test_msg("Testing filter, message has tag %d\n", i);
      log_msg_set_tag_by_id(msg, i);

      if (((i % 3 == 1) ^ filter_expr_eval(f, msg)) ^ not)
        test_fail("Failed to match message by tag %d\n", i);

      test_msg("Testing filter, message no tag\n");
      log_msg_clear_tag_by_id(msg, i);
      if (filter_expr_eval(f, msg) ^ not)
        test_fail("Failed to match message with no tags\n");
    }

  filter_expr_unref(f);
  log_msg_unref(msg);
}
コード例 #3
0
ファイル: filter-pipe.c プロジェクト: gyula/syslog-ng-3.5
static void
log_filter_pipe_free(LogPipe *s)
{
  LogFilterPipe *self = (LogFilterPipe *) s;

  g_free(self->name);
  filter_expr_unref(self->expr);
  log_pipe_free_method(s);
}
コード例 #4
0
ファイル: cond-funcs.c プロジェクト: essodjolo/syslog-ng-3.4
static void
tf_cond_free_state(gpointer s)
{
  TFCondState *state = (TFCondState *) s;

  if (state->filter)
    filter_expr_unref(state->filter);
  tf_simple_func_free_state(&state->super);
}
コード例 #5
0
ファイル: filter-call.c プロジェクト: algernon/syslog-ng-old
static void
filter_call_free(FilterExprNode *s)
{
  FilterCall *self = (FilterCall *) s;

  filter_expr_unref(self->filter_expr);
  g_free((gchar *) self->super.type);
  g_free(self->rule);
}
コード例 #6
0
ファイル: patterndb.c プロジェクト: algernon/syslog-ng-old
void
pdb_action_free(PDBAction *self)
{
  if (self->condition)
    filter_expr_unref(self->condition);
  if (self->content_type == RAC_MESSAGE)
    pdb_message_clean(&self->content.message);
  g_free(self);
}
コード例 #7
0
void
log_rewrite_free_method(LogPipe *s)
{
  LogRewrite *self = (LogRewrite *) s;

  if (self->condition)
    filter_expr_unref(self->condition);
  g_free(self->name);
  log_pipe_free_method(s);
}
コード例 #8
0
ファイル: basic-funcs.c プロジェクト: eric/syslog-ng-3.3
void
tf_cond_free_state(TFCondState *args)
{
  gint i;

  if (args->filter)
    filter_expr_unref(args->filter);
  for (i = 0; i < args->argc; i++)
    {
      if (args->argv[i])
        log_template_unref(args->argv[i]);
    }
  g_free(args);
}
コード例 #9
0
gboolean
evaluate_testcase(const gchar *msg,
                  FilterExprNode *filter_node)
{
  LogMessage *log_msg;
  gboolean result;

  assert_not_null(filter_node, "Constructing an in-list filter");
  log_msg = log_msg_new(msg, strlen(msg), NULL, &parse_options);
  result = filter_expr_eval(filter_node, log_msg);

  log_msg_unref(log_msg);
  filter_expr_unref(filter_node);
  return result;
}