aboutsummaryrefslogtreecommitdiffstats
path: root/perl
diff options
context:
space:
mode:
authorcebka@mailsupport.rambler.ru <cebka@mailsupport.rambler.ru>2008-09-24 18:49:08 +0400
committercebka@mailsupport.rambler.ru <cebka@mailsupport.rambler.ru>2008-09-24 18:49:08 +0400
commit9571811836cf8afe7733f0599976e90e3cbde560 (patch)
tree4ba36c4b8e2e7ff39f22dc59d5e0a0a955a7cc9f /perl
parente117181e298de4ec7a2e5e7a42436c0b69dc1b2e (diff)
downloadrspamd-9571811836cf8afe7733f0599976e90e3cbde560.tar.gz
rspamd-9571811836cf8afe7733f0599976e90e3cbde560.zip
* Add routines to perl api to access new results adding function and getting param function
this allows accessing to modules config from perl modules
Diffstat (limited to 'perl')
-rw-r--r--perl/rspamd.xs38
1 files changed, 38 insertions, 0 deletions
diff --git a/perl/rspamd.xs b/perl/rspamd.xs
index 6bbaaddf1..60c670f6c 100644
--- a/perl/rspamd.xs
+++ b/perl/rspamd.xs
@@ -12,6 +12,7 @@
#include "../config.h"
#include "../main.h"
+#include "../cfg_file.h"
#include "../perl.h"
#include "../mem_pool.h"
@@ -117,6 +118,43 @@ recall_filter (r)
process_filters (r);
void
+insert_result (r, metric, symbol, flag)
+ CODE:
+ struct worker_task *r;
+ char *metric, *symbol;
+ int flag;
+ STRLEN metriclen, symbollen;
+
+ perl_set_session (r);
+ metric = (char *) SvPV (ST(1), metriclen);
+ symbol = (char *) SvPV (ST(2), symbollen);
+ flag = (int) SvIV (ST(3));
+
+ insert_result (r, metric, symbol, flag);
+
+void
+get_module_param (r, modulename, paramname)
+ CODE:
+ struct worker_task *r;
+ char *module, *param, *value;
+ STRLEN modulelen, paramlen;
+
+ dXSTARG;
+ perl_set_session (r);
+ module = (char *) SvPV (ST(1), modulelen);
+ param = (char *) SvPV (ST(2), paramlen);
+
+ value = get_module_opt (r->worker->srv->cfg, module, param);
+ if (value == NULL) {
+ XSRETURN_UNDEF;
+ }
+
+ sv_upgrade(TARG, SVt_PV);
+ sv_setpv(TARG, value);
+
+ ST(0) = TARG;
+
+void
read_memcached_key (r, key, datalen, callback)
CODE:
struct worker_task *r;