dlg_var.h 2.9 KB

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