dlg_load.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * $Id$
  3. *
  4. * dialog module - basic support for dialog tracking
  5. *
  6. * Copyright (C) 2006 Voice Sistem SRL
  7. *
  8. * This file is part of Kamailio, a free SIP server.
  9. *
  10. * Kamailio 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. * Kamailio is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * History:
  25. * --------
  26. * 2006-04-14 initial version (bogdan)
  27. */
  28. #ifndef _DIALOG_DLG_LOAD_H_
  29. #define _DIALOG_DLG_LOAD_H_
  30. #include "dlg_cb.h"
  31. #include "../../sr_module.h"
  32. /* terminate_dlg function prototype */
  33. typedef int (*terminate_dlg_f)(str *callid, str *ftag, str *ttag, str *hdrs, str *reason);
  34. typedef int (*lookup_terminate_dlg_f)(unsigned int h_entry, unsigned int h_id, str *hdrs);
  35. /* get the current dialog based on message function prototype */
  36. typedef struct dlg_cell *(*get_dlg_f)(struct sip_msg *msg);
  37. /* get_dlg_lifetime function prototype */
  38. typedef time_t (*get_dlg_expires_f)(str *callid, str *ftag, str *ttag);
  39. struct dlg_binds {
  40. register_dlgcb_f register_dlgcb;
  41. register_dlgcb_nodlg_f register_dlgcb_nodlg;
  42. terminate_dlg_f terminate_dlg;
  43. lookup_terminate_dlg_f lookup_terminate_dlg;
  44. set_dlg_variable_f set_dlg_var;
  45. get_dlg_variable_f get_dlg_var;
  46. get_dlg_expires_f get_dlg_expires;
  47. get_dlg_f get_dlg;
  48. };
  49. typedef int(*load_dlg_f)( struct dlg_binds *dlgb );
  50. int load_dlg( struct dlg_binds *dlgb);
  51. static inline int load_dlg_api( struct dlg_binds *dlgb )
  52. {
  53. load_dlg_f load_dlg;
  54. /* import the DLG auto-loading function */
  55. if ( !(load_dlg=(load_dlg_f)find_export("load_dlg", 0, 0)))
  56. return -1;
  57. /* let the auto-loading function load all DLG stuff */
  58. if (load_dlg( dlgb )==-1)
  59. return -1;
  60. return 0;
  61. }
  62. #endif