usrloc.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * $Id$
  3. *
  4. * Usrloc interface
  5. *
  6. * Copyright (C) 2001-2003 FhG Fokus
  7. *
  8. * This file is part of ser, a free SIP server.
  9. *
  10. * ser is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version
  14. *
  15. * For a license to use the ser software under conditions
  16. * other than those described here, or to purchase support for this
  17. * software, please contact iptel.org by e-mail at the following addresses:
  18. * [email protected]
  19. *
  20. * ser is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, write to the Free Software
  27. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  28. */
  29. #include "usrloc.h"
  30. #include "../../sr_module.h"
  31. #include "ul_mod.h"
  32. int bind_usrloc(usrloc_api_t* api)
  33. {
  34. if (!api) {
  35. LOG(L_ERR, "bind_usrloc(): Invalid parameter value\n");
  36. return -1;
  37. }
  38. api->register_udomain = (register_udomain_t)find_export("ul_register_udomain", 1, 0);
  39. if (api->register_udomain == 0) {
  40. LOG(L_ERR, "bind_usrloc(): Can't bind register_udomain\n");
  41. return -1;
  42. }
  43. api->get_all_ucontacts = (get_all_ucontacts_t)find_export("ul_get_all_ucontacts", 1, 0);
  44. if (api->get_all_ucontacts == 0) {
  45. LOG(L_ERR, "bind_usrloc(): Can't bind get_all_ucontacts\n");
  46. return -1;
  47. }
  48. api->insert_urecord = (insert_urecord_t)find_export("ul_insert_urecord", 1, 0);
  49. if (api->insert_urecord == 0) {
  50. LOG(L_ERR, "bind_usrloc(): Can't bind insert_urecord\n");
  51. return -1;
  52. }
  53. api->delete_urecord = (delete_urecord_t)find_export("ul_delete_urecord", 1, 0);
  54. if (api->delete_urecord == 0) {
  55. LOG(L_ERR, "bind_usrloc(): Can't bind delete_urecord\n");
  56. return -1;
  57. }
  58. api->get_urecord = (get_urecord_t)find_export("ul_get_urecord", 1, 0);
  59. if (api->get_urecord == 0) {
  60. LOG(L_ERR, "bind_usrloc(): Can't bind get_urecord\n");
  61. return -1;
  62. }
  63. api->lock_udomain = (lock_udomain_t)find_export("ul_lock_udomain", 1, 0);
  64. if (api->lock_udomain == 0) {
  65. LOG(L_ERR, "bind_usrloc(): Can't bind loc_udomain\n");
  66. return -1;
  67. }
  68. api->unlock_udomain = (unlock_udomain_t)find_export("ul_unlock_udomain", 1, 0);
  69. if (api->unlock_udomain == 0) {
  70. LOG(L_ERR, "bind_usrloc(): Can't bind unlock_udomain\n");
  71. return -1;
  72. }
  73. api->release_urecord = (release_urecord_t)find_export("ul_release_urecord", 1, 0);
  74. if (api->release_urecord == 0) {
  75. LOG(L_ERR, "bind_usrloc(): Can't bind release_urecord\n");
  76. return -1;
  77. }
  78. api->insert_ucontact = (insert_ucontact_t)find_export("ul_insert_ucontact", 1, 0);
  79. if (api->insert_ucontact == 0) {
  80. LOG(L_ERR, "bind_usrloc(): Can't bind insert_ucontact\n");
  81. return -1;
  82. }
  83. api->delete_ucontact = (delete_ucontact_t)find_export("ul_delete_ucontact", 1, 0);
  84. if (api->delete_ucontact == 0) {
  85. LOG(L_ERR, "bind_usrloc(): Can't bind delete_ucontact\n");
  86. return -1;
  87. }
  88. api->get_ucontact = (get_ucontact_t)find_export("ul_get_ucontact", 1, 0);
  89. if (api->get_ucontact == 0) {
  90. LOG(L_ERR, "bind_usrloc(): Can't bind get_ucontact\n");
  91. return -1;
  92. }
  93. api->get_ucontact_by_instance = (get_ucontact_by_inst_t)find_export("ul_get_ucontact_by_inst", 1, 0);
  94. if (api->get_ucontact_by_instance == 0) {
  95. LOG(L_ERR, "bind_usrloc(): Can't bind get_ucontact_by_instance\n");
  96. return -1;
  97. }
  98. api->update_ucontact = (update_ucontact_t)find_export("ul_update_ucontact", 1, 0);
  99. if (api->update_ucontact == 0) {
  100. LOG(L_ERR, "bind_usrloc(): Can't bind update_ucontact\n");
  101. return -1;
  102. }
  103. api->register_watcher = (register_watcher_t)
  104. find_export("ul_register_watcher", 1, 0);
  105. if (api->register_watcher == 0) {
  106. LOG(L_ERR, "bind_usrloc(): Can't bind register_watcher\n");
  107. return -1;
  108. }
  109. api->unregister_watcher = (unregister_watcher_t)
  110. find_export("ul_unregister_watcher", 1, 0);
  111. if (api->unregister_watcher == 0) {
  112. LOG(L_ERR, "bind_usrloc(): Can't bind unregister_watcher\n");
  113. return -1;
  114. }
  115. api->register_ulcb = (register_ulcb_t)
  116. find_export("ul_register_ulcb", 1, 0);
  117. if (api->register_ulcb == 0) {
  118. LOG(L_ERR, "bind_usrloc(): Can't bind register_ulcb\n");
  119. return -1;
  120. }
  121. return 0;
  122. }