summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module-template.h15
-rw-r--r--modules.c31
-rw-r--r--omdiscard.c3
-rw-r--r--omdiscard.h2
-rw-r--r--omfile.c3
-rw-r--r--omfile.h2
-rw-r--r--omfwd.c3
-rw-r--r--omfwd.h2
-rw-r--r--ommysql.c3
-rw-r--r--ommysql.h2
-rw-r--r--omshell.c3
-rw-r--r--omshell.h2
-rw-r--r--omusrmsg.c3
-rw-r--r--omusrmsg.h2
14 files changed, 66 insertions, 10 deletions
diff --git a/module-template.h b/module-template.h
index a8de8263..9cad16ff 100644
--- a/module-template.h
+++ b/module-template.h
@@ -27,6 +27,11 @@
#include "objomsr.h"
+/* macro to define standard output-module static data members
+ */
+#define DEF_OMOD_STATIC_DATA \
+ static rsRetVal (*omsdRegCFSLineHdlr)();
+
/* to following macros are used to generate function headers and standard
* functionality. It works as follows (described on the sample case of
* createInstance()):
@@ -248,7 +253,7 @@ static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)())\
return iRet;\
}
-/* the following defintion is the standard block for queryEtryPt for output
+/* the following definition is the standard block for queryEtryPt for output
* modules. This can be used if no specific handling (e.g. to cover version
* differences) is needed.
*/
@@ -287,19 +292,25 @@ static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)())\
* decide to provide.
*/
#define BEGINmodInit(uniqName) \
-rsRetVal modInit##uniqName(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)())\
+rsRetVal modInit##uniqName(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)(), rsRetVal (*pHostQueryEtryPt)(uchar*, rsRetVal (**)()))\
{\
DEFiRet;
#define CODESTARTmodInit \
+ assert(pHostQueryEtryPt != NULL);\
if((pQueryEtryPt == NULL) || (ipIFVersProvided == NULL))\
return RS_RET_PARAM_ERROR;
#define ENDmodInit \
+finalize_it:\
*pQueryEtryPt = queryEtryPt;\
return iRet;\
}
+/* definitions for host API queries */
+#define CODEmodInit_QueryRegCFSLineHdlr \
+ CHKiRet(pHostQueryEtryPt((uchar*)"regCfSysLineHdlr", &omsdRegCFSLineHdlr));
+
#endif /* #ifndef MODULE_TEMPLATE_H_INCLUDED */
/*
* vi:set ai:
diff --git a/modules.c b/modules.c
index ec18d4cb..7bbdf47a 100644
--- a/modules.c
+++ b/modules.c
@@ -69,6 +69,31 @@ static void moduleDestruct(modInfo_t *pThis)
}
+/* The followind function is the queryEntryPoint for host-based entry points.
+ * Modules may call it to get access to core interface functions. Please note
+ * that utility functions can be accessed via shared libraries - at least this
+ * is my current shool of thinking.
+ * Please note that the implementation as a query interface allows to take
+ * care of plug-in interface version differences. -- rgerhards, 2007-07-31
+ */
+rsRetVal queryHostEtryPt(uchar *name, rsRetVal (**pEtryPoint)())
+{
+ DEFiRet;
+
+ if((name == NULL) || (pEtryPoint == NULL))
+ return RS_RET_PARAM_ERROR;
+
+ if(!strcmp((char*) name, "regCfSysLineHdlr")) {
+ //*pEtryPoint = regCfSysLineHdlr;
+ *pEtryPoint = queryHostEtryPt;
+ }
+
+ if(iRet == RS_RET_OK)
+ iRet = (*pEtryPoint == NULL) ? RS_RET_NOT_FOUND : RS_RET_OK;
+ return iRet;
+}
+
+
/* get the state-name of a module. The state name is its name
* together with a short description of the module state (which
* is pulled from the module itself.
@@ -139,7 +164,7 @@ modInfo_t *omodGetNxt(modInfo_t *pThis)
/* Add an already-loaded module to the module linked list. This function does
* anything that is needed to fully initialize the module.
*/
-rsRetVal doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)()), uchar *name)
+rsRetVal doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)()), uchar *name)
{
modInfo_t *pNew;
rsRetVal iRet;
@@ -149,7 +174,7 @@ rsRetVal doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)()), uchar *name)
if((iRet = moduleConstruct(&pNew)) != RS_RET_OK)
return iRet;
- if((iRet = (*modInit)(1, &pNew->iIFVers, &pNew->modQueryEtryPt)) != RS_RET_OK) {
+ if((iRet = (*modInit)(1, &pNew->iIFVers, &pNew->modQueryEtryPt, queryHostEtryPt)) != RS_RET_OK) {
moduleDestruct(pNew);
return iRet;
}
@@ -241,6 +266,8 @@ void modPrintList(void)
pMod = modGetNxt(pMod); /* done, go next */
}
}
+
+
/*
* vi:set ai:
*/
diff --git a/omdiscard.c b/omdiscard.c
index 3a29d2d3..3b4d4a73 100644
--- a/omdiscard.c
+++ b/omdiscard.c
@@ -38,6 +38,8 @@
/* internal structures
*/
+DEF_OMOD_STATIC_DATA
+
typedef struct _instanceData {
} instanceData;
@@ -113,6 +115,7 @@ ENDqueryEtryPt
BEGINmodInit(Discard)
CODESTARTmodInit
*ipIFVersProvided = 1; /* so far, we only support the initial definition */
+CODEmodInit_QueryRegCFSLineHdlr
ENDmodInit
/*
* vi:set ai:
diff --git a/omdiscard.h b/omdiscard.h
index 6a7d150f..113845f2 100644
--- a/omdiscard.h
+++ b/omdiscard.h
@@ -25,7 +25,7 @@
#define OMDISCARD_H_INCLUDED 1
/* prototypes */
-rsRetVal modInitDiscard(int iIFVersRequested, int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)());
+rsRetVal modInitDiscard(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)(), rsRetVal (*pHostQueryEtryPt)(uchar*, rsRetVal (**)()));
#endif /* #ifndef OMDISCARD_H_INCLUDED */
/*
diff --git a/omfile.c b/omfile.c
index 618e9b98..a5b7d6b2 100644
--- a/omfile.c
+++ b/omfile.c
@@ -53,6 +53,8 @@
/* internal structures
*/
+DEF_OMOD_STATIC_DATA
+
typedef struct _instanceData {
char f_fname[MAXFNAME];/* file or template name (display only) */
short fd; /* file descriptor for (current) file */
@@ -713,6 +715,7 @@ ENDqueryEtryPt
BEGINmodInit(File)
CODESTARTmodInit
*ipIFVersProvided = 1; /* so far, we only support the initial definition */
+CODEmodInit_QueryRegCFSLineHdlr
ENDmodInit
/*
diff --git a/omfile.h b/omfile.h
index 47aa17b7..2f02d9cc 100644
--- a/omfile.h
+++ b/omfile.h
@@ -25,7 +25,7 @@
#define OMFILE_H_INCLUDED 1
/* prototypes */
-rsRetVal modInitFile(int iIFVersRequested, int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)());
+rsRetVal modInitFile(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)(), rsRetVal (*pHostQueryEtryPt)(uchar*, rsRetVal (**)()));
#endif /* #ifndef OMFILE_H_INCLUDED */
/*
diff --git a/omfwd.c b/omfwd.c
index d52fcf3d..0a7fa0c8 100644
--- a/omfwd.c
+++ b/omfwd.c
@@ -71,6 +71,8 @@ static const char *sys_h_errlist[] = {
/* internal structures
*/
+DEF_OMOD_STATIC_DATA
+
typedef struct _instanceData {
char f_hname[MAXHOSTNAMELEN+1];
short sock; /* file descriptor */
@@ -922,6 +924,7 @@ ENDqueryEtryPt
BEGINmodInit(Fwd)
CODESTARTmodInit
*ipIFVersProvided = 1; /* so far, we only support the initial definition */
+CODEmodInit_QueryRegCFSLineHdlr
ENDmodInit
#endif /* #ifdef SYSLOG_INET */
diff --git a/omfwd.h b/omfwd.h
index 66f7d224..b2ea5cc3 100644
--- a/omfwd.h
+++ b/omfwd.h
@@ -25,7 +25,7 @@
#define OMFWD_H_INCLUDED 1
/* prototypes */
-rsRetVal modInitFwd(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)());
+rsRetVal modInitFwd(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)(), rsRetVal (*pHostQueryEtryPt)(uchar*, rsRetVal (**)()));
#endif /* #ifndef OMFWD_H_INCLUDED */
/*
diff --git a/ommysql.c b/ommysql.c
index 529597f1..7f340026 100644
--- a/ommysql.c
+++ b/ommysql.c
@@ -50,6 +50,8 @@
/* internal structures
*/
+DEF_OMOD_STATIC_DATA
+
typedef struct _instanceData {
MYSQL *f_hmysql; /* handle to MySQL */
char f_dbsrv[MAXHOSTNAMELEN+1]; /* IP or hostname of DB server*/
@@ -414,6 +416,7 @@ ENDqueryEtryPt
BEGINmodInit(MySQL)
CODESTARTmodInit
*ipIFVersProvided = 1; /* so far, we only support the initial definition */
+CODEmodInit_QueryRegCFSLineHdlr
ENDmodInit
#endif /* #ifdef WITH_DB */
diff --git a/ommysql.h b/ommysql.h
index e079778e..3162a7cd 100644
--- a/ommysql.h
+++ b/ommysql.h
@@ -29,7 +29,7 @@
/* prototypes will be removed as syslogd needs no longer to directly
* call into the module!
*/
-rsRetVal modInitMySQL(int iIFVersRequested, int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)());
+rsRetVal modInitMySQL(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)(), rsRetVal (*pHostQueryEtryPt)(uchar*, rsRetVal (**)()));
#endif /* #ifdef WITH_DB */
#endif /* #ifndef OMMYSQL_H_INCLUDED */
diff --git a/omshell.c b/omshell.c
index 7aa66331..961078d4 100644
--- a/omshell.c
+++ b/omshell.c
@@ -45,6 +45,8 @@
/* internal structures
*/
+DEF_OMOD_STATIC_DATA
+
typedef struct _instanceData {
uchar progName[MAXFNAME]; /* program to execute */
} instanceData;
@@ -136,6 +138,7 @@ ENDqueryEtryPt
BEGINmodInit(Shell)
CODESTARTmodInit
*ipIFVersProvided = 1; /* so far, we only support the initial definition */
+CODEmodInit_QueryRegCFSLineHdlr
ENDmodInit
/*
diff --git a/omshell.h b/omshell.h
index d62f7373..8ae2ef0c 100644
--- a/omshell.h
+++ b/omshell.h
@@ -25,7 +25,7 @@
#define ACTSHELL_H_INCLUDED 1
/* prototypes */
-rsRetVal modInitShell(int iIFVersRequested, int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)());
+rsRetVal modInitShell(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)(), rsRetVal (*pHostQueryEtryPt)(uchar*, rsRetVal (**)()));
#endif /* #ifndef ACTSHELL_H_INCLUDED */
/*
diff --git a/omusrmsg.c b/omusrmsg.c
index 7d5c705e..8ee2f770 100644
--- a/omusrmsg.c
+++ b/omusrmsg.c
@@ -57,6 +57,8 @@
/* internal structures
*/
+DEF_OMOD_STATIC_DATA
+
typedef struct _instanceData {
int bIsWall; /* 1- is wall, 0 - individual users */
char uname[MAXUNAMES][UNAMESZ+1];
@@ -319,6 +321,7 @@ ENDqueryEtryPt
BEGINmodInit(UsrMsg)
CODESTARTmodInit
*ipIFVersProvided = 1; /* so far, we only support the initial definition */
+CODEmodInit_QueryRegCFSLineHdlr
ENDmodInit
/*
diff --git a/omusrmsg.h b/omusrmsg.h
index 177b83d3..1498d945 100644
--- a/omusrmsg.h
+++ b/omusrmsg.h
@@ -25,7 +25,7 @@
#define OMUSRMSG_H_INCLUDED 1
/* prototypes */
-rsRetVal modInitUsrMsg(int iIFVersRequested, int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)());
+rsRetVal modInitUsrMsg(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)(), rsRetVal (*pHostQueryEtryPt)(uchar*, rsRetVal (**)()));
rsRetVal parseSelectorActUsrMsg(uchar **pp, selector_t *f);
#endif /* #ifndef OMUSRMSG_H_INCLUDED */