dbtext.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * $Id$
  3. *
  4. * DBText module interface
  5. *
  6. * Copyright (C) 2001-2003 FhG Fokus
  7. *
  8. * This file is part of ser, a free SIP server.
  9. *
  10. * ser 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. * For a license to use the ser software under conditions
  16. * other than those described here, or to purchase support for this
  17. * software, please contact iptel.org by e-mail at the following addresses:
  18. * [email protected]
  19. *
  20. * ser is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, write to the Free Software
  27. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  28. */
  29. /**
  30. * DBText module interface
  31. *
  32. * 2003-01-30 created by Daniel
  33. * 2003-03-11 New module interface (janakj)
  34. * 2003-03-16 flags export parameter added (janakj)
  35. *
  36. */
  37. #include <stdio.h>
  38. #include <unistd.h>
  39. #include "../../sr_module.h"
  40. #include "dbtext.h"
  41. #include "dbt_lib.h"
  42. #include "dbt_api.h"
  43. MODULE_VERSION
  44. static int mod_init(void);
  45. static void destroy(void);
  46. /*
  47. * Exported functions
  48. */
  49. static cmd_export_t cmds[] = {
  50. {"db_use_table", (cmd_function)dbt_use_table, 2, 0, 0},
  51. {"db_init", (cmd_function)dbt_init, 1, 0, 0},
  52. {"db_close", (cmd_function)dbt_close, 2, 0, 0},
  53. {"db_query", (cmd_function)dbt_query, 2, 0, 0},
  54. {"db_raw_query", (cmd_function)dbt_raw_query, 2, 0, 0},
  55. {"db_free_result", (cmd_function)dbt_free_query, 2, 0, 0},
  56. {"db_insert", (cmd_function)dbt_insert, 2, 0, 0},
  57. {"db_delete", (cmd_function)dbt_delete, 2, 0, 0},
  58. {"db_update", (cmd_function)dbt_update, 2, 0, 0},
  59. {0, 0, 0, 0, 0}
  60. };
  61. /*
  62. * Exported parameters
  63. */
  64. static param_export_t params[] = {
  65. {0, 0, 0}
  66. };
  67. struct module_exports exports = {
  68. "dbtext",
  69. cmds, /* Exported functions */
  70. 0, /* RPC method */
  71. params, /* Exported parameters */
  72. mod_init, /* module initialization function */
  73. 0, /* response function*/
  74. destroy, /* destroy function */
  75. 0, /* oncancel function */
  76. 0 /* per-child init function */
  77. };
  78. static int mod_init(void)
  79. {
  80. if(dbt_init_cache())
  81. return -1;
  82. /*return make_demo(); */
  83. return 0;
  84. }
  85. static void destroy(void)
  86. {
  87. DBG("DBT:destroy ...\n");
  88. dbt_cache_print(0);
  89. dbt_cache_destroy();
  90. }