api.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /**
  2. * $Id$
  3. *
  4. * Copyright (C) 2010 Daniel-Constantin Mierla (asipto.com)
  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. #ifndef _XHTTP_API_H_
  23. #define _XHTTP_API_H_
  24. #include "../../sr_module.h"
  25. typedef int (*xhttp_reply_f)(sip_msg_t *msg, int code, str *reason,
  26. str *ctype, str *body);
  27. typedef struct xhttp_api {
  28. xhttp_reply_f reply;
  29. } xhttp_api_t;
  30. typedef int (*bind_xhttp_f)(xhttp_api_t* api);
  31. int bind_xhttp(xhttp_api_t* api);
  32. /**
  33. * @brief Load the XHTTP API
  34. */
  35. static inline int xhttp_load_api(xhttp_api_t *api)
  36. {
  37. bind_xhttp_f bindxhttp;
  38. bindxhttp = (bind_xhttp_f)find_export("bind_xhttp", 0, 0);
  39. if(bindxhttp == 0) {
  40. LM_ERR("cannot find bind_xhttp\n");
  41. return -1;
  42. }
  43. if(bindxhttp(api)<0)
  44. {
  45. LM_ERR("cannot bind xhttp api\n");
  46. return -1;
  47. }
  48. return 0;
  49. }
  50. #endif