Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,3874 +0,0 @@
1
-/*
2
- *  cfg grammar
3
- *
4
- * Copyright (C) 2001-2003 FhG Fokus
5
- *
6
- * This file is part of Kamailio, a free SIP server.
7
- *
8
- * Kamailio 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
- * Kamailio 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
-
28
-%expect 6
29
-
30
-%{
31
-
32
-#include <stdlib.h>
33
-#include <stdio.h>
34
-#include <stdarg.h>
35
-#include <sys/types.h>
36
-#include <sys/socket.h>
37
-#include <netinet/in.h>
38
-#include <netinet/ip.h>
39
-#include <arpa/inet.h>
40
-#include <string.h>
41
-#include <errno.h>
42
-#include "route_struct.h"
43
-#include "globals.h"
44
-#ifdef SHM_MEM
45
-#include "shm_init.h"
46
-#endif /* SHM_MEM */
47
-#include "route.h"
48
-#include "switch.h"
49
-#include "dprint.h"
50
-#include "sr_module.h"
51
-#include "modparam.h"
52
-#include "ip_addr.h"
53
-#include "resolve.h"
54
-#include "socket_info.h"
55
-#include "name_alias.h"
56
-#include "ut.h"
57
-#include "dset.h"
58
-#include "select.h"
59
-#include "flags.h"
60
-#include "tcp_init.h"
61
-#include "tcp_options.h"
62
-#include "sctp_core.h"
63
-#include "pvar.h"
64
-#include "lvalue.h"
65
-#include "rvalue.h"
66
-#include "sr_compat.h"
67
-#include "msg_translator.h"
68
-#include "async_task.h"
69
-
70
-#include "kemi.h"
71
-#include "ppcfg.h"
72
-#include "pvapi.h"
73
-#include "config.h"
74
-#include "cfg_core.h"
75
-#include "cfg/cfg.h"
76
-#ifdef CORE_TLS
77
-#include "tls/tls_config.h"
78
-#endif
79
-#include "timer_ticks.h"
80
-
81
-#ifdef DEBUG_DMALLOC
82
-#include <dmalloc.h>
83
-#endif
84
-
85
-/* hack to avoid alloca usage in the generated C file (needed for compiler
86
- with no built in alloca, like icc*/
87
-#undef _ALLOCA_H
88
-
89
-#define onsend_check(s) \
90
-	do{\
91
-		if (rt!=ONSEND_ROUTE) yyerror( s " allowed only in onsend_routes");\
92
-	}while(0)
93
-
94
-	#define IF_AUTO_BIND_IPV6(x) x
95
-
96
-#ifdef USE_DNS_CACHE
97
-	#define IF_DNS_CACHE(x) x
98
-#else
99
-	#define IF_DNS_CACHE(x) warn("dns cache support not compiled in")
100
-#endif
101
-
102
-#ifdef USE_DNS_FAILOVER
103
-	#define IF_DNS_FAILOVER(x) x
104
-#else
105
-	#define IF_DNS_FAILOVER(x) warn("dns failover support not compiled in")
106
-#endif
107
-
108
-#ifdef USE_NAPTR
109
-	#define IF_NAPTR(x) x
110
-#else
111
-	#define IF_NAPTR(x) warn("dns naptr support not compiled in")
112
-#endif
113
-
114
-#ifdef USE_DST_BLACKLIST
115
-	#define IF_DST_BLACKLIST(x) x
116
-#else
117
-	#define IF_DST_BLACKLIST(x) warn("dst blacklist support not compiled in")
118
-#endif
119
-
120
-#ifdef USE_SCTP
121
-	#define IF_SCTP(x) x
122
-#else
123
-	#define IF_SCTP(x) warn("sctp support not compiled in")
124
-#endif
125
-
126
-#ifdef USE_RAW_SOCKS
127
-	#define IF_RAW_SOCKS(x) x
128
-#else
129
-	#define IF_RAW_SOCKS(x) warn("raw socket support not compiled in")
130
-#endif
131
-
132
-
133
-extern int yylex();
134
-/* safer then using yytext which can be array or pointer */
135
-extern char* yy_number_str;
136
-
137
-static void yyerror(char* s, ...);
138
-static void yyerror_at(struct cfg_pos* pos, char* s, ...);
139
-static char* tmp;
140
-static int i_tmp;
141
-static unsigned u_tmp;
142
-static struct socket_id* lst_tmp;
143
-static struct name_lst*  nl_tmp;
144
-static int rt;  /* Type of route block for find_export */
145
-static str* str_tmp;
146
-static str s_tmp;
147
-static struct ip_addr* ip_tmp;
148
-static struct avp_spec* s_attr;
149
-static select_t sel;
150
-static select_t* sel_ptr;
151
-static pv_spec_t* pv_spec;
152
-static struct action *mod_func_action;
153
-static struct lvalue* lval_tmp;
154
-static struct rvalue* rval_tmp;
155
-
156
-static void warn(char* s, ...);
157
-static void warn_at(struct cfg_pos* pos, char* s, ...);
158
-static void get_cpos(struct cfg_pos* pos);
159
-static struct rval_expr* mk_rve_rval(enum rval_type, void* v);
160
-static struct rval_expr* mk_rve1(enum rval_expr_op op, struct rval_expr* rve1);
161
-static struct rval_expr* mk_rve2(enum rval_expr_op op, struct rval_expr* rve1,
162
-									struct rval_expr* rve2);
163
-static int rval_expr_int_check(struct rval_expr *rve);
164
-static int warn_ct_rve(struct rval_expr *rve, char* name);
165
-static struct socket_id* mk_listen_id(char*, int, int);
166
-static struct name_lst* mk_name_lst(char* name, int flags);
167
-static struct socket_id* mk_listen_id2(struct name_lst*, int, int);
168
-static void free_name_lst(struct name_lst* lst);
169
-static void free_socket_id_lst(struct socket_id* i);
170
-
171
-static struct case_stms* mk_case_stm(struct rval_expr* ct, int is_re, 
172
-									struct action* a, int* err);
173
-static int case_check_type(struct case_stms* stms);
174
-static int case_check_default(struct case_stms* stms);
175
-static int mod_f_params_pre_fixup(struct action* a);
176
-static void free_mod_func_action(struct action* a);
177
-
178
-
179
-extern int line;
180
-extern int column;
181
-extern int startcolumn;
182
-extern int startline;
183
-extern char *finame;
184
-extern char *routename;
185
-extern char *default_routename;
186
-
187
-#define set_cfg_pos(x) \
188
-	do{\
189
-		if(x) {\
190
-		(x)->cline = line;\
191
-		(x)->cfile = (finame!=0)?finame:((cfg_file!=0)?cfg_file:"default");\
192
-		(x)->rname = (routename!=0)?routename:((default_routename!=0)?default_routename:"DEFAULT");\
193
-		}\
194
-	}while(0)
195
-
196
-
197
-%}
198
-
199
-%union {
200
-	long intval;
201
-	unsigned long uval;
202
-	char* strval;
203
-	struct expr* expr;
204
-	struct action* action;
205
-	struct case_stms* case_stms;
206
-	struct net* ipnet;
207
-	struct ip_addr* ipaddr;
208
-	struct socket_id* sockid;
209
-	struct name_lst* name_l;
210
-	struct avp_spec* attr;
211
-	struct _pv_spec* pvar;
212
-	struct lvalue* lval;
213
-	struct rvalue* rval;
214
-	struct rval_expr* rv_expr;
215
-	select_t* select;
216
-}
217
-
218
-/* terminals */
219
-
220
-
221
-/* keywords */
222
-%token FORWARD
223
-%token FORWARD_TCP
224
-%token FORWARD_TLS
225
-%token FORWARD_SCTP
226
-%token FORWARD_UDP
227
-%token EXIT
228
-%token DROP
229
-%token RETURN
230
-%token BREAK
231
-%token LOG_TOK
232
-%token ERROR
233
-%token ROUTE
234
-%token ROUTE_REQUEST
235
-%token ROUTE_FAILURE
236
-%token ROUTE_ONREPLY
237
-%token ROUTE_REPLY
238
-%token ROUTE_BRANCH
239
-%token ROUTE_SEND
240
-%token ROUTE_EVENT
241
-%token EXEC
242
-%token SET_HOST
243
-%token SET_HOSTPORT
244
-%token SET_HOSTPORTTRANS
245
-%token PREFIX
246
-%token STRIP
247
-%token STRIP_TAIL
248
-%token SET_USERPHONE
249
-%token APPEND_BRANCH
250
-%token REMOVE_BRANCH
251
-%token CLEAR_BRANCHES
252
-%token SET_USER
253
-%token SET_USERPASS
254
-%token SET_PORT
255
-%token SET_URI
256
-%token REVERT_URI
257
-%token FORCE_RPORT
258
-%token ADD_LOCAL_RPORT
259
-%token FORCE_TCP_ALIAS
260
-%token UDP_MTU
261
-%token UDP_MTU_TRY_PROTO
262
-%token UDP4_RAW
263
-%token UDP4_RAW_MTU
264
-%token UDP4_RAW_TTL
265
-%token IF
266
-%token ELSE
267
-%token SET_ADV_ADDRESS
268
-%token SET_ADV_PORT
269
-%token FORCE_SEND_SOCKET
270
-%token SET_FWD_NO_CONNECT
271
-%token SET_RPL_NO_CONNECT
272
-%token SET_FWD_CLOSE
273
-%token SET_RPL_CLOSE
274
-%token SWITCH
275
-%token CASE
276
-%token DEFAULT
277
-%token WHILE
278
-%token CFG_SELECT
279
-%token CFG_RESET
280
-%token URIHOST
281
-%token URIPORT
282
-%token MAX_LEN
283
-%token SETFLAG
284
-%token RESETFLAG
285
-%token ISFLAGSET
286
-%token SETAVPFLAG
287
-%token RESETAVPFLAG
288
-%token ISAVPFLAGSET
289
-%token METHOD
290
-%token URI
291
-%token FROM_URI
292
-%token TO_URI
293
-%token SRCIP
294
-%token SRCPORT
295
-%token DSTIP
296
-%token DSTPORT
297
-%token TOIP
298
-%token TOPORT
299
-%token SNDIP
300
-%token SNDPORT
301
-%token SNDPROTO
302
-%token SNDAF
303
-%token PROTO
304
-%token AF
305
-%token MYSELF
306
-%token MSGLEN
307
-%token UDP
308
-%token TCP
309
-%token TLS
310
-%token SCTP
311
-%token WS
312
-%token WSS
313
-
314
-/* config vars. */
315
-%token DEBUG_V
316
-%token FORK
317
-%token FORK_DELAY
318
-%token MODINIT_DELAY
319
-%token LOGSTDERROR
320
-%token LOGFACILITY
321
-%token LOGNAME
322
-%token LOGCOLOR
323
-%token LOGPREFIX
324
-%token LOGPREFIXMODE
325
-%token LOGENGINETYPE
326
-%token LOGENGINEDATA
327
-%token LISTEN
328
-%token ADVERTISE
329
-%token ALIAS
330
-%token SR_AUTO_ALIASES
331
-%token DNS
332
-%token REV_DNS
333
-%token DNS_TRY_IPV6
334
-%token DNS_TRY_NAPTR
335
-%token DNS_SRV_LB
336
-%token DNS_UDP_PREF
337
-%token DNS_TCP_PREF
338
-%token DNS_TLS_PREF
339
-%token DNS_SCTP_PREF
340
-%token DNS_RETR_TIME
341
-%token DNS_RETR_NO
342
-%token DNS_SERVERS_NO
343
-%token DNS_USE_SEARCH
344
-%token DNS_SEARCH_FMATCH
345
-%token DNS_NAPTR_IGNORE_RFC
346
-%token DNS_CACHE_INIT
347
-%token DNS_USE_CACHE
348
-%token DNS_USE_FAILOVER
349
-%token DNS_CACHE_FLAGS
350
-%token DNS_CACHE_NEG_TTL
351
-%token DNS_CACHE_MIN_TTL
352
-%token DNS_CACHE_MAX_TTL
353
-%token DNS_CACHE_MEM
354
-%token DNS_CACHE_GC_INT
355
-%token DNS_CACHE_DEL_NONEXP
356
-%token DNS_CACHE_REC_PREF
357
-
358
-/* ipv6 auto bind */
359
-%token AUTO_BIND_IPV6
360
-
361
-/*blacklist*/
362
-%token DST_BLST_INIT
363
-%token USE_DST_BLST
364
-%token DST_BLST_MEM
365
-%token DST_BLST_TTL
366
-%token DST_BLST_GC_INT
367
-%token DST_BLST_UDP_IMASK
368
-%token DST_BLST_TCP_IMASK
369
-%token DST_BLST_TLS_IMASK
370
-%token DST_BLST_SCTP_IMASK
371
-
372
-%token PORT
373
-%token STAT
374
-%token CHILDREN
375
-%token SOCKET_WORKERS
376
-%token ASYNC_WORKERS
377
-%token ASYNC_USLEEP
378
-%token CHECK_VIA
379
-%token PHONE2TEL
380
-%token MEMLOG
381
-%token MEMDBG
382
-%token MEMSUM
383
-%token MEMSAFETY
384
-%token MEMJOIN
385
-%token MEMSTATUSMODE
386
-%token CORELOG
387
-%token SIP_WARNING
388
-%token SERVER_SIGNATURE
389
-%token SERVER_HEADER
390
-%token USER_AGENT_HEADER
391
-%token REPLY_TO_VIA
392
-%token LOADMODULE
393
-%token LOADPATH
394
-%token MODPARAM
395
-%token CFGENGINE
396
-%token MAXBUFFER
397
-%token SQL_BUFFER_SIZE
398
-%token USER
399
-%token GROUP
400
-%token CHROOT
401
-%token WDIR
402
-%token RUNDIR
403
-%token MHOMED
404
-%token DISABLE_TCP
405
-%token TCP_ACCEPT_ALIASES
406
-%token TCP_CHILDREN
407
-%token TCP_CONNECT_TIMEOUT
408
-%token TCP_SEND_TIMEOUT
409
-%token TCP_CON_LIFETIME
410
-%token TCP_POLL_METHOD
411
-%token TCP_MAX_CONNECTIONS
412
-%token TLS_MAX_CONNECTIONS
413
-%token TCP_NO_CONNECT
414
-%token TCP_SOURCE_IPV4
415
-%token TCP_SOURCE_IPV6
416
-%token TCP_OPT_FD_CACHE
417
-%token TCP_OPT_BUF_WRITE
418
-%token TCP_OPT_CONN_WQ_MAX
419
-%token TCP_OPT_WQ_MAX
420
-%token TCP_OPT_RD_BUF
421
-%token TCP_OPT_WQ_BLK
422
-%token TCP_OPT_DEFER_ACCEPT
423
-%token TCP_OPT_DELAYED_ACK
424
-%token TCP_OPT_SYNCNT
425
-%token TCP_OPT_LINGER2
426
-%token TCP_OPT_KEEPALIVE
427
-%token TCP_OPT_KEEPIDLE
428
-%token TCP_OPT_KEEPINTVL
429
-%token TCP_OPT_KEEPCNT
430
-%token TCP_OPT_CRLF_PING
431
-%token TCP_OPT_ACCEPT_NO_CL
432
-%token TCP_CLONE_RCVBUF
433
-%token DISABLE_TLS
434
-%token ENABLE_TLS
435
-%token TLSLOG
436
-%token TLS_PORT_NO
437
-%token TLS_METHOD
438
-%token TLS_HANDSHAKE_TIMEOUT
439
-%token TLS_SEND_TIMEOUT
440
-%token SSLv23
441
-%token SSLv2
442
-%token SSLv3
443
-%token TLSv1
444
-%token TLS_VERIFY
445
-%token TLS_REQUIRE_CERTIFICATE
446
-%token TLS_CERTIFICATE
447
-%token TLS_PRIVATE_KEY
448
-%token TLS_CA_LIST
449
-%token DISABLE_SCTP
450
-%token ENABLE_SCTP
451
-%token SCTP_CHILDREN
452
-%token ADVERTISED_ADDRESS
453
-%token ADVERTISED_PORT
454
-%token DISABLE_CORE
455
-%token OPEN_FD_LIMIT
456
-%token SHM_MEM_SZ
457
-%token SHM_FORCE_ALLOC
458
-%token MLOCK_PAGES
459
-%token REAL_TIME
460
-%token RT_PRIO
461
-%token RT_POLICY
462
-%token RT_TIMER1_PRIO
463
-%token RT_TIMER1_POLICY
464
-%token RT_TIMER2_PRIO
465
-%token RT_TIMER2_POLICY
466
-%token MCAST_LOOPBACK
467
-%token MCAST_TTL
468
-%token MCAST
469
-%token TOS
470
-%token PMTU_DISCOVERY
471
-%token KILL_TIMEOUT
472
-%token MAX_WLOOPS
473
-%token PVBUFSIZE
474
-%token PVBUFSLOTS
475
-%token HTTP_REPLY_PARSE
476
-%token VERSION_TABLE_CFG
477
-%token CFG_DESCRIPTION
478
-%token SERVER_ID
479
-%token MAX_RECURSIVE_LEVEL
480
-%token MAX_BRANCHES_PARAM
481
-%token LATENCY_CFG_LOG
482
-%token LATENCY_LOG
483
-%token LATENCY_LIMIT_DB
484
-%token LATENCY_LIMIT_ACTION
485
-%token MSG_TIME
486
-%token ONSEND_RT_REPLY
487
-
488
-%token FLAGS_DECL
489
-%token AVPFLAGS_DECL
490
-
491
-%token ATTR_MARK
492
-%token SELECT_MARK
493
-%token ATTR_FROM
494
-%token ATTR_TO
495
-%token ATTR_FROMURI
496
-%token ATTR_TOURI
497
-%token ATTR_FROMUSER
498
-%token ATTR_TOUSER
499
-%token ATTR_FROMDOMAIN
500
-%token ATTR_TODOMAIN
501
-%token ATTR_GLOBAL
502
-%token ADDEQ
503
-
504
-
505
-/*pre-processor*/
506
-%token SUBST
507
-%token SUBSTDEF
508
-%token SUBSTDEFS
509
-
510
-/* operators, C like precedence */
511
-%right EQUAL
512
-%left LOG_OR
513
-%left LOG_AND
514
-%left BIN_OR
515
-%left BIN_AND
516
-%left BIN_XOR
517
-%left BIN_LSHIFT
518
-%left BIN_RSHIFT
519
-%left EQUAL_T DIFF MATCH INTEQ INTDIFF STREQ STRDIFF
520
-%left GT LT GTE LTE
521
-%left PLUS MINUS
522
-%left STAR SLASH MODULO
523
-%right NOT UNARY BIN_NOT
524
-%right DEFINED
525
-%right INTCAST STRCAST
526
-%left DOT
527
-
528
-/* no precedence, they use () */
529
-%token STRLEN
530
-%token STREMPTY
531
-
532
-/* values */
533
-%token <intval> NUMBER
534
-%token <strval> ID
535
-%token <strval> NUM_ID
536
-%token <strval> STRING
537
-%token <strval> IPV6ADDR
538
-%token <strval> PVAR
539
-/* not clear yet if this is an avp or pvar */
540
-%token <strval> AVP_OR_PVAR
541
-%token <strval> EVENT_RT_NAME
542
-
543
-/* other */
544
-%token COMMA
545
-%token SEMICOLON
546
-%token RPAREN
547
-%token LPAREN
548
-%token LBRACE
549
-%token RBRACE
550
-%token LBRACK
551
-%token RBRACK
552
-%token CR
553
-%token COLON
554
-
555
-
556
-/*non-terminals */
557
-/*%type <expr> exp */
558
-%type <expr> exp_elem
559
-%type <intval> intno eint_op eint_op_onsend
560
-%type <intval> eip_op eip_op_onsend
561
-%type <action> action actions cmd fcmd if_cmd stm /*exp_stm*/ assign_action
562
-%type <action> switch_cmd while_cmd ret_cmd
563
-%type <case_stms> single_case case_stms
564
-%type <ipaddr> ipv4 ipv6 ipv6addr ip
565
-%type <ipnet> ipnet
566
-%type <strval> host host_or_if host_if_id
567
-%type <strval> listen_id
568
-%type <name_l> listen_id_lst
569
-%type <name_l> listen_id2
570
-%type <sockid>  id_lst
571
-%type <sockid>  phostport
572
-%type <sockid>  listen_phostport
573
-%type <intval> proto eqproto port
574
-%type <intval> equalop strop cmpop rve_cmpop rve_equalop
575
-%type <intval> uri_type
576
-%type <attr> attr_id
577
-%type <attr> attr_id_num_idx
578
-%type <attr> attr_id_no_idx
579
-%type <attr> attr_id_ass
580
-/*%type <attr> attr_id_val*/
581
-%type <attr> attr_id_any
582
-%type <attr> attr_id_any_str
583
-%type <pvar> pvar
584
-%type <lval> lval
585
-%type <rv_expr> rval rval_expr ct_rval
586
-%type <lval> avp_pvar
587
-/* %type <intval> class_id */
588
-%type <intval> assign_op
589
-%type <select> select_id
590
-%type <strval>	flag_name;
591
-%type <strval>	route_name;
592
-%type <intval> avpflag_oper
593
-%type <intval> rve_un_op
594
-%type <strval> cfg_var_id
595
-/* %type <intval> rve_op */
596
-
597
-/*%type <route_el> rules;
598
-  %type <route_el> rule;
599
-*/
600
-
601
-%%
602
-
603
-
604
-cfg:
605
-	statements
606
-	;
607
-statements:
608
-	statements statement {}
609
-	| statement {}
610
-	| statements error { yyerror(""); YYABORT;}
611
-	;
612
-statement:
613
-	assign_stm
614
-	| preprocess_stm
615
-	| flags_decl
616
-	| avpflags_decl
617
-	| module_stm
618
-	| {rt=REQUEST_ROUTE;} route_stm
619
-	| {rt=FAILURE_ROUTE;} failure_route_stm
620
-	| onreply_route_stm
621
-	| {rt=BRANCH_ROUTE;} branch_route_stm
622
-	| {rt=ONSEND_ROUTE;}   send_route_stm
623
-	| {rt=EVENT_ROUTE;}   event_route_stm
624
-	| SEMICOLON	/* null statement */
625
-	| CR	/* null statement*/
626
-	;
627
-listen_id:
628
-	ip {
629
-		if ($1){
630
-			tmp=ip_addr2a($1);
631
-			if (tmp==0) {
632
-				LOG(L_CRIT, "ERROR: cfg. parser: bad ip "
633
-						"address.\n");
634
-				$$=0;
635
-			} else {
636
-				$$=pkg_malloc(strlen(tmp)+1);
637
-				if ($$==0) {
638
-					LOG(L_CRIT, "ERROR: cfg. parser: out of "
639
-							"memory.\n");
640
-				} else {
641
-					strncpy($$, tmp, strlen(tmp)+1);
642
-				}
643
-			}
644
-		}
645
-	}
646
-	| STRING {
647
-		$$=pkg_malloc(strlen($1)+1);
648
-		if ($$==0) {
649
-				LOG(L_CRIT, "ERROR: cfg. parser: out of "
650
-						"memory.\n");
651
-		} else {
652
-				strncpy($$, $1, strlen($1)+1);
653
-		}
654
-	}
655
-	| host_or_if {
656
-		if ($1){
657
-			$$=pkg_malloc(strlen($1)+1);
658
-			if ($$==0) {
659
-					LOG(L_CRIT, "ERROR: cfg. parser: out of "
660
-							"memory.\n");
661
-			} else {
662
-					strncpy($$, $1, strlen($1)+1);
663
-			}
664
-		}
665
-	}
666
-	;
667
-
668
-
669
-listen_id_lst:
670
-	listen_id	{ $$=mk_name_lst($1, SI_IS_MHOMED); }
671
-	| listen_id COMMA listen_id_lst	{ $$=mk_name_lst($1, SI_IS_MHOMED); 
672
-										if ($$) $$->next=$3;
673
-									}
674
-	;
675
-
676
-listen_id2:
677
-	LPAREN listen_id_lst RPAREN { $$=$2; }
678
-	| listen_id	{ $$=mk_name_lst($1, 0); }
679
-	;
680
-
681
-proto:
682
-	UDP	{ $$=PROTO_UDP; }
683
-	| TCP	{ $$=PROTO_TCP; }
684
-	| TLS	{ $$=PROTO_TLS; }
685
-	| SCTP	{ $$=PROTO_SCTP; }
686
-	| STAR	{ $$=0; }
687
-	;
688
-eqproto:
689
-	UDP	{ $$=PROTO_UDP; }
690
-	| TCP	{ $$=PROTO_TCP; }
691
-	| TLS	{ $$=PROTO_TLS; }
692
-	| SCTP	{ $$=PROTO_SCTP; }
693
-	| WS	{ $$=PROTO_WS; }
694
-	| WSS	{ $$=PROTO_WSS; }
695
-	| STAR	{ $$=0; }
696
-	;
697
-port:
698
-	NUMBER	{ $$=$1; }
699
-	| STAR	{ $$=0; }
700
-;
701
-phostport:
702
-	listen_id		{ $$=mk_listen_id($1, 0, 0); }
703
-	| listen_id COLON port	{ $$=mk_listen_id($1, 0, $3); }
704
-	| proto COLON listen_id	{ $$=mk_listen_id($3, $1, 0); }
705
-	| proto COLON listen_id COLON port	{ $$=mk_listen_id($3, $1, $5);}
706
-	| listen_id COLON error { $$=0; yyerror(" port number expected"); }
707
-	;
708
-
709
-listen_phostport:
710
-	listen_id2		{ $$=mk_listen_id2($1, 0, 0); }
711
-	| listen_id2 COLON port	{ $$=mk_listen_id2($1, 0, $3); }
712
-	| proto COLON listen_id2	{ $$=mk_listen_id2($3, $1, 0); }
713
-	| proto COLON listen_id2 COLON port	{ $$=mk_listen_id2($3, $1, $5);}
714
-	| listen_id2 COLON error { $$=0; yyerror(" port number expected"); }
715
-	;
716
-
717
-id_lst:
718
-	listen_phostport		{  $$=$1 ; }
719
-	| listen_phostport id_lst	{ $$=$1;  if ($$) $$->next=$2; }
720
-	;
721
-
722
-intno: NUMBER
723
-	|  MINUS NUMBER %prec UNARY { $$=-$2; }
724
-	;
725
-
726
-flags_decl:		FLAGS_DECL	flag_list
727
-			|	FLAGS_DECL error { yyerror("flag list expected\n"); }
728
-;
729
-flag_list:		flag_spec
730
-			|	flag_spec COMMA flag_list
731
-;
732
-
733
-flag_spec:		flag_name	{ if (register_flag($1,-1)<0)
734
-								yyerror("register flag failed");
735
-						}
736
-			|	flag_name COLON NUMBER {
737
-						if (register_flag($1, $3)<0)
738
-								yyerror("register flag failed");
739
-										}
740
-;
741
-
742
-flag_name:		STRING	{ $$=$1; }
743
-			|	ID		{ $$=$1; }
744
-;
745
-
746
-avpflags_decl:
747
-	AVPFLAGS_DECL avpflag_list
748
-	| AVPFLAGS_DECL error { yyerror("avpflag list expected\n"); }
749
-	;
750
-avpflag_list:
751
-	avpflag_spec
752
-	| avpflag_spec COMMA avpflag_list
753
-	;
754
-avpflag_spec:
755
-	flag_name {
756
-		if (register_avpflag($1)==0)
757
-			yyerror("cannot declare avpflag");
758
-	}
759
-	;
760
-assign_stm:
761
-	DEBUG_V EQUAL intno { default_core_cfg.debug=$3; }
762
-	| DEBUG_V EQUAL error  { yyerror("number  expected"); }
763
-	| FORK  EQUAL NUMBER { dont_fork= ! $3; }
764
-	| FORK  EQUAL error  { yyerror("boolean value expected"); }
765
-	| FORK_DELAY  EQUAL NUMBER { set_fork_delay($3); }
766
-	| FORK_DELAY  EQUAL error  { yyerror("number expected"); }
767
-	| MODINIT_DELAY  EQUAL NUMBER { set_modinit_delay($3); }
768
-	| MODINIT_DELAY  EQUAL error  { yyerror("number expected"); }
769
-	| LOGSTDERROR EQUAL NUMBER { if (!config_check)  /* if set from cmd line, don't overwrite from yyparse()*/ 
770
-					if(log_stderr == 0) log_stderr=$3; 
771
-				   }
772
-	| LOGSTDERROR EQUAL error { yyerror("boolean value expected"); }
773
-	| LOGFACILITY EQUAL ID {
774
-		if ( (i_tmp=str2facility($3))==-1)
775
-			yyerror("bad facility (see syslog(3) man page)");
776
-		if (!config_check)
777
-			default_core_cfg.log_facility=i_tmp;
778
-	}
779
-	| LOGFACILITY EQUAL error { yyerror("ID expected"); }
780
-	| LOGNAME EQUAL STRING { log_name=$3; }
781
-	| LOGNAME EQUAL error { yyerror("string value expected"); }
782
-	| LOGCOLOR EQUAL NUMBER { log_color=$3; }
783
-	| LOGCOLOR EQUAL error { yyerror("boolean value expected"); }
784
-	| LOGPREFIX EQUAL STRING { log_prefix_fmt=$3; }
785
-	| LOGPREFIX EQUAL error { yyerror("string value expected"); }
786
-	| LOGPREFIXMODE EQUAL NUMBER { log_prefix_mode=$3; }
787
-	| LOGPREFIXMODE EQUAL error { yyerror("number expected"); }
788
-	| LOGENGINETYPE EQUAL STRING { _km_log_engine_type=$3; }
789
-	| LOGENGINETYPE EQUAL error { yyerror("string value expected"); }
790
-	| LOGENGINEDATA EQUAL STRING { _km_log_engine_data=$3; }
791
-	| LOGENGINEDATA EQUAL error { yyerror("string value expected"); }
792
-	| DNS EQUAL NUMBER   { received_dns|= ($3)?DO_DNS:0; }
793
-	| DNS EQUAL error { yyerror("boolean value expected"); }
794
-	| REV_DNS EQUAL NUMBER { received_dns|= ($3)?DO_REV_DNS:0; }
795
-	| REV_DNS EQUAL error { yyerror("boolean value expected"); }
796
-	| DNS_TRY_IPV6 EQUAL NUMBER   { default_core_cfg.dns_try_ipv6=$3; }
797
-	| DNS_TRY_IPV6 error { yyerror("boolean value expected"); }
798
-	| DNS_TRY_NAPTR EQUAL NUMBER   { IF_NAPTR(default_core_cfg.dns_try_naptr=$3); }
799
-	| DNS_TRY_NAPTR error { yyerror("boolean value expected"); }
800
-	| DNS_SRV_LB EQUAL NUMBER   { IF_DNS_FAILOVER(default_core_cfg.dns_srv_lb=$3); }
801
-	| DNS_SRV_LB error { yyerror("boolean value expected"); }
802
-	| DNS_UDP_PREF EQUAL intno { IF_NAPTR(default_core_cfg.dns_udp_pref=$3);}
803
-	| DNS_UDP_PREF error { yyerror("number expected"); }
804
-	| DNS_TCP_PREF EQUAL intno { IF_NAPTR(default_core_cfg.dns_tcp_pref=$3);}
805
-	| DNS_TCP_PREF error { yyerror("number expected"); }
806
-	| DNS_TLS_PREF EQUAL intno { IF_NAPTR(default_core_cfg.dns_tls_pref=$3);}
807
-	| DNS_TLS_PREF error { yyerror("number expected"); }
808
-	| DNS_SCTP_PREF EQUAL intno { 
809
-								IF_NAPTR(default_core_cfg.dns_sctp_pref=$3); }
810
-	| DNS_SCTP_PREF error { yyerror("number expected"); }
811
-	| DNS_RETR_TIME EQUAL NUMBER   { default_core_cfg.dns_retr_time=$3; }
812
-	| DNS_RETR_TIME error { yyerror("number expected"); }
813
-	| DNS_RETR_NO EQUAL NUMBER   { default_core_cfg.dns_retr_no=$3; }
814
-	| DNS_RETR_NO error { yyerror("number expected"); }
815
-	| DNS_SERVERS_NO EQUAL NUMBER   { default_core_cfg.dns_servers_no=$3; }
816
-	| DNS_SERVERS_NO error { yyerror("number expected"); }
817
-	| DNS_USE_SEARCH EQUAL NUMBER   { default_core_cfg.dns_search_list=$3; }
818
-	| DNS_USE_SEARCH error { yyerror("boolean value expected"); }
819
-	| DNS_SEARCH_FMATCH EQUAL NUMBER   { default_core_cfg.dns_search_fmatch=$3; }
820
-	| DNS_SEARCH_FMATCH error { yyerror("boolean value expected"); }
821
-	| DNS_NAPTR_IGNORE_RFC EQUAL NUMBER   { default_core_cfg.dns_naptr_ignore_rfc=$3; }
822
-	| DNS_NAPTR_IGNORE_RFC error { yyerror("boolean value expected"); }
823
-	| DNS_CACHE_INIT EQUAL NUMBER   { IF_DNS_CACHE(dns_cache_init=$3); }
824
-	| DNS_CACHE_INIT error { yyerror("boolean value expected"); }
825
-	| DNS_USE_CACHE EQUAL NUMBER   { IF_DNS_CACHE(default_core_cfg.use_dns_cache=$3); }
826
-	| DNS_USE_CACHE error { yyerror("boolean value expected"); }
827
-	| DNS_USE_FAILOVER EQUAL NUMBER   { IF_DNS_FAILOVER(default_core_cfg.use_dns_failover=$3);}
828
-	| DNS_USE_FAILOVER error { yyerror("boolean value expected"); }
829
-	| DNS_CACHE_FLAGS EQUAL NUMBER   { IF_DNS_CACHE(default_core_cfg.dns_cache_flags=$3); }
830
-	| DNS_CACHE_FLAGS error { yyerror("boolean value expected"); }
831
-	| DNS_CACHE_NEG_TTL EQUAL NUMBER   { IF_DNS_CACHE(default_core_cfg.dns_neg_cache_ttl=$3); }
832
-	| DNS_CACHE_NEG_TTL error { yyerror("boolean value expected"); }
833
-	| DNS_CACHE_MAX_TTL EQUAL NUMBER   { IF_DNS_CACHE(default_core_cfg.dns_cache_max_ttl=$3); }
834
-	| DNS_CACHE_MAX_TTL error { yyerror("boolean value expected"); }
835
-	| DNS_CACHE_MIN_TTL EQUAL NUMBER   { IF_DNS_CACHE(default_core_cfg.dns_cache_min_ttl=$3); }
836
-	| DNS_CACHE_MIN_TTL error { yyerror("boolean value expected"); }
837
-	| DNS_CACHE_MEM EQUAL NUMBER   { IF_DNS_CACHE(default_core_cfg.dns_cache_max_mem=$3); }
838
-	| DNS_CACHE_MEM error { yyerror("boolean value expected"); }
839
-	| DNS_CACHE_GC_INT EQUAL NUMBER   { IF_DNS_CACHE(dns_timer_interval=$3); }
840
-	| DNS_CACHE_GC_INT error { yyerror("boolean value expected"); }
841
-	| DNS_CACHE_DEL_NONEXP EQUAL NUMBER   { IF_DNS_CACHE(default_core_cfg.dns_cache_del_nonexp=$3); }
842
-	| DNS_CACHE_DEL_NONEXP error { yyerror("boolean value expected"); }
843
-	| DNS_CACHE_REC_PREF EQUAL NUMBER   { IF_DNS_CACHE(default_core_cfg.dns_cache_rec_pref=$3); }
844
-	| DNS_CACHE_REC_PREF error { yyerror("boolean value expected"); }
845
-	| AUTO_BIND_IPV6 EQUAL NUMBER {IF_AUTO_BIND_IPV6(auto_bind_ipv6 = $3);}
846
-	| AUTO_BIND_IPV6 error { yyerror("boolean value expected"); }
847
-	| DST_BLST_INIT EQUAL NUMBER   { IF_DST_BLACKLIST(dst_blacklist_init=$3); }
848
-	| DST_BLST_INIT error { yyerror("boolean value expected"); }
849
-	| USE_DST_BLST EQUAL NUMBER {
850
-		IF_DST_BLACKLIST(default_core_cfg.use_dst_blacklist=$3);
851
-	}
852
-	| USE_DST_BLST error { yyerror("boolean value expected"); }
853
-	| DST_BLST_MEM EQUAL NUMBER {
854
-		IF_DST_BLACKLIST(default_core_cfg.blst_max_mem=$3); 
855
-	}
856
-	| DST_BLST_MEM error { yyerror("boolean value expected"); }
857
-	| DST_BLST_TTL EQUAL NUMBER {
858
-		IF_DST_BLACKLIST(default_core_cfg.blst_timeout=$3);
859
-	}
860
-	| DST_BLST_TTL error { yyerror("boolean value expected"); }
861
-	| DST_BLST_GC_INT EQUAL NUMBER { IF_DST_BLACKLIST(blst_timer_interval=$3);}
862
-	| DST_BLST_GC_INT error { yyerror("boolean value expected"); }
863
-	| DST_BLST_UDP_IMASK EQUAL NUMBER {
864
-		IF_DST_BLACKLIST(default_core_cfg.blst_udp_imask=$3);
865
-	}
866
-	| DST_BLST_UDP_IMASK error { yyerror("number(flags) expected"); }
867
-	| DST_BLST_TCP_IMASK EQUAL NUMBER {
868
-		IF_DST_BLACKLIST(default_core_cfg.blst_tcp_imask=$3);
869
-	}
870
-	| DST_BLST_TCP_IMASK error { yyerror("number(flags) expected"); }
871
-	| DST_BLST_TLS_IMASK EQUAL NUMBER {
872
-		IF_DST_BLACKLIST(default_core_cfg.blst_tls_imask=$3);
873
-	}
874
-	| DST_BLST_TLS_IMASK error { yyerror("number(flags) expected"); }
875
-	| DST_BLST_SCTP_IMASK EQUAL NUMBER {
876
-		IF_DST_BLACKLIST(default_core_cfg.blst_sctp_imask=$3);
877
-	}
878
-	| DST_BLST_SCTP_IMASK error { yyerror("number(flags) expected"); }
879
-	| PORT EQUAL NUMBER   { port_no=$3; }
880
-	| STAT EQUAL STRING {
881
-		#ifdef STATS
882
-				stat_file=$3;
883
-		#endif
884
-	}
885
-	| MAXBUFFER EQUAL NUMBER { maxbuffer=$3; }
886
-	| MAXBUFFER EQUAL error { yyerror("number expected"); }
887
-    | SQL_BUFFER_SIZE EQUAL NUMBER { sql_buffer_size=$3; }
888
-	| SQL_BUFFER_SIZE EQUAL error { yyerror("number expected"); }
889
-	| PORT EQUAL error    { yyerror("number expected"); }
890
-	| CHILDREN EQUAL NUMBER { children_no=$3; }
891
-	| CHILDREN EQUAL error { yyerror("number expected"); }
892
-	| SOCKET_WORKERS EQUAL NUMBER { socket_workers=$3; }
893
-	| SOCKET_WORKERS EQUAL error { yyerror("number expected"); }
894
-	| ASYNC_WORKERS EQUAL NUMBER { async_task_set_workers($3); }
895
-	| ASYNC_WORKERS EQUAL error { yyerror("number expected"); }
896
-	| ASYNC_USLEEP EQUAL NUMBER { async_task_set_usleep($3); }
897
-	| ASYNC_USLEEP EQUAL error { yyerror("number expected"); }
898
-	| CHECK_VIA EQUAL NUMBER { check_via=$3; }
899
-	| CHECK_VIA EQUAL error { yyerror("boolean value expected"); }
900
-	| PHONE2TEL EQUAL NUMBER { phone2tel=$3; }
901
-	| PHONE2TEL EQUAL error { yyerror("boolean value expected"); }
902
-	| MEMLOG EQUAL intno { default_core_cfg.memlog=$3; }
903
-	| MEMLOG EQUAL error { yyerror("int value expected"); }
904