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