dlg_mod.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (C) 2005 iptelorg GmbH
  3. *
  4. * This file is part of ser, a free SIP server.
  5. *
  6. * ser is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version
  10. *
  11. * For a license to use the ser software under conditions
  12. * other than those described here, or to purchase support for this
  13. * software, please contact iptel.org by e-mail at the following addresses:
  14. * [email protected]
  15. *
  16. * ser is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  24. */
  25. #ifndef __DLG_MOD_H
  26. #define __DLG_MOD_H
  27. #include "../../modules/tm/dlg.h"
  28. #include "../../lib/srdb2/db.h"
  29. #include "../../modules/tm/t_hooks.h"
  30. #include <cds/serialize.h>
  31. /* Prototype of function for storing dialog into database.
  32. * This function computes ID of newly added row and returns
  33. * it in dst_id (if set). Function returns 0 if OK, nonzero
  34. * on error.
  35. */
  36. /*typedef int (*db_store_dlg_f)(db_con_t* conn, dlg_t *dlg, str *dst_id);
  37. typedef int (*db_load_dlg_f)(db_con_t* conn, str *id, dlg_t **dst_dlg);*/
  38. typedef int (*serialize_dlg_f)(sstream_t *ss, dlg_t *dlg);
  39. typedef int (*dlg2str_f)(dlg_t *dlg, str *dst_str);
  40. typedef int (*str2dlg_f)(const str *s, dlg_t *dst_dlg);
  41. typedef int (*preset_dialog_route_f)(dlg_t* dialog, str *route);
  42. typedef int (*request_outside_f)(str* method, str* headers, str* body, dlg_t* dialog, transaction_cb cb, void* cbp);
  43. typedef int (*request_inside_f)(str* method, str* headers, str* body, dlg_t* dialog, transaction_cb cb, void* cbp);
  44. typedef int (*cmp_dlg_ids_f)(dlg_id_t *a, dlg_id_t *b);
  45. typedef unsigned int (*hash_dlg_id_f)(dlg_id_t *id);
  46. typedef struct {
  47. /* dialog creation/destruction functions */
  48. /* db_store_dlg_f db_store;
  49. db_load_dlg_f db_load;*/
  50. /* utility functions */
  51. serialize_dlg_f serialize;
  52. dlg2str_f dlg2str;
  53. str2dlg_f str2dlg;
  54. hash_dlg_id_f hash_dlg_id;
  55. cmp_dlg_ids_f cmp_dlg_ids;
  56. /* dialog functions */
  57. preset_dialog_route_f preset_dialog_route;
  58. request_outside_f request_outside;
  59. request_inside_f request_inside;
  60. } dlg_func_t;
  61. typedef int (*bind_dlg_mod_f)(dlg_func_t *dst);
  62. #endif