summaryrefslogtreecommitdiffstats
path: root/runtime/module-template.h
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-06-01 18:51:55 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2010-06-01 18:51:55 +0200
commit527bfcea5c9ca5c8414620a022f097d4e53af784 (patch)
treef4bcee98f1f1f1d372a914a247dad86b5b36ad6e /runtime/module-template.h
parent59227a861821b2e0e37357c0695f6b3d9f11dd9d (diff)
downloadrsyslog-527bfcea5c9ca5c8414620a022f097d4e53af784.tar.gz
rsyslog-527bfcea5c9ca5c8414620a022f097d4e53af784.tar.xz
rsyslog-527bfcea5c9ca5c8414620a022f097d4e53af784.zip
first implementation of strgen interface
and a first built-in strgen module. Some tweaks and more default strgens are needed, but the code doesn't look too bad ;)
Diffstat (limited to 'runtime/module-template.h')
-rw-r--r--runtime/module-template.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/runtime/module-template.h b/runtime/module-template.h
index 18aad650..d05ec23c 100644
--- a/runtime/module-template.h
+++ b/runtime/module-template.h
@@ -49,6 +49,9 @@
#define DEF_PMOD_STATIC_DATA \
DEFobjCurrIf(obj) \
DEF_MOD_STATIC_DATA
+#define DEF_SMOD_STATIC_DATA \
+ DEFobjCurrIf(obj) \
+ DEF_MOD_STATIC_DATA
/* Macro to define the module type. Each module can only have a single type. If
@@ -69,6 +72,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_STRGEN MODULE_TYPE(eMOD_STRGEN)
#define MODULE_TYPE_LIB \
DEF_LMOD_STATIC_DATA \
MODULE_TYPE(eMOD_LIB)
@@ -416,6 +420,18 @@ static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)())\
*pEtryPoint = GetParserName;\
}
+/* the following definition is the standard block for queryEtryPt for Strgen
+ * modules. This can be used if no specific handling (e.g. to cover version
+ * differences) is needed.
+ */
+#define CODEqueryEtryPt_STD_SMOD_QUERIES \
+ CODEqueryEtryPt_STD_MOD_QUERIES \
+ else if(!strcmp((char*) name, "strgen")) {\
+ *pEtryPoint = strgen;\
+ } else if(!strcmp((char*) name, "GetName")) {\
+ *pEtryPoint = GetStrgenName;\
+ }
+
/* 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
@@ -621,6 +637,21 @@ static rsRetVal parse(msg_t *pMsg)\
}
+/* strgen() - main entry point of parser modules
+ */
+#define BEGINstrgen \
+static rsRetVal strgen(msg_t *pMsg, uchar **ppBuf, size_t *pLenBuf) \
+{\
+ DEFiRet;
+
+#define CODESTARTstrgen \
+ assert(pMsg != NULL);
+
+#define ENDstrgen \
+ RETiRet;\
+}
+
+
/* function to specify the parser name. This is done via a single command which
* receives a ANSI string as parameter.
*/
@@ -632,5 +663,17 @@ static rsRetVal GetParserName(uchar **ppSz)\
}
+
+/* function to specify the strgen name. This is done via a single command which
+ * receives a ANSI string as parameter.
+ */
+#define STRGEN_NAME(x) \
+static rsRetVal GetStrgenName(uchar **ppSz)\
+{\
+ *ppSz = UCHAR_CONSTANT(x);\
+ return RS_RET_OK;\
+}
+
+
/* vim:set ai:
*/