From 7449e8356b19900acaa33e387bd4ea65ba85e204 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 31 Jul 2007 13:30:55 +0000 Subject: - added interface to register a cfsysline command handler (basic functionality) --- modules.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'modules.c') diff --git a/modules.c b/modules.c index 7bbdf47a..32bec07c 100644 --- a/modules.c +++ b/modules.c @@ -36,10 +36,12 @@ #include #include "syslogd.h" +#include "cfsysline.h" #include "modules.h" static modInfo_t *pLoadedModules = NULL; /* list of currently-loaded modules */ static modInfo_t *pLoadedModulesLast = NULL; /* tail-pointer */ +static int bCfsyslineInitialized = 0; /* Construct a new module object @@ -84,8 +86,7 @@ rsRetVal queryHostEtryPt(uchar *name, rsRetVal (**pEtryPoint)()) return RS_RET_PARAM_ERROR; if(!strcmp((char*) name, "regCfSysLineHdlr")) { - //*pEtryPoint = regCfSysLineHdlr; - *pEtryPoint = queryHostEtryPt; + *pEtryPoint = regCfSysLineHdlr; } if(iRet == RS_RET_OK) @@ -166,11 +167,17 @@ modInfo_t *omodGetNxt(modInfo_t *pThis) */ rsRetVal doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)()), uchar *name) { + DEFiRet; modInfo_t *pNew; - rsRetVal iRet; assert(modInit != NULL); + if(bCfsyslineInitialized == 0) { + /* we need to initialize the cfsysline subsystem first */ + CHKiRet(cfsyslineInit()); + bCfsyslineInitialized = 1; + } + if((iRet = moduleConstruct(&pNew)) != RS_RET_OK) return iRet; @@ -228,7 +235,8 @@ rsRetVal doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)()) /* we initialized the structure, now let's add it to the linked list of modules */ addModToList(pNew); - return RS_RET_OK; +finalize_it: + return iRet; } /* Print loaded modules. This is more or less a -- cgit v1.2.3