summaryrefslogtreecommitdiffstats
path: root/plugins/imrelp
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-03-17 16:30:38 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-03-17 16:30:38 +0000
commit41fe6b8c538dbafc2bc4a50acb8a1d47fa42c4ce (patch)
tree3a45c61295f427cf758a13fefb988da860789895 /plugins/imrelp
parentbfb9a77d69ab776f0116e0caf2c221269466d846 (diff)
downloadrsyslog-41fe6b8c538dbafc2bc4a50acb8a1d47fa42c4ce.tar.gz
rsyslog-41fe6b8c538dbafc2bc4a50acb8a1d47fa42c4ce.tar.xz
rsyslog-41fe6b8c538dbafc2bc4a50acb8a1d47fa42c4ce.zip
done a bit to support librelp testing
Diffstat (limited to 'plugins/imrelp')
-rw-r--r--plugins/imrelp/imrelp.c45
1 files changed, 20 insertions, 25 deletions
diff --git a/plugins/imrelp/imrelp.c b/plugins/imrelp/imrelp.c
index cabc368f..d3a76b29 100644
--- a/plugins/imrelp/imrelp.c
+++ b/plugins/imrelp/imrelp.c
@@ -36,28 +36,28 @@
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <relp.h>
#include "rsyslog.h"
#include "syslogd.h"
#include "cfsysline.h"
#include "module-template.h"
#include "net.h"
-#include "tcpsrv.h"
MODULE_TYPE_INPUT
/* static data */
DEF_IMOD_STATIC_DATA
-DEFobjCurrIf(tcpsrv)
-DEFobjCurrIf(tcps_sess)
DEFobjCurrIf(net)
/* Module static data */
-static tcpsrv_t *pOurTcpsrv = NULL; /* our TCP server(listener) TODO: change for multiple instances */
+static relpEngine_t *pRelpEngine; /* our relp engine */
+
/* config settings */
static int iTCPSessMax = 200; /* max number of sessions */
+#if 0
/* callbacks */
/* this shall go into a specific ACL module! */
static int
@@ -111,22 +111,19 @@ onErrClose(tcps_sess_t *pSess)
}
/* ------------------------------ end callbacks ------------------------------ */
+#endif // #if 0
-static rsRetVal addTCPListener(void __attribute__((unused)) *pVal, uchar *pNewVal)
+static rsRetVal addListener(void __attribute__((unused)) *pVal, uchar *pNewVal)
{
DEFiRet;
- if(pOurTcpsrv == NULL) {
- CHKiRet(tcpsrv.Construct(&pOurTcpsrv));
- CHKiRet(tcpsrv.SetCBIsPermittedHost(pOurTcpsrv, isPermittedHost));
- CHKiRet(tcpsrv.SetCBRcvData(pOurTcpsrv, doRcvData));
- CHKiRet(tcpsrv.SetCBOpenLstnSocks(pOurTcpsrv, doOpenLstnSocks));
- CHKiRet(tcpsrv.SetCBOnRegularClose(pOurTcpsrv, onRegularClose));
- CHKiRet(tcpsrv.SetCBOnErrClose(pOurTcpsrv, onErrClose));
- tcpsrv.configureTCPListen(pOurTcpsrv, (char *) pNewVal);
- CHKiRet(tcpsrv.ConstructFinalize(pOurTcpsrv));
+ if(pRelpEngine == NULL) {
+ CHKiRet(relpEngineConstruct(&pRelpEngine));
+ CHKiRet(relpEngineSetDbgprint(pRelpEngine, dbgprintf));
}
+ CHKiRet(relpEngineAddListner(pRelpEngine, pNewVal));
+
finalize_it:
RETiRet;
}
@@ -138,7 +135,7 @@ CODESTARTrunInput
/* TODO: we must be careful to start the listener here. Currently, tcpsrv.c seems to
* do that in ConstructFinalize
*/
- iRet = tcpsrv.Run(pOurTcpsrv);
+ iRet = relpEngineRun(pRelpEngine);
ENDrunInput
@@ -146,8 +143,8 @@ ENDrunInput
BEGINwillRun
CODESTARTwillRun
/* first apply some config settings */
- net.PrintAllowedSenders(2); /* TCP */
- if(pOurTcpsrv == NULL)
+ //net.PrintAllowedSenders(2); /* TCP */
+ if(pRelpEngine == NULL)
ABORT_FINALIZE(RS_RET_NO_RUN);
finalize_it:
ENDwillRun
@@ -156,22 +153,22 @@ ENDwillRun
BEGINafterRun
CODESTARTafterRun
/* do cleanup here */
+#if 0
if(net.pAllowedSenders_TCP != NULL) {
net.clearAllowedSenders(net.pAllowedSenders_TCP);
net.pAllowedSenders_TCP = NULL;
}
+#endif
ENDafterRun
BEGINmodExit
CODESTARTmodExit
- if(pOurTcpsrv != NULL)
- iRet = tcpsrv.Destruct(&pOurTcpsrv);
+ if(pRelpEngine != NULL)
+ iRet = relpEngineDestruct(&pRelpEngine);
/* release objects we used */
objRelease(net, LM_NET_FILENAME);
- objRelease(tcps_sess, LM_TCPSRV_FILENAME);
- objRelease(tcpsrv, LM_TCPSRV_FILENAME);
ENDmodExit
@@ -194,15 +191,13 @@ BEGINmodInit()
CODESTARTmodInit
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
- pOurTcpsrv = NULL;
+ pRelpEngine = NULL;
/* request objects we use */
CHKiRet(objUse(net, LM_NET_FILENAME));
- CHKiRet(objUse(tcps_sess, LM_TCPSRV_FILENAME));
- CHKiRet(objUse(tcpsrv, LM_TCPSRV_FILENAME));
/* register config file handlers */
CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputrelpserverrun", 0, eCmdHdlrGetWord,
- addTCPListener, NULL, STD_LOADABLE_MODULE_ID));
+ addListener, NULL, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputrelpmaxsessions", 0, eCmdHdlrInt,
NULL, &iTCPSessMax, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler,