diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-28 16:38:05 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-28 16:38:05 +0000 |
commit | 7ddc2511193930c1f9aa755904cef6f3b860a670 (patch) | |
tree | 4753b366f29ff47896039c1bb8420ab86c3b05e9 /plugins/omsnmp/omsnmp.c | |
parent | b5df9ccaf173b409ba1c363447c9b2ec46091d47 (diff) | |
download | rsyslog-7ddc2511193930c1f9aa755904cef6f3b860a670.tar.gz rsyslog-7ddc2511193930c1f9aa755904cef6f3b860a670.tar.xz rsyslog-7ddc2511193930c1f9aa755904cef6f3b860a670.zip |
provided sample for integer config variable
Diffstat (limited to 'plugins/omsnmp/omsnmp.c')
-rw-r--r-- | plugins/omsnmp/omsnmp.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/omsnmp/omsnmp.c b/plugins/omsnmp/omsnmp.c index 0328d851..f8711ac5 100644 --- a/plugins/omsnmp/omsnmp.c +++ b/plugins/omsnmp/omsnmp.c @@ -58,9 +58,12 @@ MODULE_TYPE_OUTPUT DEF_OMOD_STATIC_DATA static uchar* pszTarget = NULL; +/* note using an unsigned for a port number is not a good idea from an IPv6 point of view */ +static int iPort = 0; typedef struct _instanceData { uchar szTarget[MAXHOSTNAMELEN+1]; /* IP or hostname of Snmp Target*/ + int iPort; } instanceData; @@ -130,6 +133,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(0) /* Copy Target */ strncpy( (char*) pData->szTarget, (char*) pszTarget, sizeof( pData->szTarget -1 ) ); } + pThis->iPort = iPort; CODE_STD_FINALIZERparseSelectorAct ENDparseSelectorAct @@ -146,6 +150,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a if (pszTarget != NULL) free(pszTarget); pszTarget = NULL; + iPort = 0; return RS_RET_OK; } @@ -169,6 +174,7 @@ CODESTARTmodInit *ipIFVersProvided = 1; /* so far, we only support the initial definition */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(omsdRegCFSLineHdlr((uchar *)"actionsnmptarget", 0, eCmdHdlrGetWord, NULL, &pszTarget, STD_LOADABLE_MODULE_ID)); + CHKiRet(regCfSysLineHdlr((uchar *)"actionsnmptargetport", 0, eCmdHdlrInt, NULL, &iPort, NULL)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID)); ENDmodInit /* |