[sr-dev] git:master: core: store current executed cfg action in a global variable

Daniel-Constantin Mierla miconda at gmail.com
Mon Sep 16 09:54:43 CEST 2013


Module: sip-router
Branch: master
Commit: 4294b7bf3b67f1405869e865c171e268e60d5ee7
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4294b7bf3b67f1405869e865c171e268e60d5ee7

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Sun Sep 15 22:35:38 2013 +0200

core: store current executed cfg action in a global variable

- can be retrieved by module to access name of config file and the line

---

 action.c |   10 ++++++++++
 action.h |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/action.c b/action.c
index d9a7f2c..72f4fe9 100644
--- a/action.c
+++ b/action.c
@@ -111,6 +111,14 @@
 int _last_returned_code  = 0;
 struct onsend_info* p_onsend=0; /* onsend route send info */
 
+/* current action executed from config file */
+static cfg_action_t *_cfg_crt_action = 0;
+
+/* return currect action executed from config file */
+cfg_action_t *get_cfg_crt_action(void)
+{
+	return _cfg_crt_action;
+}
 
 
 /* handle the exit code of a module function call.
@@ -1572,7 +1580,9 @@ int run_actions(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 	for (t=a; t!=0; t=t->next){
 		if(unlikely(cfg_get(core, core_cfg, latency_limit_action)>0))
 			ms = TICKS_TO_MS(get_ticks_raw());
+		_cfg_crt_action = t;
 		ret=do_action(h, t, msg);
+		_cfg_crt_action = 0;
 		if(unlikely(cfg_get(core, core_cfg, latency_limit_action)>0)) {
 			ms = TICKS_TO_MS(get_ticks_raw()) - ms;
 			if(ms >= cfg_get(core, core_cfg, latency_limit_action)) {
diff --git a/action.h b/action.h
index a2a5395..d715a65 100644
--- a/action.h
+++ b/action.h
@@ -68,6 +68,7 @@ int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
 
 int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c);
 
+cfg_action_t *get_cfg_crt_action(void);
 
 #ifdef USE_LONGJMP
 int run_actions_safe(struct run_act_ctx* c, struct action* a,




More information about the sr-dev mailing list