00001 /* 00002 * $Id: cpl_db.h 5003 2008-09-26 11:01:51Z henningw $ 00003 * 00004 * Copyright (C) 2001-2003 FhG Fokus 00005 * 00006 * This file is part of Kamailio, a free SIP server. 00007 * 00008 * Kamailio is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version 00012 * 00013 * Kamailio is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 */ 00022 00023 #ifndef _CPL_DB_H 00024 #define _CPL_DB_H 00025 00026 #include "../../db/db.h" 00027 00028 00029 int cpl_db_bind(const str* db_url, const str* db_table); 00030 int cpl_db_init(const str* db_url, const str* db_table); 00031 void cpl_db_close(void); 00032 00033 extern str cpl_username_col; 00034 extern str cpl_domain_col; 00035 extern str cpl_xml_col; 00036 extern str cpl_bin_col; 00037 00038 /* inserts into database a cpl script in XML format(xml) along with its binary 00039 * format (bin) 00040 * Returns: 1 - success 00041 * -1 - error 00042 */ 00043 int write_to_db(str *username, str*domain, str *xml, str *bin); 00044 00045 00046 /* fetch from database the binary format of the cpl script for a given user 00047 * Returns: 1 - success 00048 * -1 - error 00049 */ 00050 int get_user_script(str *username, str*domain, str *script, str *key); 00051 00052 00053 /* delete from database the entire record for a given user - if a user has no 00054 * script, he will be removed completely from db; users without script are not 00055 * allowed into db ;-) 00056 * Returns: 1 - success 00057 * -1 - error 00058 */ 00059 int rmv_from_db(str *username, str *domain); 00060 00061 00062 #endif
1.5.6