modules_s/cpl-c/cpl_db.h

00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2001-2003 FhG Fokus
00005  *
00006  * This file is part of ser, a free SIP server.
00007  *
00008  * ser 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  * For a license to use the ser software under conditions
00014  * other than those described here, or to purchase support for this
00015  * software, please contact iptel.org by e-mail at the following addresses:
00016  *    info@iptel.org
00017  *
00018  * ser is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  */
00027 
00028 #ifndef _CPL_DB_H
00029 #define _CPL_DB_H
00030 
00031 #include "../../lib/srdb2/db.h"
00032 
00033 
00034 int cpl_db_bind(char* db_url);
00035 int cpl_db_init(char* db_url, char* db_table);
00036 void cpl_db_close();
00037 
00038 
00039 /* inserts into database a cpl script in XML format(xml) along with its binary
00040  * format (bin)
00041  * Returns:  1 - success
00042  *          -1 - error
00043  */
00044 int write_to_db( char *usr, str *xml, str *bin);
00045 
00046 
00047 /* fetch from database the binary format of the cpl script for a given user
00048  * Returns:  1 - success
00049  *          -1 - error
00050  */
00051 int get_user_script(str *user, str *script, int bin);
00052 
00053 
00054 /* delete from database the entire record for a given user - if a user has no
00055  * script, he will be removed completely from db; users without script are not
00056  * allowed into db ;-)
00057  * Returns:  1 - success
00058  *          -1 - error
00059  */
00060 int rmv_from_db(char *usr);
00061 
00062 
00063 #endif