summaryrefslogtreecommitdiffstats
path: root/module-template.h
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-27 16:55:40 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-27 16:55:40 +0000
commit1d96a98daf4ac4c4ec9e664e328f1aac4bf6af9e (patch)
tree249ec71321b657a6a37b91f1d03f4e2c4bf07697 /module-template.h
parent8193522d85290df659d8c2e505e8c47f39db9267 (diff)
downloadrsyslog-1d96a98daf4ac4c4ec9e664e328f1aac4bf6af9e.tar.gz
rsyslog-1d96a98daf4ac4c4ec9e664e328f1aac4bf6af9e.tar.xz
rsyslog-1d96a98daf4ac4c4ec9e664e328f1aac4bf6af9e.zip
- added omsr object (objomsr.c, objomsr.h) - template request for output
modules - changed doAction() interface - templates and output string generation for doActon() is now fully
Diffstat (limited to 'module-template.h')
-rw-r--r--module-template.h31
1 files changed, 26 insertions, 5 deletions
diff --git a/module-template.h b/module-template.h
index 2d34893e..470d81d8 100644
--- a/module-template.h
+++ b/module-template.h
@@ -25,6 +25,8 @@
#ifndef MODULE_TEMPLATE_H_INCLUDED
#define MODULE_TEMPLATE_H_INCLUDED 1
+#include "objomsr.h"
+
/* to following macros are used to generate function headers and standard
* functionality. It works as follows (described on the sample case of
* createInstance()):
@@ -89,13 +91,13 @@ static rsRetVal isCompatibleWithFeature(syslogFeature __attribute__((unused)) eF
/* doAction()
*/
#define BEGINdoAction \
-static rsRetVal doAction(selector_t *f, uchar __attribute__((unused)) *pMsg, instanceData __attribute__((unused)) *pData)\
+static rsRetVal doAction(selector_t *f, uchar __attribute__((unused)) **ppString, unsigned __attribute__((unused)) iMsgOpts, instanceData __attribute__((unused)) *pData)\
{\
rsRetVal iRet = RS_RET_OK;
#define CODESTARTdoAction \
assert(f != NULL);\
- assert(pMsg != NULL);
+ assert(ppString != NULL);
#define ENDdoAction \
return iRet;\
@@ -191,10 +193,18 @@ static rsRetVal getWriteFDForSelect(selector_t *f, void *pModData, short *fd)\
* Extra comments:
* try to process a selector action line. Checks if the action
* applies to this module and, if so, processed it. If not, it
- * is left untouched. The driver will then call another module
+ * is left untouched. The driver will then call another module.
+ * On exit, ppModData must point to instance data. Also, a string
+ * request object must be created and filled. A macro is defined
+ * for that.
+ * For the most usual case, we have defined a macro below.
+ * If more than one string is requested, the macro can be used together
+ * with own code that overwrites the entry count. In this case, the
+ * macro must come before the own code. It is recommended to be
+ * placed right after CODESTARTparseSelectorAct.
*/
#define BEGINparseSelectorAct \
-static rsRetVal parseSelectorAct(uchar **pp, selector_t *f, void **ppModData)\
+static rsRetVal parseSelectorAct(uchar **pp, selector_t *f, void **ppModData, omodStringRequest_t **ppOMSR)\
{\
rsRetVal iRet = RS_RET_OK;\
uchar *p;\
@@ -204,13 +214,24 @@ static rsRetVal parseSelectorAct(uchar **pp, selector_t *f, void **ppModData)\
assert(pp != NULL);\
assert(ppModData != NULL);\
assert(f != NULL);\
+ assert(ppOMSR != NULL);\
p = *pp;
+#define CODE_STD_STRING_REQUESTparseSelectorAct(NumStrReqEntries) \
+ if((iRet = OMSRconstruct(ppOMSR, NumStrReqEntries)) != RS_RET_OK)\
+ goto do_abort;\
+
#define ENDparseSelectorAct \
+do_abort:\
if(iRet == RS_RET_OK) {\
*ppModData = pData;\
*pp = p;\
- }\
+ } else {\
+ /* cleanup, we failed */\
+ if(*ppOMSR != NULL)\
+ OMSRdestruct(*ppOMSR);\
+ *ppOMSR = NULL;\
+ }\
return iRet;\
}