group.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. * History:
  23. * --------
  24. * 2003-02-25 - created by janakj
  25. */
  26. /**
  27. * \file
  28. * \brief Group membership module
  29. * \ingroup group
  30. * - Module: \ref group
  31. */
  32. #ifndef GROUP_H
  33. #define GROUP_H
  34. #include "../../parser/msg_parser.h"
  35. #include "../../pvar.h"
  36. #include "../../usr_avp.h"
  37. typedef struct _group_check
  38. {
  39. int id;
  40. pv_spec_t sp;
  41. } group_check_t, *group_check_p;
  42. /*!
  43. * \brief Extract the username and domain from the SIP message
  44. *
  45. * Set the username and domain depending on the value of the SIP
  46. * message and the group check structure.
  47. * \param msg SIP message
  48. * \param gcp group check structure
  49. * \param username stored username
  50. * \param domain stored domain
  51. * \return 0 on success, -1 on failure
  52. */
  53. int get_username_domain(struct sip_msg *msg, group_check_p gcp,
  54. str *username, str *domain);
  55. /*!
  56. * \brief Check if username in specified header field is in a table
  57. * \param _msg SIP message
  58. * \param _hf Header field
  59. * \param _grp checked table
  60. * \return 1 on success, negative on failure
  61. */
  62. int is_user_in(struct sip_msg* _msg, char* _hf, char* _grp);
  63. /*!
  64. * \brief Initialize the DB connection
  65. * \param db_url database URL
  66. * \return 0 on success, -1 on failure
  67. */
  68. int group_db_init(const str* db_url);
  69. /*!
  70. * \brief Bind the DB connection
  71. * \param db_url database URL
  72. * \return 0 on success, -1 on failure
  73. */
  74. int group_db_bind(const str* db_url);
  75. /*!
  76. * \brief Close the DB connection
  77. */
  78. void group_db_close(void);
  79. #endif