diff options
Diffstat (limited to 'plugins/im3195/im3195.c')
-rw-r--r-- | plugins/im3195/im3195.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/plugins/im3195/im3195.c b/plugins/im3195/im3195.c index c75e0e3..b8a4a14 100644 --- a/plugins/im3195/im3195.c +++ b/plugins/im3195/im3195.c @@ -48,6 +48,7 @@ #include "cfsysline.h" #include "msg.h" #include "errmsg.h" +#include "unicode-helper.h" MODULE_TYPE_INPUT MODULE_TYPE_NOKEEP @@ -56,6 +57,7 @@ MODULE_CNFNAME("im3195") /* Module static data */ DEF_IMOD_STATIC_DATA DEFobjCurrIf(errmsg) +DEFobjCurrIf(prop) /* configuration settings */ @@ -71,6 +73,8 @@ static int listenPort = 601; */ static srAPIObj* pAPI; +static prop_t *pInputName = NULL; /* there is only one global inputName for all messages generated by this module */ + /* This method is called when a message has been fully received. * It passes the received message to the rsyslog main message @@ -90,7 +94,7 @@ void OnReceive(srAPIObj __attribute__((unused)) *pMyAPI, srSLMGObj* pSLMG) srSLMGGetRawMSG(pSLMG, &pszRawMsg); parseAndSubmitMessage(fromHost, fromHostIP, pszRawMsg, strlen((char*)pszRawMsg), - PARSE_HOSTNAME, eFLOWCTL_FULL_DELAY, (uchar*)"im3195", NULL, 0, NULL); + PARSE_HOSTNAME, eFLOWCTL_FULL_DELAY, pInputName, NULL, 0, NULL); } @@ -171,8 +175,12 @@ ENDafterRun BEGINmodExit CODESTARTmodExit srAPIExitLib(pAPI); /* terminate liblogging */ + /* global variable cleanup */ + if(pInputName != NULL) + prop.Destruct(&pInputName); /* release objects we used */ objRelease(errmsg, CORE_COMPONENT); + objRelease(prop, CORE_COMPONENT); ENDmodExit @@ -193,9 +201,15 @@ CODESTARTmodInit *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(errmsg, CORE_COMPONENT)); + CHKiRet(objUse(prop, CORE_COMPONENT)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"input3195listenport", 0, eCmdHdlrInt, NULL, &listenPort, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID)); + + CHKiRet(prop.Construct(&pInputName)); + CHKiRet(prop.SetString(pInputName, UCHAR_CONSTANT("im3195"), sizeof("im3195") - 1)); + CHKiRet(prop.ConstructFinalize(pInputName)); + ENDmodInit /* vim:set ai: */ |