From ca0ddc30a3edce02a440904a01f0b866c0f82b5a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 12 Jun 2009 15:31:08 +0200 Subject: completed multi-ruleset core support ... as well as added multi-ruleset support for imtcp --- tcpsrv.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tcpsrv.c') diff --git a/tcpsrv.c b/tcpsrv.c index 3516b2e3..95409d2f 100644 --- a/tcpsrv.c +++ b/tcpsrv.c @@ -69,6 +69,7 @@ #include "netstrm.h" #include "nssel.h" #include "errmsg.h" +#include "ruleset.h" #include "unicode-helper.h" MODULE_TYPE_LIB @@ -81,6 +82,7 @@ MODULE_TYPE_LIB DEFobjStaticHelpers DEFobjCurrIf(conf) DEFobjCurrIf(glbl) +DEFobjCurrIf(ruleset) DEFobjCurrIf(tcps_sess) DEFobjCurrIf(errmsg) DEFobjCurrIf(net) @@ -104,6 +106,8 @@ addNewLstnPort(tcpsrv_t *pThis, uchar *pszPort) CHKmalloc(pEntry = malloc(sizeof(tcpLstnPortList_t))); pEntry->pszPort = pszPort; pEntry->pSrv = pThis; +RUNLOG_VAR("%p", pThis->pRuleset); + pEntry->pRuleset = pThis->pRuleset; CHKmalloc(pEntry->pszInputName = ustrdup(pThis->pszInputName)); /* and add to list */ @@ -755,6 +759,16 @@ finalize_it: } +/* Set the ruleset (ptr) to use */ +static rsRetVal +SetRuleset(tcpsrv_t *pThis, ruleset_t *pRuleset) +{ + DEFiRet; + pThis->pRuleset = pRuleset; + RETiRet; +} + + /* here follows a number of methods that shuffle authentication settings down * to the drivers. Drivers not supporting these settings may return an error * state. @@ -855,6 +869,7 @@ CODESTARTobjQueryInterface(tcpsrv) pIf->SetCBOnRegularClose = SetCBOnRegularClose; pIf->SetCBOnErrClose = SetCBOnErrClose; pIf->SetOnMsgReceive = SetOnMsgReceive; + pIf->SetRuleset = SetRuleset; finalize_it: ENDobjQueryInterface(tcpsrv) @@ -868,6 +883,7 @@ CODESTARTObjClassExit(tcpsrv) /* release objects we no longer need */ objRelease(tcps_sess, DONT_LOAD_LIB); objRelease(conf, CORE_COMPONENT); + objRelease(ruleset, CORE_COMPONENT); objRelease(glbl, CORE_COMPONENT); objRelease(errmsg, CORE_COMPONENT); objRelease(netstrms, DONT_LOAD_LIB); @@ -891,6 +907,7 @@ BEGINObjClassInit(tcpsrv, 1, OBJ_IS_LOADABLE_MODULE) /* class, version - CHANGE CHKiRet(objUse(tcps_sess, DONT_LOAD_LIB)); CHKiRet(objUse(conf, CORE_COMPONENT)); CHKiRet(objUse(glbl, CORE_COMPONENT)); + CHKiRet(objUse(ruleset, CORE_COMPONENT)); /* set our own handlers */ OBJSetMethodHandler(objMethod_DEBUGPRINT, tcpsrvDebugPrint); -- cgit From b5ccdf06724d309b777d4dd38a455ed2ef0318a0 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 12 Jun 2009 15:59:50 +0200 Subject: performance-enhanced imtcp ...by now using lowres time and thus saving many time() calls. This needs some performance testing and must be made configurable if it works out. --- tcpsrv.c | 1 - 1 file changed, 1 deletion(-) (limited to 'tcpsrv.c') diff --git a/tcpsrv.c b/tcpsrv.c index 95409d2f..5e2bd530 100644 --- a/tcpsrv.c +++ b/tcpsrv.c @@ -106,7 +106,6 @@ addNewLstnPort(tcpsrv_t *pThis, uchar *pszPort) CHKmalloc(pEntry = malloc(sizeof(tcpLstnPortList_t))); pEntry->pszPort = pszPort; pEntry->pSrv = pThis; -RUNLOG_VAR("%p", pThis->pRuleset); pEntry->pRuleset = pThis->pRuleset; CHKmalloc(pEntry->pszInputName = ustrdup(pThis->pszInputName)); -- cgit From 057c9b11fca013205877e15dd851927a11aa058b Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 12 Jun 2009 16:30:39 +0200 Subject: fixed a regression from past commit & more performance enhancement a larger buffer is a cheap, yet useful, enhancement... ;) --- tcpsrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tcpsrv.c') diff --git a/tcpsrv.c b/tcpsrv.c index 5e2bd530..21699bca 100644 --- a/tcpsrv.c +++ b/tcpsrv.c @@ -513,7 +513,7 @@ Run(tcpsrv_t *pThis) while(nfds && iTCPSess != -1) { CHKiRet(nssel.IsReady(pSel, pThis->pSessions[iTCPSess]->pStrm, NSDSEL_RD, &bIsReady, &nfds)); if(bIsReady) { - char buf[8*1024]; /* reception buffer - may hold a partial or multiple messages */ + char buf[64*1024]; /* reception buffer - may hold a partial or multiple messages */ dbgprintf("netstream %p with new data\n", pThis->pSessions[iTCPSess]->pStrm); /* Receive message */ -- cgit From 015d17ca70e81ad998e32cdfeed3cd925fd7dedc Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 16 Jun 2009 08:46:45 +0200 Subject: some performance optimizations - saved gettimeofday() calls in imtcp (and increased reception buffer) - somewhat optimized stringbuf.c - some other optimizations --- tcpsrv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tcpsrv.c') diff --git a/tcpsrv.c b/tcpsrv.c index 3516b2e3..11619498 100644 --- a/tcpsrv.c +++ b/tcpsrv.c @@ -105,6 +105,7 @@ addNewLstnPort(tcpsrv_t *pThis, uchar *pszPort) pEntry->pszPort = pszPort; pEntry->pSrv = pThis; CHKmalloc(pEntry->pszInputName = ustrdup(pThis->pszInputName)); + pEntry->lenInputName = ustrlen(pEntry->pszInputName); /* and add to list */ pEntry->pNext = pThis->pLstnPorts; @@ -510,7 +511,7 @@ Run(tcpsrv_t *pThis) while(nfds && iTCPSess != -1) { CHKiRet(nssel.IsReady(pSel, pThis->pSessions[iTCPSess]->pStrm, NSDSEL_RD, &bIsReady, &nfds)); if(bIsReady) { - char buf[8*1024]; /* reception buffer - may hold a partial or multiple messages */ + char buf[128*1024]; /* reception buffer - may hold a partial or multiple messages */ dbgprintf("netstream %p with new data\n", pThis->pSessions[iTCPSess]->pStrm); /* Receive message */ -- cgit