a3192e4fc8172ffe2a387a16b70a78a1796188fb
[sip-router] / select_core.h
1 /*
2  * $Id$
3  *
4  * Copyright (C) 2005-2006 iptelorg GmbH
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  *    info@iptel.org
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  * History:
28  * --------
29  *  2005-12-19  select framework, basic core functions (mma)
30  *  2006-01-19  multiple nested calls, IS_ALIAS -> NESTED flag renamed (mma)
31  *  2007-01-26  date, identity, identity_info support added (gergo)
32  */
33
34  
35 #ifndef _SELECT_CORE_H
36 #define _SELECT_CORE_H
37
38 #include "str.h"
39 #include "parser/msg_parser.h"
40 #include "select.h"
41
42 enum {
43         SEL_PARAM_TAG, 
44         SEL_PARAM_Q, SEL_PARAM_EXPIRES, SEL_PARAM_METHODS, SEL_PARAM_RECEIVED, SEL_PARAM_INSTANCE, 
45         SEL_PARAM_BRANCH, SEL_PARAM_RPORT, SEL_PARAM_I, SEL_PARAM_ALIAS
46        };
47
48 enum {
49         SEL_AUTH_PROXY,
50         SEL_AUTH_WWW,
51         SEL_AUTH_USERNAME,
52         SEL_AUTH_USER,
53         SEL_AUTH_DOMAIN,
54         SEL_AUTH_REALM,
55         SEL_AUTH_NONCE,
56         SEL_AUTH_URI,
57         SEL_AUTH_CNONCE,
58         SEL_AUTH_NC,
59         SEL_AUTH_RESPONSE,
60         SEL_AUTH_OPAQUE,
61         SEL_AUTH_ALG,
62         SEL_AUTH_QOP
63 };
64
65 enum {
66         SEL_SRC  = 1<<0,
67         SEL_DST  = 1<<1,
68         SEL_RCV  = 1<<2,
69         SEL_PROTO= 1<<5,
70         SEL_IP   = 1<<6,
71         SEL_PORT = 1<<7,
72         SEL_IP_PORT = SEL_IP | SEL_PORT,
73 };
74
75 enum {
76         SEL_NOW_GMT = 1,
77         SEL_NOW_LOCAL = 2
78 };
79
80 enum {
81         SEL_BRANCH_URI = 1<<0,
82         SEL_BRANCH_Q = 1<<1,
83         SEL_BRANCH_DST_URI = 1<<2
84 };
85
86 SELECT_F(select_ruri)
87 SELECT_F(select_dst_uri)
88 SELECT_F(select_next_hop)
89 SELECT_F(select_next_hop_src_ip)
90 SELECT_F(select_from)
91 SELECT_F(select_from_uri)
92 SELECT_F(select_from_tag)
93 SELECT_F(select_from_name)
94 SELECT_F(select_from_params)
95 SELECT_F(select_to)
96 SELECT_F(select_to_uri)
97 SELECT_F(select_to_tag)
98 SELECT_F(select_to_name)
99 SELECT_F(select_to_params)
100 SELECT_F(select_refer_to)
101 SELECT_F(select_refer_to_uri)
102 SELECT_F(select_refer_to_tag)
103 SELECT_F(select_refer_to_name)
104 SELECT_F(select_refer_to_params)
105 SELECT_F(select_rpid)
106 SELECT_F(select_rpid_uri)
107 SELECT_F(select_rpid_tag)
108 SELECT_F(select_rpid_name)
109 SELECT_F(select_rpid_params)
110 SELECT_F(select_contact)
111 SELECT_F(select_contact_uri)
112 SELECT_F(select_contact_name)
113 SELECT_F(select_contact_params)
114 SELECT_F(select_contact_params_spec)
115 SELECT_F(select_via)
116 SELECT_F(select_via_name)
117 SELECT_F(select_via_version)
118 SELECT_F(select_via_transport)
119 SELECT_F(select_via_host)
120 SELECT_F(select_via_port)
121 SELECT_F(select_via_comment)
122 SELECT_F(select_via_params)
123 SELECT_F(select_via_params_spec)
124
125 SELECT_F(select_msg)
126 SELECT_F(select_msg_first_line)
127 SELECT_F(select_msg_flags)
128 SELECT_F(select_msg_type)
129 SELECT_F(select_msg_len)
130 SELECT_F(select_msg_id)
131 SELECT_F(select_msg_id_hex)
132 SELECT_F(select_msg_body)
133 SELECT_F(select_msg_body_sdp)
134 SELECT_F(select_sdp_line)
135 SELECT_F(select_msg_header)
136 SELECT_F(select_anyheader)
137 SELECT_F(select_anyheader_params)
138 SELECT_F(select_msg_request)
139 SELECT_F(select_msg_request_method)
140 SELECT_F(select_msg_request_uri)
141 SELECT_F(select_msg_request_version)
142 SELECT_F(select_msg_response)
143 SELECT_F(select_msg_response_version)
144 SELECT_F(select_msg_response_status)
145 SELECT_F(select_msg_response_reason)
146 SELECT_F(select_version)
147
148 SELECT_F(select_any_nameaddr)
149 SELECT_F(select_nameaddr_name)
150 SELECT_F(select_nameaddr_uri)
151 SELECT_F(select_nameaddr_params)
152 SELECT_F(select_any_params)
153         
154 SELECT_F(select_any_uri)
155 SELECT_F(select_uri_type)
156 SELECT_F(select_uri_user)
157 SELECT_F(select_uri_rn_user)
158 SELECT_F(select_uri_pwd)
159 SELECT_F(select_uri_host)
160 SELECT_F(select_uri_port)
161 SELECT_F(select_uri_hostport)
162 SELECT_F(select_uri_params)
163 SELECT_F(select_uri_proto)
164
165 SELECT_F(select_event)
166
167 SELECT_F(select_rr)
168 SELECT_F(select_rr_uri)
169 SELECT_F(select_rr_name)
170 SELECT_F(select_rr_params)
171
172 SELECT_F(select_cseq)
173 SELECT_F(select_cseq_method)
174 SELECT_F(select_cseq_num)
175
176 SELECT_F(select_auth)
177 SELECT_F(select_auth_param)
178 SELECT_F(select_auth_username)
179 SELECT_F(select_auth_username_comp)
180
181 SELECT_F(select_src)
182 SELECT_F(select_dst)
183 SELECT_F(select_rcv)
184 SELECT_F(select_ip_port)
185
186 SELECT_F(select_call_id)
187 SELECT_F(select_expires)
188 SELECT_F(select_max_forwards)
189 SELECT_F(select_content_type)
190 SELECT_F(select_content_length)
191 SELECT_F(select_subject)
192 SELECT_F(select_organization)
193 SELECT_F(select_priority)
194 SELECT_F(select_session_expires)
195 SELECT_F(select_min_se)
196 SELECT_F(select_user_agent)
197 SELECT_F(select_sip_if_match)
198
199 SELECT_F(select_sys)
200 SELECT_F(select_sys_pid)
201 SELECT_F(select_sys_server_id)
202 SELECT_F(select_sys_unique)
203 SELECT_F(select_sys_now)
204 SELECT_F(select_sys_now_fmt)
205
206 SELECT_F(select_branch)
207 SELECT_F(select_branch_count)
208 SELECT_F(select_branch_uri)
209 SELECT_F(select_branch_dst_uri)
210 SELECT_F(select_branch_uriq)
211 SELECT_F(select_branch_q)
212
213 SELECT_F(select_date)
214 SELECT_F(select_identity)
215 SELECT_F(select_identity_info)
216
217 SELECT_F(select_cfg_var)
218 SELECT_F(select_cfg_var1)
219 SELECT_F(cfg_selected_inst)
220
221 static select_row_t select_core[] = {
222         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("ruri"), select_ruri, 0}, /* not the same as request.uri because it is involved by new_uri */
223         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("request_uri"), select_ruri, 0},
224         { select_ruri, SEL_PARAM_STR, STR_NULL, select_any_uri, NESTED},
225         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("dst_uri"), select_dst_uri, 0},
226         { select_dst_uri, SEL_PARAM_STR, STR_NULL, select_any_uri, NESTED},
227         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("next_hop"), select_next_hop, 0},
228         { select_next_hop, SEL_PARAM_STR, STR_STATIC_INIT("src_ip"), select_next_hop_src_ip, 0},
229         { select_next_hop, SEL_PARAM_STR, STR_NULL, select_any_uri, NESTED},
230         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("from"), select_from, 0},
231         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("f"), select_from, 0},
232         { select_from, SEL_PARAM_STR, STR_STATIC_INIT("uri"), select_from_uri, 0},
233         { select_from, SEL_PARAM_STR, STR_STATIC_INIT("tag"), select_from_tag, 0},
234         { select_from, SEL_PARAM_STR, STR_STATIC_INIT("name"), select_from_name, 0},
235         { select_from, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_from_params, CONSUME_NEXT_STR},
236         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("to"), select_to, 0},
237         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("t"), select_to, 0},
238         { select_to, SEL_PARAM_STR, STR_STATIC_INIT("uri"), select_to_uri, 0},
239         { select_to, SEL_PARAM_STR, STR_STATIC_INIT("tag"), select_to_tag, 0},
240         { select_to, SEL_PARAM_STR, STR_STATIC_INIT("name"), select_to_name, 0},
241         { select_to, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_to_params, CONSUME_NEXT_STR},
242         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("refer_to"), select_refer_to, 0},
243         { select_refer_to, SEL_PARAM_STR, STR_STATIC_INIT("uri"), select_refer_to_uri, 0},
244         { select_refer_to, SEL_PARAM_STR, STR_STATIC_INIT("tag"), select_refer_to_tag, 0},
245         { select_refer_to, SEL_PARAM_STR, STR_STATIC_INIT("name"), select_refer_to_name, 0},
246         { select_refer_to, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_refer_to_params, CONSUME_NEXT_STR},
247         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("remote_party_id"), select_rpid, 0},
248         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("rpid"), select_rpid, 0},
249         { select_rpid, SEL_PARAM_STR, STR_STATIC_INIT("uri"), select_rpid_uri, 0},
250         { select_rpid, SEL_PARAM_STR, STR_STATIC_INIT("tag"), select_rpid_tag, 0},
251         { select_rpid, SEL_PARAM_STR, STR_STATIC_INIT("name"), select_rpid_name, 0},
252         { select_rpid, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_rpid_params, CONSUME_NEXT_STR},
253         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("contact"), select_contact, 0},
254         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("m"), select_contact, 0},
255         { select_contact, SEL_PARAM_STR, STR_STATIC_INIT("uri"), select_contact_uri, 0},
256         { select_contact, SEL_PARAM_STR, STR_STATIC_INIT("name"), select_contact_name, 0}, 
257         { select_contact, SEL_PARAM_STR, STR_STATIC_INIT("q"), select_contact_params_spec, DIVERSION | SEL_PARAM_Q}, 
258         { select_contact, SEL_PARAM_STR, STR_STATIC_INIT("expires"), select_contact_params_spec, DIVERSION | SEL_PARAM_EXPIRES}, 
259         { select_contact, SEL_PARAM_STR, STR_STATIC_INIT("methods"), select_contact_params_spec, DIVERSION | SEL_PARAM_METHODS}, 
260         { select_contact, SEL_PARAM_STR, STR_STATIC_INIT("received"), select_contact_params_spec, DIVERSION | SEL_PARAM_RECEIVED}, 
261         { select_contact, SEL_PARAM_STR, STR_STATIC_INIT("instance"), select_contact_params_spec, DIVERSION | SEL_PARAM_INSTANCE},      
262         { select_contact, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_contact_params, CONSUME_NEXT_STR},
263         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("via"), select_via, OPTIONAL | CONSUME_NEXT_INT},
264         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("v"), select_via, OPTIONAL | CONSUME_NEXT_INT},
265         { select_via, SEL_PARAM_STR, STR_STATIC_INIT("name"), select_via_name, 0},
266         { select_via, SEL_PARAM_STR, STR_STATIC_INIT("version"), select_via_version, 0},
267         { select_via, SEL_PARAM_STR, STR_STATIC_INIT("transport"), select_via_transport, 0},
268         { select_via, SEL_PARAM_STR, STR_STATIC_INIT("host"), select_via_host, 0},
269         { select_via, SEL_PARAM_STR, STR_STATIC_INIT("port"), select_via_port, 0},
270         { select_via, SEL_PARAM_STR, STR_STATIC_INIT("comment"), select_via_comment, 0},
271         { select_via, SEL_PARAM_STR, STR_STATIC_INIT("branch"), select_via_params_spec, DIVERSION | SEL_PARAM_BRANCH},
272         { select_via, SEL_PARAM_STR, STR_STATIC_INIT("received"), select_via_params_spec, DIVERSION | SEL_PARAM_RECEIVED},
273         { select_via, SEL_PARAM_STR, STR_STATIC_INIT("rport"), select_via_params_spec, DIVERSION | SEL_PARAM_RPORT},
274         { select_via, SEL_PARAM_STR, STR_STATIC_INIT("i"), select_via_params_spec, DIVERSION | SEL_PARAM_I},
275         { select_via, SEL_PARAM_STR, STR_STATIC_INIT("alias"), select_via_params_spec, DIVERSION | SEL_PARAM_ALIAS},
276         { select_via, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_via_params, CONSUME_NEXT_STR},
277         
278         { select_from_uri, SEL_PARAM_INT, STR_NULL, select_any_uri, NESTED},
279         { select_to_uri, SEL_PARAM_INT, STR_NULL, select_any_uri, NESTED},
280         { select_refer_to_uri, SEL_PARAM_INT, STR_NULL, select_any_uri, NESTED},
281         { select_rpid_uri, SEL_PARAM_INT, STR_NULL, select_any_uri, NESTED},
282         { select_contact_uri, SEL_PARAM_INT, STR_NULL, select_any_uri, NESTED},
283         { select_rr_uri, SEL_PARAM_INT, STR_NULL, select_any_uri, NESTED},
284         { select_any_uri, SEL_PARAM_STR, STR_STATIC_INIT("type"), select_uri_type, 0},
285         { select_any_uri, SEL_PARAM_STR, STR_STATIC_INIT("user"), select_uri_user, 0},
286         { select_any_uri, SEL_PARAM_STR, STR_STATIC_INIT("rn_user"), select_uri_rn_user, 0},
287         { select_any_uri, SEL_PARAM_STR, STR_STATIC_INIT("pwd"), select_uri_pwd, 0},
288         { select_any_uri, SEL_PARAM_STR, STR_STATIC_INIT("host"), select_uri_host, 0},
289         { select_any_uri, SEL_PARAM_STR, STR_STATIC_INIT("port"), select_uri_port, 0},
290         { select_any_uri, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_uri_params, CONSUME_NEXT_STR | OPTIONAL | FIXUP_CALL },
291         { select_any_uri, SEL_PARAM_STR, STR_STATIC_INIT("hostport"), select_uri_hostport, 0},
292         { select_any_uri, SEL_PARAM_STR, STR_STATIC_INIT("transport"), select_uri_proto, 0},
293
294         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("event"), select_event, 0},
295
296         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("record_route"), select_rr, 0},
297         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("rr"), select_rr, 0},
298         { select_rr, SEL_PARAM_STR, STR_STATIC_INIT("uri"), select_rr_uri, 0},
299         { select_rr, SEL_PARAM_STR, STR_STATIC_INIT("name"), select_rr_name, 0}, 
300         { select_rr, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_rr_params, CONSUME_NEXT_STR},
301
302         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("cseq"), select_cseq, 0},
303         { select_cseq, SEL_PARAM_STR, STR_STATIC_INIT("num"), select_cseq_num, 0},
304         { select_cseq, SEL_PARAM_STR, STR_STATIC_INIT("method"), select_cseq_method, 0},
305
306         { select_any_nameaddr, SEL_PARAM_STR, STR_STATIC_INIT("name"), select_nameaddr_name, 0},
307         { select_any_nameaddr, SEL_PARAM_STR, STR_STATIC_INIT("uri"), select_nameaddr_uri, 0},
308         { select_any_nameaddr, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_nameaddr_params, OPTIONAL | CONSUME_NEXT_STR},
309         { select_nameaddr_uri, SEL_PARAM_INT, STR_NULL, select_any_uri, NESTED},
310
311         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("msg"), select_msg, 0},
312         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("message"), select_msg, 0},
313         { select_msg, SEL_PARAM_STR, STR_STATIC_INIT("first_line"), select_msg_first_line, 0},
314         { select_msg, SEL_PARAM_STR, STR_STATIC_INIT("flags"), select_msg_flags, 0},
315         { select_msg, SEL_PARAM_STR, STR_STATIC_INIT("len"), select_msg_len, 0},
316         { select_msg, SEL_PARAM_STR, STR_STATIC_INIT("id"), select_msg_id, 0},
317         { select_msg_id, SEL_PARAM_STR, STR_STATIC_INIT("hex"), select_msg_id_hex, 0},
318         { select_msg, SEL_PARAM_STR, STR_STATIC_INIT("type"), select_msg_type, 0},
319         { select_msg, SEL_PARAM_STR, STR_STATIC_INIT("header"), select_msg_header, 0},
320         { select_msg, SEL_PARAM_STR, STR_STATIC_INIT("h"), select_msg_header, 0},
321         { select_msg_header, SEL_PARAM_STR, STR_NULL, select_anyheader, OPTIONAL | CONSUME_NEXT_INT | FIXUP_CALL},
322         { select_anyheader, SEL_PARAM_STR, STR_STATIC_INIT("nameaddr"), select_any_nameaddr, NESTED | CONSUME_NEXT_STR},
323         { select_anyheader, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_anyheader_params, NESTED},
324         { select_anyheader_params, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_any_params, CONSUME_NEXT_STR},
325         { select_msg, SEL_PARAM_STR, STR_STATIC_INIT("body"), select_msg_body, 0},
326         { select_msg, SEL_PARAM_STR, STR_STATIC_INIT("content"), select_msg_body, 0},
327         { select_msg_body, SEL_PARAM_STR, STR_STATIC_INIT("sdp"), select_msg_body_sdp, 0},
328         { select_msg_body_sdp, SEL_PARAM_STR, STR_STATIC_INIT("line"), select_sdp_line, CONSUME_NEXT_STR | FIXUP_CALL},
329         { select_msg, SEL_PARAM_STR, STR_STATIC_INIT("request"), select_msg_request, 0},
330         { select_msg, SEL_PARAM_STR, STR_STATIC_INIT("req"), select_msg_request, 0},
331         { select_msg_request, SEL_PARAM_STR, STR_STATIC_INIT("method"), select_msg_request_method, 0},
332         { select_msg_request, SEL_PARAM_STR, STR_STATIC_INIT("uri"), select_msg_request_uri, 0},
333         { select_msg_request_uri, SEL_PARAM_STR, STR_NULL, select_any_uri, NESTED},
334         { select_msg_request, SEL_PARAM_STR, STR_STATIC_INIT("version"), select_msg_request_version, 0},
335         { select_msg, SEL_PARAM_STR, STR_STATIC_INIT("response"), select_msg_response, 0},
336         { select_msg, SEL_PARAM_STR, STR_STATIC_INIT("res"), select_msg_response, 0},
337         { select_msg_response, SEL_PARAM_STR, STR_STATIC_INIT("version"), select_msg_response_version, 0},
338         { select_msg_response, SEL_PARAM_STR, STR_STATIC_INIT("status"), select_msg_response_status, 0},
339         { select_msg_response, SEL_PARAM_STR, STR_STATIC_INIT("code"), select_msg_response_status, 0},
340         { select_msg_response, SEL_PARAM_STR, STR_STATIC_INIT("reason"), select_msg_response_reason, 0},
341         /*short aliases*/
342         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("method"), select_msg_request_method, 0},
343         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("version"), select_version, 0},
344         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("status"), select_msg_response_status, 0},
345         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("code"), select_msg_response_status, 0},
346         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("reason"), select_msg_response_reason, 0},
347
348         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("proxy_authorization"), select_auth, CONSUME_NEXT_STR | DIVERSION | SEL_AUTH_PROXY | FIXUP_CALL},
349         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("authorization"), select_auth, CONSUME_NEXT_STR | DIVERSION | SEL_AUTH_WWW | FIXUP_CALL}, 
350         { select_auth, SEL_PARAM_STR, STR_STATIC_INIT("username"), select_auth_username, DIVERSION | SEL_AUTH_USERNAME},
351         { select_auth, SEL_PARAM_STR, STR_STATIC_INIT("realm"), select_auth_param, DIVERSION | SEL_AUTH_REALM},
352         { select_auth, SEL_PARAM_STR, STR_STATIC_INIT("nonce"), select_auth_param, DIVERSION | SEL_AUTH_NONCE},
353         { select_auth, SEL_PARAM_STR, STR_STATIC_INIT("uri"), select_auth_param, DIVERSION | SEL_AUTH_URI},
354         { select_auth, SEL_PARAM_STR, STR_STATIC_INIT("cnonce"), select_auth_param, DIVERSION | SEL_AUTH_CNONCE},
355         { select_auth, SEL_PARAM_STR, STR_STATIC_INIT("nc"), select_auth_param, DIVERSION | SEL_AUTH_NC},
356         { select_auth, SEL_PARAM_STR, STR_STATIC_INIT("response"), select_auth_param, DIVERSION | SEL_AUTH_RESPONSE},
357         { select_auth, SEL_PARAM_STR, STR_STATIC_INIT("opaque"), select_auth_param, DIVERSION | SEL_AUTH_OPAQUE},
358         { select_auth, SEL_PARAM_STR, STR_STATIC_INIT("algorithm"), select_auth_param, DIVERSION | SEL_AUTH_ALG},
359         { select_auth, SEL_PARAM_STR, STR_STATIC_INIT("qop"), select_auth_param, DIVERSION | SEL_AUTH_QOP},
360         { select_auth_username, SEL_PARAM_STR, STR_STATIC_INIT("user"), select_auth_username_comp, DIVERSION | SEL_AUTH_USER},
361         { select_auth_username, SEL_PARAM_STR, STR_STATIC_INIT("domain"), select_auth_username_comp, DIVERSION | SEL_AUTH_DOMAIN},
362
363         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("src"), select_src, SEL_PARAM_EXPECTED},
364         { select_src, SEL_PARAM_STR, STR_STATIC_INIT("ip"), select_ip_port, DIVERSION | SEL_SRC | SEL_IP},
365         { select_src, SEL_PARAM_STR, STR_STATIC_INIT("port"), select_ip_port, DIVERSION | SEL_SRC | SEL_PORT},
366         { select_src, SEL_PARAM_STR, STR_STATIC_INIT("ip_port"), select_ip_port, DIVERSION | SEL_SRC | SEL_IP_PORT},
367         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("dst"), select_dst, SEL_PARAM_EXPECTED},
368         { select_dst, SEL_PARAM_STR, STR_STATIC_INIT("ip"), select_ip_port, DIVERSION | SEL_DST | SEL_IP},
369         { select_dst, SEL_PARAM_STR, STR_STATIC_INIT("port"), select_ip_port, DIVERSION | SEL_DST | SEL_PORT},
370         { select_dst, SEL_PARAM_STR, STR_STATIC_INIT("ip_port"), select_ip_port, DIVERSION | SEL_DST | SEL_IP_PORT},
371         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("received"), select_rcv, SEL_PARAM_EXPECTED},
372         { select_rcv, SEL_PARAM_STR, STR_STATIC_INIT("proto"), select_ip_port, DIVERSION | SEL_RCV | SEL_PROTO},
373         { select_rcv, SEL_PARAM_STR, STR_STATIC_INIT("ip"), select_ip_port, DIVERSION | SEL_RCV | SEL_IP},
374         { select_rcv, SEL_PARAM_STR, STR_STATIC_INIT("port"), select_ip_port, DIVERSION | SEL_RCV | SEL_PORT},
375         { select_rcv, SEL_PARAM_STR, STR_STATIC_INIT("ip_port"), select_ip_port, DIVERSION | SEL_RCV | SEL_IP_PORT},
376         { select_rcv, SEL_PARAM_STR, STR_STATIC_INIT("proto_ip_port"), select_ip_port, DIVERSION | SEL_RCV | SEL_PROTO | SEL_IP_PORT},
377
378         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("call_id"), select_call_id, 0},
379         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("expires"), select_expires, 0},
380         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("max_forwards"), select_max_forwards, 0},
381         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("content_type"), select_content_type, 0},
382         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("content_length"), select_content_length, 0},
383         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("subject"), select_subject, 0},
384         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("organization"), select_organization, 0},
385         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("priority"), select_priority, 0},
386         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("session_expires"), select_session_expires, 0},
387         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("min_se"), select_min_se, 0},
388         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("user_agent"), select_user_agent, 0},
389         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("sip_if_match"), select_sip_if_match, 0},
390
391         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("sys"), select_sys, SEL_PARAM_EXPECTED},
392         { select_sys, SEL_PARAM_STR, STR_STATIC_INIT("pid"), select_sys_pid, 0},
393         { select_sys, SEL_PARAM_STR, STR_STATIC_INIT("unique"), select_sys_unique, 0},
394         { select_sys, SEL_PARAM_STR, STR_STATIC_INIT("now"), select_sys_now, 0},
395         { select_sys_now, SEL_PARAM_STR, STR_STATIC_INIT("local"), select_sys_now_fmt, OPTIONAL | CONSUME_NEXT_STR | DIVERSION | SEL_NOW_LOCAL},
396         { select_sys_now, SEL_PARAM_STR, STR_STATIC_INIT("gmt"), select_sys_now_fmt, OPTIONAL | CONSUME_NEXT_STR | DIVERSION | SEL_NOW_GMT},
397         { select_sys_now, SEL_PARAM_STR, STR_STATIC_INIT("utc"), select_sys_now_fmt, OPTIONAL | CONSUME_NEXT_STR | DIVERSION | SEL_NOW_GMT},
398         { select_sys, SEL_PARAM_STR, STR_STATIC_INIT("server_id"), select_sys_server_id, 0},
399
400         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("branch"), select_branch, SEL_PARAM_EXPECTED},
401         { select_branch, SEL_PARAM_STR, STR_STATIC_INIT("count"), select_branch_count, 0},
402         { select_branch, SEL_PARAM_STR, STR_STATIC_INIT("uri"), select_branch_uri, OPTIONAL | CONSUME_NEXT_INT | DIVERSION | SEL_BRANCH_URI },
403         { select_branch, SEL_PARAM_STR, STR_STATIC_INIT("dst_uri"), select_branch_dst_uri, OPTIONAL | CONSUME_NEXT_INT | DIVERSION | SEL_BRANCH_DST_URI},
404         { select_branch_uri, SEL_PARAM_STR, STR_NULL, select_any_uri, NESTED},
405         { select_branch_dst_uri, SEL_PARAM_STR, STR_NULL, select_any_uri, NESTED},
406         { select_branch, SEL_PARAM_STR, STR_STATIC_INIT("uriq"), select_branch_uriq, OPTIONAL | CONSUME_NEXT_INT | DIVERSION | SEL_BRANCH_URI | SEL_BRANCH_Q},
407         { select_branch_uriq, SEL_PARAM_STR, STR_NULL, select_any_nameaddr, NESTED},
408         { select_branch, SEL_PARAM_STR, STR_STATIC_INIT("q"), select_branch_q, OPTIONAL | CONSUME_NEXT_INT | DIVERSION | SEL_BRANCH_Q},
409
410         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("date"), select_date, 0},
411         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("identity"), select_identity, 0},
412         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("identity_info"), select_identity_info, 0},
413
414         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("cfg_get"), select_cfg_var1, SEL_PARAM_EXPECTED | CONSUME_NEXT_STR},
415         { select_cfg_var1, SEL_PARAM_STR, STR_NULL, select_cfg_var, FIXUP_CALL },
416         { NULL, SEL_PARAM_STR, STR_STATIC_INIT("cfg_selected"), cfg_selected_inst, CONSUME_NEXT_STR | FIXUP_CALL },
417
418         { select_cfg_var, SEL_PARAM_STR, STR_STATIC_INIT("nameaddr"), select_any_nameaddr, NESTED | CONSUME_NEXT_STR},
419         { select_cfg_var, SEL_PARAM_STR, STR_STATIC_INIT("uri"), select_any_uri, NESTED | CONSUME_NEXT_STR},
420         { select_cfg_var, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_anyheader_params, NESTED},
421
422         { NULL, SEL_PARAM_INT, STR_NULL, NULL, 0}
423 };
424
425 static select_table_t select_core_table = {select_core, NULL};
426
427 #endif // _SELECT_CORE_H