db_userblacklist.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*!
  2. * \file
  3. * \ingroup db
  4. * \brief Database support for modules.
  5. *
  6. * Database support functions for modules.
  7. *
  8. * @cond
  9. * WARNING:
  10. * This file was autogenerated from the XML source file
  11. * ../../modules/userblacklist/kamailio-userblacklist.xml.
  12. * It can be regenerated by running 'make modules' in the db/schema
  13. * directory of the source code. You need to have xsltproc and
  14. * docbook-xsl stylesheets installed.
  15. * ALL CHANGES DONE HERE WILL BE LOST IF THE FILE IS REGENERATED
  16. * @endcond
  17. */
  18. #ifndef db_userblacklist_h
  19. #define db_userblacklist_h
  20. /* necessary includes */
  21. #include "../../lib/srdb1/db.h"
  22. #include "../../str.h"
  23. #include "../../ut.h"
  24. #include <string.h>
  25. /* database variables */
  26. extern str userblacklist_db_url;
  27. extern db1_con_t * userblacklist_dbh;
  28. extern db_func_t userblacklist_dbf;
  29. #define userblacklist_DB_URL { "db_url", PARAM_STR, &userblacklist_db_url },
  30. #define userblacklist_DB_TABLE { "userblacklist_table", PARAM_STR, &userblacklist_table },
  31. extern str userblacklist_table;
  32. /* column names */
  33. extern str userblacklist_id_col;
  34. extern str userblacklist_username_col;
  35. extern str userblacklist_domain_col;
  36. extern str userblacklist_prefix_col;
  37. extern str userblacklist_whitelist_col;
  38. #define userblacklist_DB_COLS \
  39. { "userblacklist_id_col", PARAM_STR, &userblacklist_id_col }, \
  40. { "userblacklist_username_col", PARAM_STR, &userblacklist_username_col }, \
  41. { "userblacklist_domain_col", PARAM_STR, &userblacklist_domain_col }, \
  42. { "userblacklist_prefix_col", PARAM_STR, &userblacklist_prefix_col }, \
  43. { "userblacklist_whitelist_col", PARAM_STR, &userblacklist_whitelist_col }, \
  44. /* table version */
  45. extern const unsigned int userblacklist_version;
  46. #define globalblacklist_DB_TABLE { "globalblacklist_table", PARAM_STR, &globalblacklist_table },
  47. extern str globalblacklist_table;
  48. /* column names */
  49. extern str globalblacklist_id_col;
  50. extern str globalblacklist_prefix_col;
  51. extern str globalblacklist_whitelist_col;
  52. extern str globalblacklist_description_col;
  53. #define globalblacklist_DB_COLS \
  54. { "globalblacklist_id_col", PARAM_STR, &globalblacklist_id_col }, \
  55. { "globalblacklist_prefix_col", PARAM_STR, &globalblacklist_prefix_col }, \
  56. { "globalblacklist_whitelist_col", PARAM_STR, &globalblacklist_whitelist_col }, \
  57. { "globalblacklist_description_col", PARAM_STR, &globalblacklist_description_col }, \
  58. /* table version */
  59. extern const unsigned int globalblacklist_version;
  60. /*
  61. * Closes the DB connection.
  62. */
  63. void userblacklist_db_close(void);
  64. /*!
  65. * Initialises the DB API, check the table version and closes the connection.
  66. * This should be called from the mod_init function.
  67. *
  68. * \return 0 means ok, -1 means an error occured.
  69. */
  70. int userblacklist_db_init(void);
  71. /*!
  72. * Initialize the DB connection without checking the table version and DB URL.
  73. * This should be called from child_init. An already existing database
  74. * connection will be closed, and a new one created.
  75. *
  76. * \return 0 means ok, -1 means an error occured.
  77. */
  78. int userblacklist_db_open(void);
  79. #endif