Переглянути джерело

core: Add callback to be able to log assign actions.

Victor Seva 12 роки тому
батько
коміт
a2316f35de
2 змінених файлів з 16 додано та 1 видалено
  1. 14 0
      lvalue.c
  2. 2 1
      lvalue.h

+ 14 - 0
lvalue.c

@@ -36,7 +36,16 @@
 #include "dprint.h"
 #include "route.h"
 
+/* callback to log assign actions */
+static log_assign_action_f _log_assign_action = NULL;
 
+/**
+ * @brief set callback function log assign actions
+ */
+void set_log_assign_action_cb(log_assign_action_f f)
+{
+	_log_assign_action = f;
+}
 
 /**
  * @brief eval rve and assign the result to an avp
@@ -406,6 +415,11 @@ int lval_assign(struct run_act_ctx* h, struct sip_msg* msg,
 			rve->fpos.s_line, rve->fpos.s_col,
 			rve->fpos.e_line, rve->fpos.e_col);
 	}
+	else
+	{
+		if(unlikely(_log_assign_action!=NULL))
+			_log_assign_action(msg, lv);
+	}
 	rval_destroy(rv);
 	return ret;
 error:

+ 2 - 1
lvalue.h

@@ -51,7 +51,8 @@ struct lvalue{
 /* lval operators */
 #define EQ_T 254 /* k compatibility */
 
-
+typedef int (*log_assign_action_f)(struct sip_msg* msg, struct lvalue *lv);
+void set_log_assign_action_cb(log_assign_action_f f);
 
 /** eval rve and assign the result to lv
  * lv=eval(rve)