summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/ruleset.c26
-rw-r--r--runtime/ruleset.h7
2 files changed, 32 insertions, 1 deletions
diff --git a/runtime/ruleset.c b/runtime/ruleset.c
index 57cf6afe..3c4d2eed 100644
--- a/runtime/ruleset.c
+++ b/runtime/ruleset.c
@@ -284,6 +284,30 @@ execStop(batch_t *pBatch, sbool *active)
}
RETiRet;
}
+static rsRetVal
+execCall(struct cnfstmt *stmt, batch_t *pBatch, sbool *active)
+{
+ msg_t *pMsg;
+ int i;
+ DEFiRet;
+ if(stmt->d.s_call.ruleset == NULL) {
+ scriptExec(stmt->d.s_call.stmt, pBatch, active);
+ } else {
+ for(i = 0 ; i < batchNumMsgs(pBatch) ; ++i) {
+ CHKmalloc(pMsg = MsgDup((msg_t*) pBatch->pElem[i].pMsg));
+ DBGPRINTF("CALL: forwarding message %d to async ruleset %p\n",
+ i, stmt->d.s_call.ruleset->pQueue);
+ MsgSetFlowControlType(pMsg, eFLOWCTL_NO_DELAY);
+ MsgSetRuleset(pMsg, stmt->d.s_call.ruleset);
+ /* Note: we intentionally use submitMsg2() here, as we process messages
+ * that were already run through the rate-limiter.
+ */
+ submitMsg2(pMsg);
+ }
+ }
+finalize_it:
+ RETiRet;
+}
/* for details, see scriptExec() header comment! */
// save current filter, evaluate new one
@@ -537,7 +561,7 @@ scriptExec(struct cnfstmt *root, batch_t *pBatch, sbool *active)
execUnset(stmt, pBatch, active);
break;
case S_CALL:
- scriptExec(stmt->d.s_call.stmt, pBatch, active);
+ execCall(stmt, pBatch, active);
break;
case S_IF:
execIf(stmt, pBatch, active);
diff --git a/runtime/ruleset.h b/runtime/ruleset.h
index 8bfd4920..9905b53c 100644
--- a/runtime/ruleset.h
+++ b/runtime/ruleset.h
@@ -90,6 +90,13 @@ rulesetGetName(ruleset_t *pRuleset)
return pRuleset->pszName;
}
+/* returns 1 if the ruleset has a queue associtated, 0 if not */
+static inline int
+rulesetHasQueue(ruleset_t *pRuleset)
+{
+ return pRuleset->pQueue == NULL ? 0 : 1;
+}
+
/* we will most probably convert this module back to traditional C
* calling sequence, so here we go...