diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-07-27 09:44:35 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-07-27 09:44:35 +0200 |
commit | d18b238f16a7ff4dbb998314b6d76ffb8b2acf59 (patch) | |
tree | 0b15554ce8f002a8017ca77ae73865a05950278b /plugins/ommysql | |
parent | c97b1d3c72ef1504a430f65ae017112d834a3127 (diff) | |
download | rsyslog-d18b238f16a7ff4dbb998314b6d76ffb8b2acf59.tar.gz rsyslog-d18b238f16a7ff4dbb998314b6d76ffb8b2acf59.tar.xz rsyslog-d18b238f16a7ff4dbb998314b6d76ffb8b2acf59.zip |
milestone commit: output plugin interface changes (may NOT run)
The output interface has been changed, but we do not yet utilize the
new interface. Also, it looks like a regression was introduced. But before
hunting it down, I'd like to make a commit (what also easys the regresion
hunt).
Diffstat (limited to 'plugins/ommysql')
-rw-r--r-- | plugins/ommysql/ommysql.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c index 7da445ee..b12bb846 100644 --- a/plugins/ommysql/ommysql.c +++ b/plugins/ommysql/ommysql.c @@ -47,23 +47,33 @@ MODULE_TYPE_OUTPUT +static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal); + /* internal structures */ DEF_OMOD_STATIC_DATA DEFobjCurrIf(errmsg) typedef struct _instanceData { - MYSQL *f_hmysql; /* handle to MySQL */ + MYSQL *f_hmysql; /* handle to MySQL */ char f_dbsrv[MAXHOSTNAMELEN+1]; /* IP or hostname of DB server*/ unsigned int f_dbsrvPort; /* port of MySQL server */ char f_dbname[_DB_MAXDBLEN+1]; /* DB name */ char f_dbuid[_DB_MAXUNAMELEN+1]; /* DB user */ char f_dbpwd[_DB_MAXPWDLEN+1]; /* DB user's password */ - unsigned uLastMySQLErrno; /* last errno returned by MySQL or 0 if all is well */ + unsigned uLastMySQLErrno; /* last errno returned by MySQL or 0 if all is well */ } instanceData; -/* config variables */ -static int iSrvPort = 0; /* database server port */ +typedef struct configSettings_s { + int iSrvPort; /* database server port */ +} configSettings_t; + +SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ + +BEGINinitConfVars /* (re)set config variables to default values */ +CODESTARTinitConfVars + resetConfigVariables(NULL, NULL); +ENDinitConfVars BEGINcreateInstance @@ -277,7 +287,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1) errmsg.LogError(0, RS_RET_INVALID_PARAMS, "Trouble with MySQL connection properties. -MySQL logging disabled"); ABORT_FINALIZE(RS_RET_INVALID_PARAMS); } else { - pData->f_dbsrvPort = (unsigned) iSrvPort; /* set configured port */ + pData->f_dbsrvPort = (unsigned) cs.iSrvPort; /* set configured port */ pData->f_hmysql = NULL; /* initialize, but connect only on first message (important for queued mode!) */ } @@ -301,7 +311,7 @@ ENDqueryEtryPt static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal) { DEFiRet; - iSrvPort = 0; /* zero is the default port */ + cs.iSrvPort = 0; /* zero is the default port */ RETiRet; } @@ -311,7 +321,7 @@ CODESTARTmodInit CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(errmsg, CORE_COMPONENT)); /* register our config handlers */ - CHKiRet(omsdRegCFSLineHdlr((uchar *)"actionommysqlserverport", 0, eCmdHdlrInt, NULL, &iSrvPort, STD_LOADABLE_MODULE_ID, eConfObjAction)); + CHKiRet(omsdRegCFSLineHdlr((uchar *)"actionommysqlserverport", 0, eCmdHdlrInt, NULL, &cs.iSrvPort, STD_LOADABLE_MODULE_ID, eConfObjAction)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID, eConfObjAction)); ENDmodInit |