pg_uri.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * $Id$
  3. *
  4. * PostgreSQL Database Driver for SER
  5. *
  6. * Portions Copyright (C) 2001-2003 FhG FOKUS
  7. * Copyright (C) 2003 August.Net Services, LLC
  8. * Portions Copyright (C) 2005-2008 iptelorg GmbH
  9. *
  10. * This file is part of SER, a free SIP server.
  11. *
  12. * SER is free software; you can redistribute it and/or modify it under the
  13. * terms of the GNU General Public License as published by the Free Software
  14. * Foundation; either version 2 of the License, or (at your option) any later
  15. * version
  16. *
  17. * For a license to use the ser software under conditions other than those
  18. * described here, or to purchase support for this software, please contact
  19. * iptel.org by e-mail at the following addresses: [email protected]
  20. *
  21. * SER is distributed in the hope that it will be useful, but WITHOUT ANY
  22. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  23. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  24. * details.
  25. *
  26. * You should have received a copy of the GNU General Public License along
  27. * with this program; if not, write to the Free Software Foundation, Inc., 59
  28. * Temple Place, Suite 330, Boston, MA 02111-1307 USA
  29. */
  30. #ifndef _PG_URI_H
  31. #define _PG_URI_H
  32. /** \addtogroup postgres
  33. * @{
  34. */
  35. /** \file
  36. * The implementation of parser parsing postgres://.. URIs.
  37. */
  38. #include "../../lib/srdb2/db_uri.h"
  39. #include "../../lib/srdb2/db_drv.h"
  40. /** PostgreSQL driver specific payload to attach to db_uri structures.
  41. * This is the PostgreSQL specific structure that will be attached
  42. * to generic db_uri structures in the database API in SER. The
  43. * structure contains parsed elements of postgres:// uri.
  44. */
  45. struct pg_uri {
  46. db_drv_t drv;
  47. char* username;
  48. char* password;
  49. char* host;
  50. unsigned short port;
  51. char* database;
  52. };
  53. /** Create a new pg_uri structure and parse the URI in parameter.
  54. * This function builds a new pg_uri structure from the body of
  55. * the generic URI given to it in parameter.
  56. * @param uri A generic db_uri structure.
  57. * @retval 0 on success
  58. * @retval A negative number on error.
  59. */
  60. int pg_uri(db_uri_t* uri);
  61. /** @} */
  62. #endif /* _PG_URI_H */