siptrace: removed mi command
authorDaniel-Constantin Mierla <miconda@gmail.com>
Mon, 2 Jan 2017 12:41:48 +0000 (13:41 +0100)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Mon, 2 Jan 2017 13:19:43 +0000 (14:19 +0100)
src/modules/siptrace/Makefile
src/modules/siptrace/doc/siptrace_admin.xml
src/modules/siptrace/siptrace.c

index 1377159..67549cb 100644 (file)
@@ -12,6 +12,5 @@ LIBS=
 DEFS+=-DKAMAILIO_MOD_INTERFACE
 
 SERLIBPATH=../../lib
-SER_LIBS+=$(SERLIBPATH)/kmi/kmi
 SER_LIBS+=$(SERLIBPATH)/srdb1/srdb1
 include ../../Makefile.modules
index f41c7f2..f121946 100644 (file)
@@ -10,9 +10,9 @@
 <!-- Module User's Guide -->
 
 <chapter>
-       
+
        <title>&adminguide;</title>
-       
+
        <section>
        <title>Overview</title>
        <para>
@@ -536,43 +536,6 @@ sip_trace("sip:10.1.1.2:5085");
        </section>
 
     <section>
-       <title>MI Commands</title>
-       <section id="siptrace.m.sip_trace">
-               <title>
-               <function moreinfo="none">sip_trace</function>
-               </title>
-               <para>
-
-               </para>
-               <para>
-               Name: <emphasis>sip_trace</emphasis>
-               </para>
-               <para>Parameters: </para>
-               <itemizedlist>
-                       <listitem><para>trace_mode : turns on/off SIP message tracing.
-                       Possible values are:</para>
-                       <itemizedlist>
-                               <listitem><para> on </para></listitem> 
-                               <listitem><para> off </para></listitem>
-                       </itemizedlist>
-                       <para>The parameter is optional - if missing, the command will
-                       return the status of the SIP message tracing (as string 
-                       <quote>on</quote> or <quote>off</quote> ) without changing
-                       anything.</para>
-                       </listitem>
-               </itemizedlist>
-
-               <para>
-               MI FIFO Command Format:
-               </para>
-               <programlisting  format="linespecific">
-               :sip_trace:_reply_fifo_file_
-               trace_mode
-               _empty_line_
-               </programlisting>
-       </section>
-       </section><!-- MI Commands -->
-       <section>
        <title>RPC Commands</title>
        <section id="siptrace.r.siptrace.status">
                <title>
@@ -589,18 +552,27 @@ sip_trace("sip:10.1.1.2:5085");
                        <listitem><para>on or off: turns on/off SIP message tracing..
                        Possible values are:</para>
                        <itemizedlist>
-                               <listitem><para>on</para></listitem> 
+                               <listitem><para>on</para></listitem>
                                <listitem><para>off</para></listitem>
                        </itemizedlist>
                        </listitem>
-                       <listitem><para><quote>check</quote> does not change 
+                       <listitem><para><quote>check</quote> does not change
                        siptrace status, just reports the current status.</para>
                        </listitem>
                </itemizedlist>
-
+               <para>
+               RPC Command Format:
+               </para>
+               <programlisting  format="linespecific">
+...
+&kamcmd; siptrace.status on
+&kamcmd; siptrace.status off
+&kamcmd; siptrace.status check
+...
+               </programlisting>
        </section>
        </section><!-- RPC commands -->
-       
+
        <section>
                <title>Database setup</title>
                <para>
index 806d021..cf7d922 100644 (file)
@@ -38,7 +38,6 @@
 #include "../../core/ip_addr.h"
 #include "../../core/mem/mem.h"
 #include "../../core/mem/shm_mem.h"
-#include "../../lib/kmi/mi.h"
 #include "../../core/rpc.h"
 #include "../../core/rpc_lookup.h"
 #include "../../lib/srdb1/db.h"
@@ -112,8 +111,6 @@ int siptrace_net_data_send(void *data);
 static int _siptrace_mode = 0;
 
 
-static struct mi_root* sip_trace_mi(struct mi_root* cmd, void* param );
-
 static str db_url             = str_init(DEFAULT_DB_URL);
 static str siptrace_table     = str_init("sip_trace");
 static str date_column        = str_init("time_stamp");  /* 00 */
