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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date:   Mon May 16 17:27:07 2011 +0200

core: added rpc command core.psx

- similar to core.ps but prints the details in RPC structure along with
  process index, like:

sercmd> core.psx
{
        IDX: 0
        PID: 73408
        DSC: attendant
}
{
        IDX: 1
        PID: 73409
        DSC: udp receiver child=0 sock=127.0.0.1:5060
}

---

 core_cmd.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/core_cmd.c b/core_cmd.c
index 848970a..c023b59 100644
--- a/core_cmd.c
+++ b/core_cmd.c
@@ -412,6 +412,27 @@ static void core_ps(rpc_t* rpc, void* c)
        }
 }
 
+static const char* core_psx_doc[] = {
+       "Returns the detailed description of running SER processes.",
+               /* Documentation string */
+       0       /* Method signature(s) */
+};
+
+
+static void core_psx(rpc_t* rpc, void* c)
+{
+       int p;
+       void *handle;
+
+       for (p=0; p<*process_count;p++) {
+               rpc->add(c, "{", &handle);
+               rpc->struct_add(handle, "dds",
+                               "IDX", p,
+                               "PID", pt[p].pid,
+                               "DSC", pt[p].desc);
+       }
+}
+
 
 static const char* core_pwd_doc[] = {
        "Returns the working directory of SER server.",    /* Documentation 
string */
@@ -889,6 +910,7 @@ static rpc_export_t core_rpc_methods[] = {
                0        },
        {"core.uptime",            core_uptime,            core_uptime_doc,     
       0        },
        {"core.ps",                core_ps,                core_ps_doc,         
       RET_ARRAY},
+       {"core.psx",               core_psx,               core_psx_doc,        
        0},
        {"core.pwd",               core_pwd,               core_pwd_doc,        
       RET_ARRAY},
        {"core.arg",               core_arg,               core_arg_doc,        
       RET_ARRAY},
        {"core.kill",              core_kill,              core_kill_doc,       
       0        },


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to