4 * Copyright (C) 2001-2003 FhG Fokus
6 * This file is part of Kamailio, a free SIP server.
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
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:
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.
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
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>
42 #include "route_struct.h"
50 #include "sr_module.h"
54 #include "socket_info.h"
55 #include "name_alias.h"
61 #include "tcp_options.h"
62 #include "sctp_core.h"
66 #include "sr_compat.h"
67 #include "msg_translator.h"
68 #include "async_task.h"
77 #include "tls/tls_config.h"
79 #include "timer_ticks.h"
85 /* hack to avoid alloca usage in the generated C file (needed for compiler
86 with no built in alloca, like icc*/
89 #define onsend_check(s) \
91 if (rt!=ONSEND_ROUTE) yyerror( s " allowed only in onsend_routes");\
94 #define IF_AUTO_BIND_IPV6(x) x
97 #define IF_DNS_CACHE(x) x
99 #define IF_DNS_CACHE(x) warn("dns cache support not compiled in")
102 #ifdef USE_DNS_FAILOVER
103 #define IF_DNS_FAILOVER(x) x
105 #define IF_DNS_FAILOVER(x) warn("dns failover support not compiled in")
109 #define IF_NAPTR(x) x
111 #define IF_NAPTR(x) warn("dns naptr support not compiled in")
114 #ifdef USE_DST_BLACKLIST
115 #define IF_DST_BLACKLIST(x) x
117 #define IF_DST_BLACKLIST(x) warn("dst blacklist support not compiled in")
123 #define IF_SCTP(x) warn("sctp support not compiled in")
127 #define IF_RAW_SOCKS(x) x
129 #define IF_RAW_SOCKS(x) warn("raw socket support not compiled in")
134 /* safer then using yytext which can be array or pointer */
135 extern char* yy_number_str;
137 static void yyerror(char* s, ...);
138 static void yyerror_at(struct cfg_pos* pos, char* s, ...);
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 */
147 static struct ip_addr* ip_tmp;
148 static struct avp_spec* s_attr;
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;
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);
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);
181 extern int startcolumn;
182 extern int startline;
184 extern char *routename;
185 extern char *default_routename;
187 #define set_cfg_pos(x) \
191 (x)->cfile = (finame!=0)?finame:((cfg_file!=0)?cfg_file:"default");\
192 (x)->rname = (routename!=0)?routename:((default_routename!=0)?default_routename:"DEFAULT");\
204 struct action* action;
205 struct case_stms* case_stms;
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;
214 struct rval_expr* rv_expr;
244 %token SET_HOSTPORTTRANS
251 %token CLEAR_BRANCHES
258 %token ADD_LOCAL_RPORT
259 %token FORCE_TCP_ALIAS
261 %token UDP_MTU_TRY_PROTO
267 %token SET_ADV_ADDRESS
269 %token FORCE_SEND_SOCKET
270 %token SET_FWD_NO_CONNECT
271 %token SET_RPL_NO_CONNECT
330 %token SR_AUTO_ALIASES
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
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
354 %token DNS_CACHE_GC_INT
355 %token DNS_CACHE_DEL_NONEXP
356 %token DNS_CACHE_REC_PREF
359 %token AUTO_BIND_IPV6
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
376 %token SOCKET_WORKERS
389 %token SERVER_SIGNATURE
391 %token USER_AGENT_HEADER
398 %token SQL_BUFFER_SIZE
406 %token TCP_ACCEPT_ALIASES
408 %token TCP_CONNECT_TIMEOUT
409 %token TCP_SEND_TIMEOUT
410 %token TCP_CON_LIFETIME
411 %token TCP_POLL_METHOD
412 %token TCP_MAX_CONNECTIONS
413 %token TLS_MAX_CONNECTIONS
414 %token TCP_NO_CONNECT
415 %token TCP_SOURCE_IPV4
416 %token TCP_SOURCE_IPV6
417 %token TCP_OPT_FD_CACHE
418 %token TCP_OPT_BUF_WRITE
419 %token TCP_OPT_CONN_WQ_MAX
420 %token TCP_OPT_WQ_MAX
421 %token TCP_OPT_RD_BUF
422 %token TCP_OPT_WQ_BLK
423 %token TCP_OPT_DEFER_ACCEPT
424 %token TCP_OPT_DELAYED_ACK
425 %token TCP_OPT_SYNCNT
426 %token TCP_OPT_LINGER2
427 %token TCP_OPT_KEEPALIVE
428 %token TCP_OPT_KEEPIDLE
429 %token TCP_OPT_KEEPINTVL
430 %token TCP_OPT_KEEPCNT
431 %token TCP_OPT_CRLF_PING
432 %token TCP_OPT_ACCEPT_NO_CL
433 %token TCP_OPT_ACCEPT_HEP3
434 %token TCP_CLONE_RCVBUF
435 %token TCP_REUSE_PORT
441 %token TLS_HANDSHAKE_TIMEOUT
442 %token TLS_SEND_TIMEOUT
448 %token TLS_REQUIRE_CERTIFICATE
449 %token TLS_CERTIFICATE
450 %token TLS_PRIVATE_KEY
455 %token ADVERTISED_ADDRESS
456 %token ADVERTISED_PORT
460 %token SHM_FORCE_ALLOC
465 %token RT_TIMER1_PRIO
466 %token RT_TIMER1_POLICY
467 %token RT_TIMER2_PRIO
468 %token RT_TIMER2_POLICY
469 %token MCAST_LOOPBACK
473 %token PMTU_DISCOVERY
480 %token HTTP_REPLY_PARSE
481 %token VERSION_TABLE_CFG
482 %token VERBOSE_STARTUP
483 %token ROUTE_LOCKS_SIZE
484 %token CFG_DESCRIPTION
487 %token ONSEND_ROUTE_CALLBACK
488 %token REPLY_ROUTE_CALLBACK
489 %token EVENT_ROUTE_CALLBACK
490 %token MAX_RECURSIVE_LEVEL
491 %token MAX_BRANCHES_PARAM
492 %token LATENCY_CFG_LOG
494 %token LATENCY_LIMIT_DB
495 %token LATENCY_LIMIT_ACTION
497 %token ONSEND_RT_REPLY
510 %token ATTR_FROMDOMAIN
521 /* operators, C like precedence */
530 %left EQUAL_T DIFF MATCH INTEQ INTDIFF STREQ STRDIFF
533 %left STAR SLASH MODULO
534 %right NOT UNARY BIN_NOT
536 %right INTCAST STRCAST
539 /* no precedence, they use () */
544 %token <intval> NUMBER
546 %token <strval> NUM_ID
547 %token <strval> STRING
548 %token <strval> IPV6ADDR
550 /* not clear yet if this is an avp or pvar */
551 %token <strval> AVP_OR_PVAR
552 %token <strval> EVENT_RT_NAME
568 /*%type <expr> exp */
569 %type <expr> exp_elem
570 %type <intval> intno eint_op eint_op_onsend
571 %type <intval> eip_op eip_op_onsend
572 %type <action> action actions cmd fcmd if_cmd stm /*exp_stm*/ assign_action
573 %type <action> switch_cmd while_cmd ret_cmd
574 %type <case_stms> single_case case_stms
575 %type <ipaddr> ipv4 ipv6 ipv6addr ip
577 %type <strval> host host_or_if host_if_id
578 %type <strval> listen_id
579 %type <name_l> listen_id_lst
580 %type <name_l> listen_id2
581 %type <sockid> id_lst
582 %type <sockid> phostport
583 %type <sockid> listen_phostport
584 %type <intval> proto eqproto port
585 %type <intval> equalop strop cmpop rve_cmpop rve_equalop
586 %type <intval> uri_type
588 %type <attr> attr_id_num_idx
589 %type <attr> attr_id_no_idx
590 %type <attr> attr_id_ass
591 /*%type <attr> attr_id_val*/
592 %type <attr> attr_id_any
593 %type <attr> attr_id_any_str
596 %type <rv_expr> rval rval_expr ct_rval
597 %type <lval> avp_pvar
598 /* %type <intval> class_id */
599 %type <intval> assign_op
600 %type <select> select_id
601 %type <strval> flag_name;
602 %type <strval> route_name;
603 %type <intval> avpflag_oper
604 %type <intval> rve_un_op
605 %type <strval> cfg_var_id
606 %type <strval> cfg_var_idn
607 /* %type <intval> rve_op */
609 /*%type <route_el> rules;
610 %type <route_el> rule;
620 statements statement {}
622 | statements error { yyerror(""); YYABORT;}
630 | {rt=REQUEST_ROUTE;} route_stm
631 | {rt=FAILURE_ROUTE;} failure_route_stm
633 | {rt=BRANCH_ROUTE;} branch_route_stm
634 | {rt=ONSEND_ROUTE;} send_route_stm
635 | {rt=EVENT_ROUTE;} event_route_stm
636 | SEMICOLON /* null statement */
637 | CR /* null statement*/
644 LM_CRIT("cfg. parser: bad ip address.\n");
647 $$=pkg_malloc(strlen(tmp)+1);
649 LM_CRIT("cfg. parser: out of memory.\n");
651 strncpy($$, tmp, strlen(tmp)+1);
657 $$=pkg_malloc(strlen($1)+1);
659 LM_CRIT("cfg. parser: out of memory.\n");
661 strncpy($$, $1, strlen($1)+1);
666 $$=pkg_malloc(strlen($1)+1);
668 LM_CRIT("cfg. parser: out of memory.\n");
670 strncpy($$, $1, strlen($1)+1);
678 listen_id { $$=mk_name_lst($1, SI_IS_MHOMED); }
679 | listen_id COMMA listen_id_lst { $$=mk_name_lst($1, SI_IS_MHOMED);
685 LPAREN listen_id_lst RPAREN { $$=$2; }
686 | listen_id { $$=mk_name_lst($1, 0); }
690 UDP { $$=PROTO_UDP; }
691 | TCP { $$=PROTO_TCP; }
692 | TLS { $$=PROTO_TLS; }
693 | SCTP { $$=PROTO_SCTP; }
697 UDP { $$=PROTO_UDP; }
698 | TCP { $$=PROTO_TCP; }
699 | TLS { $$=PROTO_TLS; }
700 | SCTP { $$=PROTO_SCTP; }
701 | WS { $$=PROTO_WS; }
702 | WSS { $$=PROTO_WSS; }
710 listen_id { $$=mk_listen_id($1, 0, 0); }
711 | listen_id COLON port { $$=mk_listen_id($1, 0, $3); }
712 | proto COLON listen_id { $$=mk_listen_id($3, $1, 0); }
713 | proto COLON listen_id COLON port { $$=mk_listen_id($3, $1, $5);}
714 | listen_id COLON error { $$=0; yyerror("port number expected"); }
718 listen_id2 { $$=mk_listen_id2($1, 0, 0); }
719 | listen_id2 COLON port { $$=mk_listen_id2($1, 0, $3); }
720 | proto COLON listen_id2 { $$=mk_listen_id2($3, $1, 0); }
721 | proto COLON listen_id2 COLON port { $$=mk_listen_id2($3, $1, $5);}
722 | listen_id2 COLON error { $$=0; yyerror("port number expected"); }
726 listen_phostport { $$=$1 ; }
727 | listen_phostport id_lst { $$=$1; if ($$) $$->next=$2; }
731 | MINUS NUMBER %prec UNARY { $$=-$2; }
734 flags_decl: FLAGS_DECL flag_list
735 | FLAGS_DECL error { yyerror("flag list expected\n"); }
738 | flag_spec COMMA flag_list
741 flag_spec: flag_name { if (register_flag($1,-1)<0)
742 yyerror("register flag failed");
744 | flag_name COLON NUMBER {
745 if (register_flag($1, $3)<0)
746 yyerror("register flag failed");
750 flag_name: STRING { $$=$1; }
755 AVPFLAGS_DECL avpflag_list
756 | AVPFLAGS_DECL error { yyerror("avpflag list expected\n"); }
760 | avpflag_spec COMMA avpflag_list
764 if (register_avpflag($1)==0)
765 yyerror("cannot declare avpflag");
769 DEBUG_V EQUAL intno { default_core_cfg.debug=$3; }
770 | DEBUG_V EQUAL error { yyerror("number expected"); }
771 | FORK EQUAL NUMBER { dont_fork= ! $3; }
772 | FORK EQUAL error { yyerror("boolean value expected"); }
773 | FORK_DELAY EQUAL NUMBER { set_fork_delay($3); }
774 | FORK_DELAY EQUAL error { yyerror("number expected"); }
775 | MODINIT_DELAY EQUAL NUMBER { set_modinit_delay($3); }
776 | MODINIT_DELAY EQUAL error { yyerror("number expected"); }
777 | LOGSTDERROR EQUAL NUMBER { if (!config_check) /* if set from cmd line, don't overwrite from yyparse()*/
778 if(log_stderr == 0) log_stderr=$3;
780 | LOGSTDERROR EQUAL error { yyerror("boolean value expected"); }
781 | LOGFACILITY EQUAL ID {
782 if ( (i_tmp=str2facility($3))==-1)
783 yyerror("bad facility (see syslog(3) man page)");
785 default_core_cfg.log_facility=i_tmp;
787 | LOGFACILITY EQUAL error { yyerror("ID expected"); }
788 | LOGNAME EQUAL STRING { log_name=$3; }
789 | LOGNAME EQUAL error { yyerror("string value expected"); }
790 | LOGCOLOR EQUAL NUMBER { log_color=$3; }
791 | LOGCOLOR EQUAL error { yyerror("boolean value expected"); }
792 | LOGPREFIX EQUAL STRING { log_prefix_fmt=$3; }
793 | LOGPREFIX EQUAL error { yyerror("string value expected"); }
794 | LOGPREFIXMODE EQUAL NUMBER { log_prefix_mode=$3; }
795 | LOGPREFIXMODE EQUAL error { yyerror("number expected"); }
796 | LOGENGINETYPE EQUAL STRING { _km_log_engine_type=$3; }
797 | LOGENGINETYPE EQUAL error { yyerror("string value expected"); }
798 | LOGENGINEDATA EQUAL STRING { _km_log_engine_data=$3; }
799 | LOGENGINEDATA EQUAL error { yyerror("string value expected"); }
800 | DNS EQUAL NUMBER { received_dns|= ($3)?DO_DNS:0; }
801 | DNS EQUAL error { yyerror("boolean value expected"); }
802 | REV_DNS EQUAL NUMBER { received_dns|= ($3)?DO_REV_DNS:0; }
803 | REV_DNS EQUAL error { yyerror("boolean value expected"); }
804 | DNS_TRY_IPV6 EQUAL NUMBER { default_core_cfg.dns_try_ipv6=$3; }
805 | DNS_TRY_IPV6 error { yyerror("boolean value expected"); }
806 | DNS_TRY_NAPTR EQUAL NUMBER { IF_NAPTR(default_core_cfg.dns_try_naptr=$3); }
807 | DNS_TRY_NAPTR error { yyerror("boolean value expected"); }
808 | DNS_SRV_LB EQUAL NUMBER { IF_DNS_FAILOVER(default_core_cfg.dns_srv_lb=$3); }
809 | DNS_SRV_LB error { yyerror("boolean value expected"); }
810 | DNS_UDP_PREF EQUAL intno { IF_NAPTR(default_core_cfg.dns_udp_pref=$3);}
811 | DNS_UDP_PREF error { yyerror("number expected"); }
812 | DNS_TCP_PREF EQUAL intno { IF_NAPTR(default_core_cfg.dns_tcp_pref=$3);}
813 | DNS_TCP_PREF error { yyerror("number expected"); }
814 | DNS_TLS_PREF EQUAL intno { IF_NAPTR(default_core_cfg.dns_tls_pref=$3);}
815 | DNS_TLS_PREF error { yyerror("number expected"); }
816 | DNS_SCTP_PREF EQUAL intno {
817 IF_NAPTR(default_core_cfg.dns_sctp_pref=$3); }
818 | DNS_SCTP_PREF error { yyerror("number expected"); }
819 | DNS_RETR_TIME EQUAL NUMBER { default_core_cfg.dns_retr_time=$3; }
820 | DNS_RETR_TIME error { yyerror("number expected"); }
821 | DNS_RETR_NO EQUAL NUMBER { default_core_cfg.dns_retr_no=$3; }
822 | DNS_RETR_NO error { yyerror("number expected"); }
823 | DNS_SERVERS_NO EQUAL NUMBER { default_core_cfg.dns_servers_no=$3; }
824 | DNS_SERVERS_NO error { yyerror("number expected"); }
825 | DNS_USE_SEARCH EQUAL NUMBER { default_core_cfg.dns_search_list=$3; }
826 | DNS_USE_SEARCH error { yyerror("boolean value expected"); }
827 | DNS_SEARCH_FMATCH EQUAL NUMBER { default_core_cfg.dns_search_fmatch=$3; }
828 | DNS_SEARCH_FMATCH error { yyerror("boolean value expected"); }
829 | DNS_NAPTR_IGNORE_RFC EQUAL NUMBER { default_core_cfg.dns_naptr_ignore_rfc=$3; }
830 | DNS_NAPTR_IGNORE_RFC error { yyerror("boolean value expected"); }
831 | DNS_CACHE_INIT EQUAL NUMBER { IF_DNS_CACHE(dns_cache_init=$3); }
832 | DNS_CACHE_INIT error { yyerror("boolean value expected"); }
833 | DNS_USE_CACHE EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.use_dns_cache=$3); }
834 | DNS_USE_CACHE error { yyerror("boolean value expected"); }
835 | DNS_USE_FAILOVER EQUAL NUMBER { IF_DNS_FAILOVER(default_core_cfg.use_dns_failover=$3);}
836 | DNS_USE_FAILOVER error { yyerror("boolean value expected"); }
837 | DNS_CACHE_FLAGS EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_flags=$3); }
838 | DNS_CACHE_FLAGS error { yyerror("boolean value expected"); }
839 | DNS_CACHE_NEG_TTL EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_neg_cache_ttl=$3); }
840 | DNS_CACHE_NEG_TTL error { yyerror("boolean value expected"); }
841 | DNS_CACHE_MAX_TTL EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_max_ttl=$3); }
842 | DNS_CACHE_MAX_TTL error { yyerror("boolean value expected"); }
843 | DNS_CACHE_MIN_TTL EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_min_ttl=$3); }
844 | DNS_CACHE_MIN_TTL error { yyerror("boolean value expected"); }
845 | DNS_CACHE_MEM EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_max_mem=$3); }
846 | DNS_CACHE_MEM error { yyerror("boolean value expected"); }
847 | DNS_CACHE_GC_INT EQUAL NUMBER { IF_DNS_CACHE(dns_timer_interval=$3); }
848 | DNS_CACHE_GC_INT error { yyerror("boolean value expected"); }
849 | DNS_CACHE_DEL_NONEXP EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_del_nonexp=$3); }
850 | DNS_CACHE_DEL_NONEXP error { yyerror("boolean value expected"); }
851 | DNS_CACHE_REC_PREF EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_rec_pref=$3); }
852 | DNS_CACHE_REC_PREF error { yyerror("boolean value expected"); }
853 | AUTO_BIND_IPV6 EQUAL NUMBER {IF_AUTO_BIND_IPV6(auto_bind_ipv6 = $3);}
854 | AUTO_BIND_IPV6 error { yyerror("boolean value expected"); }
855 | DST_BLST_INIT EQUAL NUMBER { IF_DST_BLACKLIST(dst_blacklist_init=$3); }
856 | DST_BLST_INIT error { yyerror("boolean value expected"); }
857 | USE_DST_BLST EQUAL NUMBER {
858 IF_DST_BLACKLIST(default_core_cfg.use_dst_blacklist=$3);
860 | USE_DST_BLST error { yyerror("boolean value expected"); }
861 | DST_BLST_MEM EQUAL NUMBER {
862 IF_DST_BLACKLIST(default_core_cfg.blst_max_mem=$3);
864 | DST_BLST_MEM error { yyerror("boolean value expected"); }
865 | DST_BLST_TTL EQUAL NUMBER {
866 IF_DST_BLACKLIST(default_core_cfg.blst_timeout=$3);
868 | DST_BLST_TTL error { yyerror("boolean value expected"); }
869 | DST_BLST_GC_INT EQUAL NUMBER { IF_DST_BLACKLIST(blst_timer_interval=$3);}
870 | DST_BLST_GC_INT error { yyerror("boolean value expected"); }
871 | DST_BLST_UDP_IMASK EQUAL NUMBER {
872 IF_DST_BLACKLIST(default_core_cfg.blst_udp_imask=$3);
874 | DST_BLST_UDP_IMASK error { yyerror("number(flags) expected"); }
875 | DST_BLST_TCP_IMASK EQUAL NUMBER {
876 IF_DST_BLACKLIST(default_core_cfg.blst_tcp_imask=$3);
878 | DST_BLST_TCP_IMASK error { yyerror("number(flags) expected"); }
879 | DST_BLST_TLS_IMASK EQUAL NUMBER {
880 IF_DST_BLACKLIST(default_core_cfg.blst_tls_imask=$3);
882 | DST_BLST_TLS_IMASK error { yyerror("number(flags) expected"); }
883 | DST_BLST_SCTP_IMASK EQUAL NUMBER {
884 IF_DST_BLACKLIST(default_core_cfg.blst_sctp_imask=$3);
886 | DST_BLST_SCTP_IMASK error { yyerror("number(flags) expected"); }
887 | IP_FREE_BIND EQUAL intno { _sr_ip_free_bind=$3; }
888 | IP_FREE_BIND EQUAL error { yyerror("int value expected"); }
889 | PORT EQUAL NUMBER { port_no=$3; }
890 | STAT EQUAL STRING {
895 | MAXBUFFER EQUAL NUMBER { maxbuffer=$3; }
896 | MAXBUFFER EQUAL error { yyerror("number expected"); }
897 | SQL_BUFFER_SIZE EQUAL NUMBER { sql_buffer_size=$3; }
898 | SQL_BUFFER_SIZE EQUAL error { yyerror("number expected"); }
899 | PORT EQUAL error { yyerror("number expected"); }
900 | CHILDREN EQUAL NUMBER { children_no=$3; }
901 | CHILDREN EQUAL error { yyerror("number expected"); }
902 | SOCKET_WORKERS EQUAL NUMBER { socket_workers=$3; }
903 | SOCKET_WORKERS EQUAL error { yyerror("number expected"); }
904 | ASYNC_WORKERS EQUAL NUMBER { async_task_set_workers($3); }
905 | ASYNC_WORKERS EQUAL error { yyerror("number expected"); }
906 | ASYNC_USLEEP EQUAL NUMBER { async_task_set_usleep($3); }
907 | ASYNC_USLEEP EQUAL error { yyerror("number expected"); }
908 | CHECK_VIA EQUAL NUMBER { check_via=$3; }
909 | CHECK_VIA EQUAL error { yyerror("boolean value expected"); }
910 | PHONE2TEL EQUAL NUMBER { phone2tel=$3; }
911 | PHONE2TEL EQUAL error { yyerror("boolean value expected"); }
912 | MEMLOG EQUAL intno { default_core_cfg.memlog=$3; }
913 | MEMLOG EQUAL error { yyerror("int value expected"); }
914 | MEMDBG EQUAL intno { default_core_cfg.memdbg=$3; }
915 | MEMDBG EQUAL error { yyerror("int value expected"); }
916 | MEMSUM EQUAL intno { default_core_cfg.mem_summary=$3; }
917 | MEMSUM EQUAL error { yyerror("int value expected"); }
918 | MEMSAFETY EQUAL intno { default_core_cfg.mem_safety=$3; }
919 | MEMSAFETY EQUAL error { yyerror("int value expected"); }
920 | MEMJOIN EQUAL intno { default_core_cfg.mem_join=$3; }
921 | MEMJOIN EQUAL error { yyerror("int value expected"); }
922 | MEMSTATUSMODE EQUAL intno { default_core_cfg.mem_status_mode=$3; }
923 | MEMSTATUSMODE EQUAL error { yyerror("int value expected"); }
924 | CORELOG EQUAL intno { default_core_cfg.corelog=$3; }
925 | CORELOG EQUAL error { yyerror("int value expected"); }
926 | SIP_WARNING EQUAL NUMBER { sip_warning=$3; }
927 | SIP_WARNING EQUAL error { yyerror("boolean value expected"); }
928 | VERSION_TABLE_CFG EQUAL STRING { version_table.s=$3;
929 version_table.len=strlen(version_table.s);
931 | VERSION_TABLE_CFG EQUAL error { yyerror("string value expected"); }
932 | USER EQUAL STRING {
933 if (shm_initialized())
934 yyerror("user must be before any modparam or the"
940 if (shm_initialized())
941 yyerror("user must be before any modparam or the"
946 | USER EQUAL error { yyerror("string value expected"); }
947 | GROUP EQUAL STRING { group=$3; }
948 | GROUP EQUAL ID { group=$3; }
949 | GROUP EQUAL error { yyerror("string value expected"); }
950 | CHROOT EQUAL STRING { chroot_dir=$3; }
951 | CHROOT EQUAL ID { chroot_dir=$3; }
952 | CHROOT EQUAL error { yyerror("string value expected"); }
953 | WDIR EQUAL STRING { working_dir=$3; }
954 | WDIR EQUAL ID { working_dir=$3; }
955 | WDIR EQUAL error { yyerror("string value expected"); }
956 | RUNDIR EQUAL STRING { runtime_dir=$3; }
957 | RUNDIR EQUAL ID { runtime_dir=$3; }
958 | RUNDIR EQUAL error { yyerror("string value expected"); }
959 | MHOMED EQUAL NUMBER { mhomed=$3; }
960 | MHOMED EQUAL error { yyerror("boolean value expected"); }
961 | DISABLE_TCP EQUAL NUMBER {
965 warn("tcp support not compiled in");
968 | DISABLE_TCP EQUAL error { yyerror("boolean value expected"); }
969 | TCP_ACCEPT_ALIASES EQUAL NUMBER {
971 tcp_default_cfg.accept_aliases=$3;
973 warn("tcp support not compiled in");
976 | TCP_ACCEPT_ALIASES EQUAL error { yyerror("boolean value expected"); }
977 | TCP_CHILDREN EQUAL NUMBER {
979 tcp_cfg_children_no=$3;
981 warn("tcp support not compiled in");
984 | TCP_CHILDREN EQUAL error { yyerror("number expected"); }
985 | TCP_CONNECT_TIMEOUT EQUAL intno {
987 tcp_default_cfg.connect_timeout_s=$3;
989 warn("tcp support not compiled in");
992 | TCP_CONNECT_TIMEOUT EQUAL error { yyerror("number expected"); }
993 | TCP_SEND_TIMEOUT EQUAL intno {
995 tcp_default_cfg.send_timeout=S_TO_TICKS($3);
997 warn("tcp support not compiled in");
1000 | TCP_SEND_TIMEOUT EQUAL error { yyerror("number expected"); }
1001 | TCP_CON_LIFETIME EQUAL intno {
1004 tcp_default_cfg.con_lifetime=-1;
1006 tcp_default_cfg.con_lifetime=S_TO_TICKS($3);
1008 warn("tcp support not compiled in");
1011 | TCP_CON_LIFETIME EQUAL error { yyerror("number expected"); }
1012 | TCP_POLL_METHOD EQUAL ID {
1014 tcp_poll_method=get_poll_type($3);
1015 if (tcp_poll_method==POLL_NONE) {
1016 LOG(L_CRIT, "bad poll method name:"
1017 " %s\n, try one of %s.\n",
1019 yyerror("bad tcp_poll_method "
1023 warn("tcp support not compiled in");
1026 | TCP_POLL_METHOD EQUAL STRING {
1028 tcp_poll_method=get_poll_type($3);
1029 if (tcp_poll_method==POLL_NONE) {
1030 LOG(L_CRIT, "bad poll method name:"
1031 " %s\n, try one of %s.\n",
1033 yyerror("bad tcp_poll_method "
1037 warn("tcp support not compiled in");
1040 | TCP_POLL_METHOD EQUAL error { yyerror("poll method name expected"); }
1041 | TCP_MAX_CONNECTIONS EQUAL NUMBER {
1043 tcp_max_connections=$3;
1045 warn("tcp support not compiled in");
1048 | TCP_MAX_CONNECTIONS EQUAL error { yyerror("number expected"); }
1049 | TLS_MAX_CONNECTIONS EQUAL NUMBER {
1051 tls_max_connections=$3;
1053 warn("tls support not compiled in");
1056 | TLS_MAX_CONNECTIONS EQUAL error { yyerror("number expected"); }
1057 | TCP_NO_CONNECT EQUAL NUMBER {
1059 tcp_default_cfg.no_connect=$3;
1061 warn("tcp support not compiled in");
1064 | TCP_NO_CONNECT EQUAL error { yyerror("boolean value expected"); }
1065 | TCP_SOURCE_IPV4 EQUAL ipv4 {
1067 if (tcp_set_src_addr($3)<0)
1068 warn("tcp_source_ipv4 failed");
1070 warn("tcp support not compiled in");
1074 | TCP_SOURCE_IPV4 EQUAL error { yyerror("IPv4 address expected"); }
1075 | TCP_SOURCE_IPV6 EQUAL ipv6 {
1077 if (tcp_set_src_addr($3)<0)
1078 warn("tcp_source_ipv6 failed");
1080 warn("tcp support not compiled in");
1084 | TCP_SOURCE_IPV6 EQUAL error { yyerror("IPv6 address expected"); }
1085 | TCP_OPT_FD_CACHE EQUAL NUMBER {
1087 tcp_default_cfg.fd_cache=$3;
1089 warn("tcp support not compiled in");
1092 | TCP_OPT_FD_CACHE EQUAL error { yyerror("boolean value expected"); }
1093 | TCP_OPT_BUF_WRITE EQUAL NUMBER {
1095 tcp_default_cfg.async=$3;
1097 warn("tcp support not compiled in");
1100 | TCP_OPT_BUF_WRITE EQUAL error { yyerror("boolean value expected"); }
1101 | TCP_OPT_CONN_WQ_MAX EQUAL NUMBER {
1103 tcp_default_cfg.tcpconn_wq_max=$3;
1105 warn("tcp support not compiled in");
1108 | TCP_OPT_CONN_WQ_MAX error { yyerror("boolean value expected"); }
1109 | TCP_OPT_WQ_MAX EQUAL NUMBER {
1111 tcp_default_cfg.tcp_wq_max=$3;
1113 warn("tcp support not compiled in");
1116 | TCP_OPT_WQ_MAX error { yyerror("number expected"); }
1117 | TCP_OPT_RD_BUF EQUAL NUMBER {
1119 tcp_default_cfg.rd_buf_size=$3;
1121 warn("tcp support not compiled in");
1124 | TCP_OPT_RD_BUF error { yyerror("number expected"); }
1125 | TCP_OPT_WQ_BLK EQUAL NUMBER {
1127 tcp_default_cfg.wq_blk_size=$3;
1129 warn("tcp support not compiled in");
1132 | TCP_OPT_WQ_BLK error { yyerror("number expected"); }
1133 | TCP_OPT_DEFER_ACCEPT EQUAL NUMBER {
1135 tcp_default_cfg.defer_accept=$3;
1137 warn("tcp support not compiled in");
1140 | TCP_OPT_DEFER_ACCEPT EQUAL error { yyerror("boolean value expected"); }
1141 | TCP_OPT_DELAYED_ACK EQUAL NUMBER {
1143 tcp_default_cfg.delayed_ack=$3;
1145 warn("tcp support not compiled in");
1148 | TCP_OPT_DELAYED_ACK EQUAL error { yyerror("boolean value expected"); }
1149 | TCP_OPT_SYNCNT EQUAL NUMBER {
1151 tcp_default_cfg.syncnt=$3;
1153 warn("tcp support not compiled in");
1156 | TCP_OPT_SYNCNT EQUAL error { yyerror("number expected"); }
1157 | TCP_OPT_LINGER2 EQUAL NUMBER {
1159 tcp_default_cfg.linger2=$3;
1161 warn("tcp support not compiled in");
1164 | TCP_OPT_LINGER2 EQUAL error { yyerror("number expected"); }
1165 | TCP_OPT_KEEPALIVE EQUAL NUMBER {
1167 tcp_default_cfg.keepalive=$3;
1169 warn("tcp support not compiled in");
1172 | TCP_OPT_KEEPALIVE EQUAL error { yyerror("boolean value expected");}
1173 | TCP_OPT_KEEPIDLE EQUAL NUMBER {
1175 tcp_default_cfg.keepidle=$3;
1177 warn("tcp support not compiled in");
1180 | TCP_OPT_KEEPIDLE EQUAL error { yyerror("number expected"); }
1181 | TCP_OPT_KEEPINTVL EQUAL NUMBER {
1183 tcp_default_cfg.keepintvl=$3;
1185 warn("tcp support not compiled in");
1188 | TCP_OPT_KEEPINTVL EQUAL error { yyerror("number expected"); }
1189 | TCP_OPT_KEEPCNT EQUAL NUMBER {
1191 tcp_default_cfg.keepcnt=$3;
1193 warn("tcp support not compiled in");
1196 | TCP_OPT_KEEPCNT EQUAL error { yyerror("number expected"); }
1197 | TCP_OPT_CRLF_PING EQUAL NUMBER {
1199 tcp_default_cfg.crlf_ping=$3;
1201 warn("tcp support not compiled in");
1204 | TCP_OPT_CRLF_PING EQUAL error { yyerror("boolean value expected"); }
1205 | TCP_OPT_ACCEPT_NO_CL EQUAL NUMBER {
1207 tcp_default_cfg.accept_no_cl=$3;
1209 warn("tcp support not compiled in");
1212 | TCP_OPT_ACCEPT_NO_CL EQUAL error { yyerror("boolean value expected"); }
1213 | TCP_OPT_ACCEPT_HEP3 EQUAL NUMBER {
1215 ksr_tcp_accept_hep3=$3;
1217 warn("tcp support not compiled in");
1220 | TCP_OPT_ACCEPT_HEP3 EQUAL error { yyerror("boolean value expected"); }
1222 | TCP_CLONE_RCVBUF EQUAL NUMBER {
1224 tcp_set_clone_rcvbuf($3);
1226 warn("tcp support not compiled in");
1229 | TCP_CLONE_RCVBUF EQUAL error { yyerror("number expected"); }
1230 | TCP_REUSE_PORT EQUAL NUMBER {
1233 tcp_default_cfg.reuse_port=$3;
1235 warn("support for SO_REUSEPORT not compiled in");
1238 warn("tcp support not compiled in");
1241 | TCP_REUSE_PORT EQUAL error { yyerror("boolean value expected"); }
1242 | DISABLE_TLS EQUAL NUMBER {
1246 warn("tls support not compiled in");
1249 | DISABLE_TLS EQUAL error { yyerror("boolean value expected"); }
1250 | ENABLE_TLS EQUAL NUMBER {
1254 warn("tls support not compiled in");
1257 | ENABLE_TLS EQUAL error { yyerror("boolean value expected"); }
1258 | TLSLOG EQUAL NUMBER {
1262 warn("tls-in-core support not compiled in");
1265 | TLSLOG EQUAL error { yyerror("int value expected"); }
1266 | TLS_PORT_NO EQUAL NUMBER {
1270 warn("tls support not compiled in");
1273 | TLS_PORT_NO EQUAL error { yyerror("number expected"); }
1274 | TLS_METHOD EQUAL SSLv23 {
1276 tls_method=TLS_USE_SSLv23;
1278 warn("tls-in-core support not compiled in");
1281 | TLS_METHOD EQUAL SSLv2 {
1283 tls_method=TLS_USE_SSLv2;
1285 warn("tls-in-core support not compiled in");
1288 | TLS_METHOD EQUAL SSLv3 {
1290 tls_method=TLS_USE_SSLv3;
1292 warn("tls-in-core support not compiled in");
1295 | TLS_METHOD EQUAL TLSv1 {
1297 tls_method=TLS_USE_TLSv1;
1299 warn("tls-in-core support not compiled in");
1302 | TLS_METHOD EQUAL error {
1304 yyerror("SSLv23, SSLv2, SSLv3 or TLSv1 expected");
1306 warn("tls-in-core support not compiled in");
1309 | TLS_VERIFY EQUAL NUMBER {
1313 warn("tls-in-core support not compiled in");
1316 | TLS_VERIFY EQUAL error { yyerror("boolean value expected"); }
1317 | TLS_REQUIRE_CERTIFICATE EQUAL NUMBER {
1319 tls_require_cert=$3;
1321 warn( "tls-in-core support not compiled in");
1324 | TLS_REQUIRE_CERTIFICATE EQUAL error { yyerror("boolean value expected"); }
1325 | TLS_CERTIFICATE EQUAL STRING {
1329 warn("tls-in-core support not compiled in");
1332 | TLS_CERTIFICATE EQUAL error { yyerror("string value expected"); }
1333 | TLS_PRIVATE_KEY EQUAL STRING {
1337 warn("tls-in-core support not compiled in");
1340 | TLS_PRIVATE_KEY EQUAL error { yyerror("string value expected"); }
1341 | TLS_CA_LIST EQUAL STRING {
1345 warn("tls-in-core support not compiled in");
1348 | TLS_CA_LIST EQUAL error { yyerror("string value expected"); }
1349 | TLS_HANDSHAKE_TIMEOUT EQUAL NUMBER {
1351 tls_handshake_timeout=$3;
1353 warn("tls-in-core support not compiled in");
1356 | TLS_HANDSHAKE_TIMEOUT EQUAL error { yyerror("number expected"); }
1357 | TLS_SEND_TIMEOUT EQUAL NUMBER {
1359 tls_send_timeout=$3;
1361 warn("tls-in-core support not compiled in");
1364 | TLS_SEND_TIMEOUT EQUAL error { yyerror("number expected"); }
1365 | DISABLE_SCTP EQUAL NUMBER {
1369 warn("sctp support not compiled in");
1372 | DISABLE_SCTP EQUAL error { yyerror("boolean value expected"); }
1373 | ENABLE_SCTP EQUAL NUMBER {
1375 sctp_disable=($3<=1)?!$3:$3;
1377 warn("sctp support not compiled in");
1380 | ENABLE_SCTP EQUAL error { yyerror("boolean or number expected"); }
1381 | SCTP_CHILDREN EQUAL NUMBER {
1383 sctp_children_no=$3;
1385 warn("sctp support not compiled in");
1388 | SCTP_CHILDREN EQUAL error { yyerror("number expected"); }
1389 | SERVER_SIGNATURE EQUAL NUMBER { server_signature=$3; }
1390 | SERVER_SIGNATURE EQUAL error { yyerror("boolean value expected"); }
1391 | SERVER_HEADER EQUAL STRING { server_hdr.s=$3;
1392 server_hdr.len=strlen(server_hdr.s);
1394 | SERVER_HEADER EQUAL error { yyerror("string value expected"); }
1395 | USER_AGENT_HEADER EQUAL STRING { user_agent_hdr.s=$3;
1396 user_agent_hdr.len=strlen(user_agent_hdr.s);
1398 | USER_AGENT_HEADER EQUAL error { yyerror("string value expected"); }
1399 | REPLY_TO_VIA EQUAL NUMBER { reply_to_via=$3; }
1400 | REPLY_TO_VIA EQUAL error { yyerror("boolean value expected"); }
1401 | LISTEN EQUAL id_lst {
1402 for(lst_tmp=$3; lst_tmp; lst_tmp=lst_tmp->next) {
1403 if (add_listen_iface( lst_tmp->addr_lst->name,
1404 lst_tmp->addr_lst->next,
1405 lst_tmp->port, lst_tmp->proto,
1406 lst_tmp->flags)!=0) {
1407 LM_CRIT("cfg. parser: failed to add listen address\n");
1411 free_socket_id_lst($3);
1413 | LISTEN EQUAL id_lst ADVERTISE listen_id COLON NUMBER {
1414 for(lst_tmp=$3; lst_tmp; lst_tmp=lst_tmp->next) {
1415 if (add_listen_advertise_iface( lst_tmp->addr_lst->name,
1416 lst_tmp->addr_lst->next,
1417 lst_tmp->port, lst_tmp->proto,
1419 lst_tmp->flags)!=0) {
1420 LM_CRIT("cfg. parser: failed to add listen address\n");
1424 free_socket_id_lst($3);
1426 | LISTEN EQUAL error { yyerror("ip address, interface name or"
1427 " hostname expected"); }
1428 | ALIAS EQUAL id_lst {
1429 for(lst_tmp=$3; lst_tmp; lst_tmp=lst_tmp->next){
1430 add_alias( lst_tmp->addr_lst->name,
1431 strlen(lst_tmp->addr_lst->name),
1432 lst_tmp->port, lst_tmp->proto);
1433 for (nl_tmp=lst_tmp->addr_lst->next; nl_tmp; nl_tmp=nl_tmp->next)
1434 add_alias(nl_tmp->name, strlen(nl_tmp->name),
1435 lst_tmp->port, lst_tmp->proto);
1437 free_socket_id_lst($3);
1439 | ALIAS EQUAL error { yyerror("hostname expected"); }
1440 | SR_AUTO_ALIASES EQUAL NUMBER { sr_auto_aliases=$3; }
1441 | SR_AUTO_ALIASES EQUAL error { yyerror("boolean value expected"); }
1442 | ADVERTISED_ADDRESS EQUAL listen_id {
1444 default_global_address.s=$3;
1445 default_global_address.len=strlen($3);
1448 | ADVERTISED_ADDRESS EQUAL error {yyerror("ip address or hostname expected"); }
1449 | ADVERTISED_PORT EQUAL NUMBER {
1450 tmp=int2str($3, &i_tmp);
1451 if ((default_global_port.s=pkg_malloc(i_tmp))==0) {
1452 LM_CRIT("cfg. parser: out of memory.\n");
1453 default_global_port.len=0;
1455 default_global_port.len=i_tmp;
1456 memcpy(default_global_port.s, tmp, default_global_port.len);
1459 |ADVERTISED_PORT EQUAL error {yyerror("ip address or hostname expected"); }
1460 | DISABLE_CORE EQUAL NUMBER { disable_core_dump=$3; }
1461 | DISABLE_CORE EQUAL error { yyerror("boolean value expected"); }
1462 | OPEN_FD_LIMIT EQUAL NUMBER { open_files_limit=$3; }
1463 | OPEN_FD_LIMIT EQUAL error { yyerror("number expected"); }
1464 | SHM_MEM_SZ EQUAL NUMBER {
1465 if (shm_initialized())
1466 yyerror("shm/shm_mem_size must be before any modparam or the"
1468 else if (shm_mem_size == 0 || shm_mem_size == SHM_MEM_POOL_SIZE)
1469 shm_mem_size=$3 * 1024 * 1024;
1471 | SHM_MEM_SZ EQUAL error { yyerror("number expected"); }
1472 | SHM_FORCE_ALLOC EQUAL NUMBER {
1473 if (shm_initialized())
1474 yyerror("shm_force_alloc must be before any modparam or the"
1479 | SHM_FORCE_ALLOC EQUAL error { yyerror("boolean value expected"); }
1480 | MLOCK_PAGES EQUAL NUMBER { mlock_pages=$3; }
1481 | MLOCK_PAGES EQUAL error { yyerror("boolean value expected"); }
1482 | REAL_TIME EQUAL NUMBER { real_time=$3; }
1483 | REAL_TIME EQUAL error { yyerror("boolean value expected"); }
1484 | RT_PRIO EQUAL NUMBER { rt_prio=$3; }
1485 | RT_PRIO EQUAL error { yyerror("boolean value expected"); }
1486 | RT_POLICY EQUAL NUMBER { rt_policy=$3; }
1487 | RT_POLICY EQUAL error { yyerror("boolean value expected"); }
1488 | RT_TIMER1_PRIO EQUAL NUMBER { rt_timer1_prio=$3; }
1489 | RT_TIMER1_PRIO EQUAL error { yyerror("boolean value expected"); }
1490 | RT_TIMER1_POLICY EQUAL NUMBER { rt_timer1_policy=$3; }
1491 | RT_TIMER1_POLICY EQUAL error { yyerror("boolean value expected"); }
1492 | RT_TIMER2_PRIO EQUAL NUMBER { rt_timer2_prio=$3; }
1493 | RT_TIMER2_PRIO EQUAL error { yyerror("boolean value expected"); }
1494 | RT_TIMER2_POLICY EQUAL NUMBER { rt_timer2_policy=$3; }
1495 | RT_TIMER2_POLICY EQUAL error { yyerror("boolean value expected"); }
1496 | MCAST_LOOPBACK EQUAL NUMBER {
1500 warn("no multicast support compiled in");
1503 | MCAST_LOOPBACK EQUAL error { yyerror("boolean value expected"); }
1504 | MCAST_TTL EQUAL NUMBER {
1508 warn("no multicast support compiled in");
1511 | MCAST_TTL EQUAL error { yyerror("number expected"); }
1516 warn("no multicast support compiled in");
1519 | MCAST EQUAL STRING {
1523 warn("no multicast support compiled in");
1526 | MCAST EQUAL error { yyerror("string expected"); }
1527 | TOS EQUAL NUMBER { tos=$3; }
1528 | TOS EQUAL ID { if (strcasecmp($3,"IPTOS_LOWDELAY")) {
1530 } else if (strcasecmp($3,"IPTOS_THROUGHPUT")) {
1531 tos=IPTOS_THROUGHPUT;
1532 } else if (strcasecmp($3,"IPTOS_RELIABILITY")) {
1533 tos=IPTOS_RELIABILITY;
1534 #if defined(IPTOS_MINCOST)
1535 } else if (strcasecmp($3,"IPTOS_MINCOST")) {
1538 #if defined(IPTOS_LOWCOST)
1539 } else if (strcasecmp($3,"IPTOS_LOWCOST")) {
1543 yyerror("invalid tos value - allowed: "
1544 "IPTOS_LOWDELAY,IPTOS_THROUGHPUT,"
1546 #if defined(IPTOS_LOWCOST)
1549 #if !defined(IPTOS_MINCOST)
1555 | TOS EQUAL error { yyerror("number expected"); }
1556 | PMTU_DISCOVERY EQUAL NUMBER { pmtu_discovery=$3; }
1557 | PMTU_DISCOVERY error { yyerror("number expected"); }
1558 | KILL_TIMEOUT EQUAL NUMBER { ser_kill_timeout=$3; }
1559 | KILL_TIMEOUT EQUAL error { yyerror("number expected"); }
1560 | MAX_WLOOPS EQUAL NUMBER { default_core_cfg.max_while_loops=$3; }
1561 | MAX_WLOOPS EQUAL error { yyerror("number expected"); }
1562 | PVBUFSIZE EQUAL NUMBER { pv_set_buffer_size($3); }
1563 | PVBUFSIZE EQUAL error { yyerror("number expected"); }
1564 | PVBUFSLOTS EQUAL NUMBER { pv_set_buffer_slots($3); }
1565 | PVBUFSLOTS EQUAL error { yyerror("number expected"); }
1566 | PVCACHELIMIT EQUAL NUMBER { default_core_cfg.pv_cache_limit=$3; }
1567 | PVCACHELIMIT EQUAL error { yyerror("number expected"); }
1568 | PVCACHEACTION EQUAL NUMBER { default_core_cfg.pv_cache_action=$3; }
1569 | PVCACHEACTION EQUAL error { yyerror("number expected"); }
1570 | HTTP_REPLY_PARSE EQUAL NUMBER { http_reply_parse=$3; }
1571 | HTTP_REPLY_PARSE EQUAL error { yyerror("boolean value expected"); }
1572 | VERBOSE_STARTUP EQUAL NUMBER { ksr_verbose_startup=$3; }
1573 | VERBOSE_STARTUP EQUAL error { yyerror("boolean value expected"); }
1574 | ROUTE_LOCKS_SIZE EQUAL NUMBER { ksr_route_locks_size=$3; }
1575 | ROUTE_LOCKS_SIZE EQUAL error { yyerror("number expected"); }
1576 | SERVER_ID EQUAL NUMBER { server_id=$3; }
1577 | SERVER_ID EQUAL error { yyerror("number expected"); }
1578 | KEMI DOT ONSEND_ROUTE_CALLBACK EQUAL STRING {
1579 kemi_onsend_route_callback.s = $5;
1580 kemi_onsend_route_callback.len = strlen($5);
1581 if(kemi_onsend_route_callback.len==4
1582 && strcasecmp(kemi_onsend_route_callback.s, "none")==0) {
1583 kemi_onsend_route_callback.s = "";
1584 kemi_onsend_route_callback.len = 0;
1587 | KEMI DOT ONSEND_ROUTE_CALLBACK EQUAL error { yyerror("string expected"); }
1588 | KEMI DOT REPLY_ROUTE_CALLBACK EQUAL STRING {
1589 kemi_reply_route_callback.s = $5;
1590 kemi_reply_route_callback.len = strlen($5);
1591 if(kemi_reply_route_callback.len==4
1592 && strcasecmp(kemi_reply_route_callback.s, "none")==0) {
1593 kemi_reply_route_callback.s = "";
1594 kemi_reply_route_callback.len = 0;
1597 | KEMI DOT REPLY_ROUTE_CALLBACK EQUAL error { yyerror("string expected"); }
1598 | KEMI DOT EVENT_ROUTE_CALLBACK EQUAL STRING {
1599 kemi_event_route_callback.s = $5;
1600 kemi_event_route_callback.len = strlen($5);
1601 if(kemi_event_route_callback.len==4
1602 && strcasecmp(kemi_event_route_callback.s, "none")==0) {
1603 kemi_event_route_callback.s = "";
1604 kemi_event_route_callback.len = 0;
1607 | KEMI DOT EVENT_ROUTE_CALLBACK EQUAL error { yyerror("string expected"); }
1608 | MAX_RECURSIVE_LEVEL EQUAL NUMBER { set_max_recursive_level($3); }
1609 | MAX_BRANCHES_PARAM EQUAL NUMBER { sr_dst_max_branches = $3; }
1610 | LATENCY_LOG EQUAL intno { default_core_cfg.latency_log=$3; }
1611 | LATENCY_LOG EQUAL error { yyerror("number expected"); }
1612 | LATENCY_CFG_LOG EQUAL intno { default_core_cfg.latency_cfg_log=$3; }
1613 | LATENCY_CFG_LOG EQUAL error { yyerror("number expected"); }
1614 | LATENCY_LIMIT_DB EQUAL NUMBER { default_core_cfg.latency_limit_db=$3; }
1615 | LATENCY_LIMIT_DB EQUAL error { yyerror("number expected"); }
1616 | LATENCY_LIMIT_ACTION EQUAL NUMBER { default_core_cfg.latency_limit_action=$3; }
1617 | LATENCY_LIMIT_ACTION EQUAL error { yyerror("number expected"); }
1618 | MSG_TIME EQUAL NUMBER { sr_msg_time=$3; }
1619 | MSG_TIME EQUAL error { yyerror("number expected"); }
1620 | ONSEND_RT_REPLY EQUAL NUMBER { onsend_route_reply=$3; }
1621 | ONSEND_RT_REPLY EQUAL error { yyerror("int value expected"); }
1622 | UDP_MTU EQUAL NUMBER { default_core_cfg.udp_mtu=$3; }
1623 | UDP_MTU EQUAL error { yyerror("number expected"); }
1624 | FORCE_RPORT EQUAL NUMBER
1625 { default_core_cfg.force_rport=$3; fix_global_req_flags(0, 0); }
1626 | FORCE_RPORT EQUAL error { yyerror("boolean value expected"); }
1627 | UDP_MTU_TRY_PROTO EQUAL proto
1628 { default_core_cfg.udp_mtu_try_proto=$3; fix_global_req_flags(0, 0); }
1629 | UDP_MTU_TRY_PROTO EQUAL error
1630 { yyerror("TCP, TLS, SCTP or UDP expected"); }
1631 | UDP4_RAW EQUAL intno { IF_RAW_SOCKS(default_core_cfg.udp4_raw=$3); }
1632 | UDP4_RAW EQUAL error { yyerror("number expected"); }
1633 | UDP4_RAW_MTU EQUAL NUMBER {
1634 IF_RAW_SOCKS(default_core_cfg.udp4_raw_mtu=$3);
1636 | UDP4_RAW_MTU EQUAL error { yyerror("number expected"); }
1637 | UDP4_RAW_TTL EQUAL NUMBER {
1638 IF_RAW_SOCKS(default_core_cfg.udp4_raw_ttl=$3);
1640 | UDP4_RAW_TTL EQUAL error { yyerror("number expected"); }
1642 | error EQUAL { yyerror("unknown config variable"); }
1646 | DEFAULT { $$="default" ; } /*needed to allow default as cfg var. name*/
1650 | DEFAULT { $$="default" ; } /*needed to allow default as cfg var. name*/
1652 yyerror("cfg var field name - use of number or reserved token not allowed: %s",
1659 cfg_var_id DOT cfg_var_idn EQUAL NUMBER {
1660 if (cfg_declare_int($1, $3, $5, 0, 0, NULL)) {
1661 yyerror("variable cannot be declared");
1664 | cfg_var_id DOT cfg_var_idn EQUAL STRING {
1665 if (cfg_declare_str($1, $3, $5, NULL)) {
1666 yyerror("variable cannot be declared");
1669 | cfg_var_id DOT cfg_var_idn EQUAL NUMBER CFG_DESCRIPTION STRING {
1670 if (cfg_declare_int($1, $3, $5, 0, 0, $7)) {
1671 yyerror("variable cannot be declared");
1674 | cfg_var_id DOT cfg_var_idn EQUAL STRING CFG_DESCRIPTION STRING {
1675 if (cfg_declare_str($1, $3, $5, $7)) {
1676 yyerror("variable cannot be declared");
1679 | cfg_var_id DOT cfg_var_idn EQUAL error {
1680 yyerror("number or string expected");
1682 | cfg_var_id LBRACK NUMBER RBRACK DOT cfg_var_idn EQUAL NUMBER {
1683 if (cfg_ginst_var_int($1, $3, $6, $8)) {
1684 yyerror("variable cannot be added to the group instance");
1687 | cfg_var_id LBRACK NUMBER RBRACK DOT cfg_var_idn EQUAL STRING {
1688 if (cfg_ginst_var_string($1, $3, $6, $8)) {
1689 yyerror("variable cannot be added to the group instance");
1696 LM_DBG("loading module %s\n", $2);
1697 if (load_module($2)!=0) {
1698 yyerror("failed to load module");
1701 | LOADMODULE error { yyerror("string expected"); }
1703 if(mods_dir_cmd==0) {
1704 LM_DBG("loading modules under %s\n", $2);
1705 printf("loading modules under config path: %s\n", $2);
1708 LM_DBG("ignoring mod path given in config: %s\n", $2);
1709 printf("loading modules under command line path: %s\n", mods_dir);
1712 | LOADPATH error { yyerror("string expected"); }
1713 | LOADPATH EQUAL STRING {
1714 if(mods_dir_cmd==0) {
1715 LM_DBG("loading modules under %s\n", $3);
1716 printf("loading modules under config path: %s\n", $3);
1719 LM_DBG("ignoring mod path given in config: %s\n", $3);
1720 printf("loading modules under command line path: %s\n", mods_dir);
1723 | LOADPATH EQUAL error { yyerror("string expected"); }
1724 | MODPARAM LPAREN STRING COMMA STRING COMMA STRING RPAREN {
1726 if (!shm_initialized() && init_shm()<0) {
1727 yyerror("Can't initialize shared memory");
1730 #endif /* SHM_MEM */
1731 if (set_mod_param_regex($3, $5, PARAM_STRING, $7) != 0) {
1732 yyerror("Can't set module parameter");
1735 | MODPARAM LPAREN STRING COMMA STRING COMMA intno RPAREN {
1737 if (!shm_initialized() && init_shm()<0) {
1738 yyerror("Can't initialize shared memory");
1741 #endif /* SHM_MEM */
1742 if (set_mod_param_regex($3, $5, PARAM_INT, (void*)$7) != 0) {
1743 yyerror("Can't set module parameter");
1746 | MODPARAM error { yyerror("Invalid arguments"); }
1747 | CFGENGINE STRING {
1748 if(sr_kemi_eng_setz($2, NULL)) {
1749 yyerror("Can't set config routing engine");
1753 | CFGENGINE error { yyerror("string expected"); }
1754 | CFGENGINE EQUAL STRING {
1755 if(sr_kemi_eng_setz($3, NULL)) {
1756 yyerror("Can't set config routing engine");
1760 | CFGENGINE EQUAL error { yyerror("string expected"); }
1768 NUMBER DOT NUMBER DOT NUMBER DOT NUMBER {
1769 $$=pkg_malloc(sizeof(struct ip_addr));
1771 LM_CRIT("cfg. parser: out of memory.\n");
1773 memset($$, 0, sizeof(struct ip_addr));
1776 if (($1>255) || ($1<0) ||
1777 ($3>255) || ($3<0) ||
1778 ($5>255) || ($5<0) ||
1779 ($7>255) || ($7<0)) {
1780 yyerror("invalid ipv4 address");
1790 ($3<<16)| ($5<<8)|$7 );
1798 $$=pkg_malloc(sizeof(struct ip_addr));
1800 LM_CRIT("cfg. parser: out of memory.\n");
1802 memset($$, 0, sizeof(struct ip_addr));
1805 if (inet_pton(AF_INET6, $1, $$->u.addr)<=0) {
1806 yyerror("bad ipv6 address");
1813 | LBRACK ipv6addr RBRACK {$$=$2; }
1817 route_name: NUMBER {
1818 tmp=int2str($1, &i_tmp);
1819 if (($$=pkg_malloc(i_tmp+1))==0) {
1820 yyerror("out of memory");
1823 memcpy($$, tmp, i_tmp);
1828 | ID { routename = $1; $$=$1; }
1829 | STRING { routename = $1; $$=$1; }
1833 route_main: ROUTE { routename=NULL; }
1834 | ROUTE_REQUEST { routename=NULL; }
1838 route_main LBRACE actions RBRACE {
1840 if (!shm_initialized() && init_shm()<0) {
1841 yyerror("Can't initialize shared memory");
1844 #endif /* SHM_MEM */
1845 push($3, &main_rt.rlist[DEFAULT_RT]);
1847 | ROUTE LBRACK route_name RBRACK LBRACE actions RBRACE {
1849 if (!shm_initialized() && init_shm()<0) {
1850 yyerror("Can't initialize shared memory");
1853 #endif /* SHM_MEM */
1854 i_tmp=route_get(&main_rt, $3);
1856 yyerror("internal error");
1859 if (main_rt.rlist[i_tmp]){
1860 yyerror("duplicate route");
1863 push($6, &main_rt.rlist[i_tmp]);
1865 | ROUTE error { yyerror("invalid route statement"); }
1866 | ROUTE_REQUEST error { yyerror("invalid request_route statement"); }
1869 ROUTE_FAILURE LBRACE actions RBRACE {
1871 if (!shm_initialized() && init_shm()<0) {
1872 yyerror("Can't initialize shared memory");
1875 #endif /* SHM_MEM */
1876 push($3, &failure_rt.rlist[DEFAULT_RT]);
1878 | ROUTE_FAILURE LBRACK route_name RBRACK LBRACE actions RBRACE {
1880 if (!shm_initialized() && init_shm()<0) {
1881 yyerror("Can't initialize shared memory");
1884 #endif /* SHM_MEM */
1885 i_tmp=route_get(&failure_rt, $3);
1887 yyerror("internal error");
1890 if (failure_rt.rlist[i_tmp]){
1891 yyerror("duplicate route");
1894 push($6, &failure_rt.rlist[i_tmp]);
1896 | ROUTE_FAILURE error { yyerror("invalid failure_route statement"); }
1900 route_reply_main: ROUTE_ONREPLY { routename=NULL; }
1901 | ROUTE_REPLY { routename=NULL; }
1906 route_reply_main LBRACE {rt=CORE_ONREPLY_ROUTE;} actions RBRACE {
1908 if (!shm_initialized() && init_shm()<0) {
1909 yyerror("Can't initialize shared memory");
1912 #endif /* SHM_MEM */
1913 push($4, &onreply_rt.rlist[DEFAULT_RT]);
1915 | ROUTE_ONREPLY error { yyerror("invalid onreply_route statement"); }
1916 | ROUTE_REPLY error { yyerror("invalid onreply_route statement"); }
1917 | ROUTE_ONREPLY LBRACK route_name RBRACK
1918 {rt=(*$3=='0' && $3[1]==0)?CORE_ONREPLY_ROUTE:TM_ONREPLY_ROUTE;}
1919 LBRACE actions RBRACE {
1921 if (!shm_initialized() && init_shm()<0) {
1922 yyerror("Can't initialize shared memory");
1925 #endif /* SHM_MEM */
1926 if (*$3=='0' && $3[1]==0){
1927 /* onreply_route[0] {} is equivalent with onreply_route {}*/
1928 push($7, &onreply_rt.rlist[DEFAULT_RT]);
1930 i_tmp=route_get(&onreply_rt, $3);
1932 yyerror("internal error");
1935 if (onreply_rt.rlist[i_tmp]){
1936 yyerror("duplicate route");
1939 push($7, &onreply_rt.rlist[i_tmp]);
1942 | ROUTE_ONREPLY LBRACK route_name RBRACK error {
1943 yyerror("invalid onreply_route statement");
1947 ROUTE_BRANCH LBRACE actions RBRACE {
1949 if (!shm_initialized() && init_shm()<0) {
1950 yyerror("Can't initialize shared memory");
1953 #endif /* SHM_MEM */
1954 push($3, &branch_rt.rlist[DEFAULT_RT]);
1956 | ROUTE_BRANCH LBRACK route_name RBRACK LBRACE actions RBRACE {
1958 if (!shm_initialized() && init_shm()<0) {
1959 yyerror("Can't initialize shared memory");
1962 #endif /* SHM_MEM */
1963 i_tmp=route_get(&branch_rt, $3);
1965 yyerror("internal error");
1968 if (branch_rt.rlist[i_tmp]){
1969 yyerror("duplicate route");
1972 push($6, &branch_rt.rlist[i_tmp]);
1974 | ROUTE_BRANCH error { yyerror("invalid branch_route statement"); }
1976 send_route_stm: ROUTE_SEND LBRACE actions RBRACE {
1978 if (!shm_initialized() && init_shm()<0) {
1979 yyerror("Can't initialize shared memory");
1982 #endif /* SHM_MEM */
1983 push($3, &onsend_rt.rlist[DEFAULT_RT]);
1985 | ROUTE_SEND LBRACK route_name RBRACK LBRACE actions RBRACE {
1987 if (!shm_initialized() && init_shm()<0) {
1988 yyerror("Can't initialize shared memory");
1991 #endif /* SHM_MEM */
1992 i_tmp=route_get(&onsend_rt, $3);
1994 yyerror("internal error");
1997 if (onsend_rt.rlist[i_tmp]){
1998 yyerror("duplicate route");
2001 push($6, &onsend_rt.rlist[i_tmp]);
2003 | ROUTE_SEND error { yyerror("invalid onsend_route statement"); }
2005 event_route_stm: ROUTE_EVENT LBRACK EVENT_RT_NAME RBRACK LBRACE actions RBRACE {
2007 if (!shm_initialized() && init_shm()<0) {
2008 yyerror("Can't initialize shared memory");
2011 #endif /* SHM_MEM */
2012 i_tmp=route_get(&event_rt, $3);
2014 yyerror("internal error");
2017 if (event_rt.rlist[i_tmp]){
2018 yyerror("duplicate route");
2021 push($6, &event_rt.rlist[i_tmp]);
2024 | ROUTE_EVENT error { yyerror("invalid event_route statement"); }
2027 SUBST STRING { if(pp_subst_add($2)<0) YYERROR; }
2028 | SUBST error { yyerror("invalid subst preprocess statement"); }
2029 | SUBSTDEF STRING { if(pp_substdef_add($2, 0)<0) YYERROR; }
2030 | SUBSTDEF error { yyerror("invalid substdef preprocess statement"); }
2031 | SUBSTDEFS STRING { if(pp_substdef_add($2, 1)<0) YYERROR; }
2032 | SUBSTDEFS error { yyerror("invalid substdefs preprocess statement"); }
2038 yyerror("invalid expression");
2040 }else if (!rve_check_type((enum rval_type*)&i_tmp, $1, 0, 0 ,0)){
2041 yyerror("invalid expression");
2043 }else if (i_tmp!=RV_INT && i_tmp!=RV_NONE){
2044 yyerror("invalid expression type, int expected\n");
2047 $$=mk_elem(NO_OP, RVEXP_O, $1, 0, 0);
2052 /* exp elem operators */
2054 EQUAL_T {$$=EQUAL_OP; }
2055 | DIFF {$$=DIFF_OP; }
2056 | STREQ {$$=EQUAL_OP; } /* for expr. elems equiv. to EQUAL_T*/
2057 | STRDIFF {$$=DIFF_OP; } /* for expr. elems. equiv. to DIFF */
2067 | MATCH {$$=MATCH_OP; }
2071 /* rve expr. operators */
2073 EQUAL_T {$$=RVE_EQ_OP; }
2074 | DIFF {$$=RVE_DIFF_OP; }
2075 | INTEQ {$$=RVE_IEQ_OP; }
2076 | INTDIFF {$$=RVE_IDIFF_OP; }
2077 | STREQ {$$=RVE_STREQ_OP; }
2078 | STRDIFF {$$=RVE_STRDIFF_OP; }
2079 | MATCH {$$=RVE_MATCH_OP; }
2083 | LT {$$=RVE_LT_OP; }
2084 | GTE {$$=RVE_GTE_OP; }
2085 | LTE {$$=RVE_LTE_OP; }
2090 /* boolean expression uri operands */
2093 | FROM_URI {$$=FROM_URI_O;}
2094 | TO_URI {$$=TO_URI_O;}
2098 /* boolean expression integer operands, available only in the
2101 SNDPORT { $$=SNDPORT_O; }
2102 | TOPORT { $$=TOPORT_O; }
2103 | SNDAF { $$=SNDAF_O; }
2106 /* boolean expression integer operands */
2107 eint_op: SRCPORT { $$=SRCPORT_O; }
2108 | DSTPORT { $$=DSTPORT_O; }
2110 | MSGLEN { $$=MSGLEN_O; }
2114 /* boolean expression ip/ipnet operands */
2116 SNDIP { onsend_check("snd_ip"); $$=SNDIP_O; }
2117 | TOIP { onsend_check("to_ip"); $$=TOIP_O; }
2120 eip_op: SRCIP { $$=SRCIP_O; }
2121 | DSTIP { $$=DSTIP_O; }
2128 METHOD strop rval_expr %prec EQUAL_T
2129 {$$= mk_elem($2, METHOD_O, 0, RVE_ST, $3);}
2130 | METHOD strop ID %prec EQUAL_T
2131 {$$ = mk_elem($2, METHOD_O, 0, STRING_ST,$3); }
2132 | METHOD strop error { $$=0; yyerror("string expected"); }
2134 { $$=0; yyerror("invalid operator,== , !=, or =~ expected"); }
2135 | uri_type strop rval_expr %prec EQUAL_T
2136 {$$ = mk_elem($2, $1, 0, RVE_ST, $3); }
2137 | uri_type strop MYSELF %prec EQUAL_T
2138 {$$=mk_elem($2, $1, 0, MYSELF_ST, 0); }
2139 | uri_type strop error %prec EQUAL_T
2140 { $$=0; yyerror("string or MYSELF expected"); }
2142 { $$=0; yyerror("invalid operator, == , != or =~ expected"); }
2143 | eint_op cmpop rval_expr %prec GT { $$=mk_elem($2, $1, 0, RVE_ST, $3 ); }
2144 | eint_op equalop rval_expr %prec EQUAL_T
2145 { $$=mk_elem($2, $1, 0, RVE_ST, $3 ); }
2146 | eint_op cmpop error { $$=0; yyerror("number expected"); }
2147 | eint_op equalop error { $$=0; yyerror("number expected"); }
2148 | eint_op error { $$=0; yyerror("==, !=, <,>, >= or <= expected"); }
2149 | PROTO equalop eqproto %prec EQUAL_T
2150 { $$=mk_elem($2, PROTO_O, 0, NUMBER_ST, (void*)$3 ); }
2151 | PROTO equalop rval_expr %prec EQUAL_T
2152 { $$=mk_elem($2, PROTO_O, 0, RVE_ST, $3 ); }
2153 | PROTO equalop error
2154 { $$=0; yyerror("protocol expected (udp, tcp, tls, sctp, ws, or wss)"); }
2155 | SNDPROTO equalop eqproto %prec EQUAL_T
2156 { $$=mk_elem($2, SNDPROTO_O, 0, NUMBER_ST, (void*)$3 ); }
2157 | SNDPROTO equalop rval_expr %prec EQUAL_T
2158 { $$=mk_elem($2, SNDPROTO_O, 0, RVE_ST, $3 ); }
2159 | SNDPROTO equalop error
2160 { $$=0; yyerror("protocol expected (udp, tcp, tls, sctp, ws, or wss)"); }
2161 | eip_op strop ipnet %prec EQUAL_T { $$=mk_elem($2, $1, 0, NET_ST, $3); }
2162 | eip_op strop rval_expr %prec EQUAL_T {
2165 if (rve_is_constant($3)){
2166 i_tmp=rve_guess_type($3);
2168 yyerror("string expected");
2169 else if (i_tmp==RV_STR){
2170 if (((rval_tmp=rval_expr_eval(0, 0, $3))==0) ||
2171 (rval_get_str(0, 0, &s_tmp, rval_tmp, 0)<0)){
2172 rval_destroy(rval_tmp);
2173 yyerror("bad rvalue expression");
2175 rval_destroy(rval_tmp);
2178 yyerror("BUG: unexpected dynamic type");
2181 /* warn("non constant rvalue in ip comparison") */;
2184 ip_tmp=str2ip(&s_tmp);
2186 ip_tmp=str2ip6(&s_tmp);
2189 $$=mk_elem($2, $1, 0, NET_ST,
2190 mk_new_net_bitlen(ip_tmp, ip_tmp->len*8) );
2192 $$=mk_elem($2, $1, 0, RVE_ST, $3);
2195 $$=mk_elem($2, $1, 0, RVE_ST, $3);
2198 | eip_op strop host %prec EQUAL_T
2199 { $$=mk_elem($2, $1, 0, STRING_ST, $3); }
2200 | eip_op strop MYSELF %prec EQUAL_T
2201 { $$=mk_elem($2, $1, 0, MYSELF_ST, 0); }
2202 | eip_op strop error %prec EQUAL_T
2203 { $$=0; yyerror( "ip address or hostname expected" ); }
2205 { $$=0; yyerror("invalid operator, ==, != or =~ expected");}
2207 | MYSELF equalop uri_type %prec EQUAL_T
2208 { $$=mk_elem($2, $3, 0, MYSELF_ST, 0); }
2209 | MYSELF equalop eip_op %prec EQUAL_T
2210 { $$=mk_elem($2, $3, 0, MYSELF_ST, 0); }
2211 | MYSELF equalop error %prec EQUAL_T
2212 { $$=0; yyerror("URI, SRCIP or DSTIP expected"); }
2213 | MYSELF error { $$=0; yyerror ("invalid operator, == or != expected"); }
2217 ip SLASH ip { $$=mk_new_net($1, $3); }
2219 if (($3<0) || ($3>$1->len*8)) {
2220 yyerror("invalid bit number in netmask");
2223 $$=mk_new_net_bitlen($1, $3);
2225 $$=mk_new_net($1, htonl( ($3)?~( (1<<(32-$3))-1 ):0 ) );
2229 | ip { $$=mk_new_net_bitlen($1, $1->len*8); }
2230 | ip SLASH error { $$=0; yyerror("netmask (eg:255.0.0.0 or 8) expected"); }
2237 $$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1);
2239 LM_CRIT("cfg. parser: memory allocation"
2240 " failure while parsing host\n");
2242 memcpy($$, $1, strlen($1));
2244 memcpy($$+strlen($1)+1, $3, strlen($3));
2245 $$[strlen($1)+1+strlen($3)]=0;
2249 if ($3) pkg_free($3);
2253 $$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1);
2255 LM_CRIT("cfg. parser: memory allocation"
2256 " failure while parsing host\n");
2258 memcpy($$, $1, strlen($1));
2260 memcpy($$+strlen($1)+1, $3, strlen($3));
2261 $$[strlen($1)+1+strlen($3)]=0;
2265 if ($3) pkg_free($3);
2267 | host DOT error { $$=0; pkg_free($1); yyerror("invalid hostname"); }
2268 | host MINUS error { $$=0; pkg_free($1); yyerror("invalid hostname"); }
2274 /* get string version */
2275 $$=pkg_malloc(strlen(yy_number_str)+1);
2277 strcpy($$, yy_number_str);
2282 host_if_id { $$=$1; }
2283 | host_or_if DOT host_if_id {
2285 $$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1);
2287 LM_CRIT("cfg. parser: memory allocation"
2288 " failure while parsing host/interface name\n");
2290 memcpy($$, $1, strlen($1));
2292 memcpy($$+strlen($1)+1, $3, strlen($3));
2293 $$[strlen($1)+1+strlen($3)]=0;
2297 if ($3) pkg_free($3);
2299 | host_or_if MINUS host_if_id {
2301 $$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1);
2303 LM_CRIT("cfg. parser: memory allocation"
2304 " failure while parsing host/interface name\n");
2306 memcpy($$, $1, strlen($1));
2308 memcpy($$+strlen($1)+1, $3, strlen($3));
2309 $$[strlen($1)+1+strlen($3)]=0;
2313 if ($3) pkg_free($3);
2315 | host_or_if DOT error { $$=0; pkg_free($1);
2316 yyerror("invalid host or interface name"); }
2317 | host_or_if MINUS error { $$=0; pkg_free($1);
2318 yyerror("invalid host or interface name"); }
2325 /* check if allowed */
2326 if ($1 && rt==ONSEND_ROUTE) {
2342 case SET_FWD_NO_CONNECT_T:
2343 case SET_RPL_NO_CONNECT_T:
2344 case SET_FWD_CLOSE_T:
2345 case SET_RPL_CLOSE_T:
2350 yyerror("command not allowed in onsend_route\n");
2361 | assign_action { $$ = $1; }
2362 | LBRACE actions RBRACE { $$=$2; }
2367 | LBRACE actions RBRACE { $$=$2; }
2370 actions action {$$=append_action($1, $2); }
2372 | actions error { $$=0; yyerror("bad command"); }
2375 fcmd SEMICOLON {$$=$1;}
2377 | switch_cmd {$$=$1;}
2378 | while_cmd { $$=$1; }
2379 | ret_cmd SEMICOLON { $$=$1; }
2380 | assign_action SEMICOLON {$$=$1;}
2381 | SEMICOLON /* null action */ {$$=0;}
2382 | fcmd error { $$=0; yyerror("bad command: missing ';'?"); }
2386 if ($2 && rval_expr_int_check($2)>=0){
2387 warn_ct_rve($2, "if");
2388 $$=mk_action( IF_T, 3, RVE_ST, $2, ACTIONS_ST, $3, NOSUBTYPE, 0);
2393 | IF rval_expr stm ELSE stm {
2394 if ($2 && rval_expr_int_check($2)>=0){
2395 warn_ct_rve($2, "if");
2396 $$=mk_action( IF_T, 3, RVE_ST, $2, ACTIONS_ST, $3, ACTIONS_ST, $5);
2403 ct_rval: rval_expr {
2405 if ($1 && !rve_is_constant($1)){
2406 yyerror("constant expected");
2410 !rve_check_type((enum rval_type*)&i_tmp, $1, 0, 0 ,0)){
2411 yyerror("invalid expression (bad type)");
2412 }else if ($1 && i_tmp!=RV_INT){
2413 yyerror("invalid expression type, int expected\n");
2420 CASE ct_rval COLON actions {
2422 if ($2==0) { yyerror ("bad case label"); YYERROR; }
2423 else if ((($$=mk_case_stm($2, 0, $4, &i_tmp))==0) && (i_tmp==-10)){
2427 | CASE SLASH ct_rval COLON actions {
2429 if ($3==0) { yyerror ("bad case label"); YYERROR; }
2430 else if ((($$=mk_case_stm($3, 1, $5, &i_tmp))==0) && (i_tmp==-10)){
2434 | CASE ct_rval COLON {
2436 if ($2==0) { yyerror ("bad case label"); YYERROR; }
2437 else if ((($$=mk_case_stm($2, 0, 0, &i_tmp))==0) && (i_tmp==-10)){
2441 | CASE SLASH ct_rval COLON {
2443 if ($3==0) { yyerror ("bad regex case label"); YYERROR; }
2444 else if ((($$=mk_case_stm($3, 1, 0, &i_tmp))==0) && (i_tmp==-10)){
2448 | DEFAULT COLON actions {
2449 if ((($$=mk_case_stm(0, 0, $3, &i_tmp))==0) && (i_tmp==-10)){
2454 if ((($$=mk_case_stm(0, 0, 0, &i_tmp))==0) && (i_tmp==-10)){
2458 | CASE error COLON actions { $$=0; yyerror("bad case label"); }
2459 | CASE SLASH error COLON actions { $$=0; yyerror("bad case regex label"); }
2460 | CASE error COLON { $$=0; yyerror("bad case label"); }
2461 | CASE SLASH error COLON { $$=0; yyerror("bad case regex label"); }
2462 | CASE ct_rval COLON error { $$=0; yyerror ("bad case body"); }
2465 case_stms single_case {
2467 if ($2==0) yyerror ("bad case");
2470 if (*($$->append)!=0)
2471 $$->append=&((*($$->append))->next);
2476 if ($1==0) yyerror ("bad case");
2477 else $$->append=&($$->next);
2481 SWITCH rval_expr LBRACE case_stms RBRACE {
2484 yyerror("bad expression in switch(...)");
2487 yyerror ("bad switch body");
2489 }else if (case_check_default($4)!=0){
2490 yyerror_at(&$2->fpos, "bad switch(): too many "
2491 "\"default:\" labels\n");
2493 }else if (case_check_type($4)!=0){
2494 yyerror_at(&$2->fpos, "bad switch(): mixed integer and"
2495 " string/RE cases not allowed\n");
2498 $$=mk_action(SWITCH_T, 2, RVE_ST, $2, CASE_ST, $4);
2500 yyerror("internal error");
2506 | SWITCH rval_expr LBRACE RBRACE {
2508 warn("empty switch()");
2510 yyerror("bad expression in switch(...)");
2513 /* it might have sideffects, so leave it for the optimizer */
2514 $$=mk_action(SWITCH_T, 2, RVE_ST, $2, CASE_ST, 0);
2516 yyerror("internal error");
2522 | SWITCH error { $$=0; yyerror ("bad expression in switch(...)"); }
2523 | SWITCH rval_expr LBRACE error RBRACE
2524 {$$=0; yyerror ("bad switch body"); }
2528 WHILE rval_expr stm {
2529 if ($2 && rval_expr_int_check($2)>=0){
2530 warn_ct_rve($2, "while");
2531 $$=mk_action( WHILE_T, 2, RVE_ST, $2, ACTIONS_ST, $3);
2534 yyerror_at(&$2->fpos, "bad while(...) expression");
2541 LBRACK ATTR_USER RBRACK { $$ = AVP_CLASS_USER; }
2542 | LBRACK ATTR_DOMAIN RBRACK { $$ = AVP_CLASS_DOMAIN; }
2543 | LBRACK ATTR_GLOBAL RBRACK { $$ = AVP_CLASS_GLOBAL; }
2548 if (sel.n >= MAX_SELECT_PARAMS-1) {
2549 yyerror("Select identifier too long\n");
2551 sel.params[sel.n].type = SEL_PARAM_STR;
2552 sel.params[sel.n].v.s.s = $1;
2553 sel.params[sel.n].v.s.len = strlen($1);
2556 | ID LBRACK intno RBRACK {
2557 if (sel.n >= MAX_SELECT_PARAMS-2) {
2558 yyerror("Select identifier too long\n");
2560 sel.params[sel.n].type = SEL_PARAM_STR;
2561 sel.params[sel.n].v.s.s = $1;
2562 sel.params[sel.n].v.s.len = strlen($1);
2564 sel.params[sel.n].type = SEL_PARAM_INT;
2565 sel.params[sel.n].v.i = $3;
2568 | ID LBRACK STRING RBRACK {
2569 if (sel.n >= MAX_SELECT_PARAMS-2) {
2570 yyerror("Select identifier too long\n");
2572 sel.params[sel.n].type = SEL_PARAM_STR;
2573 sel.params[sel.n].v.s.s = $1;
2574 sel.params[sel.n].v.s.len = strlen($1);
2576 sel.params[sel.n].type = SEL_PARAM_STR;
2577 sel.params[sel.n].v.s.s = $3;
2578 sel.params[sel.n].v.s.len = strlen($3);
2583 select_params DOT select_param
2587 SELECT_MARK { sel.n = 0; sel.f[0] = 0; } select_params {
2588 sel_ptr = (select_t*)pkg_malloc(sizeof(select_t));
2590 yyerror("No memory left to allocate select structure\n");
2592 memcpy(sel_ptr, &sel, sizeof(select_t));
2597 ATTR_FROM { s_attr->type |= AVP_TRACK_FROM; }
2598 | ATTR_TO { s_attr->type |= AVP_TRACK_TO; }
2599 | ATTR_FROMURI { s_attr->type |= AVP_TRACK_FROM | AVP_CLASS_URI; }
2600 | ATTR_TOURI { s_attr->type |= AVP_TRACK_TO | AVP_CLASS_URI; }
2601 | ATTR_FROMUSER { s_attr->type |= AVP_TRACK_FROM | AVP_CLASS_USER; }
2602 | ATTR_TOUSER { s_attr->type |= AVP_TRACK_TO | AVP_CLASS_USER; }
2603 | ATTR_FROMDOMAIN { s_attr->type |= AVP_TRACK_FROM | AVP_CLASS_DOMAIN; }
2604 | ATTR_TODOMAIN { s_attr->type |= AVP_TRACK_TO | AVP_CLASS_DOMAIN; }
2605 | ATTR_GLOBAL { s_attr->type |= AVP_TRACK_ALL | AVP_CLASS_GLOBAL; }
2608 ID { s_attr->type |= AVP_NAME_STR; s_attr->name.s.s = $1; s_attr->name.s.len = strlen ($1); }
2612 | attr_class_spec DOT attr_name_spec
2616 s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
2617 if (!s_attr) { yyerror("No memory left"); YYABORT; }
2618 else s_attr->type = 0;
2622 attr_mark attr_spec { $$ = s_attr; }
2625 attr_mark attr_spec LBRACK intno RBRACK {
2626 s_attr->type|= (AVP_NAME_STR | ($4<0?AVP_INDEX_BACKWARD:AVP_INDEX_FORWARD));
2627 s_attr->index = ($4<0?-$4:$4);
2632 attr_mark attr_spec LBRACK RBRACK {
2633 s_attr->type|= AVP_INDEX_ALL;
2655 if ($1->type==LV_AVP){
2656 s_attr = pkg_malloc(sizeof(struct avp_spec));
2657 if (!s_attr) { yyerror("No memory left"); YYABORT; }
2659 *s_attr=$1->lv.avps;
2663 $$=0; /* not an avp, a pvar */
2667 avp_spec_t *avp_spec;
2670 avp_spec = pkg_malloc(sizeof(*avp_spec));
2672 yyerror("Not enough memory");
2678 s.len = strlen(s.s);
2679 if (parse_avp_name(&s, &type, &avp_spec->name, &idx)) {
2680 yyerror("error when parsing AVP");
2684 avp_spec->type = type;
2685 avp_spec->index = idx;
2691 s_tmp.s=$1; s_tmp.len=strlen($1);
2692 pv_spec=pv_cache_get(&s_tmp);
2694 yyerror("Can't get from cache: %s", $1);
2701 avp_pvar: AVP_OR_PVAR {
2702 lval_tmp=pkg_malloc(sizeof(*lval_tmp));
2704 yyerror("Not enough memory");
2707 memset(lval_tmp, 0, sizeof(*lval_tmp));
2708 s_tmp.s=$1; s_tmp.len=strlen(s_tmp.s);
2709 lval_tmp->lv.pvs = pv_cache_get(&s_tmp);
2710 if (lval_tmp->lv.pvs==NULL){
2711 lval_tmp->lv.avps.type|= AVP_NAME_STR;
2712 lval_tmp->lv.avps.name.s.s = s_tmp.s+1;
2713 lval_tmp->lv.avps.name.s.len = s_tmp.len-1;
2714 lval_tmp->type=LV_AVP;
2716 lval_tmp->type=LV_PVAR;
2719 DBG("parsed ambiguous avp/pvar \"%.*s\" to %d\n",
2720 s_tmp.len, s_tmp.s, lval_tmp->type);
2727 ADDEQ { $$ = ADD_T; }
2728 | EQUAL { $$ = ASSIGN_T; }
2732 EQUAL { $$ = ASSIGN_T; }
2737 lval_tmp=pkg_malloc(sizeof(*lval_tmp));
2739 yyerror("Not enough memory");
2742 lval_tmp->type=LV_AVP; lval_tmp->lv.avps=*$1;
2743 pkg_free($1); /* free the avp spec we just copied */
2748 yyerror("read only pvar in assignment left side");
2750 yyerror("pvar with transformations in assignment"
2752 lval_tmp=pkg_malloc(sizeof(*lval_tmp));
2754 yyerror("Not enough memory");
2757 lval_tmp->type=LV_PVAR; lval_tmp->lv.pvs=$1;
2761 if (($1)->type==LV_PVAR){
2762 if (!pv_is_w($1->lv.pvs))
2763 yyerror("read only pvar in assignment left side");
2764 if ($1->lv.pvs->trans!=0)
2765 yyerror("pvar with transformations in assignment"
2772 rval: intno {$$=mk_rve_rval(RV_INT, (void*)$1); }
2773 | STRING { s_tmp.s=$1; s_tmp.len=strlen($1);
2774 $$=mk_rve_rval(RV_STR, &s_tmp); }
2775 | attr_id_any {$$=mk_rve_rval(RV_AVP, $1); pkg_free($1); }
2776 | pvar {$$=mk_rve_rval(RV_PVAR, $1); }
2780 $$=mk_rve_rval(RV_AVP, &$1->lv.avps);
2783 $$=mk_rve_rval(RV_PVAR, $1->lv.pvs);
2786 yyerror("BUG: invalid lvalue type ");
2789 pkg_free($1); /* not needed anymore */
2791 | select_id {$$=mk_rve_rval(RV_SEL, $1); pkg_free($1); }
2792 | fcmd {$$=mk_rve_rval(RV_ACTION_ST, $1); }
2793 | exp_elem { $$=mk_rve_rval(RV_BEXPR, $1); }
2794 | LBRACE actions RBRACE {$$=mk_rve_rval(RV_ACTION_ST, $2); }
2795 | LBRACE error RBRACE { $$=0; yyerror("bad command block"); }
2796 | LPAREN assign_action RPAREN {$$=mk_rve_rval(RV_ACTION_ST, $2); }
2797 | LPAREN error RPAREN { $$=0; yyerror("bad expression"); }
2801 rve_un_op: NOT { $$=RVE_LNOT_OP; }
2802 | BIN_NOT { $$=RVE_BNOT_OP; }
2803 | MINUS %prec UNARY { $$=RVE_UMINUS_OP; }
2804 /* TODO: RVE_BOOL_OP, RVE_NOT_OP? */
2808 rve_op: PLUS { $$=RVE_PLUS_OP; }
2809 | MINUS { $$=RVE_MINUS_OP; }
2810 | STAR { $$=RVE_MUL_OP; }
2811 | SLASH { $$=RVE_DIV_OP; }
2812 | MODULO { $$=RVE_MOD_OP; }
2816 rval_expr: rval { $$=$1;
2818 /*yyerror("out of memory\n");*/
2822 | rve_un_op rval_expr %prec UNARY {$$=mk_rve1($1, $2); }
2823 | INTCAST rval_expr {$$=mk_rve1(RVE_INT_OP, $2); }
2824 | STRCAST rval_expr {$$=mk_rve1(RVE_STR_OP, $2); }
2825 | rval_expr PLUS rval_expr {$$=mk_rve2(RVE_PLUS_OP, $1, $3); }
2826 | rval_expr MINUS rval_expr {$$=mk_rve2(RVE_MINUS_OP, $1, $3); }
2827 | rval_expr STAR rval_expr {$$=mk_rve2(RVE_MUL_OP, $1, $3); }
2828 | rval_expr SLASH rval_expr {$$=mk_rve2(RVE_DIV_OP, $1, $3); }
2829 | rval_expr MODULO rval_expr {$$=mk_rve2(RVE_MOD_OP, $1, $3); }
2830 | rval_expr BIN_OR rval_expr {$$=mk_rve2(RVE_BOR_OP, $1, $3); }
2831 | rval_expr BIN_AND rval_expr {$$=mk_rve2(RVE_BAND_OP, $1, $3);}
2832 | rval_expr BIN_XOR rval_expr {$$=mk_rve2(RVE_BXOR_OP, $1, $3);}
2833 | rval_expr BIN_LSHIFT rval_expr {$$=mk_rve2(RVE_BLSHIFT_OP, $1, $3);}
2834 | rval_expr BIN_RSHIFT rval_expr {$$=mk_rve2(RVE_BRSHIFT_OP, $1, $3);}
2835 | rval_expr rve_cmpop rval_expr %prec GT { $$=mk_rve2( $2, $1, $3);}
2836 | rval_expr rve_equalop rval_expr %prec EQUAL_T {
2837 /* comparing with $null => treat as defined or !defined */
2838 if($3->op==RVE_RVAL_OP && $3->left.rval.type==RV_PVAR
2839 && $3->left.rval.v.pvs.type==PVT_NULL) {
2840 if($2==RVE_DIFF_OP || $2==RVE_IDIFF_OP
2841 || $2==RVE_STRDIFF_OP) {
2842 DBG("comparison with $null switched to notdefined operator\n");
2843 $$=mk_rve1(RVE_DEFINED_OP, $1);
2845 DBG("comparison with $null switched to defined operator\n");
2846 $$=mk_rve1(RVE_NOTDEFINED_OP, $1);
2848 /* free rve struct for $null */
2851 $$=mk_rve2($2, $1, $3);
2854 | rval_expr LOG_AND rval_expr { $$=mk_rve2(RVE_LAND_OP, $1, $3);}
2855 | rval_expr LOG_OR rval_expr { $$=mk_rve2(RVE_LOR_OP, $1, $3);}
2856 | LPAREN rval_expr RPAREN { $$=$2;}
2857 | STRLEN LPAREN rval_expr RPAREN { $$=mk_rve1(RVE_STRLEN_OP, $3);}
2858 | STREMPTY LPAREN rval_expr RPAREN {$$=mk_rve1(RVE_STREMPTY_OP, $3);}
2859 | DEFINED rval_expr { $$=mk_rve1(RVE_DEFINED_OP, $2);}
2860 | rve_un_op error %prec UNARY { $$=0; yyerror("bad expression"); }
2861 | INTCAST error { $$=0; yyerror("bad expression"); }
2862 | STRCAST error { $$=0; yyerror("bad expression"); }
2863 | rval_expr PLUS error { $$=0; yyerror("bad expression"); }
2864 | rval_expr MINUS error { $$=0; yyerror("bad expression"); }
2865 | rval_expr STAR error { $$=0; yyerror("bad expression"); }
2866 | rval_expr SLASH error { $$=0; yyerror("bad expression"); }
2867 | rval_expr MODULO error { $$=0; yyerror("bad expression"); }
2868 | rval_expr BIN_OR error { $$=0; yyerror("bad expression"); }
2869 | rval_expr BIN_AND error { $$=0; yyerror("bad expression"); }
2870 | rval_expr rve_cmpop error %prec GT
2871 { $$=0; yyerror("bad expression"); }
2872 | rval_expr rve_equalop error %prec EQUAL_T
2873 { $$=0; yyerror("bad expression"); }
2874 | rval_expr LOG_AND error { $$=0; yyerror("bad expression"); }
2875 | rval_expr LOG_OR error { $$=0; yyerror("bad expression"); }
2876 | STRLEN LPAREN error RPAREN { $$=0; yyerror("bad expression"); }
2877 | STREMPTY LPAREN error RPAREN { $$=0; yyerror("bad expression"); }
2878 | DEFINED error { $$=0; yyerror("bad expression"); }
2881 assign_action: lval assign_op rval_expr { $$=mk_action($2, 2, LVAL_ST, $1,
2889 attr_id_ass assign_op STRING { $$=mk_action($2, 2, AVP_ST, $1, STRING_ST, $3); }
2890 | attr_id_ass assign_op NUMBER { $$=mk_action($2, 2, AVP_ST, $1, NUMBER_ST, (void*)$3); }
2891 | attr_id_ass assign_op fcmd { $$=mk_action($2, 2, AVP_ST, $1, ACTION_ST, $3); }
2892 | attr_id_ass assign_op attr_id_any { $$=mk_action($2, 2, AVP_ST, $1, AVP_ST, $3); }
2893 | attr_id_ass assign_op select_id { $$=mk_action($2, 2, AVP_ST, (void*)$1, SELECT_ST, (void*)$3); }
2894 | attr_id_ass assign_op LPAREN exp RPAREN { $$ = mk_action($2, 2, AVP_ST, $1, EXPR_ST, $4); }
2899 SETAVPFLAG { $$ = 1; }
2900 | RESETAVPFLAG { $$ = 0; }
2901 | ISAVPFLAGSET { $$ = -1; }
2904 FORWARD LPAREN RPAREN { $$=mk_action(FORWARD_T, 2, URIHOST_ST, 0, URIPORT_ST, 0); set_cfg_pos($$); }
2905 | FORWARD LPAREN host RPAREN { $$=mk_action( FORWARD_T, 2, STRING_ST, $3, NUMBER_ST, 0); set_cfg_pos($$); }
2906 | FORWARD LPAREN STRING RPAREN { $$=mk_action( FORWARD_T, 2, STRING_ST, $3, NUMBER_ST, 0); set_cfg_pos($$); }
2907 | FORWARD LPAREN ip RPAREN { $$=mk_action( FORWARD_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); set_cfg_pos($$); }
2908 | FORWARD LPAREN host COMMA NUMBER RPAREN { $$=mk_action(FORWARD_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); set_cfg_pos($$); }
2909 | FORWARD LPAREN STRING COMMA NUMBER RPAREN {$$=mk_action(FORWARD_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); set_cfg_pos($$); }
2910 | FORWARD LPAREN ip COMMA NUMBER RPAREN { $$=mk_action(FORWARD_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5); set_cfg_pos($$); }
2911 | FORWARD LPAREN URIHOST COMMA URIPORT RPAREN { $$=mk_action(FORWARD_T, 2, URIHOST_ST, 0, URIPORT_ST, 0); set_cfg_pos($$); }
2912 | FORWARD LPAREN URIHOST COMMA NUMBER RPAREN {$$=mk_action(FORWARD_T, 2, URIHOST_ST, 0, NUMBER_ST, (void*)$5); set_cfg_pos($$); }
2913 | FORWARD LPAREN URIHOST RPAREN { $$=mk_action(FORWARD_T, 2, URIHOST_ST, 0, NUMBER_ST, 0); set_cfg_pos($$); }
2914 | FORWARD error { $$=0; yyerror("missing '(' or ')' ?"); }
2915 | FORWARD LPAREN error RPAREN { $$=0; yyerror("bad forward argument"); }
2916 | FORWARD_UDP LPAREN host RPAREN { $$=mk_action(FORWARD_UDP_T, 2, STRING_ST, $3, NUMBER_ST, 0); set_cfg_pos($$); }
2917 | FORWARD_UDP LPAREN STRING RPAREN { $$=mk_action(FORWARD_UDP_T, 2, STRING_ST, $3, NUMBER_ST, 0); set_cfg_pos($$); }
2918 | FORWARD_UDP LPAREN ip RPAREN { $$=mk_action(FORWARD_UDP_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); set_cfg_pos($$); }
2919 | FORWARD_UDP LPAREN host COMMA NUMBER RPAREN { $$=mk_action(FORWARD_UDP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); set_cfg_pos($$); }
2920 | FORWARD_UDP LPAREN STRING COMMA NUMBER RPAREN {$$=mk_action(FORWARD_UDP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); set_cfg_pos($$); }
2921 | FORWARD_UDP LPAREN ip COMMA NUMBER RPAREN { $$=mk_action(FORWARD_UDP_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5); set_cfg_pos($$); }
2922 | FORWARD_UDP LPAREN URIHOST COMMA URIPORT RPAREN {$$=mk_action(FORWARD_UDP_T, 2, URIHOST_ST, 0, URIPORT_ST, 0); set_cfg_pos($$); }
2923 | FORWARD_UDP LPAREN URIHOST COMMA NUMBER RPAREN { $$=mk_action(FORWARD_UDP_T, 2, URIHOST_ST, 0, NUMBER_ST, (void*)$5); set_cfg_pos($$); }
2924 | FORWARD_UDP LPAREN URIHOST RPAREN { $$=mk_action(FORWARD_UDP_T, 2, URIHOST_ST, 0, NUMBER_ST, 0); set_cfg_pos($$); }
2925 | FORWARD_UDP error { $$=0; yyerror("missing '(' or ')' ?"); }
2926 | FORWARD_UDP LPAREN error RPAREN { $$=0; yyerror("bad forward_udp argument"); }
2927 | FORWARD_TCP LPAREN host RPAREN { $$=mk_action(FORWARD_TCP_T, 2, STRING_ST, $3, NUMBER_ST, 0); set_cfg_pos($$); }
2928 | FORWARD_TCP LPAREN STRING RPAREN { $$=mk_action(FORWARD_TCP_T, 2, STRING_ST, $3, NUMBER_ST, 0); set_cfg_pos($$); }
2929 | FORWARD_TCP LPAREN ip RPAREN { $$=mk_action(FORWARD_TCP_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); set_cfg_pos($$); }
2930 | FORWARD_TCP LPAREN host COMMA NUMBER RPAREN { $$=mk_action(FORWARD_TCP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); set_cfg_pos($$); }
2931 | FORWARD_TCP LPAREN STRING COMMA NUMBER RPAREN {$$=mk_action(FORWARD_TCP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); set_cfg_pos($$); }
2932 | FORWARD_TCP LPAREN ip COMMA NUMBER RPAREN { $$=mk_action(FORWARD_TCP_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5); set_cfg_pos($$); }
2933 | FORWARD_TCP LPAREN URIHOST COMMA URIPORT RPAREN {$$=mk_action(FORWARD_TCP_T, 2, URIHOST_ST, 0, URIPORT_ST, 0); set_cfg_pos($$); }
2934 | FORWARD_TCP LPAREN URIHOST COMMA NUMBER RPAREN { $$=mk_action(FORWARD_TCP_T, 2, URIHOST_ST, 0, NUMBER_ST, (void*)$5); set_cfg_pos($$); }
2935 | FORWARD_TCP LPAREN URIHOST RPAREN { $$=mk_action(FORWARD_TCP_T, 2, URIHOST_ST, 0, NUMBER_ST, 0); set_cfg_pos($$); }
2936 | FORWARD_TCP error { $$=0; yyerror("missing '(' or ')' ?"); }
2937 | FORWARD_TCP LPAREN error RPAREN { $$=0; yyerror("bad forward_tcp argument"); }
2938 | FORWARD_TLS LPAREN host RPAREN {
2940 $$=mk_action(FORWARD_TLS_T, 2, STRING_ST, $3, NUMBER_ST, 0); set_cfg_pos($$);
2943 yyerror("tls support not compiled in");
2946 | FORWARD_TLS LPAREN STRING RPAREN {
2948 $$=mk_action(FORWARD_TLS_T, 2, STRING_ST, $3, NUMBER_ST, 0); set_cfg_pos($$);
2951 yyerror("tls support not compiled in");
2954 | FORWARD_TLS LPAREN ip RPAREN {
2956 $$=mk_action(FORWARD_TLS_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); set_cfg_pos($$);
2959 yyerror("tls support not compiled in");
2962 | FORWARD_TLS LPAREN host COMMA NUMBER RPAREN {
2964 $$=mk_action(FORWARD_TLS_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); set_cfg_pos($$);
2967 yyerror("tls support not compiled in");
2970 | FORWARD_TLS LPAREN STRING COMMA NUMBER RPAREN {
2972 $$=mk_action(FORWARD_TLS_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); set_cfg_pos($$);
2975 yyerror("tls support not compiled in");
2978 | FORWARD_TLS LPAREN ip COMMA NUMBER RPAREN {
2980 $$=mk_action(FORWARD_TLS_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5); set_cfg_pos($$);
2983 yyerror("tls support not compiled in");
2986 | FORWARD_TLS LPAREN URIHOST COMMA URIPORT RPAREN {
2988 $$=mk_action(FORWARD_TLS_T, 2, URIHOST_ST, 0, URIPORT_ST, 0); set_cfg_pos($$);
2991 yyerror("tls support not compiled in");
2994 | FORWARD_TLS LPAREN URIHOST COMMA NUMBER RPAREN {
2996 $$=mk_action(FORWARD_TLS_T, 2, URIHOST_ST, 0, NUMBER_ST, (void*)$5); set_cfg_pos($$);
2999 yyerror("tls support not compiled in");
3002 | FORWARD_TLS LPAREN URIHOST RPAREN {
3004 $$=mk_action(FORWARD_TLS_T, 2, URIHOST_ST, 0, NUMBER_ST, 0); set_cfg_pos($$);
3007 yyerror("tls support not compiled in");
3010 | FORWARD_TLS error { $$=0; yyerror("missing '(' or ')' ?"); }
3011 | FORWARD_TLS LPAREN error RPAREN { $$=0;
3012 yyerror("bad forward_tls argument"); }
3013 | FORWARD_SCTP LPAREN host RPAREN {
3015 $$=mk_action(FORWARD_SCTP_T, 2, STRING_ST, $3, NUMBER_ST, 0); set_cfg_pos($$);
3018 yyerror("sctp support not compiled in");
3021 | FORWARD_SCTP LPAREN STRING RPAREN {
3023 $$=mk_action(FORWARD_SCTP_T, 2, STRING_ST, $3, NUMBER_ST, 0); set_cfg_pos($$);
3026 yyerror("sctp support not compiled in");
3029 | FORWARD_SCTP LPAREN ip RPAREN {
3031 $$=mk_action(FORWARD_SCTP_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); set_cfg_pos($$);
3034 yyerror("sctp support not compiled in");
3037 | FORWARD_SCTP LPAREN host COMMA NUMBER RPAREN {
3039 $$=mk_action(FORWARD_SCTP_T, 2, STRING_ST, $3, NUMBER_ST,
3040 (void*)$5); set_cfg_pos($$);
3043 yyerror("sctp support not compiled in");
3046 | FORWARD_SCTP LPAREN STRING COMMA NUMBER RPAREN {
3048 $$=mk_action(FORWARD_SCTP_T, 2, STRING_ST, $3, NUMBER_ST,
3049 (void*)$5); set_cfg_pos($$);
3052 yyerror("sctp support not compiled in");
3055 | FORWARD_SCTP LPAREN ip COMMA NUMBER RPAREN {
3057 $$=mk_action(FORWARD_SCTP_T, 2, IP_ST, (void*)$3, NUMBER_ST,
3058 (void*)$5); set_cfg_pos($$);
3061 yyerror("sctp support not compiled in");
3064 | FORWARD_SCTP LPAREN URIHOST COMMA URIPORT RPAREN {
3066 $$=mk_action(FORWARD_SCTP_T, 2, URIHOST_ST, 0, URIPORT_ST, 0); set_cfg_pos($$);
3069 yyerror("sctp support not compiled in");
3072 | FORWARD_SCTP LPAREN URIHOST COMMA NUMBER RPAREN {
3074 $$=mk_action(FORWARD_SCTP_T, 2, URIHOST_ST, 0, NUMBER_ST,
3075 (void*)$5); set_cfg_pos($$);
3078 yyerror("sctp support not compiled in");
3081 | FORWARD_SCTP LPAREN URIHOST RPAREN {
3083 $$=mk_action(FORWARD_SCTP_T, 2, URIHOST_ST, 0, NUMBER_ST, 0); set_cfg_pos($$);
3086 yyerror("tls support not compiled in");
3089 | FORWARD_SCTP error { $$=0; yyerror("missing '(' or ')' ?"); }
3090 | FORWARD_SCTP LPAREN error RPAREN { $$=0;
3091 yyerror("bad forward_sctp argument"); }
3092 | LOG_TOK LPAREN STRING RPAREN {$$=mk_action(LOG_T, 2, NUMBER_ST,
3093 (void*)(L_DBG+1), STRING_ST, $3);
3095 | LOG_TOK LPAREN NUMBER COMMA STRING RPAREN {$$=mk_action(LOG_T, 2, NUMBER_ST, (void*)$3, STRING_ST, $5); set_cfg_pos($$); }
3096 | LOG_TOK error { $$=0; yyerror("missing '(' or ')' ?"); }
3097 | LOG_TOK LPAREN error RPAREN { $$=0; yyerror("bad log argument"); }
3098 | SETFLAG LPAREN NUMBER RPAREN {
3099 if (check_flag($3)==-1)
3100 yyerror("bad flag value");
3101 $$=mk_action(SETFLAG_T, 1, NUMBER_ST,
3105 | SETFLAG LPAREN flag_name RPAREN {
3106 i_tmp=get_flag_no($3, strlen($3));
3107 if (i_tmp<0) yyerror("flag not declared");
3108 $$=mk_action(SETFLAG_T, 1, NUMBER_ST,
3109 (void*)(long)i_tmp);
3112 | SETFLAG error { $$=0; yyerror("missing '(' or ')'?"); }
3113 | RESETFLAG LPAREN NUMBER RPAREN {
3114 if (check_flag($3)==-1)
3115 yyerror("bad flag value");
3116 $$=mk_action(RESETFLAG_T, 1, NUMBER_ST, (void*)$3);
3119 | RESETFLAG LPAREN flag_name RPAREN {
3120 i_tmp=get_flag_no($3, strlen($3));
3121 if (i_tmp<0) yyerror("flag not declared");
3122 $$=mk_action(RESETFLAG_T, 1, NUMBER_ST,
3123 (void*)(long)i_tmp);
3126 | RESETFLAG error { $$=0; yyerror("missing '(' or ')'?"); }
3127 | ISFLAGSET LPAREN NUMBER RPAREN {
3128 if (check_flag($3)==-1)
3129 yyerror("bad flag value");
3130 $$=mk_action(ISFLAGSET_T, 1, NUMBER_ST, (void*)$3);
3133 | ISFLAGSET LPAREN flag_name RPAREN {
3134 i_tmp=get_flag_no($3, strlen($3));
3135 if (i_tmp<0) yyerror("flag not declared");
3136 $$=mk_action(ISFLAGSET_T, 1, NUMBER_ST,
3137 (void*)(long)i_tmp);
3140 | ISFLAGSET error { $$=0; yyerror("missing '(' or ')'?"); }
3141 | avpflag_oper LPAREN attr_id_any_str COMMA flag_name RPAREN {
3142 i_tmp=get_avpflag_no($5);
3143 if (i_tmp==0) yyerror("avpflag not declared");
3144 $$=mk_action(AVPFLAG_OPER_T, 3, AVP_ST, $3, NUMBER_ST, (void*)(long)i_tmp, NUMBER_ST, (void*)$1);
3147 | avpflag_oper LPAREN attr_id_any_str COMMA error RPAREN {
3148 $$=0; yyerror("error parsing flag name");
3150 | avpflag_oper LPAREN error COMMA flag_name RPAREN {
3151 $$=0; yyerror("error parsing first parameter (avp or string)");
3153 | avpflag_oper LPAREN error RPAREN { $$=0; yyerror("bad parameters"); }
3154 | avpflag_oper error { $$=0; yyerror("missing '(' or ')'?"); }
3155 | ERROR LPAREN STRING COMMA STRING RPAREN {$$=mk_action(ERROR_T, 2, STRING_ST, $3, STRING_ST, $5);
3158 | ERROR error { $$=0; yyerror("missing '(' or ')' ?"); }
3159 | ERROR LPAREN error RPAREN { $$=0; yyerror("bad error argument"); }
3160 | ROUTE LPAREN rval_expr RPAREN {
3162 $$ = mk_action(ROUTE_T, 1, RVE_ST, (void*)$3);
3169 | ROUTE LPAREN ID RPAREN {
3171 $$ = mk_action(ROUTE_T, 1, STRING_ST, (void*)$3);
3178 | ROUTE error { $$=0; yyerror("missing '(' or ')' ?"); }
3179 | ROUTE LPAREN error RPAREN { $$=0; yyerror("bad route argument"); }
3180 | EXEC LPAREN STRING RPAREN { $$=mk_action(EXEC_T, 1, STRING_ST, $3); set_cfg_pos($$); }
3181 | SET_HOST LPAREN STRING RPAREN { $$=mk_action(SET_HOST_T, 1, STRING_ST, $3); set_cfg_pos($$); }
3182 | SET_HOST error { $$=0; yyerror("missing '(' or ')' ?"); }
3183 | SET_HOST LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
3184 | PREFIX LPAREN STRING RPAREN { $$=mk_action(PREFIX_T, 1, STRING_ST, $3); set_cfg_pos($$); }
3185 | PREFIX error { $$=0; yyerror("missing '(' or ')' ?"); }
3186 | PREFIX LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
3187 | STRIP_TAIL LPAREN NUMBER RPAREN { $$=mk_action(STRIP_TAIL_T, 1, NUMBER_ST, (void*)$3); set_cfg_pos($$); }
3188 | STRIP_TAIL error { $$=0; yyerror("missing '(' or ')' ?"); }
3189 | STRIP_TAIL LPAREN error RPAREN { $$=0; yyerror("bad argument, number expected"); }
3190 | STRIP LPAREN NUMBER RPAREN { $$=mk_action(STRIP_T, 1, NUMBER_ST, (void*) $3); set_cfg_pos($$); }
3191 | STRIP error { $$=0; yyerror("missing '(' or ')' ?"); }
3192 | STRIP LPAREN error RPAREN { $$=0; yyerror("bad argument, number expected"); }
3193 | SET_USERPHONE LPAREN RPAREN { $$=mk_action(SET_USERPHONE_T, 0); set_cfg_pos($$); }
3194 | SET_USERPHONE error { $$=0; yyerror("missing '(' or ')' ?"); }
3195 | REMOVE_BRANCH LPAREN intno RPAREN {
3196 $$=mk_action(REMOVE_BRANCH_T, 1, NUMBER_ST, (void*)$3);
3199 | REMOVE_BRANCH LPAREN RPAREN {
3200 $$=mk_action(REMOVE_BRANCH_T, 0);
3203 | REMOVE_BRANCH error { $$=0; yyerror("missing '(' or ')' ?"); }
3204 | REMOVE_BRANCH LPAREN error RPAREN { $$=0; yyerror("bad argument, number expected"); }
3205 | CLEAR_BRANCHES LPAREN RPAREN { $$=mk_action(CLEAR_BRANCHES_T, 0); set_cfg_pos($$); }
3206 | SET_HOSTPORT LPAREN STRING RPAREN { $$=mk_action(SET_HOSTPORT_T, 1, STRING_ST, $3); set_cfg_pos($$); }
3207 | SET_HOSTPORT error { $$=0; yyerror("missing '(' or ')' ?"); }
3208 | SET_HOSTPORT LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
3209 | SET_HOSTPORTTRANS LPAREN STRING RPAREN { $$=mk_action(SET_HOSTPORTTRANS_T, 1, STRING_ST, $3); set_cfg_pos($$); }
3210 | SET_HOSTPORTTRANS error { $$=0; yyerror("missing '(' or ')' ?"); }
3211 | SET_HOSTPORTTRANS LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
3212 | SET_PORT LPAREN STRING RPAREN { $$=mk_action(SET_PORT_T, 1, STRING_ST, $3); set_cfg_pos($$); }
3213 | SET_PORT error { $$=0; yyerror("missing '(' or ')' ?"); }
3214 | SET_PORT LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
3215 | SET_USER LPAREN STRING RPAREN { $$=mk_action(SET_USER_T, 1, STRING_ST, $3); set_cfg_pos($$); }
3216 | SET_USER error { $$=0; yyerror("missing '(' or ')' ?"); }
3217 | SET_USER LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
3218 | SET_USERPASS LPAREN STRING RPAREN { $$=mk_action(SET_USERPASS_T, 1, STRING_ST, $3); set_cfg_pos($$); }
3219 | SET_USERPASS error { $$=0; yyerror("missing '(' or ')' ?"); }
3220 | SET_USERPASS LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
3221 | SET_URI LPAREN STRING RPAREN { $$=mk_action(SET_URI_T, 1, STRING_ST,$3); set_cfg_pos($$); }
3222 | SET_URI error { $$=0; yyerror("missing '(' or ')' ?"); }
3223 | SET_URI LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
3224 | REVERT_URI LPAREN RPAREN { $$=mk_action(REVERT_URI_T, 0); set_cfg_pos($$); }
3225 | REVERT_URI { $$=mk_action(REVERT_URI_T, 0); set_cfg_pos($$); }
3226 | FORCE_RPORT LPAREN RPAREN { $$=mk_action(FORCE_RPORT_T, 0); set_cfg_pos($$); }
3227 | FORCE_RPORT {$$=mk_action(FORCE_RPORT_T, 0); set_cfg_pos($$); }
3228 | ADD_LOCAL_RPORT LPAREN RPAREN { $$=mk_action(ADD_LOCAL_RPORT_T, 0); set_cfg_pos($$); }
3229 | ADD_LOCAL_RPORT {$$=mk_action(ADD_LOCAL_RPORT_T, 0); set_cfg_pos($$); }
3230 | FORCE_TCP_ALIAS LPAREN NUMBER RPAREN {
3232 $$=mk_action(FORCE_TCP_ALIAS_T, 1, NUMBER_ST, (void*)$3);
3235 yyerror("tcp support not compiled in");
3238 | FORCE_TCP_ALIAS LPAREN RPAREN {
3240 $$=mk_action(FORCE_TCP_ALIAS_T, 0);
3243 yyerror("tcp support not compiled in");
3248 $$=mk_action(FORCE_TCP_ALIAS_T, 0);
3251 yyerror("tcp support not compiled in");
3254 | FORCE_TCP_ALIAS LPAREN error RPAREN {$$=0; yyerror("bad argument, number expected"); }
3255 | UDP_MTU_TRY_PROTO LPAREN proto RPAREN
3256 { $$=mk_action(UDP_MTU_TRY_PROTO_T, 1, NUMBER_ST, $3); set_cfg_pos($$); }
3257 | UDP_MTU_TRY_PROTO LPAREN error RPAREN
3258 { $$=0; yyerror("bad argument, UDP, TCP, TLS or SCTP expected"); }
3259 | SET_ADV_ADDRESS LPAREN listen_id RPAREN {
3261 if ((str_tmp=pkg_malloc(sizeof(str)))==0) {
3262 LM_CRIT("cfg. parser: out of memory.\n");
3265 str_tmp->len=$3?strlen($3):0;
3266 $$=mk_action(SET_ADV_ADDR_T, 1, STR_ST, str_tmp);
3270 | SET_ADV_ADDRESS LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
3271 | SET_ADV_ADDRESS error {$$=0; yyerror("missing '(' or ')' ?"); }
3272 | SET_ADV_PORT LPAREN NUMBER RPAREN {
3274 tmp=int2str($3, &i_tmp);
3275 if ((str_tmp=pkg_malloc(sizeof(str)))==0) {
3276 LM_CRIT("cfg. parser: out of memory.\n");
3278 if ((str_tmp->s=pkg_malloc(i_tmp))==0) {
3279 LM_CRIT("cfg. parser: out of memory.\n");
3281 memcpy(str_tmp->s, tmp, i_tmp);
3283 $$=mk_action(SET_ADV_PORT_T, 1, STR_ST, str_tmp);
3288 | SET_ADV_PORT LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
3289 | SET_ADV_PORT error {$$=0; yyerror("missing '(' or ')' ?"); }
3290 | FORCE_SEND_SOCKET LPAREN phostport RPAREN {
3291 $$=mk_action(FORCE_SEND_SOCKET_T, 1, SOCKID_ST, $3);
3294 | FORCE_SEND_SOCKET LPAREN error RPAREN {
3295 $$=0; yyerror("bad argument, [proto:]host[:port] expected");
3297 | FORCE_SEND_SOCKET error {$$=0; yyerror("missing '(' or ')' ?"); }
3298 | SET_FWD_NO_CONNECT LPAREN RPAREN {
3299 $$=mk_action(SET_FWD_NO_CONNECT_T, 0); set_cfg_pos($$);
3301 | SET_FWD_NO_CONNECT {
3302 $$=mk_action(SET_FWD_NO_CONNECT_T, 0); set_cfg_pos($$);
3304 | SET_RPL_NO_CONNECT LPAREN RPAREN {
3305 $$=mk_action(SET_RPL_NO_CONNECT_T, 0); set_cfg_pos($$);
3307 | SET_RPL_NO_CONNECT {
3308 $$=mk_action(SET_RPL_NO_CONNECT_T, 0); set_cfg_pos($$);
3310 | SET_FWD_CLOSE LPAREN RPAREN {
3311 $$=mk_action(SET_FWD_CLOSE_T, 0); set_cfg_pos($$);
3314 $$=mk_action(SET_FWD_CLOSE_T, 0); set_cfg_pos($$);
3316 | SET_RPL_CLOSE LPAREN RPAREN {
3317 $$=mk_action(SET_RPL_CLOSE_T, 0); set_cfg_pos($$);
3320 $$=mk_action(SET_RPL_CLOSE_T, 0); set_cfg_pos($$);
3322 | CFG_SELECT LPAREN STRING COMMA NUMBER RPAREN {
3323 $$=mk_action(CFG_SELECT_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); set_cfg_pos($$);
3325 | CFG_SELECT LPAREN STRING COMMA rval_expr RPAREN {
3326 $$=mk_action(CFG_SELECT_T, 2, STRING_ST, $3, RVE_ST, $5); set_cfg_pos($$);
3328 | CFG_SELECT error { $$=0; yyerror("missing '(' or ')' ?"); }
3329 | CFG_SELECT LPAREN error RPAREN { $$=0; yyerror("bad arguments, string and number expected"); }
3330 | CFG_RESET LPAREN STRING RPAREN {
3331 $$=mk_action(CFG_RESET_T, 1, STRING_ST, $3); set_cfg_pos($$);
3333 | CFG_RESET error { $$=0; yyerror("missing '(' or ')' ?"); }
3334 | CFG_RESET LPAREN error RPAREN { $$=0; yyerror("bad arguments, string expected"); }
3335 | ID {mod_func_action = mk_action(MODULE0_T, 2, MODEXP_ST, NULL, NUMBER_ST,
3336 0); } LPAREN func_params RPAREN {
3337 mod_func_action->val[0].u.data =
3338 find_export_record($1, mod_func_action->val[1].u.number, rt,
3340 if (mod_func_action->val[0].u.data == 0) {
3341 if (find_export_record($1, mod_func_action->val[1].u.number, 0,
3343 LM_ERR("misused command %s\n", $1);
3344 yyerror("Command cannot be used in the block\n");
3346 LM_ERR("cfg. parser: failed to find command %s (params %ld)\n",
3347 $1, mod_func_action->val[1].u.number);
3348 yyerror("unknown command, missing loadmodule?\n");
3350 free_mod_func_action(mod_func_action);
3353 if (mod_func_action && mod_f_params_pre_fixup(mod_func_action)<0) {
3354 /* error messages are printed inside the function */
3355 free_mod_func_action(mod_func_action);
3356 mod_func_action = 0;
3360 $$ = mod_func_action;
3363 | ID error { yyerror("'('')' expected (function call)");}
3367 | func_params COMMA func_param { }
3372 if ($1 && mod_func_action->val[1].u.number < MAX_ACTIONS-2) {
3373 mod_func_action->val[mod_func_action->val[1].u.number+2].type =
3375 mod_func_action->val[mod_func_action->val[1].u.number+2].u.data =
3377 mod_func_action->val[1].u.number++;
3379 yyerror("Too many arguments\n");
3388 DROP LPAREN RPAREN {
3389 $$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST,
3390 (void*)(DROP_R_F|EXIT_R_F)); set_cfg_pos($$);
3393 $$=mk_action(DROP_T, 2, RVE_ST, $2, NUMBER_ST,
3394 (void*)(DROP_R_F|EXIT_R_F)); set_cfg_pos($$);
3397 $$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST,
3398 (void*)(DROP_R_F|EXIT_R_F)); set_cfg_pos($$);
3400 | EXIT LPAREN RPAREN {
3401 $$=mk_action(DROP_T, 2, NUMBER_ST, (void*)1, NUMBER_ST,
3406 $$=mk_action(DROP_T, 2, RVE_ST, $2, NUMBER_ST, (void*)EXIT_R_F);
3410 $$=mk_action(DROP_T, 2, NUMBER_ST, (void*)1, NUMBER_ST,
3415 $$=mk_action(DROP_T, 2, NUMBER_ST, (void*)1, NUMBER_ST,
3416 (void*)RETURN_R_F); set_cfg_pos($$);
3418 | RETURN LPAREN RPAREN {
3419 $$=mk_action(DROP_T, 2, NUMBER_ST, (void*)1, NUMBER_ST,
3420 (void*)RETURN_R_F); set_cfg_pos($$);
3422 | RETURN rval_expr {
3423 $$=mk_action(DROP_T, 2, RVE_ST, $2, NUMBER_ST, (void*)RETURN_R_F);
3427 $$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, (void*)BREAK_R_F);
3434 static void get_cpos(struct cfg_pos* pos)
3436 pos->s_line=startline;
3438 pos->s_col=startcolumn;
3439 pos->e_col=column-1;
3441 finame = (cfg_file!=0)?cfg_file:"default";
3443 pos->rname=(routename!=0)?routename:default_routename;
3447 static void warn_at(struct cfg_pos* p, char* format, ...)
3452 va_start(ap, format);
3453 vsnprintf(s, sizeof(s), format, ap);
3455 if (p->e_line!=p->s_line)