CPL_tree.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2001-2003 FhG Fokus
  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. #ifndef _CPL_TREE_DEFINITION_H
  23. #define _CPL_TREE_DEFINITION_H
  24. #define CPL_NODE 1
  25. #define INCOMING_NODE 2
  26. #define OUTGOING_NODE 3
  27. #define ANCILLARY_NODE 4
  28. #define SUBACTION_NODE 5
  29. #define ADDRESS_SWITCH_NODE 6
  30. #define ADDRESS_NODE 7
  31. #define BUSY_NODE 8
  32. #define DEFAULT_NODE 9
  33. #define FAILURE_NODE 10
  34. #define LOG_NODE 11
  35. #define LOOKUP_NODE 12
  36. #define LOCATION_NODE 13
  37. #define LANGUAGE_NODE 14
  38. #define LANGUAGE_SWITCH_NODE 15
  39. #define MAIL_NODE 16
  40. #define NOTFOUND_NODE 17
  41. #define NOANSWER_NODE 18
  42. #define PROXY_NODE 19
  43. #define PRIORITY_NODE 20
  44. #define PRIORITY_SWITCH_NODE 21
  45. #define REJECT_NODE 22
  46. #define REDIRECT_NODE 23
  47. #define REDIRECTION_NODE 24
  48. #define REMOVE_LOCATION_NODE 25
  49. #define SUB_NODE 26
  50. #define SUCCESS_NODE 27
  51. #define STRING_NODE 28
  52. #define STRING_SWITCH_NODE 29
  53. #define TIME_NODE 30
  54. #define TIME_SWITCH_NODE 31
  55. #define OTHERWISE_NODE 32
  56. #define NOT_PRESENT_NODE 33
  57. /* attributes and values fro ADDRESS-SWITCH node */
  58. #define FIELD_ATTR 0 /*shared with STRING_SWITCH*/
  59. #define SUBFIELD_ATTR 1
  60. #define ORIGIN_VAL 0
  61. #define DESTINATION_VAL 1
  62. #define ORIGINAL_DESTINATION_VAL 2
  63. #define ADDRESS_TYPE_VAL 0
  64. #define USER_VAL 1
  65. #define HOST_VAL 2
  66. #define PORT_VAL 3
  67. #define TEL_VAL 4
  68. #define DISPLAY_VAL 5 /*shared with STRING*/
  69. /* attributes and values for ADDRESS node */
  70. #define IS_ATTR 0 /*shared with STRING*/
  71. #define CONTAINS_ATTR 1 /*shared with STRING*/
  72. #define SUBDOMAIN_OF_ATTR 2
  73. /* attributes and values for STRING-SWITCH node */
  74. #define SUBJECT_VAL 0
  75. #define ORGANIZATION_VAL 1
  76. #define USER_AGENT_VAL 2
  77. /* attributes and values for LANGUAGE node */
  78. #define MATCHES_TAG_ATTR 0
  79. #define MATCHES_SUBTAG_ATTR 1
  80. /* attributes and values for TIME-SWITCH node */
  81. #define TZID_ATTR 0
  82. #define TZURL_ATTR 1
  83. /* attributes and values for TIME node */
  84. #define DTSTART_ATTR 0
  85. #define DTEND_ATTR 1
  86. #define DURATION_ATTR 2
  87. #define FREQ_ATTR 3
  88. #define INTERVAL_ATTR 4
  89. #define UNTIL_ATTR 5
  90. #define COUNT_ATTR 6
  91. #define BYSECOND_ATTR 7
  92. #define BYMINUTE_ATTR 8
  93. #define BYHOUR_ATTR 9
  94. #define BYDAY_ATTR 10
  95. #define BYMONTHDAY_ATTR 11
  96. #define BYYEARDAY_ATTR 12
  97. #define BYWEEKNO_ATTR 13
  98. #define BYMONTH_ATTR 14
  99. #define WKST_ATTR 15
  100. #define BYSETPOS_ATTR 16
  101. /* attributes and values for PRIORITY node */
  102. #define LESS_ATTR 0
  103. #define GREATER_ATTR 1
  104. #define EQUAL_ATTR 2
  105. #define PRIOSTR_ATTR 3
  106. #define EMERGENCY_VAL 0
  107. #define EMERGENCY_STR "emergency"
  108. #define EMERGENCY_STR_LEN (sizeof(EMERGENCY_STR)-1)
  109. #define URGENT_VAL 1
  110. #define URGENT_STR "urgent"
  111. #define URGENT_STR_LEN (sizeof(URGENT_STR)-1)
  112. #define NORMAL_VAL 2
  113. #define NORMAL_STR "normal"
  114. #define NORMAL_STR_LEN (sizeof(NORMAL_STR)-1)
  115. #define NON_URGENT_VAL 3
  116. #define NON_URGENT_STR "non-urgent"
  117. #define NON_URGENT_STR_LEN (sizeof(NON_URGENT_STR)-1)
  118. #define UNKNOWN_PRIO_VAL 4
  119. /* attributes and values for LOCATION node */
  120. #define URL_ATTR 0
  121. #define PRIORITY_ATTR 1
  122. #define CLEAR_ATTR 2 /*shared with LOOKUP node*/
  123. #define NO_VAL 0 /*shared with LOOKUP node*/
  124. #define YES_VAL 1 /*shared with LOOKUP node*/
  125. /* attributes and values for LOOKUP node */
  126. #define SOURCE_ATTR 0
  127. #define TIMEOUT_ATTR 1 /*shared with PROXY node*/
  128. #define SOURCE_REG_STR "registration"
  129. #define SOURCE_REG_STR_LEN (sizeof("registration")-1)
  130. /* attributes and values for REMOVE_LOCATION node */
  131. #define LOCATION_ATTR 0
  132. #define PARAM_ATTR 1
  133. #define VALUE_ATTR 2
  134. /* attributes and values for PROXY node */
  135. #define RECURSE_ATTR 2
  136. #define ORDERING_ATTR 3
  137. #define PARALLEL_VAL 0
  138. #define SEQUENTIAL_VAL 1
  139. #define FIRSTONLY_VAL 2
  140. /* attributes and values for REDIRECT node */
  141. #define PERMANENT_ATTR 0
  142. /* attributes and values for REJECT node */
  143. #define STATUS_ATTR 0
  144. #define REASON_ATTR 1
  145. #define BUSY_VAL 486
  146. #define BUSY_STR "busy"
  147. #define BUSY_STR_LEN (sizeof(BUSY_STR)-1)
  148. #define NOTFOUND_VAL 404
  149. #define NOTFOUND_STR "notfound"
  150. #define NOTFOUND_STR_LEN (sizeof(NOTFOUND_STR)-1)
  151. #define REJECT_VAL 603
  152. #define REJECT_STR "reject"
  153. #define REJECT_STR_LEN (sizeof(REJECT_STR)-1)
  154. #define ERROR_VAL 500
  155. #define ERROR_STR "error"
  156. #define ERROR_STR_LEN (sizeof(ERROR_STR)-1)
  157. /* attributes and values for LOG node */
  158. #define NAME_ATTR 0
  159. #define MAX_NAME_SIZE 32
  160. #define COMMENT_ATTR 1
  161. #define MAX_COMMENT_SIZE 128
  162. /* attributes and values for EMAIL node */
  163. #define TO_ATTR 0
  164. #define SUBJECT_ATTR 1
  165. #define SUBJECT_EMAILHDR_STR "subject"
  166. #define SUBJECT_EMAILHDR_LEN (sizeof(SUBJECT_EMAILHDR_STR)-1)
  167. #define BODY_ATTR 2
  168. #define BODY_EMAILHDR_STR "body"
  169. #define BODY_EMAILHDR_LEN (sizeof(BODY_EMAILHDR_STR)-1)
  170. #define URL_MAILTO_STR "mailto:"
  171. #define URL_MAILTO_LEN (sizeof(URL_MAILTO_STR)-1)
  172. /* attributes and values for SUB node */
  173. #define REF_ATTR 0
  174. /* node = | type(1) | nr_kids(1) | nr_attrs(1) | unused(1) |
  175. * | x*kids_offset(2) | y*attrs(2*n) |
  176. */
  177. #define NODE_TYPE(_p) ( *((unsigned char*)(_p)) )
  178. #define NR_OF_KIDS(_p) ( *((unsigned char* )((_p)+1)) )
  179. #define NR_OF_ATTR(_p) ( *((unsigned char* )((_p)+1+1)) )
  180. #define KID_OFFSET_PTR(_p,_n) ( (unsigned short*)((_p)+4+2*(_n)) )
  181. #define ATTR_PTR(_p) ( (_p)+4+2*NR_OF_KIDS(_p) )
  182. #define SIMPLE_NODE_SIZE(_p) ( 4+2*NR_OF_KIDS(_p) )
  183. #define GET_NODE_SIZE(_n) ( 4+2*(_n) )
  184. #define BASIC_ATTR_SIZE 4
  185. #define SET_KID_OFFSET(_p,_n,_o) *KID_OFFSET_PTR(_p,_n)=htons(_o)
  186. #define KID_OFFSET(_p,_n) ntohs(*KID_OFFSET_PTR(_p,_n))
  187. #endif