modules_s/cpl-c/CPL_tree.h

00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2001-2003 FhG Fokus
00005  *
00006  * This file is part of ser, a free SIP server.
00007  *
00008  * ser is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * For a license to use the ser software under conditions
00014  * other than those described here, or to purchase support for this
00015  * software, please contact iptel.org by e-mail at the following addresses:
00016  *    info@iptel.org
00017  *
00018  * ser is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  */
00027 
00028 #ifndef _CPL_TREE_DEFINITION_H
00029 #define _CPL_TREE_DEFINITION_H
00030 
00031 
00032 
00033 #define              CPL_NODE   1
00034 #define         INCOMING_NODE   2
00035 #define         OUTGOING_NODE   3
00036 #define        ANCILLARY_NODE   4
00037 #define        SUBACTION_NODE   5
00038 #define   ADDRESS_SWITCH_NODE   6
00039 #define          ADDRESS_NODE   7
00040 #define             BUSY_NODE   8
00041 #define          DEFAULT_NODE   9
00042 #define          FAILURE_NODE  10
00043 #define              LOG_NODE  11
00044 #define           LOOKUP_NODE  12
00045 #define         LOCATION_NODE  13
00046 #define         LANGUAGE_NODE  14
00047 #define  LANGUAGE_SWITCH_NODE  15
00048 #define             MAIL_NODE  16
00049 #define         NOTFOUND_NODE  17
00050 #define         NOANSWER_NODE  18
00051 #define            PROXY_NODE  19
00052 #define         PRIORITY_NODE  20
00053 #define  PRIORITY_SWITCH_NODE  21
00054 #define           REJECT_NODE  22
00055 #define         REDIRECT_NODE  23
00056 #define      REDIRECTION_NODE  24
00057 #define  REMOVE_LOCATION_NODE  25
00058 #define              SUB_NODE  26
00059 #define          SUCCESS_NODE  27
00060 #define           STRING_NODE  28
00061 #define    STRING_SWITCH_NODE  29
00062 #define             TIME_NODE  30
00063 #define      TIME_SWITCH_NODE  31
00064 #define        OTHERWISE_NODE  32
00065 #define      NOT_PRESENT_NODE  33
00066 
00067 
00068 
00069 /* attributes and values fro ADDRESS-SWITCH node */
00070 #define  FIELD_ATTR                  0       /*shared with STRING_SWITCH*/
00071 #define  SUBFIELD_ATTR               1
00072 #define  ORIGIN_VAL                  0
00073 #define  DESTINATION_VAL             1
00074 #define  ORIGINAL_DESTINATION_VAL    2
00075 #define  ADDRESS_TYPE_VAL            0
00076 #define  USER_VAL                    1
00077 #define  HOST_VAL                    2
00078 #define  PORT_VAL                    3
00079 #define  TEL_VAL                     4
00080 #define  DISPLAY_VAL                 5
00081 
00082 /* attributes and values for ADDRESS node */
00083 #define  IS_ATTR                     0    /*shared with STRING*/
00084 #define  CONTAINS_ATTR               1    /*shared with STRING*/
00085 #define  SUBDOMAIN_OF_ATTR           2
00086 
00087 /* attributes and values for STRING-SWITCH node */
00088 #define  SUBJECT_VAL                 0
00089 #define  ORGANIZATION_VAL            1
00090 #define  USER_AGENT_VAL              2
00091 #define  DISPALY_VAL                 3
00092 
00093 /* attributes and values for LANGUAGE node */
00094 #define  MATCHES_TAG_ATTR            0
00095 #define  MATCHES_SUBTAG_ATTR         1
00096 
00097 /* attributes and values for TIME-SWITCH node */
00098 #define  TZID_ATTR                   0
00099 #define  TZURL_ATTR                  1
00100 
00101 /* attributes and values for TIME node */
00102 #define  DTSTART_ATTR                0
00103 #define  DTEND_ATTR                  1
00104 #define  DURATION_ATTR               2
00105 #define  FREQ_ATTR                   3
00106 #define  INTERVAL_ATTR               4
00107 #define  UNTIL_ATTR                  5
00108 #define  COUNT_ATTR                  6
00109 #define  BYSECOND_ATTR               7
00110 #define  BYMINUTE_ATTR               8
00111 #define  BYHOUR_ATTR                 9
00112 #define  BYDAY_ATTR                 10
00113 #define  BYMONTHDAY_ATTR            11
00114 #define  BYYEARDAY_ATTR             12
00115 #define  BYWEEKNO_ATTR              13
00116 #define  BYMONTH_ATTR               14
00117 #define  WKST_ATTR                  15
00118 #define  BYSETPOS_ATTR              16
00119 
00120 /* attributes and values for PRIORITY node */
00121 #define  LESS_ATTR                   0
00122 #define  GREATER_ATTR                1
00123 #define  EQUAL_ATTR                  2
00124 #define  PRIOSTR_ATTR                3
00125 #define  EMERGENCY_VAL               0
00126 #define  EMERGENCY_STR               "emergency"
00127 #define  EMERGENCY_STR_LEN           (sizeof(EMERGENCY_STR)-1)
00128 #define  URGENT_VAL                  1
00129 #define  URGENT_STR                  "urgent"
00130 #define  URGENT_STR_LEN              (sizeof(URGENT_STR)-1)
00131 #define  NORMAL_VAL                  2
00132 #define  NORMAL_STR                  "normal"
00133 #define  NORMAL_STR_LEN              (sizeof(NORMAL_STR)-1)
00134 #define  NON_URGENT_VAL              3
00135 #define  NON_URGENT_STR              "non-urgent"
00136 #define  NON_URGENT_STR_LEN          (sizeof(NON_URGENT_STR)-1)
00137 #define  UNKNOWN_PRIO_VAL            4
00138 
00139 /* attributes and values for LOCATION node */
00140 #define  URL_ATTR                    0
00141 #define  PRIORITY_ATTR               1
00142 #define  CLEAR_ATTR                  2    /*shared with LOOKUP node*/
00143 #define  NO_VAL                      0    /*shared with LOOKUP node*/
00144 #define  YES_VAL                     1    /*shared with LOOKUP node*/
00145 
00146 /* attributes and values for LOOKUP node */
00147 #define  SOURCE_ATTR                 0
00148 #define  TIMEOUT_ATTR                1    /*shared with PROXY node*/
00149 #define  SOURCE_REG_STR              "registration"
00150 #define  SOURCE_REG_STR_LEN          (sizeof("registration")-1)
00151 
00152 /* attributes and values for REMOVE_LOCATION node */
00153 #define  LOCATION_ATTR               0
00154 #define  PARAM_ATTR                  1
00155 #define  VALUE_ATTR                  2
00156 
00157 /* attributes and values for PROXY node */
00158 #define  RECURSE_ATTR                2
00159 #define  ORDERING_ATTR               3
00160 #define  PARALLEL_VAL                0
00161 #define  SEQUENTIAL_VAL              1
00162 #define  FIRSTONLY_VAL               2
00163 
00164 /* attributes and values for REDIRECT node */
00165 #define  PERMANENT_ATTR              0
00166 
00167 /* attributes and values for REJECT node */
00168 #define  STATUS_ATTR                 0
00169 #define  REASON_ATTR                 1
00170 #define  BUSY_VAL                    486
00171 #define  BUSY_STR                    "busy"
00172 #define  BUSY_STR_LEN                (sizeof(BUSY_STR)-1)
00173 #define  NOTFOUND_VAL                404
00174 #define  NOTFOUND_STR                "notfound"
00175 #define  NOTFOUND_STR_LEN            (sizeof(NOTFOUND_STR)-1)
00176 #define  REJECT_VAL                  603
00177 #define  REJECT_STR                  "reject"
00178 #define  REJECT_STR_LEN              (sizeof(REJECT_STR)-1)
00179 #define  ERROR_VAL                   500
00180 #define  ERROR_STR                   "error"
00181 #define  ERROR_STR_LEN               (sizeof(ERROR_STR)-1)
00182 
00183 /* attributes and values for LOG node */
00184 #define  NAME_ATTR                   0
00185 #define  MAX_NAME_SIZE               32
00186 #define  COMMENT_ATTR                1
00187 #define  MAX_COMMENT_SIZE            128
00188 
00189 /* attributes and values for EMAIL node */
00190 #define  TO_ATTR                     0
00191 #define  SUBJECT_ATTR                1
00192 #define  SUBJECT_EMAILHDR_STR        "subject"
00193 #define  SUBJECT_EMAILHDR_LEN        (sizeof(SUBJECT_EMAILHDR_STR)-1)
00194 #define  BODY_ATTR                   2
00195 #define  BODY_EMAILHDR_STR           "body"
00196 #define  BODY_EMAILHDR_LEN           (sizeof(BODY_EMAILHDR_STR)-1)
00197 #define  URL_MAILTO_STR              "mailto:"
00198 #define  URL_MAILTO_LEN              (sizeof(URL_MAILTO_STR)-1)
00199 
00200 /* attributes and values for SUB node */
00201 #define  REF_ATTR                    0
00202 
00203 
00204 
00205 /* node = | type(1) | nr_kids(1) | nr_attrs(1) | unused(1) |
00206  *        | x*kids_offset(2) | y*attrs(2*n) |
00207  */
00208 
00209 #define      NODE_TYPE(_p)            ( *((unsigned char*)(_p)) )
00210 #define      NR_OF_KIDS(_p)           ( *((unsigned char* )((_p)+1)) )
00211 #define      NR_OF_ATTR(_p)           ( *((unsigned char* )((_p)+1+1)) )
00212 #define      KID_OFFSET_PTR(_p,_n)    ( (unsigned short*)((_p)+4+2*(_n)) )
00213 #define      ATTR_PTR(_p)             ( (_p)+4+2*NR_OF_KIDS(_p) )
00214 #define      SIMPLE_NODE_SIZE(_p)     ( 4+2*NR_OF_KIDS(_p) )
00215 #define      GET_NODE_SIZE(_n)        ( 4+2*(_n) )
00216 #define      BASIC_ATTR_SIZE          4
00217 
00218 #define      SET_KID_OFFSET(_p,_n,_o) *KID_OFFSET_PTR(_p,_n)=htons(_o)
00219 #define      KID_OFFSET(_p,_n)        ntohs(*KID_OFFSET_PTR(_p,_n))
00220 
00221 
00222 
00223 
00224 #endif
00225