From 535d6cf0b8fe2423eee3fd670bc1e944b231e827 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 19 Jan 2012 14:48:40 +0100 Subject: v6.1/2 scoping support removed from plugins --- plugins/mmnormalize/mmnormalize.c | 5 ++--- plugins/mmsnmptrapd/mmsnmptrapd.c | 5 ++--- plugins/omlibdbi/omlibdbi.c | 5 ++--- plugins/ommail/ommail.c | 5 ++--- plugins/ommysql/ommysql.c | 5 ++--- plugins/ompgsql/ompgsql.c | 5 ++--- plugins/omprog/omprog.c | 5 ++--- plugins/omrelp/omrelp.c | 5 ++--- plugins/omruleset/omruleset.c | 5 ++--- plugins/omstdout/omstdout.c | 5 ++--- plugins/omtesting/omtesting.c | 5 ++--- plugins/omudpspoof/omudpspoof.c | 5 ++--- plugins/omuxsock/omuxsock.c | 4 ++-- runtime/module-template.h | 37 +++---------------------------------- tools/omdiscard.c | 11 ----------- tools/omfile.c | 5 ++--- tools/omfwd.c | 5 ++--- tools/ompipe.c | 5 ++--- tools/omshell.c | 5 ++--- tools/omusrmsg.c | 4 ++-- 20 files changed, 39 insertions(+), 97 deletions(-) diff --git a/plugins/mmnormalize/mmnormalize.c b/plugins/mmnormalize/mmnormalize.c index fd898a3b..7b92d820 100644 --- a/plugins/mmnormalize/mmnormalize.c +++ b/plugins/mmnormalize/mmnormalize.c @@ -69,8 +69,7 @@ typedef struct configSettings_s { uchar *rulebase; /**< name of normalization rulebase to use */ sbool bUseRawMsg; /**< use %rawmsg% instead of %msg% */ } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -238,7 +237,7 @@ BEGINmodInit() unsigned long opts; int bMsgPassingSupported; CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr diff --git a/plugins/mmsnmptrapd/mmsnmptrapd.c b/plugins/mmsnmptrapd/mmsnmptrapd.c index cfc30a95..b1ac2f64 100644 --- a/plugins/mmsnmptrapd/mmsnmptrapd.c +++ b/plugins/mmsnmptrapd/mmsnmptrapd.c @@ -77,8 +77,7 @@ typedef struct configSettings_s { uchar *pszTagName; /**< name of tag start value that indicates snmptrapd initiated message */ uchar *pszSeverityMapping; /**< severitystring to numerical code mapping for snmptrapd string */ } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -386,7 +385,7 @@ BEGINmodInit() unsigned long opts; int bMsgPassingSupported; CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr diff --git a/plugins/omlibdbi/omlibdbi.c b/plugins/omlibdbi/omlibdbi.c index 4bca5263..44e635c1 100644 --- a/plugins/omlibdbi/omlibdbi.c +++ b/plugins/omlibdbi/omlibdbi.c @@ -78,8 +78,7 @@ typedef struct configSettings_s { uchar *pwd; /* password for connect */ uchar *dbName; /* database to use */ } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -361,7 +360,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a BEGINmodInit() CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(errmsg, CORE_COMPONENT)); diff --git a/plugins/ommail/ommail.c b/plugins/ommail/ommail.c index 73bccd15..d70fa30a 100644 --- a/plugins/ommail/ommail.c +++ b/plugins/ommail/ommail.c @@ -98,8 +98,7 @@ typedef struct configSettings_s { uchar *pszSubject; int bEnableBody; /* should a mail body be generated? (set to 0 eg for SMS gateways) */ } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -706,7 +705,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a BEGINmodInit() CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr /* tell which objects we need */ diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c index d5fa7c71..50ebf3a3 100644 --- a/plugins/ommysql/ommysql.c +++ b/plugins/ommysql/ommysql.c @@ -73,8 +73,7 @@ typedef struct configSettings_s { uchar *pszMySQLConfigFile; /* MySQL Client Configuration File */ uchar *pszMySQLConfigSection; /* MySQL Client Configuration Section */ } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -356,7 +355,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a BEGINmodInit() CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(errmsg, CORE_COMPONENT)); diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c index 46e929dd..2c10d881 100644 --- a/plugins/ompgsql/ompgsql.c +++ b/plugins/ompgsql/ompgsql.c @@ -69,8 +69,7 @@ typedef struct _instanceData { typedef struct configSettings_s { EMPTY_STRUCT } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -368,7 +367,7 @@ ENDqueryEtryPt BEGINmodInit() CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(errmsg, CORE_COMPONENT)); diff --git a/plugins/omprog/omprog.c b/plugins/omprog/omprog.c index 9b2ad934..1f6bb62f 100644 --- a/plugins/omprog/omprog.c +++ b/plugins/omprog/omprog.c @@ -62,8 +62,7 @@ typedef struct _instanceData { typedef struct configSettings_s { uchar *szBinary; /* name of binary to call */ } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -349,7 +348,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a BEGINmodInit() CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(errmsg, CORE_COMPONENT)); diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c index 804a2da4..ca64daf2 100644 --- a/plugins/omrelp/omrelp.c +++ b/plugins/omrelp/omrelp.c @@ -68,8 +68,7 @@ typedef struct _instanceData { typedef struct configSettings_s { EMPTY_STRUCT } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -347,7 +346,7 @@ ENDqueryEtryPt BEGINmodInit() CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr /* create our relp engine */ diff --git a/plugins/omruleset/omruleset.c b/plugins/omruleset/omruleset.c index ccc82d72..67aee97e 100644 --- a/plugins/omruleset/omruleset.c +++ b/plugins/omruleset/omruleset.c @@ -74,8 +74,7 @@ typedef struct configSettings_s { ruleset_t *pRuleset; /* ruleset to enqueue message to (NULL = Default, not recommended) */ uchar *pszRulesetName; } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -215,7 +214,7 @@ BEGINmodInit() unsigned long opts; int bMsgPassingSupported; /* does core support template passing as an array? */ CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr /* check if the rsyslog core supports parameter passing code */ diff --git a/plugins/omstdout/omstdout.c b/plugins/omstdout/omstdout.c index f8564a01..fb95e951 100644 --- a/plugins/omstdout/omstdout.c +++ b/plugins/omstdout/omstdout.c @@ -64,8 +64,7 @@ typedef struct configSettings_s { int bUseArrayInterface; /* shall action use array instead of string template interface? */ int bEnsureLFEnding; /* shall action use array instead of string template interface? */ } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -197,7 +196,7 @@ BEGINmodInit() unsigned long opts; int bArrayPassingSupported; /* does core support template passing as an array? */ CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr /* check if the rsyslog core supports parameter passing code */ diff --git a/plugins/omtesting/omtesting.c b/plugins/omtesting/omtesting.c index 466aab3f..ff290c94 100644 --- a/plugins/omtesting/omtesting.c +++ b/plugins/omtesting/omtesting.c @@ -79,8 +79,7 @@ typedef struct _instanceData { typedef struct configSettings_s { int bEchoStdout; /* echo non-failed messages to stdout */ } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -319,7 +318,7 @@ ENDqueryEtryPt BEGINmodInit() CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(omsdRegCFSLineHdlr((uchar *)"actionomtestingechostdout", 0, eCmdHdlrBinary, NULL, diff --git a/plugins/omudpspoof/omudpspoof.c b/plugins/omudpspoof/omudpspoof.c index 762f83c5..506fca77 100644 --- a/plugins/omudpspoof/omudpspoof.c +++ b/plugins/omudpspoof/omudpspoof.c @@ -115,8 +115,7 @@ typedef struct configSettings_s { int iSourcePortStart; int iSourcePortEnd; } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -485,7 +484,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a BEGINmodInit() CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(glbl, CORE_COMPONENT)); diff --git a/plugins/omuxsock/omuxsock.c b/plugins/omuxsock/omuxsock.c index f6b18111..cf27c93c 100644 --- a/plugins/omuxsock/omuxsock.c +++ b/plugins/omuxsock/omuxsock.c @@ -69,8 +69,7 @@ typedef struct configSettings_s { uchar *tplName; /* name of the default template to use */ uchar *sockName; /* name of the default template to use */ } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -307,6 +306,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a BEGINmodInit() CODESTARTmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(glbl, CORE_COMPONENT)); diff --git a/runtime/module-template.h b/runtime/module-template.h index b98890ae..75bf7312 100644 --- a/runtime/module-template.h +++ b/runtime/module-template.h @@ -375,38 +375,7 @@ static rsRetVal tryResume(instanceData __attribute__((unused)) *pData)\ } -/* Config scoping system. - * save current config scope and start a new one. Note that we do NOT implement a - * stack. Exactly one scope can be saved. - * We assume standard naming conventions (local confgSettings_t holds all - * config settings and MUST have been defined before this macro is being used!). - * Note that initConfVars() must be defined locally as well. - */ -#define SCOPING_SUPPORT \ -static rsRetVal initConfVars(void);\ -static configSettings_t cs; /* our current config settings */ \ -static configSettings_t cs_save; /* our saved (scope!) config settings */ \ -static rsRetVal __attribute__((unused)) newScope(void) \ -{ \ - DEFiRet; \ - memcpy(&cs_save, &cs, sizeof(cs)); \ - iRet = initConfVars(); \ - RETiRet; \ -} \ -static rsRetVal __attribute__((unused)) restoreScope(void) \ -{ \ - DEFiRet; \ - memcpy(&cs, &cs_save, sizeof(cs)); \ - RETiRet; \ -} -/* initConfVars() - * This entry point is called to check if a module can resume operations. This - * happens when a module requested that it be suspended. In suspended state, - * the engine periodically tries to resume the module. If that succeeds, normal - * processing continues. If not, the module will not be called unless a - * tryResume() call succeeds. - * Returns RS_RET_OK, if resumption succeeded, RS_RET_SUSPENDED otherwise - * rgerhard, 2007-08-02 +/* initConfVars() - initialize pre-v6.3-config variables */ #define BEGINinitConfVars \ static rsRetVal initConfVars(void)\ @@ -634,8 +603,8 @@ rsRetVal modInit##uniqName(int iIFVersRequested __attribute__((unused)), int *ip /* now get the obj interface so that we can access other objects */ \ CHKiRet(pObjGetObjInterface(&obj)); -/* do those initializations necessary for scoping */ -#define SCOPINGmodInit \ +/* do those initializations necessary for legacy config variables */ +#define INITLegCnfVars \ initConfVars(); #define ENDmodInit \ diff --git a/tools/omdiscard.c b/tools/omdiscard.c index 5b64d3ff..182c4b63 100644 --- a/tools/omdiscard.c +++ b/tools/omdiscard.c @@ -47,16 +47,6 @@ typedef struct _instanceData { EMPTY_STRUCT } instanceData; -typedef struct configSettings_s { - EMPTY_STRUCT -} configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ - -BEGINinitConfVars /* (re)set config variables to default values */ -CODESTARTinitConfVars -ENDinitConfVars - /* we do not need a createInstance()! BEGINcreateInstance CODESTARTcreateInstance @@ -124,7 +114,6 @@ ENDqueryEtryPt BEGINmodInit(Discard) CODESTARTmodInit -SCOPINGmodInit *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr ENDmodInit diff --git a/tools/omfile.c b/tools/omfile.c index e618b817..c7f1b896 100644 --- a/tools/omfile.c +++ b/tools/omfile.c @@ -177,10 +177,9 @@ typedef struct configSettings_s { int bUseAsyncWriter; /* should we enable asynchronous writing? */ EMPTY_STRUCT } configSettings_t; +static configSettings_t cs; uchar *pszFileDfltTplName; /* name of the default template to use */ -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ - /* tables for interfacing with the v6 config system */ /* action (instance) parameters */ static struct cnfparamdescr actpdescr[] = { @@ -1010,7 +1009,7 @@ BEGINmodInit(File) CODESTARTmodInit *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr -SCOPINGmodInit +INITLegCnfVars CHKiRet(objUse(errmsg, CORE_COMPONENT)); CHKiRet(objUse(strm, CORE_COMPONENT)); diff --git a/tools/omfwd.c b/tools/omfwd.c index da8f9e22..96458941 100644 --- a/tools/omfwd.c +++ b/tools/omfwd.c @@ -112,8 +112,7 @@ typedef struct configSettings_s { int iUDPRebindInterval; /* support for automatic re-binding (load balancers!). 0 - no rebind */ permittedPeers_t *pPermPeers; } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; /* tables for interfacing with the v6 config system */ /* action (instance) parameters */ @@ -987,7 +986,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a BEGINmodInit(Fwd) CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(glbl, CORE_COMPONENT)); diff --git a/tools/ompipe.c b/tools/ompipe.c index 7400bb18..1eb0dbce 100644 --- a/tools/ompipe.c +++ b/tools/ompipe.c @@ -78,8 +78,7 @@ typedef struct _instanceData { typedef struct configSettings_s { EMPTY_STRUCT } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -250,7 +249,7 @@ ENDqueryEtryPt BEGINmodInit(Pipe) CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(errmsg, CORE_COMPONENT)); diff --git a/tools/omshell.c b/tools/omshell.c index 648d28a4..130d89d8 100644 --- a/tools/omshell.c +++ b/tools/omshell.c @@ -60,8 +60,7 @@ typedef struct _instanceData { typedef struct configSettings_s { EMPTY_STRUCT /* remove this when data members are added */ } configSettings_t; - -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; BEGINinitConfVars /* (re)set config variables to default values */ CODESTARTinitConfVars @@ -148,7 +147,7 @@ ENDqueryEtryPt BEGINmodInit(Shell) CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(errmsg, CORE_COMPONENT)); diff --git a/tools/omusrmsg.c b/tools/omusrmsg.c index 6d6b267a..f8e40594 100644 --- a/tools/omusrmsg.c +++ b/tools/omusrmsg.c @@ -91,7 +91,7 @@ typedef struct configSettings_s { EMPTY_STRUCT } configSettings_t; -SCOPING_SUPPORT; /* must be set AFTER configSettings_t is defined */ +static configSettings_t cs; /* tables for interfacing with the v6 config system */ @@ -442,7 +442,7 @@ ENDqueryEtryPt BEGINmodInit(UsrMsg) CODESTARTmodInit -SCOPINGmodInit +INITLegCnfVars *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(errmsg, CORE_COMPONENT)); -- cgit