@@ -211,24 +208,15 @@ static param_export_t params[] = {
        {"trace_sl_acks",      INT_PARAM, &trace_sl_acks        },
        {"xheaders_write",     INT_PARAM, &xheaders_write       },
        {"xheaders_read",      INT_PARAM, &xheaders_read        },
-       {"hep_mode_on",        INT_PARAM, &hep_mode_on          },       
+       {"hep_mode_on",        INT_PARAM, &hep_mode_on          },
        {"force_send_sock",    PARAM_STR, &force_send_sock_str  },
        {"hep_version",        INT_PARAM, &hep_version          },
-       {"hep_capture_id",     INT_PARAM, &hep_capture_id       },              
+       {"hep_capture_id",     INT_PARAM, &hep_capture_id       },
        {"trace_delayed",      INT_PARAM, &trace_delayed        },
        {"trace_mode",         PARAM_INT, &_siptrace_mode       },
        {0, 0, 0}
 };
 
-/*! \brief
- * MI commands
- */
-static mi_export_t mi_cmds[] = {
-       { "sip_trace", sip_trace_mi,   0,  0,  0 },
-       { 0, 0, 0, 0, 0}
-};
-
-
 #ifdef STATISTICS
 stat_var* siptrace_req;
 stat_var* siptrace_rpl;
@@ -242,7 +230,7 @@ stat_export_t siptrace_stats[] = {
 
 /*! \brief module exports */
 struct module_exports exports = {
-       "siptrace", 
+       "siptrace",
        DEFAULT_DLFLAGS, /*!< dlopen flags */
        cmds,       /*!< Exported functions */
        params,     /*!< Exported parameters */
@@ -251,7 +239,7 @@ struct module_exports exports = {
 #else
        0,          /*!< exported statistics */
 #endif
-       mi_cmds,    /*!< exported MI functions */
+       0,    /*!< exported MI functions */
        0,          /*!< exported pseudo-variables */
        0,          /*!< extra processes */
        mod_init,   /*!< module initialization function */
@@ -276,12 +264,7 @@ static int mod_init(void)
        }
 #endif
 
-       if(register_mi_mod(exports.name, mi_cmds)!=0)
-       {
-               LM_ERR("failed to register MI commands\n");
-               return -1;
-       }
-       if(siptrace_init_rpc() != 0) 
+       if(siptrace_init_rpc() != 0)
        {
                LM_ERR("failed to register RPC commands\n");
                return -1;
@@ -1535,53 +1518,6 @@ static void trace_sl_onreply_out(sl_cbp_t *slcbp)
 }
 
 
-/*! \brief
- * MI Sip_trace command
- *
- * MI command format:
- * name: sip_trace
- * attribute: name=none, value=[on|off]
- */
-static struct mi_root* sip_trace_mi(struct mi_root* cmd_tree, void* param )
-{
-       struct mi_node* node;
-
-       struct mi_node *rpl; 
-       struct mi_root *rpl_tree ; 
-
-       node = cmd_tree->node.kids;
-       if(node == NULL) {
-               rpl_tree = init_mi_tree( 200, MI_SSTR(MI_OK));
-               if (rpl_tree == 0)
-                       return 0;
-               rpl = &rpl_tree->node;
-
-               if (*trace_on_flag == 0 ) {
-                       node = add_mi_node_child(rpl,0,0,0,MI_SSTR("off"));
-               } else if (*trace_on_flag == 1) {
-                       node = add_mi_node_child(rpl,0,0,0,MI_SSTR("on"));
-               }
-               return rpl_tree ;
-       }
-       if(trace_on_flag==NULL)
-               return init_mi_tree( 500, MI_SSTR(MI_INTERNAL_ERR));
-
-       if ( node->value.len==2 && (node->value.s[0]=='o'
-                               || node->value.s[0]=='O') &&
-                       (node->value.s[1]=='n'|| node->value.s[1]=='N')) {
-               *trace_on_flag = 1;
-               return init_mi_tree( 200, MI_SSTR(MI_OK));
-       } else if ( node->value.len==3 && (node->value.s[0]=='o'
-                               || node->value.s[0]=='O')
-                       && (node->value.s[1]=='f'|| node->value.s[1]=='F')
-                       && (node->value.s[2]=='f'|| node->value.s[2]=='F')) {
-               *trace_on_flag = 0;
-               return init_mi_tree( 200, MI_SSTR(MI_OK));
-       } else {
-               return init_mi_tree( 400, MI_SSTR(MI_BAD_PARM));
-       }
-}
-
 static int trace_send_duplicate(char *buf, int len, struct dest_info *dst2)
 {
        struct dest_info dst;
@@ -2043,7 +1979,7 @@ static void siptrace_rpc_status (rpc_t* rpc, void* c) {
        if (strncasecmp(status.s, "check", strlen("check")) == 0) {
                rpc->rpl_printf(c, *trace_on_flag ? "Enabled" : "Disabled");
                return;
-       } 
+       }
        rpc->fault(c, 500, "Bad parameter (on, off or check)");
        return;
 }