usrloc.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. *
  25. * 2006-11-28 Added a new function to the usrloc_api, to retrieve the number
  26. * of registered users. (Jeffrey Magder - SOMA Networks)
  27. */
  28. /*! \file
  29. * \brief USRLOC - module API exports interfaces
  30. * \ingroup usrloc
  31. *
  32. * - Module \ref usrloc
  33. */
  34. #include "usrloc.h"
  35. #include "dlist.h"
  36. #include "urecord.h"
  37. #include "ucontact.h"
  38. #include "udomain.h"
  39. #include "../../sr_module.h"
  40. #include "ul_mod.h"
  41. /*!
  42. * \brief usrloc module API export bind function
  43. * \param api usrloc API
  44. * \return 0 on success, -1 on failure
  45. */
  46. int bind_usrloc(usrloc_api_t* api)
  47. {
  48. if (!api) {
  49. LM_ERR("invalid parameter value\n");
  50. return -1;
  51. }
  52. if (init_flag==0) {
  53. LM_ERR("configuration error - trying to bind to usrloc module"
  54. " before being initialized\n");
  55. return -1;
  56. }
  57. api->register_udomain = register_udomain;
  58. api->get_udomain = get_udomain;
  59. api->get_all_ucontacts = get_all_ucontacts;
  60. api->insert_urecord = insert_urecord;
  61. api->delete_urecord = delete_urecord;
  62. api->delete_urecord_by_ruid = delete_urecord_by_ruid;
  63. api->get_urecord = get_urecord;
  64. api->lock_udomain = lock_udomain;
  65. api->unlock_udomain = unlock_udomain;
  66. api->release_urecord = release_urecord;
  67. api->insert_ucontact = insert_ucontact;
  68. api->delete_ucontact = delete_ucontact;
  69. api->get_ucontact = get_ucontact;
  70. api->update_ucontact = update_ucontact;
  71. api->register_ulcb = register_ulcb;
  72. api->get_aorhash = ul_get_aorhash;
  73. api->get_urecord_by_ruid = get_urecord_by_ruid;
  74. api->get_ucontact_by_instance = get_ucontact_by_instance;
  75. api->set_keepalive_timeout = ul_set_keepalive_timeout;
  76. api->refresh_keepalive = ul_refresh_keepalive;
  77. api->use_domain = use_domain;
  78. api->db_mode = db_mode;
  79. api->nat_flag = nat_bflag;
  80. return 0;
  81. }
  82. /**
  83. *
  84. */
  85. int ul_set_keepalive_timeout(int _to)
  86. {
  87. int oto;
  88. oto = ul_keepalive_timeout;
  89. ul_keepalive_timeout = _to;
  90. return oto;
  91. }