bdb_res.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /* $Id$
  2. *
  3. * Copyright (C) 2006-2007 Sippy Software, Inc. <[email protected]>
  4. *
  5. * This file is part of ser, a free SIP server.
  6. *
  7. * ser is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version
  11. *
  12. * For a license to use the ser software under conditions
  13. * other than those described here, or to purchase support for this
  14. * software, please contact iptel.org by e-mail at the following addresses:
  15. * [email protected]
  16. *
  17. * ser is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  25. *
  26. */
  27. #ifndef _BDB_RES_H_
  28. #define _BDB_RES_H_
  29. typedef struct _bdb_con {
  30. DB_ENV *dbenvp; /* Env structure handle */
  31. DB *dbp; /* DB structure handle */
  32. int col_num; /* number of columns */
  33. } bdb_con_t, *bdb_con_p;
  34. #define BDB_CON_DBENV(db_con) (((bdb_con_p)((db_con)->tail))->dbenvp)
  35. #define BDB_CON_DB(db_con) (((bdb_con_p)((db_con)->tail))->dbp)
  36. #define BDB_CON_COL_NUM(db_con) (((bdb_con_p)((db_con)->tail))->col_num)
  37. /* * */
  38. typedef struct _bdb_val_t
  39. {
  40. db_val_t v;
  41. struct _bdb_val_t *next;
  42. } bdb_val_t, *bdb_val_p;
  43. typedef struct _bdb_row
  44. {
  45. DBT key;
  46. DBT data;
  47. str tail;
  48. bdb_val_p fields;
  49. struct _bdb_row *next;
  50. } bdb_row_t, *bdb_row_p;
  51. /* * */
  52. typedef struct _bdb_uval_t
  53. {
  54. int c_idx; /* column index number */
  55. db_val_t v;
  56. struct _bdb_uval_t *next;
  57. } bdb_uval_t, *bdb_uval_p;
  58. typedef struct _bdb_urow
  59. {
  60. bdb_uval_p fields;
  61. } bdb_urow_t, *bdb_urow_p;
  62. /* * */
  63. typedef struct _bdb_sval_t
  64. {
  65. int c_idx; /* column index number */
  66. db_val_t v;
  67. int op;
  68. #define BDB_OP_EQ 0
  69. #define BDB_OP_LT 1
  70. #define BDB_OP_GT 2
  71. #define BDB_OP_LEQ 3
  72. #define BDB_OP_GEQ 4
  73. struct _bdb_sval_t *next;
  74. } bdb_sval_t, *bdb_sval_p;
  75. typedef struct _bdb_srow
  76. {
  77. DBT key;
  78. bdb_sval_p fields;
  79. } bdb_srow_t, *bdb_srow_p;
  80. /* * */
  81. typedef int bdb_rrow_t, *bdb_rrow_p;
  82. /* * */
  83. typedef struct _bdb_column {
  84. str name;
  85. int type;
  86. struct _bdb_column *next;
  87. } bdb_column_t, *bdb_column_p;
  88. typedef struct _bdb_table {
  89. str name;
  90. int col_num; /* number of columns */
  91. bdb_column_p cols;
  92. struct _bdb_table *next;
  93. } bdb_table_t, *bdb_table_p;
  94. #endif