6 * Copyright (C) 2006 Voice Sistem SRL
7 * Copyright (C) 2012 Juha Heinanen
9 * This file is part of Kamailio, a free SIP server.
11 * Kamailio is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version
16 * Kamailio is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 * 2006-10-05 created (bogdan)
31 #include "../../dprint.h"
32 #include "../../lib/srdb1/db.h"
33 #include "domain_mod.h"
40 * MI function to reload domain table
42 struct mi_root* mi_domain_reload(struct mi_root *cmd_tree, void *param)
44 lock_get(reload_lock);
45 if (reload_tables() == 1) {
46 lock_release(reload_lock);
47 return init_mi_tree( 200, MI_OK_S, MI_OK_LEN);
49 lock_release(reload_lock);
50 return init_mi_tree( 500, "Domain table reload failed", 26);
56 * MI function to print domains from current hash table
58 struct mi_root* mi_domain_dump(struct mi_root *cmd_tree, void *param)
60 struct mi_root* rpl_tree;
62 rpl_tree = init_mi_tree( 200, MI_OK_S, MI_OK_LEN);
63 if (rpl_tree == NULL) return 0;
65 if(hash_table_mi_print(*hash_table, &rpl_tree->node) < 0) {
66 LM_ERR("failed to add node\n");
67 free_mi_tree(rpl_tree);