parse_privacy.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * $Id: parse_privacy.h 4720 2008-08-23 10:56:15Z henningw $
  3. *
  4. * Copyright (c) 2006 Juha Heinanen
  5. *
  6. * This file is part of Kamailio, a free SIP server.
  7. *
  8. * Kamailio is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version
  12. *
  13. * Kamailio is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. /*!
  23. * \file
  24. * \brief Privacy value parser
  25. * \ingroup parser
  26. */
  27. #ifndef PARSE_PRIVACY_H
  28. #define PARSE_PRIVACY_H
  29. #include "../../mem/mem.h"
  30. #include "../../parser/msg_parser.h"
  31. /*! bitmap of Privacy header privacy values
  32. * (http://www.iana.org/assignments/sip-priv-values)
  33. */
  34. enum privacy_value {
  35. PRIVACY_USER=1,
  36. PRIVACY_HEADER=2,
  37. PRIVACY_SESSION=4,
  38. PRIVACY_NONE=8,
  39. PRIVACY_CRITICAL=16,
  40. PRIVACY_ID=32,
  41. PRIVACY_HISTORY=64
  42. };
  43. /*!
  44. * casting macro for accessing enumeration of priv-values
  45. */
  46. #define get_privacy_values(p_msg) \
  47. ((unsigned int)(long)((p_msg)->privacy->parsed))
  48. /*!
  49. * This method is used to parse Privacy HF body, which consist of
  50. * comma separated list of priv-values. After parsing, msg->privacy->parsed
  51. * contains enum bits of privacy values defined in parse_privacy.h.
  52. * \return 0 on success and -1 on failure.
  53. */
  54. int parse_privacy(struct sip_msg *msg);
  55. /*!
  56. * Parse a privacy value pointed by start that can be at most max_len long.
  57. * \return length of matched privacy value on success or NULL otherwise
  58. */
  59. unsigned int parse_priv_value(char* start, unsigned int max_len,
  60. unsigned int* value);
  61. #endif /* PARSE_PRIVACY_H */