my_con.h 1.7 KB

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