my_con.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2001-2003 FhG Fokus
  5. * Copyright (C) 2006-2007 iptelorg GmbH
  6. *
  7. * This file is part of ser, a free SIP server.
  8. *
  9. * ser is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version
  13. *
  14. * For a license to use the ser software under conditions
  15. * other than those described here, or to purchase support for this
  16. * software, please contact iptel.org by e-mail at the following addresses:
  17. * [email protected]
  18. *
  19. * ser is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  27. */
  28. #ifndef _MY_CON_H
  29. #define _MY_CON_H 1
  30. #include "../../lib/srdb2/db_pool.h"
  31. #include "../../lib/srdb2/db_con.h"
  32. #include "../../lib/srdb2/db_uri.h"
  33. #include <time.h>
  34. #include <mysql/mysql.h>
  35. enum my_con_flags {
  36. MY_CONNECTED = 1
  37. };
  38. typedef struct my_con {
  39. /* Generic part of the structure */
  40. db_pool_entry_t gen;
  41. MYSQL* con;
  42. unsigned int flags;
  43. /* We keep the number of connection resets in this variable, this
  44. * variable is incremented each time the module performs a disconnect
  45. * on the connection. This is used by my_cmd related functions to
  46. * check if a pre-compiled command needs to be uploaded to the server
  47. * before executing them.
  48. */
  49. unsigned int resets;
  50. } my_con_t;
  51. /*
  52. * Create a new connection structure,
  53. * open the MySQL connection and set reference count to 1
  54. */
  55. int my_con(db_con_t* con);
  56. int my_con_connect(db_con_t* con);
  57. void my_con_disconnect(db_con_t* con);
  58. #endif /* _MY_CON_H */