diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-08-29 12:32:54 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-08-29 12:32:54 +0200 |
commit | df492da1804b14e53a56a3dd6a3b8cc8fb1e2d78 (patch) | |
tree | b200f1e6e11411a9de4a38aff293b4272c5e3685 /action.c | |
parent | eab4df6580f036bc54bb793f6ebc523935bf3eff (diff) | |
download | rsyslog-df492da1804b14e53a56a3dd6a3b8cc8fb1e2d78.tar.gz rsyslog-df492da1804b14e53a56a3dd6a3b8cc8fb1e2d78.tar.xz rsyslog-df492da1804b14e53a56a3dd6a3b8cc8fb1e2d78.zip |
implement ACT_JSON_PASSING
NOTE: this is only compile-tested! For real testing, a module using
that mode is required. Will be done as next steps.
Diffstat (limited to 'action.c')
-rw-r--r-- | action.c | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -98,6 +98,7 @@ #include <strings.h> #include <time.h> #include <errno.h> +#include <json/json.h> #include "dirty.h" #include "template.h" @@ -803,6 +804,7 @@ static rsRetVal prepareDoActionParams(action_t *pAction, batch_obj_t *pElem) { int i; msg_t *pMsg; + struct json_object *json; DEFiRet; ASSERT(pAction != NULL); @@ -824,7 +826,8 @@ static rsRetVal prepareDoActionParams(action_t *pAction, batch_obj_t *pElem) pElem->staticActParams[i] = (void*) pMsg; break; case ACT_JSON_PASSING: - // TODO: implement + CHKiRet(tplToJSON(pAction->ppTpl[i], pMsg, &json)); + pElem->staticActParams[i] = (void*) json; break; default:dbgprintf("software bug/error: unknown pAction->eParamPassing %d in prepareDoActionParams\n", (int) pAction->eParamPassing); @@ -877,7 +880,6 @@ static rsRetVal releaseBatch(action_t *pAction, batch_t *pBatch) break; case ACT_STRING_PASSING: case ACT_MSG_PASSING: - case ACT_JSON_PASSING: /* nothing to do in that case */ /* TODO ... and yet we do something ;) This is considered not * really needed, but I was not bold enough to remove that while @@ -889,6 +891,13 @@ static rsRetVal releaseBatch(action_t *pAction, batch_t *pBatch) ((uchar**)pElem->staticActParams)[j] = NULL; } break; + case ACT_JSON_PASSING: + for(j = 0 ; j < pAction->iNumTpls ; ++j) { + json_object_put((struct json_object*) + pElem->staticActParams[j]); + pElem->staticActParams[j] = NULL; + } + break; } } } @@ -1098,16 +1107,6 @@ finalize_it: RETiRet; } -/* debug aid */ -static void displayBatchState(batch_t *pBatch) -{ - int i; - for(i = 0 ; i < pBatch->nElem ; ++i) { - dbgprintf("XXXXX: displayBatchState2 %p[%d]: %d\n", pBatch, i, pBatch->pElem[i].state); - } -} - - /* submit a batch for actual action processing. * The first nElem elements are processed. This function calls itself * recursively if it needs to handle errors. |