Module: kamailio
Branch: master
Commit: 144b3c54e4fc23e95e5601e38165defa7c377ba8
URL:
https://github.com/kamailio/kamailio/commit/144b3c54e4fc23e95e5601e38165def…
Author: Stefan Mititelu <stefan.mititelu(a)1and1.ro>
Committer: Stefan Mititelu <stefan.mititelu(a)1and1.ro>
Date: 2016-01-05T14:37:34+02:00
debugger: rpc module level/facility getters
Add kamcmd rpc module level/facility getters.
---
Modified: modules/debugger/debugger_api.c
---
Diff:
https://github.com/kamailio/kamailio/commit/144b3c54e4fc23e95e5601e38165def…
Patch:
https://github.com/kamailio/kamailio/commit/144b3c54e4fc23e95e5601e38165def…
---
diff --git a/modules/debugger/debugger_api.c b/modules/debugger/debugger_api.c
index 0e28b54..566be68 100644
--- a/modules/debugger/debugger_api.c
+++ b/modules/debugger/debugger_api.c
@@ -1039,6 +1039,55 @@ static void dbg_rpc_set_mod_facility(rpc_t* rpc, void* ctx) {
/**
*
*/
+static const char* dbg_rpc_get_mod_level_doc[2] = {
+ "Get module log level",
+ 0
+};
+
+static void dbg_rpc_get_mod_level(rpc_t* rpc, void* ctx){
+ int l;
+ str value = {0,0};
+
+ if (rpc->scan(ctx, "S", &value) < 1)
+ {
+ rpc->fault(ctx, 500, "invalid parameters");
+ return;
+ }
+
+ l = get_debug_level(value.s, value.len);
+
+ rpc->add(ctx, "d", l);
+}
+
+/**
+ *
+ */
+static const char* dbg_rpc_get_mod_facility_doc[2] = {
+ "Get module log facility",
+ 0
+};
+
+static void dbg_rpc_get_mod_facility(rpc_t* rpc, void* ctx) {
+ int fl;
+ str value = {0, 0};
+ str facility = {0, 0};
+
+ if (rpc->scan(ctx, "S", &value) < 1)
+ {
+ rpc->fault(ctx, 500, "invalid parameters");
+ return;
+ }
+
+ fl = get_debug_facility(value.s, value.len);
+ facility.s = facility2str(fl, &facility.len);
+
+ rpc->add(ctx, "S", &facility);
+}
+
+
+/**
+ *
+ */
static const char* dbg_rpc_reset_msgid_doc[2] = {
"Reset msgid on all process",
0
@@ -1078,6 +1127,8 @@ rpc_export_t dbg_rpc[] = {
{"dbg.trace", dbg_rpc_trace, dbg_rpc_trace_doc, 0},
{"dbg.set_mod_level", dbg_rpc_set_mod_level, dbg_rpc_set_mod_level_doc, 0},
{"dbg.set_mod_facility", dbg_rpc_set_mod_facility,
dbg_rpc_set_mod_facility_doc, 0},
+ {"dbg.get_mod_level", dbg_rpc_get_mod_level, dbg_rpc_get_mod_level_doc, 0},
+ {"dbg.get_mod_facility", dbg_rpc_get_mod_facility,
dbg_rpc_get_mod_facility_doc, 0},
{"dbg.reset_msgid", dbg_rpc_reset_msgid, dbg_rpc_reset_msgid_doc, 0},
{0, 0, 0, 0}
};