00001 /* 00002 * $Id: $ 00003 * 00004 * db_berkeley MI functions 00005 * 00006 * Copyright (C) 2007 Cisco Systems 00007 * 00008 * This file is part of Kamailio, a free SIP server. 00009 * 00010 * Kamailio is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version 00014 * 00015 * Kamailio is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 * 00024 * History: 00025 * -------- 00026 * 2007-11-05 created (wiquan) 00027 */ 00028 00029 00030 #include "../../dprint.h" 00031 #include "../../db/db.h" 00032 #include "db_berkeley.h" 00033 #include "bdb_mi.h" 00034 00035 00036 /* 00037 * MI function to reload db table or env 00038 * expects 1 node: the tablename or dbenv name to reload 00039 */ 00040 struct mi_root* mi_bdb_reload(struct mi_root *cmd, void *param) 00041 { 00042 struct mi_node *node; 00043 str *db_path; 00044 00045 node = cmd->node.kids; 00046 if (node && node->next) 00047 return init_mi_tree( 400, MI_MISSING_PARM_S, MI_MISSING_PARM_LEN); 00048 00049 db_path = &node->value; 00050 00051 if (!db_path || db_path->len == 0) 00052 return init_mi_tree( 400, "bdb_reload missing db arg", 21); 00053 00054 if (bdb_reload(db_path->s) == 0) 00055 { 00056 return init_mi_tree( 200, MI_OK_S, MI_OK_LEN); 00057 } 00058 else 00059 { 00060 return init_mi_tree( 500, "db_berkeley Reload Failed", 26); 00061 } 00062 } 00063
1.5.6