summaryrefslogtreecommitdiffstats
path: root/runtime/module-template.h
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-11-03 12:39:48 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-11-03 12:39:48 +0100
commit6f511cecfae3592f271627ebcb41e6a8c4f831e9 (patch)
treefbc67531528d42ba50c66e1d9129792bad5a3cc5 /runtime/module-template.h
parent7d78b3bdfd357dd921797ce983eb96532c56a7f6 (diff)
downloadrsyslog-6f511cecfae3592f271627ebcb41e6a8c4f831e9.tar.gz
rsyslog-6f511cecfae3592f271627ebcb41e6a8c4f831e9.tar.xz
rsyslog-6f511cecfae3592f271627ebcb41e6a8c4f831e9.zip
more cleanup and working towards a parser module calling interface
I cleaned up a lot of config variable access along the way. This version compiles and runs, but does not yet offer any enhanced functionality. pmrfc5424 is just a dummy that is not yet being used.
Diffstat (limited to 'runtime/module-template.h')
-rw-r--r--runtime/module-template.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/runtime/module-template.h b/runtime/module-template.h
index d49da2c9..b136b6a3 100644
--- a/runtime/module-template.h
+++ b/runtime/module-template.h
@@ -46,6 +46,9 @@
DEFobjCurrIf(obj)
#define DEF_LMOD_STATIC_DATA \
DEF_MOD_STATIC_DATA
+#define DEF_PMOD_STATIC_DATA \
+ DEFobjCurrIf(obj) \
+ DEF_MOD_STATIC_DATA
/* Macro to define the module type. Each module can only have a single type. If
@@ -65,6 +68,7 @@ static rsRetVal modGetType(eModType_t *modType) \
#define MODULE_TYPE_INPUT MODULE_TYPE(eMOD_IN)
#define MODULE_TYPE_OUTPUT MODULE_TYPE(eMOD_OUT)
+#define MODULE_TYPE_PARSER MODULE_TYPE(eMOD_PARSER)
#define MODULE_TYPE_LIB \
DEF_LMOD_STATIC_DATA \
MODULE_TYPE(eMOD_LIB)
@@ -400,6 +404,16 @@ static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)())\
#define CODEqueryEtryPt_STD_LIB_QUERIES \
CODEqueryEtryPt_STD_MOD_QUERIES
+/* the following definition is the standard block for queryEtryPt for PARSER
+ * modules. This can be used if no specific handling (e.g. to cover version
+ * differences) is needed.
+ */
+#define CODEqueryEtryPt_STD_PMOD_QUERIES \
+ CODEqueryEtryPt_STD_MOD_QUERIES \
+ else if(!strcmp((char*) name, "parse")) {\
+ *pEtryPoint = parse;\
+ }
+
/* modInit()
* This has an extra parameter, which is the specific name of the modInit
* function. That is needed for built-in modules, which must have unique
@@ -590,5 +604,21 @@ static rsRetVal doHUP(instanceData __attribute__((unused)) *pData)\
}
+
+/* parse() - main entry point of parser modules
+ */
+#define BEGINparse \
+static rsRetVal parse(msg_t *pMsg)\
+{\
+ DEFiRet;
+
+#define CODESTARTparse \
+ assert(pMsg != NULL);
+
+#define ENDparse \
+ RETiRet;\
+}
+
+
/* vim:set ai:
*/