parse_identityinfo.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (c) 2007 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. * ser is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. /*! \file
  21. * \brief Parser :: Parse Identity-info header field
  22. *
  23. * \ingroup parser
  24. */
  25. #ifndef PARSE_IDENTITYNFO
  26. #define PARSE_IDENTITYNFO
  27. #include "../str.h"
  28. #include "msg_parser.h"
  29. enum {
  30. II_START,
  31. II_URI_BEGIN,
  32. II_URI_DOMAIN,
  33. II_URI_IPV4,
  34. II_URI_IPV6,
  35. II_URI_PATH,
  36. II_URI_END,
  37. II_LWS,
  38. II_LWSCR,
  39. II_LWSCRLF,
  40. II_LWSCRLFSP,
  41. II_SEMIC,
  42. II_TAG,
  43. II_EQUAL,
  44. II_TOKEN,
  45. II_ENDHEADER
  46. };
  47. enum {
  48. II_M_START,
  49. II_M_URI_BEGIN,
  50. II_M_URI_END,
  51. II_M_SEMIC,
  52. II_M_TAG,
  53. II_M_EQUAL,
  54. II_M_TOKEN
  55. };
  56. #define ZSW(_c) ((_c)?(_c):"")
  57. struct identityinfo_body {
  58. int error; /* Error code */
  59. str uri; /* URI */
  60. str domain; /* Domain part of the URI */
  61. str alg; /* Identity-Info header field MUST contain an 'alg' parameter */
  62. };
  63. /* casting macro for accessing IDENTITY-INFO body */
  64. #define get_identityinfo(p_msg) ((struct identityinfo_body*)(p_msg)->identity_info->parsed)
  65. /*
  66. * Parse Identity-Info header field
  67. */
  68. void parse_identityinfo(char *buffer, char* end, struct identityinfo_body *ii_b);
  69. int parse_identityinfo_header(struct sip_msg *msg);
  70. /*
  71. * Free all associated memory
  72. */
  73. void free_identityinfo(struct identityinfo_body *ii_b);
  74. #endif