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