s/bdb/bdb_res.h

00001 /* $Id$
00002  *
00003  * Copyright (C) 2006-2007 Sippy Software, Inc. <sales@sippysoft.com>
00004  *
00005  * This file is part of ser, a free SIP server.
00006  *
00007  * ser is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version
00011  *
00012  * For a license to use the ser software under conditions
00013  * other than those described here, or to purchase support for this
00014  * software, please contact iptel.org by e-mail at the following addresses:
00015  *    info@iptel.org
00016  *
00017  * ser is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  *
00026  */
00027 
00028 
00029 #ifndef _BDB_RES_H_
00030 #define _BDB_RES_H_
00031 
00032 typedef struct _bdb_con {
00033         DB_ENV  *dbenvp;                /* Env structure handle */
00034         DB      *dbp;                   /* DB structure handle */
00035         int     col_num;                /* number of columns */
00036 } bdb_con_t, *bdb_con_p;
00037 
00038 #define BDB_CON_DBENV(db_con) (((bdb_con_p)((db_con)->tail))->dbenvp)
00039 #define BDB_CON_DB(db_con) (((bdb_con_p)((db_con)->tail))->dbp)
00040 #define BDB_CON_COL_NUM(db_con) (((bdb_con_p)((db_con)->tail))->col_num)
00041 
00042 /* * */
00043 
00044 typedef struct _bdb_val_t
00045 {
00046         db_val_t v;
00047         struct _bdb_val_t *next;
00048 } bdb_val_t, *bdb_val_p;
00049 
00050 typedef struct _bdb_row
00051 {
00052         DBT     key;
00053         DBT     data;
00054         str     tail;
00055         bdb_val_p fields;
00056         struct _bdb_row *next;
00057 
00058 } bdb_row_t, *bdb_row_p;
00059 
00060 /* * */
00061 
00062 typedef struct _bdb_uval_t
00063 {
00064         int c_idx;                      /* column index number */
00065         db_val_t v;
00066         struct _bdb_uval_t *next;
00067 } bdb_uval_t, *bdb_uval_p;
00068 
00069 typedef struct _bdb_urow
00070 {
00071         bdb_uval_p fields;
00072 } bdb_urow_t, *bdb_urow_p;
00073 
00074 /* * */
00075 
00076 typedef struct _bdb_sval_t
00077 {
00078         int c_idx;                      /* column index number */
00079         db_val_t v;
00080         int op;
00081 #define BDB_OP_EQ       0
00082 #define BDB_OP_LT       1
00083 #define BDB_OP_GT       2
00084 #define BDB_OP_LEQ      3
00085 #define BDB_OP_GEQ      4
00086         struct _bdb_sval_t *next;
00087 } bdb_sval_t, *bdb_sval_p;
00088 
00089 typedef struct _bdb_srow
00090 {
00091         DBT     key;
00092         bdb_sval_p fields;
00093 } bdb_srow_t, *bdb_srow_p;
00094 
00095 /* * */
00096 
00097 typedef int bdb_rrow_t, *bdb_rrow_p;
00098 
00099 /* * */
00100 
00101 typedef struct _bdb_column {
00102         str name;
00103         int type;
00104         struct _bdb_column *next;
00105 
00106 } bdb_column_t, *bdb_column_p;
00107 
00108 typedef struct _bdb_table {
00109         str     name;
00110         int     col_num;                /* number of columns */
00111         bdb_column_p cols;
00112         struct _bdb_table *next;
00113 } bdb_table_t, *bdb_table_p;
00114 
00115 #endif