Module: sip-router Branch: master Commit: a57d5982e0966b7e21478b0bfb377e0bc93e3097 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a57d5982...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Mon Mar 7 17:10:08 2011 +0100
kex: two new functions to control local debug level
- setdebug(level) - can change the debug level per process - resetdebug() - set back the debug level to the global parameter 'debug' - useful to troubleshoot parts of config file by increasing debug level for a specific process, just for a set of actions
---
modules_k/kex/kex_mod.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/modules_k/kex/kex_mod.c b/modules_k/kex/kex_mod.c index c6b55b4..5a6d845 100644 --- a/modules_k/kex/kex_mod.c +++ b/modules_k/kex/kex_mod.c @@ -46,6 +46,8 @@ MODULE_VERSION
/** module functions */ int w_is_myself(struct sip_msg *msg, char *uri, str *s2); +int w_setdebug(struct sip_msg *msg, char *level, str *s2); +int w_resetdebug(struct sip_msg *msg, char *uri, str *s2);
static int mod_init(void); static int child_init(int rank); @@ -86,6 +88,10 @@ static cmd_export_t cmds[]={ 0, ANY_ROUTE }, {"is_myself", (cmd_function)w_is_myself, 1, fixup_spve_null, 0, ANY_ROUTE }, + {"setdebug", (cmd_function)w_setdebug, 1, fixup_igp_null, + 0, ANY_ROUTE }, + {"resetdebug", (cmd_function)w_resetdebug, 0, 0, + 0, ANY_ROUTE },
{0,0,0,0,0,0} }; @@ -182,3 +188,20 @@ int w_is_myself(struct sip_msg *msg, char *uri, str *s2) return 1; }
+int w_setdebug(struct sip_msg *msg, char *level, str *s2) +{ + int lval=0; + if(fixup_get_ivalue(msg, (gparam_p)level, &lval)!=0) + { + LM_ERR("no debug level value\n"); + return -1; + } + set_local_debug_level(lval); + return 1; +} + +int w_resetdebug(struct sip_msg *msg, char *uri, str *s2) +{ + reset_local_debug_level(); + return 1; +}