CPL_tree.h 8.1 KB

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