modules/lcr/mi.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "lcr_mod.h"
00031 #include "../../dprint.h"
00032 #include "../../db/db.h"
00033 #include "mi.h"
00034
00035
00036
00037
00038
00039 struct mi_root* mi_lcr_reload(struct mi_root* cmd_tree, void* param)
00040 {
00041 lock_get(reload_lock);
00042 if (reload_gws_and_lcrs() == 1) {
00043 lock_release(reload_lock);
00044 return init_mi_tree( 200, MI_OK_S, MI_OK_LEN);
00045 } else {
00046 lock_release(reload_lock);
00047 return init_mi_tree( 400, "Reload of gateways failed", 25);
00048 }
00049 }
00050
00051
00052
00053
00054
00055 struct mi_root* mi_lcr_gw_dump(struct mi_root* cmd_tree, void* param)
00056 {
00057 struct mi_root* rpl_tree = NULL;
00058
00059 rpl_tree = init_mi_tree(200, MI_OK_S, MI_OK_LEN);
00060 if (rpl_tree == 0)
00061 return 0;
00062
00063 if (mi_print_gws(&rpl_tree->node ) < 0) {
00064 LM_ERR("failed to add node\n");
00065 free_mi_tree(rpl_tree);
00066 return 0;
00067 }
00068
00069 return rpl_tree;
00070 }
00071
00072
00073
00074
00075 struct mi_root* mi_lcr_lcr_dump(struct mi_root* cmd_tree, void* param)
00076 {
00077 struct mi_root* rpl_tree = NULL;
00078
00079 rpl_tree = init_mi_tree( 200, MI_OK_S, MI_OK_LEN);
00080 if (rpl_tree == 0)
00081 return 0;
00082
00083 if (mi_print_lcrs(&rpl_tree->node) < 0) {
00084 LM_ERR("failed to add node\n");
00085 free_mi_tree(rpl_tree);
00086 return 0;
00087 }
00088
00089 return rpl_tree;
00090 }