dbcassa_base.h

00001 /*
00002  * $Id$
00003  *
00004  * CASSANDRA module interface
00005  *
00006  * Copyright (C) 2012 1&1 Internet AG
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  * 2012-01  first version (Anca Vamanu)
00027  */
00028 
00029 #ifndef _CASSA_DBASE_H
00030 #define _CASSA_DBASE_H
00031 
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 
00038 #include "../../lib/srdb1/db_pool.h"
00039 #include "../../lib/srdb1/db_row.h"
00040 #include "../../lib/srdb1/db_res.h"
00041 #include "../../lib/srdb1/db_op.h"
00042 
00043 extern unsigned int cassa_auto_reconnect;
00044 extern unsigned int cassa_retries;
00045 extern unsigned int cassa_conn_timeout;
00046 extern unsigned int cassa_send_timeout;
00047 extern unsigned int cassa_recv_timeout;
00048 
00049 /*
00050  * Open connection
00051  */
00052 void* db_cassa_new_connection(struct db_id* id);
00053 
00054 /*
00055  * Free connection
00056  */
00057 void db_cassa_free_connection(struct pool_con* con);
00058 
00059 
00060 /*
00061  * Do a query
00062  */
00063 int db_cassa_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
00064                 const db_val_t* _v, const db_key_t* _c, int _n, int _nc,
00065                 const db_key_t _o, db1_res_t** _r);
00066 
00067 /*
00068  * Insert a row into table
00069  */
00070 int db_cassa_insert(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v,
00071                 int _n);
00072 
00073 
00074 /*
00075  * Delete a row from table
00076  */
00077 int db_cassa_delete(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
00078                 const db_val_t* _v, int _n);
00079 
00080 
00081 /*
00082  * Update a row in table
00083  */
00084 int db_cassa_update(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
00085                 const db_val_t* _v, const db_key_t* _uk, const db_val_t* _uv,
00086                 int _n, int _un);
00087 
00088 int db_cassa_free_result(db1_con_t* _h, db1_res_t* _r);
00089 
00090 #ifdef __cplusplus
00091 }
00092 #endif
00093 
00094 
00095 #endif