case_prox.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Proxy-Require, Proxy-Authorization Header Field Name Parsing Macros
  3. *
  4. * Copyright (C) 2001-2003 FhG Fokus
  5. *
  6. * This file is part of ser, a free SIP server.
  7. *
  8. * ser 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. * For a license to use the ser software under conditions
  14. * other than those described here, or to purchase support for this
  15. * software, please contact iptel.org by e-mail at the following addresses:
  16. * [email protected]
  17. *
  18. * ser is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  26. *
  27. * History:
  28. * --------
  29. * 2003-02-28 scratchpad compatibility abandoned (jiri)
  30. * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
  31. */
  32. /*! \file
  33. * \brief Parser :: Proxy-Require, Proxy-Authorization Header Field Name Parsing Macros
  34. *
  35. * \ingroup parser
  36. */
  37. #ifndef CASE_PROX_H
  38. #define CASE_PROX_H
  39. #include "../comp_defs.h"
  40. #define ION_CASE \
  41. switch(LOWER_DWORD(val)) { \
  42. case _ion1_: \
  43. hdr->type = HDR_PROXYAUTH_T; \
  44. hdr->name.len = 19; \
  45. return (p + 4); \
  46. \
  47. case _ion2_: \
  48. hdr->type = HDR_PROXYAUTH_T; \
  49. p += 4; \
  50. goto dc_end; \
  51. }
  52. #define IZAT_CASE \
  53. switch(LOWER_DWORD(val)) { \
  54. case _izat_: \
  55. p += 4; \
  56. val = READ(p); \
  57. ION_CASE; \
  58. goto other; \
  59. }
  60. #define TE_CASE \
  61. switch(LOWER_DWORD(val)&0xffffff) { \
  62. case _te1_: /* "te:"*/ \
  63. hdr->type = HDR_PROXY_AUTHENTICATE_T; \
  64. hdr->name.len = 18; \
  65. return (p + 3); \
  66. case _te2_: /* "te " */ \
  67. hdr->type = HDR_PROXY_AUTHENTICATE_T; \
  68. p+=3; \
  69. goto dc_end; \
  70. }
  71. #define TICA_CASE \
  72. switch(LOWER_DWORD(val)) { \
  73. case _tica_: \
  74. p += 4; \
  75. val = READ3(p); \
  76. TE_CASE; \
  77. goto other; \
  78. }
  79. #define THOR_THEN_CASE \
  80. switch(LOWER_DWORD(val)) { \
  81. case _thor_: \
  82. p += 4; \
  83. val = READ(p); \
  84. IZAT_CASE; \
  85. goto other; \
  86. case _then_: \
  87. p += 4; \
  88. val = READ(p); \
  89. TICA_CASE; \
  90. goto other; \
  91. }
  92. #define QUIR_CASE \
  93. switch(LOWER_DWORD(val)) { \
  94. case _quir_: \
  95. p += 4; \
  96. switch(LOWER_BYTE(*p)) { \
  97. case 'e': \
  98. hdr->type = HDR_PROXYREQUIRE_T; \
  99. p++; \
  100. goto dc_end; \
  101. } \
  102. goto other; \
  103. }
  104. #define PROX2_CASE \
  105. switch(LOWER_DWORD(val)) { \
  106. case _y_au_: \
  107. p += 4; \
  108. val = READ(p); \
  109. THOR_THEN_CASE; \
  110. goto other; \
  111. \
  112. case _y_re_: \
  113. p += 4; \
  114. val = READ(p); \
  115. QUIR_CASE; \
  116. goto other; \
  117. }
  118. #define prox_CASE \
  119. p += 4; \
  120. val = READ(p); \
  121. PROX2_CASE; \
  122. goto other;
  123. #endif /* CASE_PROX_H */