summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-07-21 11:14:52 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-07-21 11:14:52 +0200
commit9ce9fbb28f7a7a1a0380cc272a90be077cd9c1bc (patch)
tree06c97ee3796a8d339c4dd0eeadd132b306474ed2
parent5820c5f3e8dc69bdee969d6487d084e884595069 (diff)
downloadrsyslog-9ce9fbb28f7a7a1a0380cc272a90be077cd9c1bc.tar.gz
rsyslog-9ce9fbb28f7a7a1a0380cc272a90be077cd9c1bc.tar.xz
rsyslog-9ce9fbb28f7a7a1a0380cc272a90be077cd9c1bc.zip
milestone: new output plugin interface call added
-rw-r--r--action.c6
-rw-r--r--runtime/glbl.c2
-rw-r--r--runtime/glbl.h1
-rw-r--r--runtime/module-template.h13
-rw-r--r--runtime/modules.c58
-rw-r--r--runtime/modules.h3
-rw-r--r--runtime/rsyslog.h1
-rw-r--r--tools/omfile.c2
-rw-r--r--tools/ompipe.c2
9 files changed, 65 insertions, 23 deletions
diff --git a/action.c b/action.c
index f24fee06..450b0691 100644
--- a/action.c
+++ b/action.c
@@ -1018,7 +1018,7 @@ tryDoAction(action_t *pAction, batch_t *pBatch, int *pnElem)
i = pBatch->iDoneUpTo; /* all messages below that index are processed */
iElemProcessed = 0;
iCommittedUpTo = i;
-dbgprintf("XXXXX: tryDoAction %p, pnElem %d, nElem %d\n", pAction, *pnElem, pBatch->nElem);
+ DBGPRINTF("tryDoAction %p, pnElem %d, nElem %d\n", pAction, *pnElem, pBatch->nElem);
while(iElemProcessed <= *pnElem && i < pBatch->nElem) {
if(*(pBatch->pbShutdownImmediate))
ABORT_FINALIZE(RS_RET_FORCE_TERM);
@@ -1940,6 +1940,8 @@ actionNewInst(struct nvlst *lst, action_t **ppAction)
struct cnfparamvals *paramvals;
modInfo_t *pMod;
uchar *cnfModName = NULL;
+ omodStringRequest_t *pOMSR;
+ void *pModData;
DEFiRet;
paramvals = nvlstGetParams(lst, &paramblk, NULL);
@@ -1958,6 +1960,8 @@ actionNewInst(struct nvlst *lst, action_t **ppAction)
ABORT_FINALIZE(RS_RET_MOD_UNKNOWN);
}
dbgprintf("XXXX:actionNewInst for module '%s'/%p\n", cnfModName, pMod);
+ CHKiRet(pMod->mod.om.newActInst(cnfModName, lst, &pModData, &pOMSR));
+dbgprintf("XXXX:actionNewInst CALLED module '%s'/%p\n", cnfModName, pMod);
finalize_it:
free(cnfModName);
RETiRet;
diff --git a/runtime/glbl.c b/runtime/glbl.c
index ccc39e45..5df0c329 100644
--- a/runtime/glbl.c
+++ b/runtime/glbl.c
@@ -460,7 +460,7 @@ glblCheckCnf()
}
void
-glblDoneLoadCnf()
+glblDoneLoadCnf(void)
{
int i;
unsigned char *cstr;
diff --git a/runtime/glbl.h b/runtime/glbl.h
index 94eec23d..262b2cc2 100644
--- a/runtime/glbl.h
+++ b/runtime/glbl.h
@@ -88,5 +88,6 @@ PROTOTYPEObj(glbl);
void glblPrepCnf(void);
void glblProcessCnf(struct cnfobj *o);
+void glblDoneLoadCnf(void);
#endif /* #ifndef GLBL_H_INCLUDED */
diff --git a/runtime/module-template.h b/runtime/module-template.h
index 2fa8e2e2..6238d0f4 100644
--- a/runtime/module-template.h
+++ b/runtime/module-template.h
@@ -321,10 +321,10 @@ finalize_it:\
* placed right after CODESTARTnewActInst.
*/
#define BEGINnewActInst \
-static rsRetVal newActInst(struct nvlst *lst, void **ppModData, omodStringRequest_t **ppOMSR)\
+static rsRetVal newActInst(uchar __attribute__((unused)) *modName, \
+ struct nvlst *lst, void **ppModData, omodStringRequest_t **ppOMSR)\
{\
DEFiRet;\
- uchar *p;\
instanceData *pData = NULL;
#define CODESTARTnewActInst \
@@ -537,6 +537,15 @@ static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)())\
} \
CODEqueryEtryPt_STD_CONF2_CNFNAME_QUERIES
+/* the following block is to be added for output modules that support the v2
+ * config system. The config name is also provided.
+ */
+#define CODEqueryEtryPt_STD_CONF2_OMOD_QUERIES \
+ else if(!strcmp((char*) name, "newActInst")) {\
+ *pEtryPoint = newActInst;\
+ } \
+ CODEqueryEtryPt_STD_CONF2_CNFNAME_QUERIES
+
/* the following block is to be added for modules that require
* pre priv drop activation support.
diff --git a/runtime/modules.c b/runtime/modules.c
index 59eaec34..f6b4bad9 100644
--- a/runtime/modules.c
+++ b/runtime/modules.c
@@ -90,18 +90,30 @@ static uchar *pModDir; /* directory where loadable modules are found */
* harm. This simplifies things as in action processing we do not need to check
* if the transactional entry points exist.
*/
-static rsRetVal dummyBeginTransaction()
+static rsRetVal
+dummyBeginTransaction()
{
return RS_RET_OK;
}
-static rsRetVal dummyEndTransaction()
+static rsRetVal
+dummyEndTransaction()
{
return RS_RET_OK;
}
-static rsRetVal dummyIsCompatibleWithFeature()
+static rsRetVal
+dummyIsCompatibleWithFeature()
{
return RS_RET_INCOMPATIBLE;
}
+static rsRetVal
+dummynewActInst(uchar *modName, struct nvlst __attribute__((unused)) *dummy1,
+ void __attribute__((unused)) **dummy2, omodStringRequest_t __attribute__((unused)) **dummy3)
+{
+ errmsg.LogError(0, RS_RET_CONFOBJ_UNSUPPORTED, "config objects are not "
+ "supported by module '%s' -- legacy config options "
+ "MUST be used instead", modName);
+ return RS_RET_CONFOBJ_UNSUPPORTED;
+}
#ifdef DEBUG
/* we add some home-grown support to track our users (and detect who does not free us). In
@@ -443,11 +455,14 @@ FindWithCnfName(rsconf_t *cnf, uchar *name, eModType_t rqtdType)
{
cfgmodules_etry_t *node;
- node = cnf->modules.root;
- while(node != NULL && node->pMod->eType != rqtdType) {
+ ;
+ for( node = cnf->modules.root
+ ; node != NULL
+ ; node = node->next) {
+ if(node->pMod->eType != rqtdType || node->pMod->cnfName == NULL)
+ continue;
if(!strcasecmp((char*)node->pMod->cnfName, (char*)name))
break;
- node = node->next;
}
return node == NULL ? NULL : node->pMod;
@@ -603,6 +618,13 @@ doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)(), modInfo_
} else if(localRet != RS_RET_OK) {
ABORT_FINALIZE(localRet);
}
+
+ localRet = (*pNew->modQueryEtryPt)((uchar*)"newActInst", &pNew->mod.om.newActInst);
+ if(localRet == RS_RET_MODULE_ENTRY_POINT_NOT_FOUND) {
+ pNew->mod.om.newActInst = dummynewActInst;
+ } else if(localRet != RS_RET_OK) {
+ ABORT_FINALIZE(localRet);
+ }
break;
case eMOD_LIB:
break;
@@ -749,18 +771,18 @@ static void modPrintList(void)
switch(pMod->eType) {
case eMOD_OUT:
dbgprintf("Output Module Entry Points:\n");
- dbgprintf("\tdoAction: 0x%lx\n", (unsigned long) pMod->mod.om.doAction);
- dbgprintf("\tparseSelectorAct: 0x%lx\n", (unsigned long) pMod->mod.om.parseSelectorAct);
- dbgprintf("\ttryResume: 0x%lx\n", (unsigned long) pMod->tryResume);
- dbgprintf("\tdoHUP: 0x%lx\n", (unsigned long) pMod->doHUP);
- dbgprintf("\tnewScope: 0x%lx\n", (unsigned long) pMod->mod.om.newScope);
- dbgprintf("\trestoreScope: 0x%lx\n", (unsigned long) pMod->mod.om.restoreScope);
- dbgprintf("\tBeginTransaction: 0x%lx\n", (unsigned long)
- ((pMod->mod.om.beginTransaction == dummyBeginTransaction) ?
- 0 : pMod->mod.om.beginTransaction));
- dbgprintf("\tEndTransaction: 0x%lx\n", (unsigned long)
- ((pMod->mod.om.endTransaction == dummyEndTransaction) ?
- 0 : pMod->mod.om.endTransaction));
+ dbgprintf("\tdoAction: %p\n", pMod->mod.om.doAction);
+ dbgprintf("\tparseSelectorAct: %p\n", pMod->mod.om.parseSelectorAct);
+ dbgprintf("\tnewActInst: %p\n", (pMod->mod.om.newActInst == dummynewActInst) ?
+ NULL : pMod->mod.om.newActInst);
+ dbgprintf("\ttryResume: %p\n", pMod->tryResume);
+ dbgprintf("\tdoHUP: %p\n", pMod->doHUP);
+ dbgprintf("\tnewScope: %p\n", pMod->mod.om.newScope);
+ dbgprintf("\trestoreScope: %p\n", pMod->mod.om.restoreScope);
+ dbgprintf("\tBeginTransaction: %p\n", ((pMod->mod.om.beginTransaction == dummyBeginTransaction) ?
+ NULL : pMod->mod.om.beginTransaction));
+ dbgprintf("\tEndTransaction: %p\n", ((pMod->mod.om.endTransaction == dummyEndTransaction) ?
+ NULL : pMod->mod.om.endTransaction));
break;
case eMOD_IN:
dbgprintf("Input Module Entry Points\n");
diff --git a/runtime/modules.h b/runtime/modules.h
index ebde1219..4956dd4a 100644
--- a/runtime/modules.h
+++ b/runtime/modules.h
@@ -36,7 +36,7 @@
#define MODULES_H_INCLUDED 1
#include "objomsr.h"
-
+#include "rainerscript.h"
/* the following define defines the current version of the module interface.
* It can be used by any module which want's to simply prevent version conflicts
@@ -140,6 +140,7 @@ struct modInfo_s {
rsRetVal (*parseSelectorAct)(uchar**, void**,omodStringRequest_t**);
rsRetVal (*newScope)(void);
rsRetVal (*restoreScope)(void);
+ rsRetVal (*newActInst)(uchar *modName, struct nvlst *lst, void **, omodStringRequest_t **);
} om;
struct { /* data for library modules */
char dummy;
diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h
index dc2f15be..dd770f26 100644
--- a/runtime/rsyslog.h
+++ b/runtime/rsyslog.h
@@ -363,6 +363,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_CONF_PARSE_ERROR = -2207,/**< (fatal) error parsing config file */
RS_RET_CONF_RQRD_PARAM_MISSING = -2208,/**< required parameter in config object is missing */
RS_RET_MOD_UNKNOWN = -2209,/**< module (config name) is unknown */
+ RS_RET_CONFOBJ_UNSUPPORTED = -2210,/**< config objects (v6 conf) are not supported here */
/* RainerScript error messages (range 1000.. 1999) */
RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */
diff --git a/tools/omfile.c b/tools/omfile.c
index 0735e48d..8d332ee9 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -714,6 +714,7 @@ ENDdoAction
BEGINnewActInst
CODESTARTnewActInst
// TODO: valid lst params
+ dbgprintf("XXXX: in newActInst (omfile)\n");
#if 0
CHKiRet(createInstance(&pData));
@@ -929,6 +930,7 @@ ENDmodExit
BEGINqueryEtryPt
CODESTARTqueryEtryPt
CODEqueryEtryPt_STD_OMOD_QUERIES
+CODEqueryEtryPt_STD_CONF2_OMOD_QUERIES
CODEqueryEtryPt_TXIF_OMOD_QUERIES /* we support the transactional interface! */
CODEqueryEtryPt_doHUP
CODEqueryEtryPt_STD_CONF2_CNFNAME_QUERIES
diff --git a/tools/ompipe.c b/tools/ompipe.c
index 5d9397e1..d5faffc8 100644
--- a/tools/ompipe.c
+++ b/tools/ompipe.c
@@ -58,6 +58,7 @@
MODULE_TYPE_OUTPUT
MODULE_TYPE_NOKEEP
+MODULE_CNFNAME("ompipe")
/* internal structures
*/
@@ -244,6 +245,7 @@ BEGINqueryEtryPt
CODESTARTqueryEtryPt
CODEqueryEtryPt_STD_OMOD_QUERIES
CODEqueryEtryPt_doHUP
+CODEqueryEtryPt_STD_CONF2_CNFNAME_QUERIES
ENDqueryEtryPt