summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2012-08-24 15:08:12 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2012-08-24 15:08:12 +0200
commitab7b1b381a467d6a61760a5cb84ef804a74598f1 (patch)
treedcc737c05f7665ccc09a37bf3d2066a2ab2e21ac
parent2f4292a81c2bf89b349f0e276c69616ac6e51164 (diff)
downloadrsyslog-ab7b1b381a467d6a61760a5cb84ef804a74598f1.zip
rsyslog-ab7b1b381a467d6a61760a5cb84ef804a74598f1.tar.gz
rsyslog-ab7b1b381a467d6a61760a5cb84ef804a74598f1.tar.xz
add base plumbing for template() config object to grammar
-rw-r--r--grammar/grammar.y14
-rw-r--r--grammar/lexer.l8
-rw-r--r--grammar/rainerscript.h3
-rw-r--r--runtime/rsconf.c10
4 files changed, 33 insertions, 2 deletions
diff --git a/grammar/grammar.y b/grammar/grammar.y
index 402b1a5..35afae3 100644
--- a/grammar/grammar.y
+++ b/grammar/grammar.y
@@ -63,6 +63,9 @@ extern int yyerror(char*);
%token ENDOBJ
%token <s> CFSYSLINE
%token BEGIN_ACTION
+%token BEGIN_PROPERTY
+%token BEGIN_CONSTANT
+%token BEGIN_TPL
%token STOP
%token <s> LEGACY_ACTION
%token <s> PRIFILT
@@ -89,7 +92,7 @@ extern int yyerror(char*);
%token CMP_STARTSWITHI
%type <nvlst> nv nvlst
-%type <obj> obj
+%type <obj> obj propconst
%type <actlst> actlst
%type <actlst> act
%type <s> cfsysline
@@ -128,6 +131,15 @@ conf: /* empty (to end recursion) */
| conf BSD_HOST_SELECTOR { cnfDoBSDHost($2); }
obj: BEGINOBJ nvlst ENDOBJ { $$ = cnfobjNew($1, $2); }
| BEGIN_ACTION nvlst ENDOBJ { $$ = cnfobjNew(CNFOBJ_ACTION, $2); }
+ | BEGIN_TPL nvlst ENDOBJ { $$ = cnfobjNew(CNFOBJ_TPL, $2); dbgprintf("processing template() without {}\n"); }
+ | BEGIN_TPL nvlst ENDOBJ '{' propconst '}'
+ { $$ = cnfobjNew(CNFOBJ_TPL, $2); dbgprintf("processing template() WITH {}\n"); }
+/* TODO: NOTE:
+ propconst is the NEXT step. It is just included as an experiment and needs
+ to be replaced.
+*/
+propconst: BEGIN_PROPERTY nvlst ENDOBJ { $$ = cnfobjNew(CNFOBJ_PROPERTY, $2);
+ dbgprintf("processed property()\n"); }
cfsysline: CFSYSLINE { $$ = $1; }
nvlst: { $$ = NULL; }
| nvlst nv { $2->next = $1; $$ = $2; }
diff --git a/grammar/lexer.l b/grammar/lexer.l
index e688ffc..c5e7bf7 100644
--- a/grammar/lexer.l
+++ b/grammar/lexer.l
@@ -9,7 +9,7 @@
* cases. So while we hope that cfsysline support can be dropped some time in
* the future, we will probably keep these useful constructs.
*
- * Copyright 2011 Rainer Gerhards and Adiscon GmbH.
+ * Copyright 2011-2012 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of the rsyslog runtime library.
*
@@ -151,6 +151,12 @@ int fileno(FILE *stream);
BEGIN INITIAL; }
"global"[ \n\t]*"(" { yylval.objType = CNFOBJ_GLOBAL;
BEGIN INOBJ; return BEGINOBJ; }
+"template"[ \n\t]*"(" { yylval.objType = CNFOBJ_TPL;
+ BEGIN INOBJ; return BEGIN_TPL; }
+"property"[ \n\t]*"(" { yylval.objType = CNFOBJ_PROPERTY;
+ BEGIN INOBJ; return BEGIN_PROPERTY; }
+"constant"[ \n\t]*"(" { yylval.objType = CNFOBJ_CONSTANT;
+ BEGIN INOBJ; return BEGIN_CONSTANT; }
"input"[ \n\t]*"(" { yylval.objType = CNFOBJ_INPUT;
BEGIN INOBJ; return BEGINOBJ; }
"module"[ \n\t]*"(" { yylval.objType = CNFOBJ_MODULE;
diff --git a/grammar/rainerscript.h b/grammar/rainerscript.h
index 5ff71be..83a253f 100644
--- a/grammar/rainerscript.h
+++ b/grammar/rainerscript.h
@@ -16,6 +16,9 @@ enum cnfobjType {
CNFOBJ_GLOBAL,
CNFOBJ_INPUT,
CNFOBJ_MODULE,
+ CNFOBJ_TPL,
+ CNFOBJ_PROPERTY,
+ CNFOBJ_CONSTANT,
CNFOBJ_INVALID = 0
};
diff --git a/runtime/rsconf.c b/runtime/rsconf.c
index bd00235..f07ab31 100644
--- a/runtime/rsconf.c
+++ b/runtime/rsconf.c
@@ -386,6 +386,7 @@ yyerror(char *s)
}
void cnfDoObj(struct cnfobj *o)
{
+int bChkUnuse = 1; // TODO: Delete
dbgprintf("cnf:global:obj: ");
cnfobjPrint(o);
switch(o->objType) {
@@ -398,7 +399,16 @@ void cnfDoObj(struct cnfobj *o)
case CNFOBJ_ACTION:
actionProcessCnf(o);
break;
+ case CNFOBJ_TPL:
+ //processTemplate(o);
+bChkUnuse = 0;
+ break;
+ case CNFOBJ_PROPERTY:
+ //processTemplate(o);
+bChkUnuse = 0;
+ break;
}
+if(bChkUnuse)
nvlstChkUnused(o->nvlst);
cnfobjDestruct(o);
}