summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--grammar/lexer.l2
-rw-r--r--grammar/rainerscript.h4
-rw-r--r--runtime/lookup.c37
-rw-r--r--runtime/lookup.h5
-rw-r--r--runtime/rsconf.c5
-rw-r--r--runtime/rsyslog.c2
6 files changed, 50 insertions, 5 deletions
diff --git a/grammar/lexer.l b/grammar/lexer.l
index 237eb2a6..9678a8f0 100644
--- a/grammar/lexer.l
+++ b/grammar/lexer.l
@@ -188,6 +188,8 @@ int fileno(FILE *stream);
BEGIN INOBJ; return BEGINOBJ; }
"module"[ \n\t]*"(" { yylval.objType = CNFOBJ_MODULE;
BEGIN INOBJ; return BEGINOBJ; }
+"lookup_table"[ \n\t]*"(" { yylval.objType = CNFOBJ_LOOKUP_TABLE;
+ BEGIN INOBJ; return BEGINOBJ; }
"action"[ \n\t]*"(" { BEGIN INOBJ; return BEGIN_ACTION; }
^[ \t]*:\$?[a-z\-]+[ ]*,[ ]*!?[a-z]+[ ]*,[ ]*\"(\\\"|[^\"])*\" {
yylval.s = strdup(rmLeadingSpace(yytext));
diff --git a/grammar/rainerscript.h b/grammar/rainerscript.h
index 31b2eb93..cb8c968f 100644
--- a/grammar/rainerscript.h
+++ b/grammar/rainerscript.h
@@ -24,6 +24,7 @@ enum cnfobjType {
CNFOBJ_TPL,
CNFOBJ_PROPERTY,
CNFOBJ_CONSTANT,
+ CNFOBJ_LOOKUP_TABLE,
CNFOBJ_INVALID = 0
};
@@ -55,6 +56,9 @@ cnfobjType2str(enum cnfobjType ot)
case CNFOBJ_CONSTANT:
return "constant";
break;
+ case CNFOBJ_LOOKUP_TABLE:
+ return "lookup_table";
+ break;
default:return "error: invalid cnfobjType";
}
}
diff --git a/runtime/lookup.c b/runtime/lookup.c
index 167370f3..7cb27b07 100644
--- a/runtime/lookup.c
+++ b/runtime/lookup.c
@@ -37,6 +37,16 @@ DEFobjCurrIf(errmsg)
DEFobjCurrIf(glbl)
/* static data */
+/* tables for interfacing with the v6 config system (as far as we need to) */
+static struct cnfparamdescr modpdescr[] = {
+ { "name", eCmdHdlrString, CNFPARAM_REQUIRED },
+ { "file", eCmdHdlrString, CNFPARAM_REQUIRED }
+};
+static struct cnfparamblk modpblk =
+ { CNFPARAMBLK_VERSION,
+ sizeof(modpdescr)/sizeof(struct cnfparamdescr),
+ modpdescr
+ };
rsRetVal
lookupNew(lookup_t **ppThis, char *modname, char *dynname)
@@ -56,15 +66,38 @@ lookupDestruct(lookup_t *lookup)
free(lookup);
}
+rsRetVal
+lookupProcessCnf(struct cnfobj *o)
+{
+ struct cnfparamvals *pvals;
+ uchar *cnfModName = NULL;
+ int typeIdx;
+ DEFiRet;
+
+ pvals = nvlstGetParams(o->nvlst, &modpblk, NULL);
+ if(pvals == NULL) {
+ ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS);
+ }
+ DBGPRINTF("lookupProcessCnf params:\n");
+ cnfparamsPrint(&modpblk, pvals);
+
+ // TODO: add code
+
+finalize_it:
+ free(cnfModName);
+ cnfparamvalsDestruct(pvals, &modpblk);
+ RETiRet;
+}
+
void
-lookupModExit(void)
+lookupClassExit(void)
{
objRelease(glbl, CORE_COMPONENT);
objRelease(errmsg, CORE_COMPONENT);
}
rsRetVal
-lookupModInit(void)
+lookupClassInit(void)
{
DEFiRet;
CHKiRet(objGetObjInterface(&obj));
diff --git a/runtime/lookup.h b/runtime/lookup.h
index 5eecf215..d7f38118 100644
--- a/runtime/lookup.h
+++ b/runtime/lookup.h
@@ -26,8 +26,9 @@ struct lookup_s {
/* prototypes */
rsRetVal lookupNew(lookup_t **ppThis, char *modname, char *dynname);
+rsRetVal lookupProcessCnf(struct cnfobj *o);
void lookupDestruct(lookup_t *pThis);
-rsRetVal lookupModInit(void);
-void lookupModExit(void);
+void lookupClassExit(void);
+rsRetVal lookupClassInit(void);
#endif /* #ifndef INCLUDED_LOOKUP_H */
diff --git a/runtime/rsconf.c b/runtime/rsconf.c
index d8b81f1b..e0b7d5eb 100644
--- a/runtime/rsconf.c
+++ b/runtime/rsconf.c
@@ -2,7 +2,7 @@
*
* Module begun 2011-04-19 by Rainer Gerhards
*
- * Copyright 2011-2012 Adiscon GmbH.
+ * Copyright 2011-2013 Adiscon GmbH.
*
* This file is part of the rsyslog runtime library.
*
@@ -413,6 +413,9 @@ void cnfDoObj(struct cnfobj *o)
case CNFOBJ_INPUT:
inputProcessCnf(o);
break;
+ case CNFOBJ_LOOKUP_TABLE:
+ lookupProcessCnf(o);
+ break;
case CNFOBJ_TPL:
if(tplProcessCnf(o) != RS_RET_OK)
parser_errmsg("error processing template object");
diff --git a/runtime/rsyslog.c b/runtime/rsyslog.c
index 047dfa9b..f9c52bb9 100644
--- a/runtime/rsyslog.c
+++ b/runtime/rsyslog.c
@@ -186,6 +186,8 @@ rsrtInit(char **ppErrObj, obj_if_t *pObjIF)
CHKiRet(strgenClassInit(NULL));
if(ppErrObj != NULL) *ppErrObj = "rsconf";
CHKiRet(rsconfClassInit(NULL));
+ if(ppErrObj != NULL) *ppErrObj = "lookup";
+ CHKiRet(lookupClassInit(NULL));
/* dummy "classes" */
if(ppErrObj != NULL) *ppErrObj = "str";