cpl_db.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2001-2003 FhG Fokus
  5. *
  6. * This file is part of Kamailio, a free SIP server.
  7. *
  8. * Kamailio is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version
  12. *
  13. * Kamailio is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. #ifndef _CPL_DB_H
  23. #define _CPL_DB_H
  24. #include "../../lib/srdb1/db.h"
  25. int cpl_db_bind(const str* db_url, const str* db_table);
  26. int cpl_db_init(const str* db_url, const str* db_table);
  27. void cpl_db_close(void);
  28. extern str cpl_username_col;
  29. extern str cpl_domain_col;
  30. extern str cpl_xml_col;
  31. extern str cpl_bin_col;
  32. /* inserts into database a cpl script in XML format(xml) along with its binary
  33. * format (bin)
  34. * Returns: 1 - success
  35. * -1 - error
  36. */
  37. int write_to_db(str *username, str*domain, str *xml, str *bin);
  38. /* fetch from database the binary format of the cpl script for a given user
  39. * Returns: 1 - success
  40. * -1 - error
  41. */
  42. int get_user_script(str *username, str*domain, str *script, str *key);
  43. /* delete from database the entire record for a given user - if a user has no
  44. * script, he will be removed completely from db; users without script are not
  45. * allowed into db ;-)
  46. * Returns: 1 - success
  47. * -1 - error
  48. */
  49. int rmv_from_db(str *username, str *domain);
  50. #endif