case_acce.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Accept, Accept-Language, Accept-Contact, Accept-Disposition Header Field Name Parsing Macros
  3. *
  4. * Copyright (C) 2001-2003 FhG Fokus
  5. *
  6. * This file is part of SIP-router, a free SIP server.
  7. *
  8. * SIP-router 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. * SIP-router 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. /*! \file
  23. * \brief Parser :: Accept, Accept-Language, Accept-Contact, Accept-Disposition Header Field Name Parsing Macros
  24. *
  25. * \ingroup parser
  26. */
  27. #ifndef CASE_ACCE_H
  28. #define CASE_ACCE_H
  29. #define age_CASE \
  30. switch(LOWER_DWORD(val)) { \
  31. case _age1_: \
  32. hdr->type = HDR_ACCEPTLANGUAGE_T; \
  33. hdr->name.len = 15; \
  34. return (p + 4); \
  35. \
  36. case _age2_: \
  37. hdr->type = HDR_ACCEPTLANGUAGE_T; \
  38. p += 4; \
  39. goto dc_end; \
  40. }
  41. #define angu_CASE \
  42. switch(LOWER_DWORD(val)) { \
  43. case _angu_: \
  44. p += 4; \
  45. val = READ(p); \
  46. age_CASE; \
  47. goto other; \
  48. }
  49. #define accept_contact_ct_CASE \
  50. if (LOWER_BYTE(*p) == 'c') { \
  51. p++; \
  52. if (LOWER_BYTE(*p) == 't') { \
  53. hdr->type = HDR_ACCEPTCONTACT_T; \
  54. p++; \
  55. goto dc_end; \
  56. } \
  57. }
  58. #define accept_c_onta_CASE \
  59. switch(LOWER_DWORD(val)) { \
  60. case _onta_: \
  61. p += 4; \
  62. val = READ(p); \
  63. accept_contact_ct_CASE; \
  64. goto other; \
  65. }
  66. #define ptldc_CASE \
  67. switch(LOWER_DWORD(val)) { \
  68. case _pt_l_: \
  69. p += 4; \
  70. val = READ(p); \
  71. angu_CASE; \
  72. goto other; \
  73. \
  74. case _pt_c_: \
  75. p += 4; \
  76. val = READ(p); \
  77. accept_c_onta_CASE;\
  78. goto other; \
  79. }
  80. #define acce_CASE \
  81. p += 4; \
  82. val = READ(p); \
  83. ptldc_CASE; \
  84. \
  85. if (LOWER_BYTE(*p) == 'p') { \
  86. p++; \
  87. if (LOWER_BYTE(*p) == 't') { \
  88. hdr->type = HDR_ACCEPT_T; \
  89. p++; \
  90. goto dc_end; \
  91. } \
  92. } \
  93. goto other;
  94. #endif /* CASE_ACCE_H */