Module: kamailio
Branch: master
Commit: 7f034e8bac8f56e91a4a0c56c21b91f9a8f8657a
URL:
https://github.com/kamailio/kamailio/commit/7f034e8bac8f56e91a4a0c56c21b91f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-05-26T06:08:22+02:00
debugger: exported pv dump function to kemi framework
---
Modified: src/modules/debugger/debugger_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/7f034e8bac8f56e91a4a0c56c21b91f…
Patch:
https://github.com/kamailio/kamailio/commit/7f034e8bac8f56e91a4a0c56c21b91f…
---
diff --git a/src/modules/debugger/debugger_mod.c b/src/modules/debugger/debugger_mod.c
index 845e262f14..bbbd535aef 100644
--- a/src/modules/debugger/debugger_mod.c
+++ b/src/modules/debugger/debugger_mod.c
@@ -34,6 +34,7 @@
#include "../../core/shm_init.h"
#include "../../core/script_cb.h"
#include "../../core/msg_translator.h"
+#include "../../core/kemi.h"
#include "debugger_api.h"
#include "debugger_config.h"
@@ -590,3 +591,50 @@ static int w_dbg_sip_msg(struct sip_msg* msg, char *level, char
*facility)
return 1;
}
+
+/**
+ * dump pv_cache contents as json
+ */
+static int ki_dbg_pv_dump(sip_msg_t* msg, char* mask, char* level)
+{
+ dbg_dump_json(msg, DBG_DP_ALL, DBG_DP_ALL);
+ return 1;
+}
+
+/**
+ * dump pv_cache contents as json
+ */
+static int ki_dbg_pv_dump_ex(sip_msg_t* msg, int mask, int level)
+{
+ dbg_dump_json(msg, (unsigned int)mask, level);
+ return 1;
+}
+
+/**
+ *
+ */
+/* clang-format off */
+static sr_kemi_t sr_kemi_debugger_exports[] = {
+ { str_init("debugger"), str_init("dbg_pv_dump"),
+ SR_KEMIP_INT, ki_dbg_pv_dump,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("debugger"), str_init("dbg_pv_dump_ex"),
+ SR_KEMIP_INT, ki_dbg_pv_dump,
+ { SR_KEMIP_INT, SR_KEMIP_INT, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+
+ { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
+};
+/* clang-format on */
+
+/**
+ *
+ */
+int mod_register(char *path, int *dlflags, void *p1, void *p2)
+{
+ sr_kemi_modules_add(sr_kemi_debugger_exports);
+ return 0;
+}