dlg_var.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /**
  2. * $Id$
  3. *
  4. * Copyright (C) 2009 Daniel-Constantin Mierla (asipto.com)
  5. * Copyright (C) 2011 Carsten Bock, [email protected]
  6. *
  7. * This file is part of kamailio, a free SIP server.
  8. *
  9. * openser is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version
  13. *
  14. * openser is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. */
  23. #ifndef _DLG_VAR_H_
  24. #define _DLG_VAR_H_
  25. #include "../../pvar.h"
  26. #include "dlg_hash.h"
  27. #define DLG_TOROUTE_SIZE 32
  28. /*! dialog context */
  29. typedef struct _dlg_ctx {
  30. int on;
  31. unsigned int flags;
  32. int to_route;
  33. char to_route_name[DLG_TOROUTE_SIZE];
  34. int to_bye;
  35. int timeout;
  36. struct dlg_cell *dlg;
  37. int set;
  38. unsigned int dir;
  39. } dlg_ctx_t;
  40. /* A dialog-variable */
  41. struct dlg_var {
  42. str key;
  43. str value;
  44. unsigned int vflags; /*!< internal variable flags */
  45. struct dlg_var *next;
  46. };
  47. str * api_get_dlg_variable(str *callid, str *ftag, str *ttag, str *key);
  48. str * get_dlg_variable(struct dlg_cell *dlg, str *key);
  49. int api_set_dlg_variable(str *callid, str *ftag, str *ttag, str *key, str *val);
  50. int set_dlg_variable(struct dlg_cell *dlg, str *key, str *val);
  51. int pv_parse_dialog_var_name(pv_spec_p sp, str *in);
  52. int pv_get_dlg_variable(struct sip_msg *msg, pv_param_t *param, pv_value_t *res);
  53. int pv_set_dlg_variable(struct sip_msg* msg, pv_param_t *param, int op, pv_value_t *val);
  54. /*! Retrieve the current var-list */
  55. struct dlg_var * get_local_varlist_pointer(struct sip_msg *msg, int clear_pointer);
  56. /* Adds, updates and deletes dialog variables */
  57. int set_dlg_variable_unsafe(struct dlg_cell *dlg, str *key, str *val, int new);
  58. extern dlg_ctx_t _dlg_ctx;
  59. int pv_get_dlg_ctx(struct sip_msg *msg, pv_param_t *param,
  60. pv_value_t *res);
  61. int pv_set_dlg_ctx(struct sip_msg* msg, pv_param_t *param,
  62. int op, pv_value_t *val);
  63. int pv_parse_dlg_ctx_name(pv_spec_p sp, str *in);
  64. int pv_get_dlg(struct sip_msg *msg, pv_param_t *param,
  65. pv_value_t *res);
  66. int pv_parse_dlg_name(pv_spec_p sp, str *in);
  67. int dlg_cfg_cb(struct sip_msg *foo, unsigned int flags, void *bar);
  68. void dlg_set_ctx_dialog(struct dlg_cell *dlg);
  69. struct dlg_cell* dlg_get_ctx_dialog(void);
  70. dlg_ctx_t* dlg_get_dlg_ctx(void);
  71. int spiral_detect_reset(struct sip_msg *foo, unsigned int flags, void *bar);
  72. #endif