1 /*
2  * Copyright (c) 2002-2012 Balabit
3  * Copyright (c) 1998-2012 Balázs Scheidler
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  *
19  * As an additional exemption you are allowed to compile & link against the
20  * OpenSSL libraries as published by the OpenSSL project. See the file
21  * COPYING for details.
22  *
23  */
24 
25 #include "rewrite/rewrite-expr-parser.h"
26 #include "rewrite/rewrite-expr.h"
27 #include "rewrite/rewrite-expr-grammar.h"
28 
29 extern int rewrite_expr_debug;
30 int rewrite_expr_parse(CfgLexer *lexer, LogExprNode **node, gpointer arg);
31 
32 static CfgLexerKeyword rewrite_expr_keywords[] =
33 {
34   { "set",                KW_SET },
35   { "unset",              KW_UNSET },
36   { "subst",              KW_SUBST },
37   { "set_tag",            KW_SET_TAG },
38   { "clear_tag",          KW_CLEAR_TAG },
39   { "set_pri",            KW_SET_PRI },
40   { "set_severity",       KW_SET_SEVERITY },
41   { "set_facility",       KW_SET_FACILITY },
42 
43   { "groupset",           KW_GROUP_SET },
44   { "groupunset",         KW_GROUP_UNSET },
45   { "values",             KW_VALUES },
46 
47   { NULL }
48 };
49 
50 CfgParser rewrite_expr_parser =
51 {
52 #if SYSLOG_NG_ENABLE_DEBUG
53   .debug_flag = &rewrite_expr_debug,
54 #endif
55   .name = "rewrite expression",
56   .context = LL_CONTEXT_REWRITE,
57   .keywords = rewrite_expr_keywords,
58   .parse = (gint (*)(CfgLexer *, gpointer *, gpointer)) rewrite_expr_parse,
59 };
60 
61 CFG_PARSER_IMPLEMENT_LEXER_BINDING(rewrite_expr_, REWRITE_EXPR_, LogExprNode **)
62