case_p_as.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (C) 2010 iptelorg GmbH
  3. *
  4. * Permission to use, copy, modify, and distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. /*
  17. * parser/case_p_as.h
  18. */
  19. /*
  20. * History:
  21. * --------
  22. * 2010-02-19 initial version (andrei)
  23. */
  24. /** Parser :: Reason Header Name Parsing Macros.
  25. * @file
  26. *
  27. * @ingroup parser
  28. */
  29. #ifndef __case_p_as_h
  30. #define __case_p_as_h
  31. #define SERT_CASE \
  32. switch(LOWER_DWORD(val)) { \
  33. case _sert_: \
  34. p += 4; \
  35. val = READ(p); \
  36. ED_I_CASE; \
  37. }
  38. #define ED_I_CASE \
  39. switch(LOWER_DWORD(val)) { \
  40. case _ed_i_: \
  41. p += 4; \
  42. val = READ(p); \
  43. DENT_CASE; \
  44. }
  45. #define DENT_CASE \
  46. switch(LOWER_DWORD(val)) { \
  47. case _dent_: \
  48. p += 4; \
  49. val = READ(p); \
  50. ITY_CASE; \
  51. }
  52. #define ITY_CASE \
  53. switch(LOWER_DWORD(val)) { \
  54. case _ity1_: \
  55. hdr->type = HDR_PAI_T; \
  56. hdr->name.len = 19; \
  57. return (p + 4); \
  58. case _ity2_: \
  59. hdr->type = HDR_PAI_T; \
  60. p+=4; \
  61. goto dc_end; \
  62. }
  63. #define p_as_CASE \
  64. p += 4; \
  65. val = READ(p); \
  66. SERT_CASE; \
  67. goto other;
  68. #endif /*__case_p_as_h*/
  69. /* vi: set ts=4 sw=4 tw=79:ai:cindent: */