dbcassa_base.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * $Id$
  3. *
  4. * CASSANDRA module interface
  5. *
  6. * Copyright (C) 2012 1&1 Internet AG
  7. *
  8. * This file is part of Kamailio, a free SIP server.
  9. *
  10. * Kamailio is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version
  14. *
  15. * Kamailio is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * History:
  25. * --------
  26. * 2012-01 first version (Anca Vamanu)
  27. */
  28. #ifndef _CASSA_DBASE_H
  29. #define _CASSA_DBASE_H
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #include "../../lib/srdb1/db_pool.h"
  34. #include "../../lib/srdb1/db_row.h"
  35. #include "../../lib/srdb1/db_res.h"
  36. #include "../../lib/srdb1/db_op.h"
  37. extern unsigned int cassa_auto_reconnect;
  38. extern unsigned int cassa_retries;
  39. extern unsigned int cassa_conn_timeout;
  40. extern unsigned int cassa_send_timeout;
  41. extern unsigned int cassa_recv_timeout;
  42. /*
  43. * Open connection
  44. */
  45. void* db_cassa_new_connection(struct db_id* id);
  46. /*
  47. * Free connection
  48. */
  49. void db_cassa_free_connection(struct pool_con* con);
  50. /*
  51. * Do a query
  52. */
  53. int db_cassa_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
  54. const db_val_t* _v, const db_key_t* _c, int _n, int _nc,
  55. const db_key_t _o, db1_res_t** _r);
  56. /*
  57. * Insert a row into table
  58. */
  59. int db_cassa_insert(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v,
  60. int _n);
  61. /*
  62. * Replace a row into table - same as insert for cassandra
  63. */
  64. int db_cassa_replace(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v,
  65. int _n, const int _un, const int _m);
  66. /*
  67. * Delete a row from table
  68. */
  69. int db_cassa_delete(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
  70. const db_val_t* _v, int _n);
  71. /*
  72. * Update a row in table
  73. */
  74. int db_cassa_update(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
  75. const db_val_t* _v, const db_key_t* _uk, const db_val_t* _uv,
  76. int _n, int _un);
  77. int db_cassa_free_result(db1_con_t* _h, db1_res_t* _r);
  78. int db_cassa_raw_query(const db1_con_t* _h, const str* _s, db1_res_t** _r);
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #endif