mcd_var.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright (C) 2009, 2013 Henning Westerholt
  3. * Copyright (C) 2013 Charles Chance, sipcentric.com
  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 along
  18. * with this program; if not, see <http://www.gnu.org/licenses/>.
  19. */
  20. /*!
  21. * \file
  22. * \brief memcached module
  23. */
  24. #ifndef _MCD_VAR_H_
  25. #define _MCD_VAR_H_
  26. #include "../../pvar.h"
  27. /*!
  28. * \brief Get a cached value from memcached
  29. * \param msg SIP message
  30. * \param param parameter
  31. * \param res result
  32. * \return null on success, negative on failure
  33. */
  34. int pv_get_mcd_value(struct sip_msg *msg, pv_param_t *param, pv_value_t *res);
  35. /*!
  36. * \brief Set a value in the cache of memcached
  37. * \param msg SIP message
  38. * \param param parameter
  39. * \param op not used
  40. * \param val value
  41. * \return 0 on success, -1 on failure
  42. */
  43. int pv_set_mcd_value(struct sip_msg* msg, pv_param_t *param, int op, pv_value_t *val);
  44. /*!
  45. * \brief Increment a key atomically in the cache
  46. * \param msg SIP message
  47. * \param param parameter
  48. * \param op not used
  49. * \param val value
  50. * \return 0 on success, -1 on failure
  51. */
  52. int pv_inc_mcd_value(struct sip_msg* msg, pv_param_t *param, int op, pv_value_t *val);
  53. /*!
  54. * \brief Decrement a key atomically in the cache
  55. * \param msg SIP message
  56. * \param param parameter
  57. * \param op not used
  58. * \param val value
  59. * \return 0 on success, -1 on failure
  60. */
  61. int pv_dec_mcd_value(struct sip_msg* msg, pv_param_t *param, int op, pv_value_t *val);
  62. /*!
  63. * \brief Set the expire value in the cache of memcached
  64. * \note The memcache library don't provide functions to change the expiration
  65. * time for a certain key after creation, so we need to do a get and set here.
  66. * \param msg SIP message
  67. * \param param parameter
  68. * \param op not used
  69. * \param val value
  70. * \return 0 on success, -1 on failure
  71. */
  72. int pv_set_mcd_expire(struct sip_msg* msg, pv_param_t *param, int op, pv_value_t *val);
  73. /*!
  74. * \brief Parse the pseudo-variable specification parameter
  75. * \param sp pseudo-variable specification
  76. * \param in parameter string
  77. * \return 0 on success, -1 on failure
  78. */
  79. int pv_parse_mcd_name(pv_spec_p sp, str *in);
  80. #endif