siputils.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2001-2003 FhG Fokus
  5. *
  6. * This file is part of SIP-router, a free SIP server.
  7. *
  8. * SIP-router 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. * SIP-router 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. #ifndef _SIPUTILS_H_
  23. #define _SIPUTILS_H_
  24. typedef int (*siputils_has_totag_t)(struct sip_msg*, char*, char*);
  25. typedef int (*siputils_is_uri_user_e164_t)(str*);
  26. /*! Siputils module API */
  27. typedef struct siputils_api {
  28. int_str rpid_avp; /*!< Name of AVP containing Remote-Party-ID */
  29. int rpid_avp_type; /*!< type of the RPID AVP */
  30. siputils_has_totag_t has_totag;
  31. siputils_is_uri_user_e164_t is_uri_user_e164;
  32. } siputils_api_t;
  33. typedef int (*bind_siputils_t)(siputils_api_t* api);
  34. /*!
  35. * \brief Bind function for the SIPUtils API
  36. * \param api binded API
  37. * \return 0 on success, -1 on failure
  38. */
  39. int bind_siputils(siputils_api_t* api);
  40. inline static int siputils_load_api(siputils_api_t *pxb)
  41. {
  42. bind_siputils_t bind_siputils_exports;
  43. if (!(bind_siputils_exports = (bind_siputils_t)find_export("bind_siputils", 1, 0)))
  44. {
  45. LM_ERR("Failed to import bind_siputils\n");
  46. return -1;
  47. }
  48. return bind_siputils_exports(pxb);
  49. }
  50. #endif