From ab7b1b381a467d6a61760a5cb84ef804a74598f1 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 24 Aug 2012 15:08:12 +0200 Subject: add base plumbing for template() config object to grammar --- runtime/rsconf.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'runtime') diff --git a/runtime/rsconf.c b/runtime/rsconf.c index bd002353..f07ab314 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); } -- cgit From 1eac94e11dab1e7caead5e31a57d2cae31b5ad62 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sat, 25 Aug 2012 11:08:38 +0200 Subject: v6 config/templates: legacy types are now supported via template() --- runtime/rsconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/rsconf.c b/runtime/rsconf.c index f07ab314..cbc09c11 100644 --- a/runtime/rsconf.c +++ b/runtime/rsconf.c @@ -66,6 +66,7 @@ #include "parserif.h" #include "modules.h" #include "dirty.h" +#include "template.h" /* static data */ DEFobjStaticHelpers @@ -400,8 +401,7 @@ int bChkUnuse = 1; // TODO: Delete actionProcessCnf(o); break; case CNFOBJ_TPL: - //processTemplate(o); -bChkUnuse = 0; + tplProcessCnf(o); break; case CNFOBJ_PROPERTY: //processTemplate(o); -- cgit From 6258cb42fd407b9388de63c746634b4df03e78eb Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sat, 25 Aug 2012 13:30:53 +0200 Subject: milestone: base plumbing for LIST-type templates mostly in place --- runtime/rsconf.c | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime') diff --git a/runtime/rsconf.c b/runtime/rsconf.c index cbc09c11..9c6bf00e 100644 --- a/runtime/rsconf.c +++ b/runtime/rsconf.c @@ -404,6 +404,7 @@ int bChkUnuse = 1; // TODO: Delete tplProcessCnf(o); break; case CNFOBJ_PROPERTY: + case CNFOBJ_CONSTANT: //processTemplate(o); bChkUnuse = 0; break; -- cgit From 76e9968c0890cb4db068c953db6e6574b6c28da0 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sat, 25 Aug 2012 17:17:27 +0200 Subject: milestone: LIST-type templates work, but no all options yet present --- runtime/rsconf.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'runtime') diff --git a/runtime/rsconf.c b/runtime/rsconf.c index 9c6bf00e..5d2407ec 100644 --- a/runtime/rsconf.c +++ b/runtime/rsconf.c @@ -387,7 +387,8 @@ yyerror(char *s) } void cnfDoObj(struct cnfobj *o) { -int bChkUnuse = 1; // TODO: Delete + int bChkUnuse = 1; + dbgprintf("cnf:global:obj: "); cnfobjPrint(o); switch(o->objType) { @@ -405,12 +406,12 @@ int bChkUnuse = 1; // TODO: Delete break; case CNFOBJ_PROPERTY: case CNFOBJ_CONSTANT: - //processTemplate(o); -bChkUnuse = 0; + /* these types are processed at a later stage */ + bChkUnuse = 0; break; } -if(bChkUnuse) - nvlstChkUnused(o->nvlst); + if(bChkUnuse) + nvlstChkUnused(o->nvlst); cnfobjDestruct(o); } -- cgit From 3d56820f130e6c1b674560125e677be3b6a2d8f4 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sat, 25 Aug 2012 19:21:12 +0200 Subject: add capability to configure outname for constant (inside template) also some cleanup --- runtime/msg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/msg.c b/runtime/msg.c index da751dba..891907ec 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -2515,9 +2515,9 @@ jsonField(struct templateEntry *pTpe, uchar **ppRes, unsigned short *pbMustBeFre pSrc = *ppRes; buflen = (*pBufLen == -1) ? ustrlen(pSrc) : *pBufLen; /* we hope we have only few escapes... */ - dst = es_newStr(buflen+es_strlen(pTpe->data.field.fieldName)+15); + dst = es_newStr(buflen+es_strlen(pTpe->fieldName)+15); es_addChar(&dst, '"'); - es_addStr(&dst, pTpe->data.field.fieldName); + es_addStr(&dst, pTpe->fieldName); es_addBufConstcstr(&dst, "\"=\""); CHKiRet(jsonAddVal(pSrc, buflen, &dst)); es_addChar(&dst, '"'); -- cgit