Skip to content

Commit

Permalink
matrix: removed mi command
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Dec 30, 2016
1 parent 0a281a4 commit 2e54c3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 46 deletions.
1 change: 0 additions & 1 deletion src/modules/matrix/Makefile
Expand Up @@ -8,6 +8,5 @@ LIBS=
DEFS+=-DKAMAILIO_MOD_INTERFACE

SERLIBPATH=../../lib
SER_LIBS+=$(SERLIBPATH)/kmi/kmi
SER_LIBS+=$(SERLIBPATH)/srdb1/srdb1
include ../../Makefile.modules
51 changes: 6 additions & 45 deletions src/modules/matrix/matrix.c
Expand Up @@ -22,7 +22,6 @@

#include "../../core/mem/shm_mem.h"
#include "../../core/sr_module.h"
#include "../../lib/kmi/mi.h"
#include "../../core/mem/mem.h"
#include "../../core/usr_avp.h"
#include "../../core/locking.h"
Expand Down Expand Up @@ -84,14 +83,8 @@ static int lookup_matrix(struct sip_msg *msg, struct multiparam_t *_first, struc
/* ---- module init functions: */
static int mod_init(void);
static int child_init(int rank);
static int mi_child_init(void);
static void mod_destroy(void);

/* --- fifo functions */
struct mi_root * mi_reload_matrix(struct mi_root* cmd, void* param); /* usage: kamctl fifo reload_matrix */




static cmd_export_t cmds[]={
{ "matrix", (cmd_function)lookup_matrix, 3, matrix_fixup, 0, REQUEST_ROUTE | FAILURE_ROUTE },
Expand All @@ -111,22 +104,13 @@ static param_export_t params[] = {



/* Exported MI functions */
static mi_export_t mi_cmds[] = {
{ "reload_matrix", mi_reload_matrix, MI_NO_INPUT_FLAG, 0, mi_child_init },
{ 0, 0, 0, 0, 0}
};




struct module_exports exports= {
"matrix",
DEFAULT_DLFLAGS,
cmds,
params,
0,
mi_cmds,
0,
0,
0,
mod_init,
Expand Down Expand Up @@ -535,24 +519,16 @@ static void destroy_shmlock(void)




struct mi_root * mi_reload_matrix(struct mi_root* cmd, void* param)
{
struct mi_root * tmp = NULL;
if(db_reload_matrix() >= 0) {
tmp = init_mi_tree( 200, MI_OK_S, MI_OK_LEN);
} else {
tmp = init_mi_tree( 500, "cannot reload matrix", 24);
}

return tmp;
}

static void matrix_rpc_reload(rpc_t* rpc, void* c)
{
if (matrix_db_open() != 0) {
rpc->fault(c, 500, "Failed to connect to db");
return;
}
if(db_reload_matrix() < 0) {
rpc->fault(c, 500, "Reload failed");
}
matrix_db_close();
}

static const char *matrix_rpc_reload_doc[2] = {
Expand Down Expand Up @@ -609,10 +585,6 @@ static void destroy_matrix(void)

static int mod_init(void)
{
if(register_mi_mod(exports.name, mi_cmds)!=0) {
LM_ERR("failed to register MI commands\n");
return -1;
}
if(matrix_rpc_init()<0) {
LM_ERR("failed to init RPC commands");
return -1;
Expand All @@ -628,7 +600,6 @@ static int mod_init(void)




static int child_init(int rank)
{
if(rank==PROC_INIT || rank==PROC_TCP_MAIN)
Expand All @@ -639,16 +610,6 @@ static int child_init(int rank)




static int mi_child_init(void)
{
if (matrix_db_open() != 0) return -1;
return 0;
}




static void mod_destroy(void)
{
destroy_matrix();
Expand Down

0 comments on commit 2e54c3d

Please sign in to comment.