summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module-template.h14
-rw-r--r--modules.c13
-rw-r--r--modules.h8
-rw-r--r--omdiscard.c2
-rw-r--r--omfile.c2
-rw-r--r--omfwd.c2
-rw-r--r--omshell.c2
-rw-r--r--omusrmsg.c2
-rw-r--r--plugins/imfile/imfile.c17
-rw-r--r--plugins/imgssapi/imgssapi.c5
-rw-r--r--plugins/imklog/imklog.c2
-rw-r--r--plugins/immark/immark.c2
-rw-r--r--plugins/imtcp/imtcp.c4
-rw-r--r--plugins/imudp/imudp.c2
-rw-r--r--plugins/imuxsock/imuxsock.c2
-rw-r--r--plugins/omlibdbi/omlibdbi.c2
-rw-r--r--plugins/ommysql/ommysql.c2
-rw-r--r--plugins/ompgsql/ompgsql.c2
-rw-r--r--plugins/omsnmp/omsnmp.c2
-rw-r--r--plugins/omtesting/omtesting.c2
-rw-r--r--rsyslog.h2
21 files changed, 54 insertions, 37 deletions
diff --git a/module-template.h b/module-template.h
index efa07be9..458a837c 100644
--- a/module-template.h
+++ b/module-template.h
@@ -33,7 +33,9 @@
/* macro to define standard output-module static data members
*/
#define DEF_MOD_STATIC_DATA \
+ DEFobjCurrIf(obj) \
static rsRetVal (*omsdRegCFSLineHdlr)();
+
#define DEF_OMOD_STATIC_DATA \
DEF_MOD_STATIC_DATA
#define DEF_IMOD_STATIC_DATA \
@@ -374,14 +376,18 @@ static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)())\
#define BEGINmodInit(uniqName) \
rsRetVal modInit##uniqName(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)(), rsRetVal (*pHostQueryEtryPt)(uchar*, rsRetVal (**)()))\
{\
- DEFiRet;
+ DEFiRet; \
+ rsRetVal (*pObjGetObjInterface)(obj_if_t *pIf);
#define CODESTARTmodInit \
assert(pHostQueryEtryPt != NULL);\
- if((pQueryEtryPt == NULL) || (ipIFVersProvided == NULL)) {\
+ iRet = pHostQueryEtryPt((uchar*)"objGetObjInterface", &pObjGetObjInterface); \
+ if((iRet != RS_RET_OK) || (pQueryEtryPt == NULL) || (ipIFVersProvided == NULL) || (pObjGetObjInterface == NULL)) { \
ENDfunc \
- return RS_RET_PARAM_ERROR; \
- }
+ return (iRet == RS_RET_OK) ? RS_RET_PARAM_ERROR : iRet; \
+ } \
+ /* now get the obj interface so that we can access other objects */ \
+ CHKiRet(pObjGetObjInterface(&obj));
#define ENDmodInit \
finalize_it:\
diff --git a/modules.c b/modules.c
index acc65f65..09ffca1a 100644
--- a/modules.c
+++ b/modules.c
@@ -95,10 +95,14 @@ rsRetVal queryHostEtryPt(uchar *name, rsRetVal (**pEtryPoint)())
if(!strcmp((char*) name, "regCfSysLineHdlr")) {
*pEtryPoint = regCfSysLineHdlr;
+ } else if(!strcmp((char*) name, "objGetObjInterface")) {
+ *pEtryPoint = objGetObjInterface;
+ } else {
+ *pEtryPoint = NULL; /* to be on the safe side */
+ ABORT_FINALIZE(RS_RET_ENTRY_POINT_NOT_FOUND);
}
- if(iRet == RS_RET_OK)
- iRet = (*pEtryPoint == NULL) ? RS_RET_NOT_FOUND : RS_RET_OK;
+finalize_it:
RETiRet;
}
@@ -224,9 +228,10 @@ rsRetVal doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)())
ABORT_FINALIZE(iRet);
}
- CHKiRet((*modInit)(1, &pNew->iIFVers, &pNew->modQueryEtryPt, queryHostEtryPt));
+RUNLOG_VAR("%p", queryHostEtryPt);
+ CHKiRet((*modInit)(CURR_MOD_IF_VERSION, &pNew->iIFVers, &pNew->modQueryEtryPt, queryHostEtryPt));
- if(pNew->iIFVers != 1) {
+ if(pNew->iIFVers != CURR_MOD_IF_VERSION) {
ABORT_FINALIZE(RS_RET_MISSING_INTERFACE);
}
diff --git a/modules.h b/modules.h
index 5c1d5bc9..a2011b17 100644
--- a/modules.h
+++ b/modules.h
@@ -37,6 +37,14 @@
#include "objomsr.h"
#include "threads.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
+ * and does not intend to do specific old-version emulations.
+ * rgerhards, 2008-03-04
+ */
+#define CURR_MOD_IF_VERSION 2
+
typedef enum eModType_ {
eMOD_IN, /* input module */
eMOD_OUT, /* output module */
diff --git a/omdiscard.c b/omdiscard.c
index 0f99b5fd..51db9b8e 100644
--- a/omdiscard.c
+++ b/omdiscard.c
@@ -118,7 +118,7 @@ ENDqueryEtryPt
BEGINmodInit(Discard)
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
ENDmodInit
/*
diff --git a/omfile.c b/omfile.c
index 21569155..0139135f 100644
--- a/omfile.c
+++ b/omfile.c
@@ -813,7 +813,7 @@ ENDqueryEtryPt
BEGINmodInit(File)
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(omsdRegCFSLineHdlr((uchar *)"dynafilecachesize", 0, eCmdHdlrInt, (void*) setDynaFileCacheSize, NULL, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"dirowner", 0, eCmdHdlrUID, NULL, &dirUID, STD_LOADABLE_MODULE_ID));
diff --git a/omfwd.c b/omfwd.c
index 94fdfa04..654e4d86 100644
--- a/omfwd.c
+++ b/omfwd.c
@@ -616,7 +616,7 @@ ENDqueryEtryPt
BEGINmodInit(Fwd)
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
ENDmodInit
diff --git a/omshell.c b/omshell.c
index 932d5b94..5ce15569 100644
--- a/omshell.c
+++ b/omshell.c
@@ -140,7 +140,7 @@ ENDqueryEtryPt
BEGINmodInit(Shell)
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
ENDmodInit
diff --git a/omusrmsg.c b/omusrmsg.c
index 76e27f33..529366c4 100644
--- a/omusrmsg.c
+++ b/omusrmsg.c
@@ -338,7 +338,7 @@ ENDqueryEtryPt
BEGINmodInit(UsrMsg)
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
ENDmodInit
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
index ba09ea42..c13e96e9 100644
--- a/plugins/imfile/imfile.c
+++ b/plugins/imfile/imfile.c
@@ -136,7 +136,7 @@ openFile(fileInfo_t *pThis)
CHKiRet(strmConstructFinalize(psSF));
/* read back in the object */
- CHKiRet(objDeserialize(&pThis->pStrm, OBJstrm, psSF, NULL, pThis));
+ CHKiRet(objDeserialize(&pThis->pStrm, "strm", psSF, NULL, pThis));
CHKiRet(strmSeekCurrOffs(pThis->pStrm));
@@ -462,19 +462,20 @@ finalize_it:
*/
BEGINmodInit()
CODESTARTmodInit
- *ipIFVersProvided = 1; /* interface spec version this module is written to (currently always 1) */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfilename", 0, eCmdHdlrGetWord,
+
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfilename", 0, eCmdHdlrGetWord,
NULL, &pszFileName, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfiletag", 0, eCmdHdlrGetWord,
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfiletag", 0, eCmdHdlrGetWord,
NULL, &pszFileTag, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfilestatefile", 0, eCmdHdlrGetWord,
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfilestatefile", 0, eCmdHdlrGetWord,
NULL, &pszStateFile, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfileseverity", 0, eCmdHdlrSeverity,
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfileseverity", 0, eCmdHdlrSeverity,
NULL, &iSeverity, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfilefacility", 0, eCmdHdlrFacility,
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfilefacility", 0, eCmdHdlrFacility,
NULL, &iFacility, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfilepollinterval", 0, eCmdHdlrInt,
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfilepollinterval", 0, eCmdHdlrInt,
NULL, &iPollInterval, STD_LOADABLE_MODULE_ID));
/* that command ads a new file! */
CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputrunfilemonitor", 0, eCmdHdlrGetWord,
diff --git a/plugins/imgssapi/imgssapi.c b/plugins/imgssapi/imgssapi.c
index dccc9172..cd42c778 100644
--- a/plugins/imgssapi/imgssapi.c
+++ b/plugins/imgssapi/imgssapi.c
@@ -73,7 +73,6 @@ static rsRetVal OnSessAcceptGSS(tcpsrv_t *pThis, tcps_sess_t **ppSess, int fd);
/* static data */
DEF_IMOD_STATIC_DATA
-DEFobjCurrIf(obj)
DEFobjCurrIf(tcpsrv)
DEFobjCurrIf(tcps_sess)
@@ -711,17 +710,15 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
BEGINmodInit()
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current definition */
CODEmodInit_QueryRegCFSLineHdlr
pOurTcpsrv = NULL;
/* request objects we use */
-CHKiRet(objGetObjInterface(&obj)); /* get ourselves ;) */ // TODO: framework must do this
CHKiRet(objUse(tcps_sess, "tcps_sess"));
CHKiRet(objUse(tcpsrv, "tcpsrv"));
CHKiRet(objUse(tcpsrv, "tcpsrv"));
/* register config file handlers */
-dbgprintf("imgssapi starting up\n");
CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputgssserverpermitplaintcp", 0, eCmdHdlrBinary,
NULL, &bPermitPlainTcp, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputgssserverrun", 0, eCmdHdlrGetWord,
diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c
index 00794a8b..9b4581b2 100644
--- a/plugins/imklog/imklog.c
+++ b/plugins/imklog/imklog.c
@@ -673,7 +673,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
BEGINmodInit()
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(omsdRegCFSLineHdlr((uchar *)"debugprintkernelsymbols", 0, eCmdHdlrBinary, NULL, &dbgPrintSymbols, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"klogsymbollookup", 0, eCmdHdlrBinary, NULL, &symbol_lookup, STD_LOADABLE_MODULE_ID));
diff --git a/plugins/immark/immark.c b/plugins/immark/immark.c
index 4d59b642..7454ef92 100644
--- a/plugins/immark/immark.c
+++ b/plugins/immark/immark.c
@@ -126,7 +126,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
BEGINmodInit()
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(omsdRegCFSLineHdlr((uchar *)"markmessageperiod", 0, eCmdHdlrInt, NULL, &iMarkMessagePeriod, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
diff --git a/plugins/imtcp/imtcp.c b/plugins/imtcp/imtcp.c
index 9ef186b4..9ea0863c 100644
--- a/plugins/imtcp/imtcp.c
+++ b/plugins/imtcp/imtcp.c
@@ -49,7 +49,6 @@ MODULE_TYPE_INPUT
/* static data */
DEF_IMOD_STATIC_DATA
-DEFobjCurrIf(obj)
DEFobjCurrIf(tcpsrv)
DEFobjCurrIf(tcps_sess)
@@ -214,11 +213,10 @@ ENDqueryEtryPt
BEGINmodInit()
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
pOurTcpsrv = NULL;
/* request objects we use */
-CHKiRet(objGetObjInterface(&obj)); /* get ourselves ;) */ // TODO: framework must do this
CHKiRet(objUse(tcps_sess, "tcps_sess"));
CHKiRet(objUse(tcpsrv, "tcpsrv"));
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index a1262438..edb8f4c1 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -283,7 +283,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
BEGINmodInit()
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
/* register config file handlers */
CHKiRet(omsdRegCFSLineHdlr((uchar *)"udpserverrun", 0, eCmdHdlrGetWord,
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index 819057df..227cf6aa 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -311,7 +311,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
BEGINmodInit()
int i;
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
/* initialize funixn[] array */
for(i = 1 ; i < MAXFUNIX ; ++i) {
diff --git a/plugins/omlibdbi/omlibdbi.c b/plugins/omlibdbi/omlibdbi.c
index 610d106e..557e2284 100644
--- a/plugins/omlibdbi/omlibdbi.c
+++ b/plugins/omlibdbi/omlibdbi.c
@@ -359,7 +359,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
BEGINmodInit()
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionlibdbidriverdirectory", 0, eCmdHdlrGetWord, NULL, &dbiDrvrDir, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionlibdbidriver", 0, eCmdHdlrGetWord, NULL, &drvrName, STD_LOADABLE_MODULE_ID));
diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c
index eb135edd..e9c0b043 100644
--- a/plugins/ommysql/ommysql.c
+++ b/plugins/ommysql/ommysql.c
@@ -296,7 +296,7 @@ ENDqueryEtryPt
BEGINmodInit()
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
ENDmodInit
/*
diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c
index 1a0fba29..abe5ff13 100644
--- a/plugins/ompgsql/ompgsql.c
+++ b/plugins/ompgsql/ompgsql.c
@@ -289,7 +289,7 @@ ENDqueryEtryPt
BEGINmodInit()
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
ENDmodInit
/*
diff --git a/plugins/omsnmp/omsnmp.c b/plugins/omsnmp/omsnmp.c
index 948ae552..bc9e30ca 100644
--- a/plugins/omsnmp/omsnmp.c
+++ b/plugins/omsnmp/omsnmp.c
@@ -480,7 +480,7 @@ ENDqueryEtryPt
BEGINmodInit()
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionsnmptransport", 0, eCmdHdlrGetWord, NULL, &pszTransport, STD_LOADABLE_MODULE_ID));
diff --git a/plugins/omtesting/omtesting.c b/plugins/omtesting/omtesting.c
index 3781eb76..11ef8381 100644
--- a/plugins/omtesting/omtesting.c
+++ b/plugins/omtesting/omtesting.c
@@ -180,7 +180,7 @@ ENDqueryEtryPt
BEGINmodInit()
CODESTARTmodInit
- *ipIFVersProvided = 1; /* so far, we only support the initial definition */
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
ENDmodInit
/*
diff --git a/rsyslog.h b/rsyslog.h
index 41da5e4f..3fa5c52d 100644
--- a/rsyslog.h
+++ b/rsyslog.h
@@ -71,6 +71,8 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_OBJ_CREATION_FAILED = - 3008, /**< the creation of an object failed (no details available) */
RS_RET_PARAM_ERROR = -1000, /**< invalid parameter in call to function */
RS_RET_MISSING_INTERFACE = -1001,/**< interface version mismatch, required missing */
+ RS_RET_INVALID_CORE_INTERFACE = -1002,/**< interface provided by host invalid, can not be used */
+ RS_RET_ENTRY_POINT_NOT_FOUND = -1003,/**< a requested entry point was not found */
/* return states for config file processing */
RS_RET_NONE = -2000, /**< some value is not available - not necessarily an error */
RS_RET_CONFLINE_UNPROCESSED = -2001,/**< config line was not processed, pass to other module */