summaryrefslogtreecommitdiffstats
path: root/plugins/im3195/im3195.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/im3195/im3195.c')
-rw-r--r--plugins/im3195/im3195.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/plugins/im3195/im3195.c b/plugins/im3195/im3195.c
index 28ca8856..b8a4a140 100644
--- a/plugins/im3195/im3195.c
+++ b/plugins/im3195/im3195.c
@@ -48,15 +48,23 @@
#include "cfsysline.h"
#include "msg.h"
#include "errmsg.h"
+#include "unicode-helper.h"
MODULE_TYPE_INPUT
MODULE_TYPE_NOKEEP
+MODULE_CNFNAME("im3195")
/* Module static data */
DEF_IMOD_STATIC_DATA
DEFobjCurrIf(errmsg)
+DEFobjCurrIf(prop)
/* configuration settings */
+
+struct modConfData_s {
+ EMPTY_STRUCT;
+};
+
static int listenPort = 601;
/* we use a global API object below, because this listener is
@@ -65,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
@@ -84,10 +94,37 @@ 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);
+ PARSE_HOSTNAME, eFLOWCTL_FULL_DELAY, pInputName, NULL, 0, NULL);
}
+#if 0
+BEGINbeginCnfLoad
+CODESTARTbeginCnfLoad
+ENDbeginCnfLoad
+
+
+BEGINendCnfLoad
+CODESTARTendCnfLoad
+ENDendCnfLoad
+
+
+BEGINcheckCnf
+CODESTARTcheckCnf
+ENDcheckCnf
+
+
+BEGINactivateCnf
+CODESTARTactivateCnf
+ENDactivateCnf
+
+
+BEGINfreeCnf
+CODESTARTfreeCnf
+ENDfreeCnf
+#endif
+
+
BEGINrunInput
CODESTARTrunInput
/* this is an endless loop - it is terminated when the thread is
@@ -138,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
@@ -160,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:
*/