~ubuntu-branches/ubuntu/maverick/syslog-ng/maverick

« back to all changes in this revision

Viewing changes to src/filter.h

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2010-03-14 12:57:49 UTC
  • mfrom: (1.3.1 upstream) (12.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20100314125749-m3ats648sp2urg0f
Tags: 3.0.5-1
New upstream release, new maintainer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 2002-2007 BalaBit IT Ltd, Budapest, Hungary                    
 
2
 * Copyright (c) 2002-2009 BalaBit IT Ltd, Budapest, Hungary
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify it
5
5
 * under the terms of the GNU General Public License version 2 as published
20
20
 * along with this program; if not, write to the Free Software
21
21
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
22
 */
23
 
 
 
23
  
24
24
#ifndef FILTER_H_INCLUDED
25
25
#define FILTER_H_INCLUDED
26
26
 
27
27
#include "syslog-ng.h"
28
28
#include "logmsg.h"
29
29
#include "messages.h"
 
30
#include "logprocess.h"
 
31
#include "logmatcher.h"
30
32
 
31
 
struct _LogFilterRule;
32
33
struct _GlobalConfig;
33
34
 
34
35
typedef struct _FilterExprNode
35
36
{
36
37
  gboolean comp;
 
38
  /* this filter changes the log message */
 
39
  gboolean modify;
37
40
  const gchar *type;
38
41
  gboolean (*eval)(struct _FilterExprNode *self, LogMessage *msg);
39
42
  void (*free_fn)(struct _FilterExprNode *self);
42
45
gboolean filter_expr_eval(FilterExprNode *self, LogMessage *msg);
43
46
void filter_expr_free(FilterExprNode *self);
44
47
 
 
48
typedef struct _FilterRE
 
49
{
 
50
  FilterExprNode super;
 
51
  const gchar *value_name;
 
52
  LogMatcher *matcher;
 
53
} FilterRE;
 
54
 
 
55
void filter_re_set_matcher(FilterRE *self, LogMatcher *matcher);
 
56
gboolean filter_re_set_regexp(FilterRE *self, gchar *re);
 
57
void filter_re_set_flags(FilterRE *self, gint flags);
 
58
 
45
59
/* various constructors */
46
60
 
47
61
FilterExprNode *fop_or_new(FilterExprNode *e1, FilterExprNode *e2);
49
63
 
50
64
FilterExprNode *filter_facility_new(guint32 facilities);
51
65
FilterExprNode *filter_level_new(guint32 levels);
52
 
FilterExprNode *filter_prog_new(gchar *prog);
53
 
FilterExprNode *filter_host_new(gchar *host);
54
 
FilterExprNode *filter_match_new(gchar *re);
55
66
FilterExprNode *filter_call_new(gchar *rule, struct _GlobalConfig *cfg);
56
67
FilterExprNode *filter_netmask_new(gchar *cidr);
57
 
FilterExprNode *filter_strip_new(const gchar *re);
58
 
FilterExprNode *filter_replace_new(const gchar *re, const gchar *replacement);
59
 
 
60
 
typedef struct _LogFilterRule
61
 
{
62
 
  gint ref_cnt;
63
 
  GString *name;
64
 
  FilterExprNode *root;
65
 
} LogFilterRule;
66
 
 
67
 
 
68
 
gboolean log_filter_rule_eval(LogFilterRule *self, LogMessage *msg);
69
 
 
70
 
LogFilterRule *log_filter_rule_new(gchar *name, struct _FilterExprNode *expr);
71
 
LogFilterRule *log_filter_ref(LogFilterRule *self);
72
 
void log_filter_unref(LogFilterRule *self);
 
68
FilterExprNode *filter_re_new(const gchar *value_name);
 
69
FilterExprNode *filter_match_new(void);
 
70
 
 
71
LogProcessRule *log_filter_rule_new(const gchar *name, FilterExprNode *expr);
73
72
 
74
73
#endif