6 * Copyright (C) 2001-2003 FhG Fokus
8 * This file is part of ser, a free SIP server.
10 * ser is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version
15 * For a license to use the ser software under conditions
16 * other than those described here, or to purchase support for this
17 * software, please contact iptel.org by e-mail at the following addresses:
20 * ser is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 * 2003-01-29 src_port added (jiri)
33 * 2003-01-23 mhomed added (jiri)
34 * 2003-03-19 replaced all mallocs/frees with pkg_malloc/pkg_free (andrei)
35 * 2003-03-19 Added support for route type in find_export (janakj)
36 * 2003-03-20 Regex support in modparam (janakj)
37 * 2003-04-01 added dst_port, proto , af (andrei)
38 * 2003-04-05 s/reply_route/failure_route, onreply_route introduced (jiri)
39 * 2003-04-12 added force_rport, chroot and wdir (andrei)
40 * 2003-04-15 added tcp_children, disable_tcp (andrei)
41 * 2003-04-22 strip_tail added (jiri)
42 * 2003-07-03 tls* (disable, certificate, private_key, ca_list, verify,
43 * require_certificate added (andrei)
44 * 2003-07-06 more tls config. vars added: tls_method, tls_port_no (andrei)
45 * 2003-10-02 added {,set_}advertised_{address,port} (andrei)
46 * 2003-10-10 added <,>,<=,>=, != operators support
47 * added msg:len (andrei)
48 * 2003-10-11 if(){} doesn't require a ';' after it anymore (andrei)
49 * 2003-10-13 added FIFO_DIR & proto:host:port listen/alias support (andrei)
50 * 2003-10-24 converted to the new socket_info lists (andrei)
51 * 2003-10-28 added tcp_accept_aliases (andrei)
52 * 2003-11-20 added {tcp_connect, tcp_send, tls_*}_timeout (andrei)
53 * 2004-03-30 added DISABLE_CORE and OPEN_FD_LIMIT (andrei)
54 * 2004-04-29 added SOCK_MODE, SOCK_USER & SOCK_GROUP (andrei)
55 * 2004-05-03 applied multicast support patch (MCAST_LOOPBACK) from janakj
56 * added MCAST_TTL (andrei)
57 * 2004-07-05 src_ip & dst_ip will detect ip addresses between quotes
59 * 2004-10-19 added FROM_URI, TO_URI (andrei)
60 * 2004-11-30 added force_send_socket (andrei)
61 * 2005-07-08 added TCP_CON_LIFETIME, TCP_POLL_METHOD, TCP_MAX_CONNECTIONS
63 * 2005-07-11 added DNS_RETR_TIME, DNS_RETR_NO, DNS_SERVERS_NO, DNS_USE_SEARCH,
64 * DNS_TRY_IPV6 (andrei)
65 * 2005-07-12 default onreply route added (andrei)
66 * 2005-11-16 fixed if (cond) cmd; (andrei)
67 * 2005-12-11 added onsend_route support, fcmd (filtered cmd),
68 * snd_{ip,port,proto,af}, to_{ip,proto} (andrei)
69 * 2005-12-19 select framework (mma)
70 * 2006-01-06 AVP index support (mma)
71 * 2005-01-07 optional semicolon in statement, PARAM_STR&PARAM_STRING
72 * 2006-02-02 named flags support (andrei)
73 * 2006-02-06 named routes support (andrei)
74 * 2006-05-30 avp flags (tma)
75 * 2006-09-11 added dns cache (use, flags, ttls, mem ,gc) & dst blacklist
77 * 2006-10-13 added STUN_ALLOW_STUN, STUN_ALLOW_FP, STUN_REFRESH_INTERVAL
79 * 2007-02-09 separated command needed for tls-in-core and for tls in general
81 * 2007-06-07 added SHM_FORCE_ALLOC, MLOCK_PAGES, REAL_TIME, RT_PRIO,
82 * RT_POLICY, RT_TIMER1_PRIO, RT_TIMER1_POLICY, RT_TIMER2_PRIO,
83 * RT_TIMER2_POLICY (andrei)
84 * 2007-06-16 added DDNS_SRV_LB, DNS_TRY_NAPTR (andrei)
85 * 2007-09-10 introduced phone2tel option which allows NOT to consider
86 * user=phone URIs as TEL URIs (jiri)
87 * 2007-10-10 added DNS_SEARCH_FMATCH (mma)
88 * 2007-11-28 added TCP_OPT_{FD_CACHE, DEFER_ACCEPT, DELAYED_ACK, SYNCNT,
89 * LINGER2, KEEPALIVE, KEEPIDLE, KEEPINTVL, KEEPCNT} (andrei)
90 * 2008-01-24 added cfg_var definition (Miklos)
91 * 2009-03-10 added SET_USERPHONE action (Miklos)
98 #include <sys/types.h>
99 #include <sys/socket.h>
100 #include <netinet/in.h>
101 #include <arpa/inet.h>
104 #include "route_struct.h"
108 #include "sr_module.h"
109 #include "modparam.h"
112 #include "socket_info.h"
113 #include "name_alias.h"
118 #include "tcp_init.h"
119 #include "tcp_options.h"
120 #include "sctp_options.h"
121 #include "msg_translator.h"
124 #include "cfg_core.h"
127 #include "tls/tls_config.h"
129 #include "timer_ticks.h"
135 /* hack to avoid alloca usage in the generated C file (needed for compiler
136 with no built in alloca, like icc*/
139 #define onsend_check(s) \
141 if (rt!=ONSEND_ROUTE) yyerror( s " allowed only in onsend_routes");\
146 #define IF_DNS_CACHE(x) x
148 #define IF_DNS_CACHE(x) warn("dns cache support not compiled in")
151 #ifdef USE_DNS_FAILOVER
152 #define IF_DNS_FAILOVER(x) x
154 #define IF_DNS_FAILOVER(x) warn("dns failover support not compiled in")
158 #define IF_NAPTR(x) x
160 #define IF_NAPTR(x) warn("dns naptr support not compiled in")
163 #ifdef USE_DST_BLACKLIST
164 #define IF_DST_BLACKLIST(x) x
166 #define IF_DST_BLACKLIST(x) warn("dst blacklist support not compiled in")
172 #define IF_STUN(x) warn("stun support not compiled in")
177 static void yyerror(char* s);
180 static struct socket_id* lst_tmp;
181 static struct name_lst* nl_tmp;
182 static int rt; /* Type of route block for find_export */
185 static struct ip_addr* ip_tmp;
186 static struct avp_spec* s_attr;
188 static select_t* sel_ptr;
189 static struct action *mod_func_action;
191 static void warn(char* s);
192 static struct socket_id* mk_listen_id(char*, int, int);
193 static struct name_lst* mk_name_lst(char* name, int flags);
194 static struct socket_id* mk_listen_id2(struct name_lst*, int, int);
195 static void free_name_lst(struct name_lst* lst);
196 static void free_socket_id_lst(struct socket_id* i);
205 struct action* action;
207 struct ip_addr* ipaddr;
208 struct socket_id* sockid;
209 struct name_lst* name_l;
210 struct avp_spec* attr;
238 %token SET_HOSTPORTTRANS
250 %token FORCE_TCP_ALIAS
252 %token UDP_MTU_TRY_PROTO
255 %token SET_ADV_ADDRESS
257 %token FORCE_SEND_SOCKET
309 %token DNS_SERVERS_NO
310 %token DNS_USE_SEARCH
311 %token DNS_SEARCH_FMATCH
312 %token DNS_CACHE_INIT
314 %token DNS_USE_FAILOVER
315 %token DNS_CACHE_FLAGS
316 %token DNS_CACHE_NEG_TTL
317 %token DNS_CACHE_MIN_TTL
318 %token DNS_CACHE_MAX_TTL
320 %token DNS_CACHE_GC_INT
321 %token DNS_CACHE_DEL_NONEXP
327 %token DST_BLST_GC_INT
338 %token SERVER_SIGNATURE
350 %token TCP_ACCEPT_ALIASES
352 %token TCP_CONNECT_TIMEOUT
353 %token TCP_SEND_TIMEOUT
354 %token TCP_CON_LIFETIME
355 %token TCP_POLL_METHOD
356 %token TCP_MAX_CONNECTIONS
357 %token TCP_NO_CONNECT
358 %token TCP_SOURCE_IPV4
359 %token TCP_SOURCE_IPV6
360 %token TCP_OPT_FD_CACHE
361 %token TCP_OPT_BUF_WRITE
362 %token TCP_OPT_CONN_WQ_MAX
363 %token TCP_OPT_WQ_MAX
364 %token TCP_OPT_RD_BUF
365 %token TCP_OPT_WQ_BLK
366 %token TCP_OPT_DEFER_ACCEPT
367 %token TCP_OPT_DELAYED_ACK
368 %token TCP_OPT_SYNCNT
369 %token TCP_OPT_LINGER2
370 %token TCP_OPT_KEEPALIVE
371 %token TCP_OPT_KEEPIDLE
372 %token TCP_OPT_KEEPINTVL
373 %token TCP_OPT_KEEPCNT
374 %token TCP_OPT_CRLF_PING
380 %token TLS_HANDSHAKE_TIMEOUT
381 %token TLS_SEND_TIMEOUT
387 %token TLS_REQUIRE_CERTIFICATE
388 %token TLS_CERTIFICATE
389 %token TLS_PRIVATE_KEY
394 %token SCTP_SOCKET_RCVBUF
395 %token SCTP_SOCKET_SNDBUF
396 %token SCTP_AUTOCLOSE
398 %token SCTP_SEND_RETRIES
399 %token ADVERTISED_ADDRESS
400 %token ADVERTISED_PORT
403 %token SHM_FORCE_ALLOC
408 %token RT_TIMER1_PRIO
409 %token RT_TIMER1_POLICY
410 %token RT_TIMER2_PRIO
411 %token RT_TIMER2_POLICY
412 %token MCAST_LOOPBACK
415 %token PMTU_DISCOVERY
417 %token CFG_DESCRIPTION
431 %token ATTR_FROMDOMAIN
436 %token STUN_REFRESH_INTERVAL
437 %token STUN_ALLOW_STUN
458 %token <intval> NUMBER
460 %token <strval> STRING
461 %token <strval> IPV6ADDR
480 %type <expr> exp exp_elem /*, condition*/
481 %type <action> action actions cmd fcmd if_cmd stm exp_stm assign_action
482 %type <ipaddr> ipv4 ipv6 ipv6addr ip
485 %type <strval> listen_id
486 %type <name_l> listen_id_lst
487 %type <name_l> listen_id2
488 %type <sockid> id_lst
489 %type <sockid> phostport
490 %type <sockid> listen_phostport
491 %type <intval> proto port
492 %type <intval> equalop strop intop binop
493 %type <strval> host_sep
494 %type <intval> uri_type
496 %type <attr> attr_id_num_idx
497 %type <attr> attr_id_no_idx
498 %type <attr> attr_id_ass
499 %type <attr> attr_id_val
500 %type <attr> attr_id_any
501 %type <attr> attr_id_any_str
502 /* %type <intval> class_id */
503 %type <intval> assign_op
504 %type <select> select_id
505 %type <strval> flag_name;
506 %type <strval> route_name;
507 %type <intval> avpflag_oper
509 /*%type <route_el> rules;
510 %type <route_el> rule;
520 statements statement {}
522 | statements error { yyerror(""); YYABORT;}
529 | {rt=REQUEST_ROUTE;} route_stm
530 | {rt=FAILURE_ROUTE;} failure_route_stm
531 | {rt=ONREPLY_ROUTE;} onreply_route_stm
532 | {rt=BRANCH_ROUTE;} branch_route_stm
533 | {rt=ONSEND_ROUTE;} send_route_stm
534 | SEMICOLON /* null statement */
535 | CR /* null statement*/
541 LOG(L_CRIT, "ERROR: cfg. parser: bad ip "
545 $$=pkg_malloc(strlen(tmp)+1);
547 LOG(L_CRIT, "ERROR: cfg. parser: out of "
550 strncpy($$, tmp, strlen(tmp)+1);
555 $$=pkg_malloc(strlen($1)+1);
557 LOG(L_CRIT, "ERROR: cfg. parser: out of "
560 strncpy($$, $1, strlen($1)+1);
564 $$=pkg_malloc(strlen($1)+1);
566 LOG(L_CRIT, "ERROR: cfg. parser: out of "
569 strncpy($$, $1, strlen($1)+1);
576 listen_id { $$=mk_name_lst($1, SI_IS_MHOMED); }
577 | listen_id COMMA listen_id_lst { $$=mk_name_lst($1, SI_IS_MHOMED);
583 LPAREN listen_id_lst RPAREN { $$=$2; }
584 | listen_id { $$=mk_name_lst($1, 0); }
588 UDP { $$=PROTO_UDP; }
589 | TCP { $$=PROTO_TCP; }
590 | TLS { $$=PROTO_TLS; }
591 | SCTP { $$=PROTO_SCTP; }
599 listen_id { $$=mk_listen_id($1, 0, 0); }
600 | listen_id COLON port { $$=mk_listen_id($1, 0, $3); }
601 | proto COLON listen_id { $$=mk_listen_id($3, $1, 0); }
602 | proto COLON listen_id COLON port { $$=mk_listen_id($3, $1, $5);}
603 | listen_id COLON error { $$=0; yyerror(" port number expected"); }
607 listen_id2 { $$=mk_listen_id2($1, 0, 0); }
608 | listen_id2 COLON port { $$=mk_listen_id2($1, 0, $3); }
609 | proto COLON listen_id2 { $$=mk_listen_id2($3, $1, 0); }
610 | proto COLON listen_id2 COLON port { $$=mk_listen_id2($3, $1, $5);}
611 | listen_id2 COLON error { $$=0; yyerror(" port number expected"); }
615 listen_phostport { $$=$1 ; }
616 | listen_phostport id_lst { $$=$1; $$->next=$2; }
619 flags_decl: FLAGS_DECL flag_list
620 | FLAGS_DECL error { yyerror("flag list expected\n"); }
623 | flag_spec COMMA flag_list
626 flag_spec: flag_name { if (register_flag($1,-1)<0)
627 yyerror("register flag failed");
629 | flag_name COLON NUMBER {
630 if (register_flag($1, $3)<0)
631 yyerror("register flag failed");
635 flag_name: STRING { $$=$1; }
640 AVPFLAGS_DECL avpflag_list
641 | AVPFLAGS_DECL error { yyerror("avpflag list expected\n"); }
645 | avpflag_spec COMMA avpflag_list
649 if (register_avpflag($1)==0)
650 yyerror("cannot declare avpflag");
654 DEBUG_V EQUAL NUMBER { default_core_cfg.debug=$3; }
655 | DEBUG_V EQUAL error { yyerror("number expected"); }
656 | FORK EQUAL NUMBER { dont_fork= ! $3; }
657 | FORK EQUAL error { yyerror("boolean value expected"); }
658 | LOGSTDERROR EQUAL NUMBER { if (!config_check) log_stderr=$3; }
659 | LOGSTDERROR EQUAL error { yyerror("boolean value expected"); }
660 | LOGFACILITY EQUAL ID {
661 if ( (i_tmp=str2facility($3))==-1)
662 yyerror("bad facility (see syslog(3) man page)");
664 default_core_cfg.log_facility=i_tmp;
666 | LOGFACILITY EQUAL error { yyerror("ID expected"); }
667 | DNS EQUAL NUMBER { received_dns|= ($3)?DO_DNS:0; }
668 | DNS EQUAL error { yyerror("boolean value expected"); }
669 | REV_DNS EQUAL NUMBER { received_dns|= ($3)?DO_REV_DNS:0; }
670 | REV_DNS EQUAL error { yyerror("boolean value expected"); }
671 | DNS_TRY_IPV6 EQUAL NUMBER { default_core_cfg.dns_try_ipv6=$3; }
672 | DNS_TRY_IPV6 error { yyerror("boolean value expected"); }
673 | DNS_TRY_NAPTR EQUAL NUMBER { IF_NAPTR(default_core_cfg.dns_try_naptr=$3); }
674 | DNS_TRY_NAPTR error { yyerror("boolean value expected"); }
675 | DNS_SRV_LB EQUAL NUMBER { IF_DNS_FAILOVER(default_core_cfg.dns_srv_lb=$3); }
676 | DNS_SRV_LB error { yyerror("boolean value expected"); }
677 | DNS_UDP_PREF EQUAL NUMBER { IF_NAPTR(default_core_cfg.dns_udp_pref=$3);}
678 | DNS_UDP_PREF error { yyerror("number expected"); }
679 | DNS_TCP_PREF EQUAL NUMBER { IF_NAPTR(default_core_cfg.dns_tcp_pref=$3);}
680 | DNS_TCP_PREF error { yyerror("number expected"); }
681 | DNS_TLS_PREF EQUAL NUMBER { IF_NAPTR(default_core_cfg.dns_tls_pref=$3);}
682 | DNS_TLS_PREF error { yyerror("number expected"); }
683 | DNS_SCTP_PREF EQUAL NUMBER {
684 IF_NAPTR(default_core_cfg.dns_sctp_pref=$3); }
685 | DNS_SCTP_PREF error { yyerror("number expected"); }
686 | DNS_RETR_TIME EQUAL NUMBER { default_core_cfg.dns_retr_time=$3; }
687 | DNS_RETR_TIME error { yyerror("number expected"); }
688 | DNS_RETR_NO EQUAL NUMBER { default_core_cfg.dns_retr_no=$3; }
689 | DNS_RETR_NO error { yyerror("number expected"); }
690 | DNS_SERVERS_NO EQUAL NUMBER { default_core_cfg.dns_servers_no=$3; }
691 | DNS_SERVERS_NO error { yyerror("number expected"); }
692 | DNS_USE_SEARCH EQUAL NUMBER { default_core_cfg.dns_search_list=$3; }
693 | DNS_USE_SEARCH error { yyerror("boolean value expected"); }
694 | DNS_SEARCH_FMATCH EQUAL NUMBER { default_core_cfg.dns_search_fmatch=$3; }
695 | DNS_SEARCH_FMATCH error { yyerror("boolean value expected"); }
696 | DNS_CACHE_INIT EQUAL NUMBER { IF_DNS_CACHE(dns_cache_init=$3); }
697 | DNS_CACHE_INIT error { yyerror("boolean value expected"); }
698 | DNS_USE_CACHE EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.use_dns_cache=$3); }
699 | DNS_USE_CACHE error { yyerror("boolean value expected"); }
700 | DNS_USE_FAILOVER EQUAL NUMBER { IF_DNS_FAILOVER(default_core_cfg.use_dns_failover=$3);}
701 | DNS_USE_FAILOVER error { yyerror("boolean value expected"); }
702 | DNS_CACHE_FLAGS EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_flags=$3); }
703 | DNS_CACHE_FLAGS error { yyerror("boolean value expected"); }
704 | DNS_CACHE_NEG_TTL EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_neg_cache_ttl=$3); }
705 | DNS_CACHE_NEG_TTL error { yyerror("boolean value expected"); }
706 | DNS_CACHE_MAX_TTL EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_max_ttl=$3); }
707 | DNS_CACHE_MAX_TTL error { yyerror("boolean value expected"); }
708 | DNS_CACHE_MIN_TTL EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_min_ttl=$3); }
709 | DNS_CACHE_MIN_TTL error { yyerror("boolean value expected"); }
710 | DNS_CACHE_MEM EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_max_mem=$3); }
711 | DNS_CACHE_MEM error { yyerror("boolean value expected"); }
712 | DNS_CACHE_GC_INT EQUAL NUMBER { IF_DNS_CACHE(dns_timer_interval=$3); }
713 | DNS_CACHE_GC_INT error { yyerror("boolean value expected"); }
714 | DNS_CACHE_DEL_NONEXP EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_del_nonexp=$3); }
715 | DNS_CACHE_DEL_NONEXP error { yyerror("boolean value expected"); }
716 | DST_BLST_INIT EQUAL NUMBER { IF_DST_BLACKLIST(dst_blacklist_init=$3); }
717 | DST_BLST_INIT error { yyerror("boolean value expected"); }
718 | USE_DST_BLST EQUAL NUMBER { IF_DST_BLACKLIST(default_core_cfg.use_dst_blacklist=$3); }
719 | USE_DST_BLST error { yyerror("boolean value expected"); }
720 | DST_BLST_MEM EQUAL NUMBER { IF_DST_BLACKLIST(default_core_cfg.blst_max_mem=$3); }
721 | DST_BLST_MEM error { yyerror("boolean value expected"); }
722 | DST_BLST_TTL EQUAL NUMBER { IF_DST_BLACKLIST(default_core_cfg.blst_timeout=$3); }
723 | DST_BLST_TTL error { yyerror("boolean value expected"); }
724 | DST_BLST_GC_INT EQUAL NUMBER { IF_DST_BLACKLIST(blst_timer_interval=$3);}
725 | DST_BLST_GC_INT error { yyerror("boolean value expected"); }
726 | PORT EQUAL NUMBER { port_no=$3; }
727 | STAT EQUAL STRING {
732 | MAXBUFFER EQUAL NUMBER { maxbuffer=$3; }
733 | MAXBUFFER EQUAL error { yyerror("number expected"); }
734 | PORT EQUAL error { yyerror("number expected"); }
735 | CHILDREN EQUAL NUMBER { children_no=$3; }
736 | CHILDREN EQUAL error { yyerror("number expected"); }
737 | CHECK_VIA EQUAL NUMBER { check_via=$3; }
738 | CHECK_VIA EQUAL error { yyerror("boolean value expected"); }
739 | PHONE2TEL EQUAL NUMBER { phone2tel=$3; }
740 | PHONE2TEL EQUAL error { yyerror("boolean value expected"); }
741 | SYN_BRANCH EQUAL NUMBER { syn_branch=$3; }
742 | SYN_BRANCH EQUAL error { yyerror("boolean value expected"); }
743 | MEMLOG EQUAL NUMBER { memlog=$3; }
744 | MEMLOG EQUAL error { yyerror("int value expected"); }
745 | MEMDBG EQUAL NUMBER { memdbg=$3; }
746 | MEMDBG EQUAL error { yyerror("int value expected"); }
747 | SIP_WARNING EQUAL NUMBER { sip_warning=$3; }
748 | SIP_WARNING EQUAL error { yyerror("boolean value expected"); }
749 | USER EQUAL STRING { user=$3; }
750 | USER EQUAL ID { user=$3; }
751 | USER EQUAL error { yyerror("string value expected"); }
752 | GROUP EQUAL STRING { group=$3; }
753 | GROUP EQUAL ID { group=$3; }
754 | GROUP EQUAL error { yyerror("string value expected"); }
755 | CHROOT EQUAL STRING { chroot_dir=$3; }
756 | CHROOT EQUAL ID { chroot_dir=$3; }
757 | CHROOT EQUAL error { yyerror("string value expected"); }
758 | WDIR EQUAL STRING { working_dir=$3; }
759 | WDIR EQUAL ID { working_dir=$3; }
760 | WDIR EQUAL error { yyerror("string value expected"); }
761 | MHOMED EQUAL NUMBER { mhomed=$3; }
762 | MHOMED EQUAL error { yyerror("boolean value expected"); }
763 | DISABLE_TCP EQUAL NUMBER {
767 warn("tcp support not compiled in");
770 | DISABLE_TCP EQUAL error { yyerror("boolean value expected"); }
771 | TCP_ACCEPT_ALIASES EQUAL NUMBER {
773 tcp_default_cfg.accept_aliases=$3;
775 warn("tcp support not compiled in");
778 | TCP_ACCEPT_ALIASES EQUAL error { yyerror("boolean value expected"); }
779 | TCP_CHILDREN EQUAL NUMBER {
783 warn("tcp support not compiled in");
786 | TCP_CHILDREN EQUAL error { yyerror("number expected"); }
787 | TCP_CONNECT_TIMEOUT EQUAL NUMBER {
789 tcp_default_cfg.connect_timeout_s=$3;
791 warn("tcp support not compiled in");
794 | TCP_CONNECT_TIMEOUT EQUAL error { yyerror("number expected"); }
795 | TCP_SEND_TIMEOUT EQUAL NUMBER {
797 tcp_default_cfg.send_timeout_s=$3;
799 warn("tcp support not compiled in");
802 | TCP_SEND_TIMEOUT EQUAL error { yyerror("number expected"); }
803 | TCP_CON_LIFETIME EQUAL NUMBER {
806 tcp_default_cfg.con_lifetime=-1;
808 tcp_default_cfg.con_lifetime=S_TO_TICKS($3);
810 warn("tcp support not compiled in");
813 | TCP_CON_LIFETIME EQUAL error { yyerror("number expected"); }
814 | TCP_POLL_METHOD EQUAL ID {
816 tcp_poll_method=get_poll_type($3);
817 if (tcp_poll_method==POLL_NONE) {
818 LOG(L_CRIT, "bad poll method name:"
819 " %s\n, try one of %s.\n",
821 yyerror("bad tcp_poll_method "
825 warn("tcp support not compiled in");
828 | TCP_POLL_METHOD EQUAL STRING {
830 tcp_poll_method=get_poll_type($3);
831 if (tcp_poll_method==POLL_NONE) {
832 LOG(L_CRIT, "bad poll method name:"
833 " %s\n, try one of %s.\n",
835 yyerror("bad tcp_poll_method "
839 warn("tcp support not compiled in");
842 | TCP_POLL_METHOD EQUAL error { yyerror("poll method name expected"); }
843 | TCP_MAX_CONNECTIONS EQUAL NUMBER {
845 tcp_max_connections=$3;
847 warn("tcp support not compiled in");
850 | TCP_MAX_CONNECTIONS EQUAL error { yyerror("number expected"); }
851 | TCP_NO_CONNECT EQUAL NUMBER {
853 tcp_default_cfg.no_connect=$3;
855 warn("tcp support not compiled in");
858 | TCP_NO_CONNECT EQUAL error { yyerror("boolean value expected"); }
859 | TCP_SOURCE_IPV4 EQUAL ipv4 {
861 if (tcp_set_src_addr($3)<0)
862 warn("tcp_source_ipv4 failed");
864 warn("tcp support not compiled in");
868 | TCP_SOURCE_IPV4 EQUAL error { yyerror("IPv4 address expected"); }
869 | TCP_SOURCE_IPV6 EQUAL ipv6 {
872 if (tcp_set_src_addr($3)<0)
873 warn("tcp_source_ipv6 failed");
875 warn("IPv6 support not compiled in");
878 warn("tcp support not compiled in");
882 | TCP_SOURCE_IPV6 EQUAL error { yyerror("IPv6 address expected"); }
883 | TCP_OPT_FD_CACHE EQUAL NUMBER {
885 tcp_default_cfg.fd_cache=$3;
887 warn("tcp support not compiled in");
890 | TCP_OPT_FD_CACHE EQUAL error { yyerror("boolean value expected"); }
891 | TCP_OPT_BUF_WRITE EQUAL NUMBER {
893 tcp_default_cfg.async=$3;
895 warn("tcp support not compiled in");
898 | TCP_OPT_BUF_WRITE EQUAL error { yyerror("boolean value expected"); }
899 | TCP_OPT_CONN_WQ_MAX EQUAL NUMBER {
901 tcp_default_cfg.tcpconn_wq_max=$3;
903 warn("tcp support not compiled in");
906 | TCP_OPT_CONN_WQ_MAX error { yyerror("boolean value expected"); }
907 | TCP_OPT_WQ_MAX EQUAL NUMBER {
909 tcp_default_cfg.tcp_wq_max=$3;
911 warn("tcp support not compiled in");
914 | TCP_OPT_WQ_MAX error { yyerror("number expected"); }
915 | TCP_OPT_RD_BUF EQUAL NUMBER {
917 tcp_default_cfg.rd_buf_size=$3;
919 warn("tcp support not compiled in");
922 | TCP_OPT_RD_BUF error { yyerror("number expected"); }
923 | TCP_OPT_WQ_BLK EQUAL NUMBER {
925 tcp_default_cfg.wq_blk_size=$3;
927 warn("tcp support not compiled in");
930 | TCP_OPT_WQ_BLK error { yyerror("number expected"); }
931 | TCP_OPT_DEFER_ACCEPT EQUAL NUMBER {
933 tcp_default_cfg.defer_accept=$3;
935 warn("tcp support not compiled in");
938 | TCP_OPT_DEFER_ACCEPT EQUAL error { yyerror("boolean value expected"); }
939 | TCP_OPT_DELAYED_ACK EQUAL NUMBER {
941 tcp_default_cfg.delayed_ack=$3;
943 warn("tcp support not compiled in");
946 | TCP_OPT_DELAYED_ACK EQUAL error { yyerror("boolean value expected"); }
947 | TCP_OPT_SYNCNT EQUAL NUMBER {
949 tcp_default_cfg.syncnt=$3;
951 warn("tcp support not compiled in");
954 | TCP_OPT_SYNCNT EQUAL error { yyerror("number expected"); }
955 | TCP_OPT_LINGER2 EQUAL NUMBER {
957 tcp_default_cfg.linger2=$3;
959 warn("tcp support not compiled in");
962 | TCP_OPT_LINGER2 EQUAL error { yyerror("number expected"); }
963 | TCP_OPT_KEEPALIVE EQUAL NUMBER {
965 tcp_default_cfg.keepalive=$3;
967 warn("tcp support not compiled in");
970 | TCP_OPT_KEEPALIVE EQUAL error { yyerror("boolean value expected");}
971 | TCP_OPT_KEEPIDLE EQUAL NUMBER {
973 tcp_default_cfg.keepidle=$3;
975 warn("tcp support not compiled in");
978 | TCP_OPT_KEEPIDLE EQUAL error { yyerror("number expected"); }
979 | TCP_OPT_KEEPINTVL EQUAL NUMBER {
981 tcp_default_cfg.keepintvl=$3;
983 warn("tcp support not compiled in");
986 | TCP_OPT_KEEPINTVL EQUAL error { yyerror("number expected"); }
987 | TCP_OPT_KEEPCNT EQUAL NUMBER {
989 tcp_default_cfg.keepcnt=$3;
991 warn("tcp support not compiled in");
994 | TCP_OPT_KEEPCNT EQUAL error { yyerror("number expected"); }
995 | TCP_OPT_CRLF_PING EQUAL NUMBER {
997 tcp_default_cfg.crlf_ping=$3;
999 warn("tcp support not compiled in");
1002 | TCP_OPT_CRLF_PING EQUAL error { yyerror("boolean value expected"); }
1003 | DISABLE_TLS EQUAL NUMBER {
1007 warn("tls support not compiled in");
1010 | DISABLE_TLS EQUAL error { yyerror("boolean value expected"); }
1011 | ENABLE_TLS EQUAL NUMBER {
1015 warn("tls support not compiled in");
1018 | ENABLE_TLS EQUAL error { yyerror("boolean value expected"); }
1019 | TLSLOG EQUAL NUMBER {
1023 warn("tls-in-core support not compiled in");
1026 | TLSLOG EQUAL error { yyerror("int value expected"); }
1027 | TLS_PORT_NO EQUAL NUMBER {
1031 warn("tls support not compiled in");
1034 | TLS_PORT_NO EQUAL error { yyerror("number expected"); }
1035 | TLS_METHOD EQUAL SSLv23 {
1037 tls_method=TLS_USE_SSLv23;
1039 warn("tls-in-core support not compiled in");
1042 | TLS_METHOD EQUAL SSLv2 {
1044 tls_method=TLS_USE_SSLv2;
1046 warn("tls-in-core support not compiled in");
1049 | TLS_METHOD EQUAL SSLv3 {
1051 tls_method=TLS_USE_SSLv3;
1053 warn("tls-in-core support not compiled in");
1056 | TLS_METHOD EQUAL TLSv1 {
1058 tls_method=TLS_USE_TLSv1;
1060 warn("tls-in-core support not compiled in");
1063 | TLS_METHOD EQUAL error {
1065 yyerror("SSLv23, SSLv2, SSLv3 or TLSv1 expected");
1067 warn("tls-in-core support not compiled in");
1070 | TLS_VERIFY EQUAL NUMBER {
1074 warn("tls-in-core support not compiled in");
1077 | TLS_VERIFY EQUAL error { yyerror("boolean value expected"); }
1078 | TLS_REQUIRE_CERTIFICATE EQUAL NUMBER {
1080 tls_require_cert=$3;
1082 warn( "tls-in-core support not compiled in");
1085 | TLS_REQUIRE_CERTIFICATE EQUAL error { yyerror("boolean value expected"); }
1086 | TLS_CERTIFICATE EQUAL STRING {
1090 warn("tls-in-core support not compiled in");
1093 | TLS_CERTIFICATE EQUAL error { yyerror("string value expected"); }
1094 | TLS_PRIVATE_KEY EQUAL STRING {
1098 warn("tls-in-core support not compiled in");
1101 | TLS_PRIVATE_KEY EQUAL error { yyerror("string value expected"); }
1102 | TLS_CA_LIST EQUAL STRING {
1106 warn("tls-in-core support not compiled in");
1109 | TLS_CA_LIST EQUAL error { yyerror("string value expected"); }
1110 | TLS_HANDSHAKE_TIMEOUT EQUAL NUMBER {
1112 tls_handshake_timeout=$3;
1114 warn("tls-in-core support not compiled in");
1117 | TLS_HANDSHAKE_TIMEOUT EQUAL error { yyerror("number expected"); }
1118 | TLS_SEND_TIMEOUT EQUAL NUMBER {
1120 tls_send_timeout=$3;
1122 warn("tls-in-core support not compiled in");
1125 | TLS_SEND_TIMEOUT EQUAL error { yyerror("number expected"); }
1126 | DISABLE_SCTP EQUAL NUMBER {
1130 warn("sctp support not compiled in");
1133 | DISABLE_SCTP EQUAL error { yyerror("boolean value expected"); }
1134 | ENABLE_SCTP EQUAL NUMBER {
1136 sctp_disable=($3<=1)?!$3:$3;
1138 warn("sctp support not compiled in");
1141 | ENABLE_SCTP EQUAL error { yyerror("boolean or number expected"); }
1142 | SCTP_CHILDREN EQUAL NUMBER {
1144 sctp_children_no=$3;
1146 warn("sctp support not compiled in");
1149 | SCTP_CHILDREN EQUAL error { yyerror("number expected"); }
1150 | SCTP_SOCKET_RCVBUF EQUAL NUMBER {
1152 sctp_options.sctp_so_rcvbuf=$3;
1154 warn("sctp support not compiled in");
1157 | SCTP_SOCKET_RCVBUF EQUAL error { yyerror("number expected"); }
1158 | SCTP_SOCKET_SNDBUF EQUAL NUMBER {
1160 sctp_options.sctp_so_sndbuf=$3;
1162 warn("sctp support not compiled in");
1165 | SCTP_SOCKET_SNDBUF EQUAL error { yyerror("number expected"); }
1166 | SCTP_AUTOCLOSE EQUAL NUMBER {
1168 sctp_options.sctp_autoclose=$3;
1170 warn("sctp support not compiled in");
1173 | SCTP_AUTOCLOSE EQUAL error { yyerror("number expected"); }
1174 | SCTP_SEND_TTL EQUAL NUMBER {
1176 sctp_options.sctp_send_ttl=$3;
1178 warn("sctp support not compiled in");
1181 | SCTP_SEND_TTL EQUAL error { yyerror("number expected"); }
1182 | SCTP_SEND_RETRIES EQUAL NUMBER {
1184 sctp_options.sctp_send_retries=$3;
1186 warn("sctp support not compiled in");
1189 | SCTP_SEND_RETRIES EQUAL error { yyerror("number expected"); }
1190 | SERVER_SIGNATURE EQUAL NUMBER { server_signature=$3; }
1191 | SERVER_SIGNATURE EQUAL error { yyerror("boolean value expected"); }
1192 | REPLY_TO_VIA EQUAL NUMBER { reply_to_via=$3; }
1193 | REPLY_TO_VIA EQUAL error { yyerror("boolean value expected"); }
1194 | LISTEN EQUAL id_lst {
1195 for(lst_tmp=$3; lst_tmp; lst_tmp=lst_tmp->next) {
1196 if (add_listen_iface( lst_tmp->addr_lst->name,
1197 lst_tmp->addr_lst->next,
1198 lst_tmp->port, lst_tmp->proto,
1199 lst_tmp->flags)!=0) {
1200 LOG(L_CRIT, "ERROR: cfg. parser: failed to add listen"
1205 free_socket_id_lst($3);
1207 | LISTEN EQUAL error { yyerror("ip address or hostname expected"); }
1208 | ALIAS EQUAL id_lst {
1209 for(lst_tmp=$3; lst_tmp; lst_tmp=lst_tmp->next){
1210 add_alias( lst_tmp->addr_lst->name,
1211 strlen(lst_tmp->addr_lst->name),
1212 lst_tmp->port, lst_tmp->proto);
1213 for (nl_tmp=lst_tmp->addr_lst->next; nl_tmp; nl_tmp=nl_tmp->next)
1214 add_alias(nl_tmp->name, strlen(nl_tmp->name),
1215 lst_tmp->port, lst_tmp->proto);
1217 free_socket_id_lst($3);
1219 | ALIAS EQUAL error { yyerror(" hostname expected"); }
1220 | ADVERTISED_ADDRESS EQUAL listen_id {
1221 default_global_address.s=$3;
1222 default_global_address.len=strlen($3);
1224 | ADVERTISED_ADDRESS EQUAL error {yyerror("ip address or hostname expected"); }
1225 | ADVERTISED_PORT EQUAL NUMBER {
1226 tmp=int2str($3, &i_tmp);
1227 if ((default_global_port.s=pkg_malloc(i_tmp))==0) {
1228 LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
1229 default_global_port.len=0;
1231 default_global_port.len=i_tmp;
1232 memcpy(default_global_port.s, tmp, default_global_port.len);
1235 |ADVERTISED_PORT EQUAL error {yyerror("ip address or hostname expected"); }
1236 | DISABLE_CORE EQUAL NUMBER { disable_core_dump=$3; }
1237 | DISABLE_CORE EQUAL error { yyerror("boolean value expected"); }
1238 | OPEN_FD_LIMIT EQUAL NUMBER { open_files_limit=$3; }
1239 | OPEN_FD_LIMIT EQUAL error { yyerror("number expected"); }
1240 | SHM_FORCE_ALLOC EQUAL NUMBER { shm_force_alloc=$3; }
1241 | SHM_FORCE_ALLOC EQUAL error { yyerror("boolean value expected"); }
1242 | MLOCK_PAGES EQUAL NUMBER { mlock_pages=$3; }
1243 | MLOCK_PAGES EQUAL error { yyerror("boolean value expected"); }
1244 | REAL_TIME EQUAL NUMBER { real_time=$3; }
1245 | REAL_TIME EQUAL error { yyerror("boolean value expected"); }
1246 | RT_PRIO EQUAL NUMBER { rt_prio=$3; }
1247 | RT_PRIO EQUAL error { yyerror("boolean value expected"); }
1248 | RT_POLICY EQUAL NUMBER { rt_policy=$3; }
1249 | RT_POLICY EQUAL error { yyerror("boolean value expected"); }
1250 | RT_TIMER1_PRIO EQUAL NUMBER { rt_timer1_prio=$3; }
1251 | RT_TIMER1_PRIO EQUAL error { yyerror("boolean value expected"); }
1252 | RT_TIMER1_POLICY EQUAL NUMBER { rt_timer1_policy=$3; }
1253 | RT_TIMER1_POLICY EQUAL error { yyerror("boolean value expected"); }
1254 | RT_TIMER2_PRIO EQUAL NUMBER { rt_timer2_prio=$3; }
1255 | RT_TIMER2_PRIO EQUAL error { yyerror("boolean value expected"); }
1256 | RT_TIMER2_POLICY EQUAL NUMBER { rt_timer2_policy=$3; }
1257 | RT_TIMER2_POLICY EQUAL error { yyerror("boolean value expected"); }
1258 | MCAST_LOOPBACK EQUAL NUMBER {
1262 warn("no multicast support compiled in");
1265 | MCAST_LOOPBACK EQUAL error { yyerror("boolean value expected"); }
1266 | MCAST_TTL EQUAL NUMBER {
1270 warn("no multicast support compiled in");
1273 | MCAST_TTL EQUAL error { yyerror("number expected"); }
1274 | TOS EQUAL NUMBER { tos=$3; }
1275 | TOS EQUAL error { yyerror("number expected"); }
1276 | PMTU_DISCOVERY EQUAL NUMBER { pmtu_discovery=$3; }
1277 | PMTU_DISCOVERY error { yyerror("number expected"); }
1278 | KILL_TIMEOUT EQUAL NUMBER { ser_kill_timeout=$3; }
1279 | KILL_TIMEOUT EQUAL error { yyerror("number expected"); }
1280 | STUN_REFRESH_INTERVAL EQUAL NUMBER { IF_STUN(stun_refresh_interval=$3); }
1281 | STUN_REFRESH_INTERVAL EQUAL error{ yyerror("number expected"); }
1282 | STUN_ALLOW_STUN EQUAL NUMBER { IF_STUN(stun_allow_stun=$3); }
1283 | STUN_ALLOW_STUN EQUAL error{ yyerror("number expected"); }
1284 | STUN_ALLOW_FP EQUAL NUMBER { IF_STUN(stun_allow_fp=$3) ; }
1285 | STUN_ALLOW_FP EQUAL error{ yyerror("number expected"); }
1286 | SERVER_ID EQUAL NUMBER { server_id=$3; }
1287 | UDP_MTU EQUAL NUMBER { default_core_cfg.udp_mtu=$3; }
1288 | UDP_MTU EQUAL error { yyerror("number expected"); }
1289 | FORCE_RPORT EQUAL NUMBER
1290 { default_core_cfg.force_rport=$3; fix_global_req_flags(0); }
1291 | FORCE_RPORT EQUAL error { yyerror("boolean value expected"); }
1292 | UDP_MTU_TRY_PROTO EQUAL proto
1293 { default_core_cfg.udp_mtu_try_proto=$3; fix_global_req_flags(0); }
1294 | UDP_MTU_TRY_PROTO EQUAL error
1295 { yyerror("TCP, TLS, SCTP or UDP expected"); }
1297 | error EQUAL { yyerror("unknown config variable"); }
1300 ID DOT ID EQUAL NUMBER {
1301 if (cfg_declare_int($1, $3, $5, 0, 0, NULL)) {
1302 yyerror("variable cannot be declared");
1305 | ID DOT ID EQUAL STRING {
1306 if (cfg_declare_str($1, $3, $5, NULL)) {
1307 yyerror("variable cannot be declared");
1310 | ID DOT ID EQUAL NUMBER CFG_DESCRIPTION STRING {
1311 if (cfg_declare_int($1, $3, $5, 0, 0, $7)) {
1312 yyerror("variable cannot be declared");
1315 | ID DOT ID EQUAL STRING CFG_DESCRIPTION STRING {
1316 if (cfg_declare_str($1, $3, $5, $7)) {
1317 yyerror("variable cannot be declared");
1320 | ID DOT ID EQUAL error { yyerror("number or string expected"); }
1324 DBG("loading module %s\n", $2);
1325 if (load_module($2)!=0) {
1326 yyerror("failed to load module");
1329 | LOADMODULE error { yyerror("string expected"); }
1331 DBG("loading modules under %s\n", $2);
1332 printf("loading modules under %s\n", $2);
1335 | LOADPATH error { yyerror("string expected"); }
1336 | MODPARAM LPAREN STRING COMMA STRING COMMA STRING RPAREN {
1337 if (set_mod_param_regex($3, $5, PARAM_STRING, $7) != 0) {
1338 yyerror("Can't set module parameter");
1341 | MODPARAM LPAREN STRING COMMA STRING COMMA NUMBER RPAREN {
1342 if (set_mod_param_regex($3, $5, PARAM_INT, (void*)$7) != 0) {
1343 yyerror("Can't set module parameter");
1346 | MODPARAM error { yyerror("Invalid arguments"); }
1353 NUMBER DOT NUMBER DOT NUMBER DOT NUMBER {
1354 $$=pkg_malloc(sizeof(struct ip_addr));
1356 LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
1358 memset($$, 0, sizeof(struct ip_addr));
1361 if (($1>255) || ($1<0) ||
1362 ($3>255) || ($3<0) ||
1363 ($5>255) || ($5<0) ||
1364 ($7>255) || ($7<0)) {
1365 yyerror("invalid ipv4 address");
1375 ($3<<16)| ($5<<8)|$7 );
1383 $$=pkg_malloc(sizeof(struct ip_addr));
1385 LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
1388 memset($$, 0, sizeof(struct ip_addr));
1391 if (inet_pton(AF_INET6, $1, $$->u.addr)<=0) {
1392 yyerror("bad ipv6 address");
1395 yyerror("ipv6 address & no ipv6 support compiled in");
1403 | LBRACK ipv6addr RBRACK {$$=$2; }
1407 route_name: NUMBER {
1408 tmp=int2str($1, &i_tmp);
1409 if (($$=pkg_malloc(i_tmp+1))==0) {
1410 yyerror("out of memory");
1413 memcpy($$, tmp, i_tmp);
1422 ROUTE LBRACE actions RBRACE { push($3, &main_rt.rlist[DEFAULT_RT]); }
1423 | ROUTE LBRACK route_name RBRACK LBRACE actions RBRACE {
1424 i_tmp=route_get(&main_rt, $3);
1426 yyerror("internal error");
1429 if (main_rt.rlist[i_tmp]){
1430 yyerror("duplicate route");
1433 push($6, &main_rt.rlist[i_tmp]);
1435 | ROUTE error { yyerror("invalid route statement"); }
1438 ROUTE_FAILURE LBRACE actions RBRACE {
1439 push($3, &failure_rt.rlist[DEFAULT_RT]);
1441 | ROUTE_FAILURE LBRACK route_name RBRACK LBRACE actions RBRACE {
1442 i_tmp=route_get(&failure_rt, $3);
1444 yyerror("internal error");
1447 if (failure_rt.rlist[i_tmp]){
1448 yyerror("duplicate route");
1451 push($6, &failure_rt.rlist[i_tmp]);
1453 | ROUTE_FAILURE error { yyerror("invalid failure_route statement"); }
1456 ROUTE_ONREPLY LBRACE actions RBRACE {
1457 push($3, &onreply_rt.rlist[DEFAULT_RT]);
1459 | ROUTE_ONREPLY LBRACK route_name RBRACK LBRACE actions RBRACE {
1460 i_tmp=route_get(&onreply_rt, $3);
1462 yyerror("internal error");
1465 if (onreply_rt.rlist[i_tmp]){
1466 yyerror("duplicate route");
1469 push($6, &onreply_rt.rlist[i_tmp]);
1471 | ROUTE_ONREPLY error { yyerror("invalid onreply_route statement"); }
1474 ROUTE_BRANCH LBRACE actions RBRACE {
1475 push($3, &branch_rt.rlist[DEFAULT_RT]);
1477 | ROUTE_BRANCH LBRACK route_name RBRACK LBRACE actions RBRACE {
1478 i_tmp=route_get(&branch_rt, $3);
1480 yyerror("internal error");
1483 if (branch_rt.rlist[i_tmp]){
1484 yyerror("duplicate route");
1487 push($6, &branch_rt.rlist[i_tmp]);
1489 | ROUTE_BRANCH error { yyerror("invalid branch_route statement"); }
1491 send_route_stm: ROUTE_SEND LBRACE actions RBRACE {
1492 push($3, &onsend_rt.rlist[DEFAULT_RT]);
1494 | ROUTE_SEND LBRACK route_name RBRACK LBRACE actions RBRACE {
1495 i_tmp=route_get(&onsend_rt, $3);
1497 yyerror("internal error");
1500 if (onsend_rt.rlist[i_tmp]){
1501 yyerror("duplicate route");
1504 push($6, &onsend_rt.rlist[i_tmp]);
1506 | ROUTE_SEND error { yyerror("invalid onsend_route statement"); }
1510 rules rule { push($2, &$1); $$=$1; }
1512 | rules error { $$=0; yyerror("invalid rule"); }
1515 condition actions CR {
1517 if (add_rule($1, $2, &$$)<0) {
1518 yyerror("error calling add_rule");
1523 | condition error { $$=0; yyerror("bad actions in rule"); }
1528 exp: exp LOG_AND exp { $$=mk_exp(LOGAND_OP, $1, $3); }
1529 | exp LOG_OR exp { $$=mk_exp(LOGOR_OP, $1, $3); }
1530 | NOT exp { $$=mk_exp(NOT_OP, $2, 0); }
1531 | LPAREN exp RPAREN { $$=$2; }
1532 | exp_elem { $$=$1; }
1535 EQUAL_T {$$=EQUAL_OP; }
1536 | DIFF {$$=DIFF_OP; }
1538 intop: equalop {$$=$1; }
1545 BIN_OR { $$= BINOR_OP; }
1546 | BIN_AND { $$ = BINAND_OP; }
1550 | MATCH {$$=MATCH_OP; }
1554 | FROM_URI {$$=FROM_URI_O;}
1555 | TO_URI {$$=TO_URI_O;}
1559 METHOD strop STRING {$$= mk_elem($2, METHOD_O, 0, STRING_ST, $3);}
1560 | METHOD strop attr_id_val {$$ = mk_elem($2, METHOD_O, 0, AVP_ST, $3); }
1561 | METHOD strop select_id {$$ = mk_elem($2, METHOD_O, 0, SELECT_ST, $3); }
1562 | METHOD strop ID {$$ = mk_elem($2, METHOD_O, 0, STRING_ST,$3); }
1563 | METHOD strop error { $$=0; yyerror("string expected"); }
1564 | METHOD error { $$=0; yyerror("invalid operator,== , !=, or =~ expected"); }
1565 | uri_type strop STRING {$$ = mk_elem($2, $1, 0, STRING_ST, $3); }
1566 | uri_type strop host {$$ = mk_elem($2, $1, 0, STRING_ST, $3); }
1567 | uri_type strop attr_id_val {$$ = mk_elem($2, $1, 0, AVP_ST, $3); }
1568 | uri_type strop select_id {$$ = mk_elem($2, $1, 0, SELECT_ST, $3); }
1569 | uri_type equalop MYSELF {$$=mk_elem($2, $1, 0, MYSELF_ST, 0); }
1570 | uri_type strop error { $$=0; yyerror("string or MYSELF expected"); }
1571 | uri_type error { $$=0; yyerror("invalid operator, == , != or =~ expected"); }
1573 | SRCPORT intop NUMBER { $$=mk_elem($2, SRCPORT_O, 0, NUMBER_ST, (void*)$3 ); }
1574 | SRCPORT intop attr_id_val { $$=mk_elem($2, SRCPORT_O, 0, AVP_ST, (void*)$3 ); }
1575 | SRCPORT intop error { $$=0; yyerror("number expected"); }
1576 | SRCPORT error { $$=0; yyerror("==, !=, <,>, >= or <= expected"); }
1578 | DSTPORT intop NUMBER { $$=mk_elem($2, DSTPORT_O, 0, NUMBER_ST, (void*)$3 ); }
1579 | DSTPORT intop attr_id_val { $$=mk_elem($2, DSTPORT_O, 0, AVP_ST, (void*)$3 ); }
1580 | DSTPORT intop error { $$=0; yyerror("number expected"); }
1581 | DSTPORT error { $$=0; yyerror("==, !=, <,>, >= or <= expected"); }
1583 | SNDPORT intop NUMBER {
1584 onsend_check("snd_port");
1585 $$=mk_elem($2, SNDPORT_O, 0, NUMBER_ST, (void*)$3 );
1587 | SNDPORT intop attr_id_val {
1588 onsend_check("snd_port");
1589 $$=mk_elem($2, SNDPORT_O, 0, AVP_ST, (void*)$3 );
1591 | SNDPORT intop error { $$=0; yyerror("number expected"); }
1592 | SNDPORT error { $$=0; yyerror("==, !=, <,>, >= or <= expected"); }
1594 | TOPORT intop NUMBER {
1595 onsend_check("to_port");
1596 $$=mk_elem($2, TOPORT_O, 0, NUMBER_ST, (void*)$3 );
1598 | TOPORT intop attr_id_val {
1599 onsend_check("to_port");
1600 $$=mk_elem($2, TOPORT_O, 0, AVP_ST, (void*)$3 );
1602 | TOPORT intop error { $$=0; yyerror("number expected"); }
1603 | TOPORT error { $$=0; yyerror("==, !=, <,>, >= or <= expected"); }
1605 | PROTO intop proto { $$=mk_elem($2, PROTO_O, 0, NUMBER_ST, (void*)$3 ); }
1606 | PROTO intop attr_id_val { $$=mk_elem($2, PROTO_O, 0, AVP_ST, (void*)$3 ); }
1607 | PROTO intop error { $$=0; yyerror("protocol expected (udp, tcp or tls)"); }
1609 | PROTO error { $$=0; yyerror("equal/!= operator expected"); }
1611 | SNDPROTO intop proto {
1612 onsend_check("snd_proto");
1613 $$=mk_elem($2, SNDPROTO_O, 0, NUMBER_ST, (void*)$3 );
1615 | SNDPROTO intop attr_id_val {
1616 onsend_check("snd_proto");
1617 $$=mk_elem($2, SNDPROTO_O, 0, AVP_ST, (void*)$3 );
1619 | SNDPROTO intop error { $$=0; yyerror("protocol expected (udp, tcp or tls)"); }
1620 | SNDPROTO error { $$=0; yyerror("equal/!= operator expected"); }
1622 | AF intop NUMBER { $$=mk_elem($2, AF_O, 0, NUMBER_ST,(void *) $3 ); }
1623 | AF intop attr_id_val { $$=mk_elem($2, AF_O, 0, AVP_ST,(void *) $3 ); }
1624 | AF intop error { $$=0; yyerror("number expected"); }
1625 | AF error { $$=0; yyerror("equal/!= operator expected"); }
1627 | SNDAF intop NUMBER {
1628 onsend_check("snd_af");
1629 $$=mk_elem($2, SNDAF_O, 0, NUMBER_ST, (void *) $3 ); }
1630 | SNDAF intop attr_id_val {
1631 onsend_check("snd_af");
1632 $$=mk_elem($2, SNDAF_O, 0, AVP_ST, (void *) $3 );
1634 | SNDAF intop error { $$=0; yyerror("number expected"); }
1635 | SNDAF error { $$=0; yyerror("equal/!= operator expected"); }
1637 | MSGLEN intop NUMBER { $$=mk_elem($2, MSGLEN_O, 0, NUMBER_ST, (void *) $3 ); }
1638 | MSGLEN intop attr_id_val { $$=mk_elem($2, MSGLEN_O, 0, AVP_ST, (void *) $3 ); }
1639 | MSGLEN intop MAX_LEN { $$=mk_elem($2, MSGLEN_O, 0, NUMBER_ST, (void *) BUF_SIZE); }
1640 | MSGLEN intop error { $$=0; yyerror("number expected"); }
1641 | MSGLEN error { $$=0; yyerror("equal/!= operator expected"); }
1643 | RETCODE intop NUMBER { $$=mk_elem($2, RETCODE_O, 0, NUMBER_ST, (void *) $3 ); }
1644 | RETCODE intop attr_id_val { $$=mk_elem($2, RETCODE_O, 0, AVP_ST, (void *) $3 ); }
1645 | RETCODE intop error { $$=0; yyerror("number expected"); }
1646 | RETCODE error { $$=0; yyerror("equal/!= operator expected"); }
1648 | SRCIP equalop ipnet { $$=mk_elem($2, SRCIP_O, 0, NET_ST, $3); }
1649 | SRCIP strop STRING {
1651 s_tmp.len=strlen($3);
1652 ip_tmp=str2ip(&s_tmp);
1655 ip_tmp=str2ip6(&s_tmp);
1658 $$=mk_elem($2, SRCIP_O, 0, NET_ST, mk_net_bitlen(ip_tmp, ip_tmp->len*8) );
1660 $$=mk_elem($2, SRCIP_O, 0, STRING_ST, $3);
1663 | SRCIP strop host { $$=mk_elem($2, SRCIP_O, 0, STRING_ST, $3); }
1664 | SRCIP equalop MYSELF { $$=mk_elem($2, SRCIP_O, 0, MYSELF_ST, 0);
1666 | SRCIP strop error { $$=0; yyerror( "ip address or hostname expected" ); }
1667 | SRCIP error { $$=0; yyerror("invalid operator, ==, != or =~ expected");}
1668 | DSTIP equalop ipnet { $$=mk_elem( $2, DSTIP_O, 0, NET_ST, (void*)$3); }
1669 | DSTIP strop STRING {
1671 s_tmp.len=strlen($3);
1672 ip_tmp=str2ip(&s_tmp);
1675 ip_tmp=str2ip6(&s_tmp);
1676 #endif /* USE_IPV6 */
1678 $$=mk_elem($2, DSTIP_O, 0, NET_ST, mk_net_bitlen(ip_tmp, ip_tmp->len*8) );
1680 $$=mk_elem($2, DSTIP_O, 0, STRING_ST, $3);
1683 | DSTIP strop host { $$=mk_elem( $2, DSTIP_O, 0, STRING_ST, $3); }
1684 | DSTIP equalop MYSELF { $$=mk_elem( $2, DSTIP_O, 0, MYSELF_ST, 0); }
1685 | DSTIP strop error { $$=0; yyerror( "ip address or hostname expected" ); }
1686 | DSTIP error { $$=0; yyerror("invalid operator, ==, != or =~ expected"); }
1687 | SNDIP equalop ipnet {
1688 onsend_check("snd_ip");
1689 $$=mk_elem($2, SNDIP_O, 0, NET_ST, $3);
1691 | SNDIP strop STRING {
1692 onsend_check("snd_ip");
1694 s_tmp.len=strlen($3);
1695 ip_tmp=str2ip(&s_tmp);
1698 ip_tmp=str2ip6(&s_tmp);
1699 #endif /* USE_IPV6 */
1701 $$=mk_elem($2, SNDIP_O, 0, NET_ST, mk_net_bitlen(ip_tmp, ip_tmp->len*8) );
1703 $$=mk_elem($2, SNDIP_O, 0, STRING_ST, $3);
1706 | SNDIP strop host {
1707 onsend_check("snd_ip");
1708 $$=mk_elem($2, SNDIP_O, 0, STRING_ST, $3);
1710 | SNDIP equalop attr_id_val {
1711 onsend_check("snd_ip");
1712 $$=mk_elem($2, SNDIP_O, 0, AVP_ST, (void*)$3 );
1714 | SNDIP equalop MYSELF {
1715 onsend_check("snd_ip");
1716 $$=mk_elem($2, SNDIP_O, 0, MYSELF_ST, 0);
1718 | SNDIP strop error { $$=0; yyerror( "ip address or hostname expected" ); }
1719 | SNDIP error { $$=0; yyerror("invalid operator, ==, != or =~ expected"); }
1720 | TOIP equalop ipnet {
1721 onsend_check("to_ip");
1722 $$=mk_elem($2, TOIP_O, 0, NET_ST, $3);
1724 | TOIP strop STRING {
1725 onsend_check("to_ip");
1727 s_tmp.len=strlen($3);
1728 ip_tmp=str2ip(&s_tmp);
1731 ip_tmp=str2ip6(&s_tmp);
1732 #endif /* USE_IPV6 */
1734 $$=mk_elem($2, TOIP_O, 0, NET_ST, mk_net_bitlen(ip_tmp, ip_tmp->len*8) );
1736 $$=mk_elem($2, TOIP_O, 0, STRING_ST, $3);
1740 onsend_check("to_ip");
1741 $$=mk_elem($2, TOIP_O, 0, STRING_ST, $3);
1743 | TOIP equalop attr_id_val {
1744 onsend_check("to_ip");
1745 $$=mk_elem($2, TOIP_O, 0, AVP_ST, (void*)$3 );
1747 | TOIP equalop MYSELF {
1748 onsend_check("to_ip");
1749 $$=mk_elem($2, TOIP_O, 0, MYSELF_ST, 0);
1751 | TOIP strop error { $$=0; yyerror( "ip address or hostname expected" ); }
1752 | TOIP error { $$=0; yyerror("invalid operator, ==, != or =~ expected"); }
1754 | MYSELF equalop uri_type { $$=mk_elem($2, $3, 0, MYSELF_ST, 0); }
1755 | MYSELF equalop SRCIP { $$=mk_elem($2, SRCIP_O, 0, MYSELF_ST, 0); }
1756 | MYSELF equalop DSTIP { $$=mk_elem($2, DSTIP_O, 0, MYSELF_ST, 0); }
1757 | MYSELF equalop SNDIP {
1758 onsend_check("snd_ip");
1759 $$=mk_elem($2, SNDIP_O, 0, MYSELF_ST, 0);
1761 | MYSELF equalop TOIP {
1762 onsend_check("to_ip");
1763 $$=mk_elem($2, TOIP_O, 0, MYSELF_ST, 0);
1765 | MYSELF equalop error { $$=0; yyerror(" URI, SRCIP or DSTIP expected"); }
1766 | MYSELF error { $$=0; yyerror ("invalid operator, == or != expected"); }
1767 | exp_stm { $$=mk_elem( NO_OP, ACTION_O, 0, ACTIONS_ST, $1); }
1768 | NUMBER { $$=mk_elem( NO_OP, NUMBER_O, 0, NUMBER_ST, (void*)$1 ); }
1770 | attr_id_any {$$=mk_elem( NO_OP, AVP_O, (void*)$1, 0, 0); }
1771 | attr_id_val strop STRING {$$=mk_elem( $2, AVP_O, (void*)$1, STRING_ST, $3); }
1772 | attr_id_val strop select_id {$$=mk_elem( $2, AVP_O, (void*)$1, SELECT_ST, $3); }
1773 | attr_id_val intop NUMBER {$$=mk_elem( $2, AVP_O, (void*)$1, NUMBER_ST, (void*)$3); }
1774 | attr_id_val binop NUMBER {$$=mk_elem( $2, AVP_O, (void*)$1, NUMBER_ST, (void*)$3); }
1775 | attr_id_val strop attr_id_val {$$=mk_elem( $2, AVP_O, (void*)$1, AVP_ST, (void*)$3); }
1776 | attr_id_val intop attr_id_val {$$=mk_elem( $2, AVP_O, (void*)$1, AVP_ST, (void*)$3); }
1778 | select_id { $$=mk_elem( NO_OP, SELECT_O, $1, 0, 0); }
1779 | select_id strop STRING { $$=mk_elem( $2, SELECT_O, $1, STRING_ST, $3); }
1780 | select_id strop attr_id_val { $$=mk_elem( $2, SELECT_O, $1, AVP_ST, (void*)$3); }
1781 | select_id strop select_id { $$=mk_elem( $2, SELECT_O, $1, SELECT_ST, $3); }
1784 ip SLASH ip { $$=mk_net($1, $3); }
1786 if (($3<0) || ($3>$1->len*8)) {
1787 yyerror("invalid bit number in netmask");
1790 $$=mk_net_bitlen($1, $3);
1792 $$=mk_net($1, htonl( ($3)?~( (1<<(32-$3))-1 ):0 ) );
1796 | ip { $$=mk_net_bitlen($1, $1->len*8); }
1797 | ip SLASH error { $$=0; yyerror("netmask (eg:255.0.0.0 or 8) expected"); }
1806 | host host_sep ID {
1807 $$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1);
1809 LOG(L_CRIT, "ERROR: cfg. parser: memory allocation failure while parsing host\n");
1811 memcpy($$, $1, strlen($1));
1813 memcpy($$+strlen($1)+1, $3, strlen($3));
1814 $$[strlen($1)+1+strlen($3)]=0;
1819 | host DOT error { $$=0; pkg_free($1); yyerror("invalid hostname"); }
1824 /* check if allowed */
1825 if ($1 && rt==ONSEND_ROUTE) {
1840 yyerror("command not allowed in onsend_route\n");
1850 | assign_action { $$ = $1; }
1851 | LBRACE actions RBRACE { $$=$2; }
1855 | LBRACE actions RBRACE { $$=$2; }
1858 actions action {$$=append_action($1, $2); }
1860 | actions error { $$=0; yyerror("bad command"); }
1863 fcmd SEMICOLON {$$=$1;}
1865 | assign_action SEMICOLON {$$=$1;}
1866 | SEMICOLON /* null action */ {$$=0;}
1867 | fcmd error { $$=0; yyerror("bad command: missing ';'?"); }
1870 IF exp stm { $$=mk_action( IF_T, 3, EXPR_ST, $2, ACTIONS_ST, $3, NOSUBTYPE, 0); }
1871 | IF exp stm ELSE stm { $$=mk_action( IF_T, 3, EXPR_ST, $2, ACTIONS_ST, $3, ACTIONS_ST, $5); }
1874 LBRACK ATTR_USER RBRACK { $$ = AVP_CLASS_USER; }
1875 | LBRACK ATTR_DOMAIN RBRACK { $$ = AVP_CLASS_DOMAIN; }
1876 | LBRACK ATTR_GLOBAL RBRACK { $$ = AVP_CLASS_GLOBAL; }
1881 if (sel.n >= MAX_SELECT_PARAMS-1) {
1882 yyerror("Select identifier too long\n");
1884 sel.params[sel.n].type = SEL_PARAM_STR;
1885 sel.params[sel.n].v.s.s = $1;
1886 sel.params[sel.n].v.s.len = strlen($1);
1889 | ID LBRACK NUMBER RBRACK {
1890 if (sel.n >= MAX_SELECT_PARAMS-2) {
1891 yyerror("Select identifier too long\n");
1893 sel.params[sel.n].type = SEL_PARAM_STR;
1894 sel.params[sel.n].v.s.s = $1;
1895 sel.params[sel.n].v.s.len = strlen($1);
1897 sel.params[sel.n].type = SEL_PARAM_INT;
1898 sel.params[sel.n].v.i = $3;
1901 | ID LBRACK STRING RBRACK {
1902 if (sel.n >= MAX_SELECT_PARAMS-2) {
1903 yyerror("Select identifier too long\n");
1905 sel.params[sel.n].type = SEL_PARAM_STR;
1906 sel.params[sel.n].v.s.s = $1;
1907 sel.params[sel.n].v.s.len = strlen($1);
1909 sel.params[sel.n].type = SEL_PARAM_STR;
1910 sel.params[sel.n].v.s.s = $3;
1911 sel.params[sel.n].v.s.len = strlen($3);
1916 select_params DOT select_param
1920 SELECT_MARK { sel.n = 0; sel.f[0] = 0; } select_params {
1921 sel_ptr = (select_t*)pkg_malloc(sizeof(select_t));
1923 yyerror("No memory left to allocate select structure\n");
1925 memcpy(sel_ptr, &sel, sizeof(select_t));
1930 ATTR_FROM { s_attr->type |= AVP_TRACK_FROM; }
1931 | ATTR_TO { s_attr->type |= AVP_TRACK_TO; }
1932 | ATTR_FROMURI { s_attr->type |= AVP_TRACK_FROM | AVP_CLASS_URI; }
1933 | ATTR_TOURI { s_attr->type |= AVP_TRACK_TO | AVP_CLASS_URI; }
1934 | ATTR_FROMUSER { s_attr->type |= AVP_TRACK_FROM | AVP_CLASS_USER; }
1935 | ATTR_TOUSER { s_attr->type |= AVP_TRACK_TO | AVP_CLASS_USER; }
1936 | ATTR_FROMDOMAIN { s_attr->type |= AVP_TRACK_FROM | AVP_CLASS_DOMAIN; }
1937 | ATTR_TODOMAIN { s_attr->type |= AVP_TRACK_TO | AVP_CLASS_DOMAIN; }
1938 | ATTR_GLOBAL { s_attr->type |= AVP_TRACK_ALL | AVP_CLASS_GLOBAL; }
1941 ID { s_attr->type |= AVP_NAME_STR; s_attr->name.s.s = $1; s_attr->name.s.len = strlen ($1); }
1945 | attr_class_spec DOT attr_name_spec
1949 s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
1950 if (!s_attr) { yyerror("No memory left"); }
1955 attr_mark attr_spec { $$ = s_attr; }
1958 attr_mark attr_spec LBRACK NUMBER RBRACK {
1959 s_attr->type|= (AVP_NAME_STR | ($4<0?AVP_INDEX_BACKWARD:AVP_INDEX_FORWARD));
1960 s_attr->index = ($4<0?-$4:$4);
1965 attr_mark attr_spec LBRACK RBRACK {
1966 s_attr->type|= AVP_INDEX_ALL;
1986 avp_spec_t *avp_spec;
1989 avp_spec = pkg_malloc(sizeof(*avp_spec));
1991 yyerror("Not enough memory");
1997 s.len = strlen(s.s);
1998 if (parse_avp_name(&s, &type, &avp_spec->name, &idx)) {
1999 yyerror("error when parsing AVP");
2003 avp_spec->type = type;
2004 avp_spec->index = idx;
2010 ADDEQ { $$ = ADD_T; }
2011 | EQUAL { $$ = ASSIGN_T; }
2015 EQUAL { $$ = ASSIGN_T; }
2018 attr_id_ass assign_op STRING { $$=mk_action($2, 2, AVP_ST, $1, STRING_ST, $3); }
2019 | attr_id_ass assign_op NUMBER { $$=mk_action($2, 2, AVP_ST, $1, NUMBER_ST, (void*)$3); }
2020 | attr_id_ass assign_op fcmd { $$=mk_action($2, 2, AVP_ST, $1, ACTION_ST, $3); }
2021 | attr_id_ass assign_op attr_id_any { $$=mk_action($2, 2, AVP_ST, $1, AVP_ST, $3); }
2022 | attr_id_ass assign_op select_id { $$=mk_action($2, 2, AVP_ST, (void*)$1, SELECT_ST, (void*)$3); }
2023 | attr_id_ass assign_op LPAREN exp RPAREN { $$ = mk_action($2, 2, AVP_ST, $1, EXPR_ST, $4); }
2026 SETAVPFLAG { $$ = 1; }
2027 | RESETAVPFLAG { $$ = 0; }
2028 | ISAVPFLAGSET { $$ = -1; }
2031 FORWARD LPAREN host RPAREN { $$=mk_action( FORWARD_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2032 | FORWARD LPAREN STRING RPAREN { $$=mk_action( FORWARD_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2033 | FORWARD LPAREN ip RPAREN { $$=mk_action( FORWARD_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); }
2034 | FORWARD LPAREN host COMMA NUMBER RPAREN { $$=mk_action(FORWARD_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2035 | FORWARD LPAREN STRING COMMA NUMBER RPAREN {$$=mk_action(FORWARD_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2036 | FORWARD LPAREN ip COMMA NUMBER RPAREN { $$=mk_action(FORWARD_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5); }
2037 | FORWARD LPAREN URIHOST COMMA URIPORT RPAREN { $$=mk_action(FORWARD_T, 2, URIHOST_ST, 0, URIPORT_ST, 0); }
2038 | FORWARD LPAREN URIHOST COMMA NUMBER RPAREN {$$=mk_action(FORWARD_T, 2, URIHOST_ST, 0, NUMBER_ST, (void*)$5); }
2039 | FORWARD LPAREN URIHOST RPAREN { $$=mk_action(FORWARD_T, 2, URIHOST_ST, 0, NUMBER_ST, 0); }
2040 | FORWARD error { $$=0; yyerror("missing '(' or ')' ?"); }
2041 | FORWARD LPAREN error RPAREN { $$=0; yyerror("bad forward argument"); }
2042 | FORWARD_UDP LPAREN host RPAREN { $$=mk_action(FORWARD_UDP_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2043 | FORWARD_UDP LPAREN STRING RPAREN { $$=mk_action(FORWARD_UDP_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2044 | FORWARD_UDP LPAREN ip RPAREN { $$=mk_action(FORWARD_UDP_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); }
2045 | FORWARD_UDP LPAREN host COMMA NUMBER RPAREN { $$=mk_action(FORWARD_UDP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2046 | FORWARD_UDP LPAREN STRING COMMA NUMBER RPAREN {$$=mk_action(FORWARD_UDP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2047 | FORWARD_UDP LPAREN ip COMMA NUMBER RPAREN { $$=mk_action(FORWARD_UDP_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5); }
2048 | FORWARD_UDP LPAREN URIHOST COMMA URIPORT RPAREN {$$=mk_action(FORWARD_UDP_T, 2, URIHOST_ST, 0, URIPORT_ST, 0); }
2049 | FORWARD_UDP LPAREN URIHOST COMMA NUMBER RPAREN { $$=mk_action(FORWARD_UDP_T, 2, URIHOST_ST, 0, NUMBER_ST, (void*)$5); }
2050 | FORWARD_UDP LPAREN URIHOST RPAREN { $$=mk_action(FORWARD_UDP_T, 2, URIHOST_ST, 0, NUMBER_ST, 0); }
2051 | FORWARD_UDP error { $$=0; yyerror("missing '(' or ')' ?"); }
2052 | FORWARD_UDP LPAREN error RPAREN { $$=0; yyerror("bad forward_udp argument"); }
2053 | FORWARD_TCP LPAREN host RPAREN { $$=mk_action(FORWARD_TCP_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2054 | FORWARD_TCP LPAREN STRING RPAREN { $$=mk_action(FORWARD_TCP_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2055 | FORWARD_TCP LPAREN ip RPAREN { $$=mk_action(FORWARD_TCP_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); }
2056 | FORWARD_TCP LPAREN host COMMA NUMBER RPAREN { $$=mk_action(FORWARD_TCP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2057 | FORWARD_TCP LPAREN STRING COMMA NUMBER RPAREN {$$=mk_action(FORWARD_TCP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2058 | FORWARD_TCP LPAREN ip COMMA NUMBER RPAREN { $$=mk_action(FORWARD_TCP_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5); }
2059 | FORWARD_TCP LPAREN URIHOST COMMA URIPORT RPAREN {$$=mk_action(FORWARD_TCP_T, 2, URIHOST_ST, 0, URIPORT_ST, 0); }
2060 | FORWARD_TCP LPAREN URIHOST COMMA NUMBER RPAREN { $$=mk_action(FORWARD_TCP_T, 2, URIHOST_ST, 0, NUMBER_ST, (void*)$5); }
2061 | FORWARD_TCP LPAREN URIHOST RPAREN { $$=mk_action(FORWARD_TCP_T, 2, URIHOST_ST, 0, NUMBER_ST, 0); }
2062 | FORWARD_TCP error { $$=0; yyerror("missing '(' or ')' ?"); }
2063 | FORWARD_TCP LPAREN error RPAREN { $$=0; yyerror("bad forward_tcp argument"); }
2064 | FORWARD_TLS LPAREN host RPAREN {
2066 $$=mk_action(FORWARD_TLS_T, 2, STRING_ST, $3, NUMBER_ST, 0);
2069 yyerror("tls support not compiled in");
2072 | FORWARD_TLS LPAREN STRING RPAREN {
2074 $$=mk_action(FORWARD_TLS_T, 2, STRING_ST, $3, NUMBER_ST, 0);
2077 yyerror("tls support not compiled in");
2080 | FORWARD_TLS LPAREN ip RPAREN {
2082 $$=mk_action(FORWARD_TLS_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0);
2085 yyerror("tls support not compiled in");
2088 | FORWARD_TLS LPAREN host COMMA NUMBER RPAREN {
2090 $$=mk_action(FORWARD_TLS_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5);
2093 yyerror("tls support not compiled in");
2096 | FORWARD_TLS LPAREN STRING COMMA NUMBER RPAREN {
2098 $$=mk_action(FORWARD_TLS_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5);
2101 yyerror("tls support not compiled in");
2104 | FORWARD_TLS LPAREN ip COMMA NUMBER RPAREN {
2106 $$=mk_action(FORWARD_TLS_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5);
2109 yyerror("tls support not compiled in");
2112 | FORWARD_TLS LPAREN URIHOST COMMA URIPORT RPAREN {
2114 $$=mk_action(FORWARD_TLS_T, 2, URIHOST_ST, 0, URIPORT_ST, 0);
2117 yyerror("tls support not compiled in");
2120 | FORWARD_TLS LPAREN URIHOST COMMA NUMBER RPAREN {
2122 $$=mk_action(FORWARD_TLS_T, 2, URIHOST_ST, 0, NUMBER_ST, (void*)$5);
2125 yyerror("tls support not compiled in");
2128 | FORWARD_TLS LPAREN URIHOST RPAREN {
2130 $$=mk_action(FORWARD_TLS_T, 2, URIHOST_ST, 0, NUMBER_ST, 0);
2133 yyerror("tls support not compiled in");
2136 | FORWARD_TLS error { $$=0; yyerror("missing '(' or ')' ?"); }
2137 | FORWARD_TLS LPAREN error RPAREN { $$=0;
2138 yyerror("bad forward_tls argument"); }
2139 | FORWARD_SCTP LPAREN host RPAREN {
2141 $$=mk_action(FORWARD_SCTP_T, 2, STRING_ST, $3, NUMBER_ST, 0);
2144 yyerror("sctp support not compiled in");
2147 | FORWARD_SCTP LPAREN STRING RPAREN {
2149 $$=mk_action(FORWARD_SCTP_T, 2, STRING_ST, $3, NUMBER_ST, 0);
2152 yyerror("sctp support not compiled in");
2155 | FORWARD_SCTP LPAREN ip RPAREN {
2157 $$=mk_action(FORWARD_SCTP_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0);
2160 yyerror("sctp support not compiled in");
2163 | FORWARD_SCTP LPAREN host COMMA NUMBER RPAREN {
2165 $$=mk_action(FORWARD_SCTP_T, 2, STRING_ST, $3, NUMBER_ST,
2169 yyerror("sctp support not compiled in");
2172 | FORWARD_SCTP LPAREN STRING COMMA NUMBER RPAREN {
2174 $$=mk_action(FORWARD_SCTP_T, 2, STRING_ST, $3, NUMBER_ST,
2178 yyerror("sctp support not compiled in");
2181 | FORWARD_SCTP LPAREN ip COMMA NUMBER RPAREN {
2183 $$=mk_action(FORWARD_SCTP_T, 2, IP_ST, (void*)$3, NUMBER_ST,
2187 yyerror("sctp support not compiled in");
2190 | FORWARD_SCTP LPAREN URIHOST COMMA URIPORT RPAREN {
2192 $$=mk_action(FORWARD_SCTP_T, 2, URIHOST_ST, 0, URIPORT_ST, 0);
2195 yyerror("sctp support not compiled in");
2198 | FORWARD_SCTP LPAREN URIHOST COMMA NUMBER RPAREN {
2200 $$=mk_action(FORWARD_SCTP_T, 2, URIHOST_ST, 0, NUMBER_ST,
2204 yyerror("sctp support not compiled in");
2207 | FORWARD_SCTP LPAREN URIHOST RPAREN {
2209 $$=mk_action(FORWARD_SCTP_T, 2, URIHOST_ST, 0, NUMBER_ST, 0);
2212 yyerror("tls support not compiled in");
2215 | FORWARD_SCTP error { $$=0; yyerror("missing '(' or ')' ?"); }
2216 | FORWARD_SCTP LPAREN error RPAREN { $$=0;
2217 yyerror("bad forward_tls argument"); }
2218 | SEND LPAREN host RPAREN { $$=mk_action(SEND_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2219 | SEND LPAREN STRING RPAREN { $$=mk_action(SEND_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2220 | SEND LPAREN ip RPAREN { $$=mk_action(SEND_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); }
2221 | SEND LPAREN host COMMA NUMBER RPAREN { $$=mk_action(SEND_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2222 | SEND LPAREN STRING COMMA NUMBER RPAREN {$$=mk_action(SEND_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2223 | SEND LPAREN ip COMMA NUMBER RPAREN { $$=mk_action(SEND_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5); }
2224 | SEND error { $$=0; yyerror("missing '(' or ')' ?"); }
2225 | SEND LPAREN error RPAREN { $$=0; yyerror("bad send argument"); }
2226 | SEND_TCP LPAREN host RPAREN { $$=mk_action(SEND_TCP_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2227 | SEND_TCP LPAREN STRING RPAREN { $$=mk_action(SEND_TCP_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2228 | SEND_TCP LPAREN ip RPAREN { $$=mk_action(SEND_TCP_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); }
2229 | SEND_TCP LPAREN host COMMA NUMBER RPAREN { $$=mk_action( SEND_TCP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5);}
2230 | SEND_TCP LPAREN STRING COMMA NUMBER RPAREN {$$=mk_action(SEND_TCP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2231 | SEND_TCP LPAREN ip COMMA NUMBER RPAREN { $$=mk_action(SEND_TCP_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5); }
2232 | SEND_TCP error { $$=0; yyerror("missing '(' or ')' ?"); }
2233 | SEND_TCP LPAREN error RPAREN { $$=0; yyerror("bad send_tcp argument"); }
2234 | DROP LPAREN RPAREN {$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, (void*)EXIT_R_F); }
2235 | DROP LPAREN NUMBER RPAREN {$$=mk_action(DROP_T, 2, NUMBER_ST, (void*)$3, NUMBER_ST, (void*)EXIT_R_F); }
2236 | DROP NUMBER {$$=mk_action(DROP_T, 2, NUMBER_ST, (void*)$2, NUMBER_ST, (void*)EXIT_R_F); }
2237 | DROP RETCODE {$$=mk_action(DROP_T, 2, RETCODE_ST, 0, NUMBER_ST, (void*)EXIT_R_F); }
2238 | DROP {$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, (void*)EXIT_R_F); }
2239 | RETURN {$$=mk_action(DROP_T, 2, NUMBER_ST, (void*)1, NUMBER_ST, (void*)RETURN_R_F); }
2240 | RETURN NUMBER {$$=mk_action(DROP_T, 2, NUMBER_ST, (void*)$2, NUMBER_ST, (void*)RETURN_R_F);}
2241 | RETURN RETCODE {$$=mk_action(DROP_T, 2, RETCODE_ST, 0, NUMBER_ST, (void*)RETURN_R_F);}
2242 | BREAK {$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, (void*)RETURN_R_F); }
2243 | LOG_TOK LPAREN STRING RPAREN {$$=mk_action(LOG_T, 2, NUMBER_ST,
2244 (void*)(L_DBG+1), STRING_ST, $3); }
2245 | LOG_TOK LPAREN NUMBER COMMA STRING RPAREN {$$=mk_action(LOG_T, 2, NUMBER_ST, (void*)$3, STRING_ST, $5); }
2246 | LOG_TOK error { $$=0; yyerror("missing '(' or ')' ?"); }
2247 | LOG_TOK LPAREN error RPAREN { $$=0; yyerror("bad log argument"); }
2248 | SETFLAG LPAREN NUMBER RPAREN {
2249 if (check_flag($3)==-1)
2250 yyerror("bad flag value");
2251 $$=mk_action(SETFLAG_T, 1, NUMBER_ST,
2254 | SETFLAG LPAREN flag_name RPAREN {
2255 i_tmp=get_flag_no($3, strlen($3));
2256 if (i_tmp<0) yyerror("flag not declared");
2257 $$=mk_action(SETFLAG_T, 1, NUMBER_ST,
2258 (void*)(long)i_tmp);
2260 | SETFLAG error { $$=0; yyerror("missing '(' or ')'?"); }
2261 | RESETFLAG LPAREN NUMBER RPAREN {
2262 if (check_flag($3)==-1)
2263 yyerror("bad flag value");
2264 $$=mk_action(RESETFLAG_T, 1, NUMBER_ST, (void*)$3);
2266 | RESETFLAG LPAREN flag_name RPAREN {
2267 i_tmp=get_flag_no($3, strlen($3));
2268 if (i_tmp<0) yyerror("flag not declared");
2269 $$=mk_action(RESETFLAG_T, 1, NUMBER_ST,
2270 (void*)(long)i_tmp);
2272 | RESETFLAG error { $$=0; yyerror("missing '(' or ')'?"); }
2273 | ISFLAGSET LPAREN NUMBER RPAREN {
2274 if (check_flag($3)==-1)
2275 yyerror("bad flag value");
2276 $$=mk_action(ISFLAGSET_T, 1, NUMBER_ST, (void*)$3);
2278 | ISFLAGSET LPAREN flag_name RPAREN {
2279 i_tmp=get_flag_no($3, strlen($3));
2280 if (i_tmp<0) yyerror("flag not declared");
2281 $$=mk_action(ISFLAGSET_T, 1, NUMBER_ST,
2282 (void*)(long)i_tmp);
2284 | ISFLAGSET error { $$=0; yyerror("missing '(' or ')'?"); }
2285 | avpflag_oper LPAREN attr_id_any_str COMMA flag_name RPAREN {
2286 i_tmp=get_avpflag_no($5);
2287 if (i_tmp==0) yyerror("avpflag not declared");
2288 $$=mk_action(AVPFLAG_OPER_T, 3, AVP_ST, $3, NUMBER_ST, (void*)(long)i_tmp, NUMBER_ST, (void*)$1);
2290 | avpflag_oper error { $$=0; yyerror("missing '(' or ')'?"); }
2291 | ERROR LPAREN STRING COMMA STRING RPAREN {$$=mk_action(ERROR_T, 2, STRING_ST, $3, STRING_ST, $5); }
2292 | ERROR error { $$=0; yyerror("missing '(' or ')' ?"); }
2293 | ERROR LPAREN error RPAREN { $$=0; yyerror("bad error argument"); }
2294 | ROUTE LPAREN route_name RPAREN {
2295 i_tmp=route_get(&main_rt, $3);
2297 yyerror("internal error");
2300 $$=mk_action(ROUTE_T, 1, NUMBER_ST,(void*)(long)i_tmp);
2302 | ROUTE error { $$=0; yyerror("missing '(' or ')' ?"); }
2303 | ROUTE LPAREN error RPAREN { $$=0; yyerror("bad route argument"); }
2304 | EXEC LPAREN STRING RPAREN { $$=mk_action(EXEC_T, 1, STRING_ST, $3); }
2305 | SET_HOST LPAREN STRING RPAREN { $$=mk_action(SET_HOST_T, 1, STRING_ST, $3); }
2306 | SET_HOST error { $$=0; yyerror("missing '(' or ')' ?"); }
2307 | SET_HOST LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2308 | PREFIX LPAREN STRING RPAREN { $$=mk_action(PREFIX_T, 1, STRING_ST, $3); }
2309 | PREFIX error { $$=0; yyerror("missing '(' or ')' ?"); }
2310 | PREFIX LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2311 | STRIP_TAIL LPAREN NUMBER RPAREN { $$=mk_action(STRIP_TAIL_T, 1, NUMBER_ST, (void*)$3); }
2312 | STRIP_TAIL error { $$=0; yyerror("missing '(' or ')' ?"); }
2313 | STRIP_TAIL LPAREN error RPAREN { $$=0; yyerror("bad argument, number expected"); }
2314 | STRIP LPAREN NUMBER RPAREN { $$=mk_action(STRIP_T, 1, NUMBER_ST, (void*) $3); }
2315 | STRIP error { $$=0; yyerror("missing '(' or ')' ?"); }
2316 | STRIP LPAREN error RPAREN { $$=0; yyerror("bad argument, number expected"); }
2317 | SET_USERPHONE LPAREN RPAREN { $$=mk_action(SET_USERPHONE_T, 0); }
2318 | SET_USERPHONE error { $$=0; yyerror("missing '(' or ')' ?"); }
2319 | APPEND_BRANCH LPAREN STRING COMMA STRING RPAREN {
2321 if (str2q(&q, $5, strlen($5)) < 0) {
2322 yyerror("bad argument, q value expected");
2324 $$=mk_action(APPEND_BRANCH_T, 2, STRING_ST, $3, NUMBER_ST, (void *)(long)q);
2326 | APPEND_BRANCH LPAREN STRING RPAREN { $$=mk_action(APPEND_BRANCH_T, 2, STRING_ST, $3, NUMBER_ST, (void *)Q_UNSPECIFIED); }
2327 | APPEND_BRANCH LPAREN RPAREN { $$=mk_action(APPEND_BRANCH_T, 2, STRING_ST, 0, NUMBER_ST, (void *)Q_UNSPECIFIED); }
2328 | APPEND_BRANCH { $$=mk_action( APPEND_BRANCH_T, 1, STRING_ST, 0); }
2329 | SET_HOSTPORT LPAREN STRING RPAREN { $$=mk_action(SET_HOSTPORT_T, 1, STRING_ST, $3); }
2330 | SET_HOSTPORT error { $$=0; yyerror("missing '(' or ')' ?"); }
2331 | SET_HOSTPORT LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2332 | SET_HOSTPORTTRANS LPAREN STRING RPAREN { $$=mk_action(SET_HOSTPORTTRANS_T, 1, STRING_ST, $3); }
2333 | SET_HOSTPORTTRANS error { $$=0; yyerror("missing '(' or ')' ?"); }
2334 | SET_HOSTPORTTRANS LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2335 | SET_PORT LPAREN STRING RPAREN { $$=mk_action(SET_PORT_T, 1, STRING_ST, $3); }
2336 | SET_PORT error { $$=0; yyerror("missing '(' or ')' ?"); }
2337 | SET_PORT LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2338 | SET_USER LPAREN STRING RPAREN { $$=mk_action(SET_USER_T, 1, STRING_ST, $3); }
2339 | SET_USER error { $$=0; yyerror("missing '(' or ')' ?"); }
2340 | SET_USER LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2341 | SET_USERPASS LPAREN STRING RPAREN { $$=mk_action(SET_USERPASS_T, 1, STRING_ST, $3); }
2342 | SET_USERPASS error { $$=0; yyerror("missing '(' or ')' ?"); }
2343 | SET_USERPASS LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2344 | SET_URI LPAREN STRING RPAREN { $$=mk_action(SET_URI_T, 1, STRING_ST,$3); }
2345 | SET_URI error { $$=0; yyerror("missing '(' or ')' ?"); }
2346 | SET_URI LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2347 | REVERT_URI LPAREN RPAREN { $$=mk_action(REVERT_URI_T, 0); }
2348 | REVERT_URI { $$=mk_action(REVERT_URI_T, 0); }
2349 | FORCE_RPORT LPAREN RPAREN { $$=mk_action(FORCE_RPORT_T, 0); }
2350 | FORCE_RPORT {$$=mk_action(FORCE_RPORT_T, 0); }
2351 | FORCE_TCP_ALIAS LPAREN NUMBER RPAREN {
2353 $$=mk_action(FORCE_TCP_ALIAS_T, 1, NUMBER_ST, (void*)$3);
2355 yyerror("tcp support not compiled in");
2358 | FORCE_TCP_ALIAS LPAREN RPAREN {
2360 $$=mk_action(FORCE_TCP_ALIAS_T, 0);
2362 yyerror("tcp support not compiled in");
2367 $$=mk_action(FORCE_TCP_ALIAS_T, 0);
2369 yyerror("tcp support not compiled in");
2372 | FORCE_TCP_ALIAS LPAREN error RPAREN {$$=0; yyerror("bad argument, number expected"); }
2373 | UDP_MTU_TRY_PROTO LPAREN proto RPAREN
2374 { $$=mk_action(UDP_MTU_TRY_PROTO_T, 1, NUMBER_ST, $3); }
2375 | UDP_MTU_TRY_PROTO LPAREN error RPAREN
2376 { $$=0; yyerror("bad argument, UDP, TCP, TLS or SCTP expected"); }
2377 | SET_ADV_ADDRESS LPAREN listen_id RPAREN {
2379 if ((str_tmp=pkg_malloc(sizeof(str)))==0) {
2380 LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
2383 str_tmp->len=strlen($3);
2384 $$=mk_action(SET_ADV_ADDR_T, 1, STR_ST, str_tmp);
2387 | SET_ADV_ADDRESS LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2388 | SET_ADV_ADDRESS error {$$=0; yyerror("missing '(' or ')' ?"); }
2389 | SET_ADV_PORT LPAREN NUMBER RPAREN {
2391 tmp=int2str($3, &i_tmp);
2392 if ((str_tmp=pkg_malloc(sizeof(str)))==0) {
2393 LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
2395 if ((str_tmp->s=pkg_malloc(i_tmp))==0) {
2396 LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
2398 memcpy(str_tmp->s, tmp, i_tmp);
2400 $$=mk_action(SET_ADV_PORT_T, 1, STR_ST, str_tmp);
2404 | SET_ADV_PORT LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2405 | SET_ADV_PORT error {$$=0; yyerror("missing '(' or ')' ?"); }
2406 | FORCE_SEND_SOCKET LPAREN phostport RPAREN {
2407 $$=mk_action(FORCE_SEND_SOCKET_T, 1, SOCKID_ST, $3);
2409 | FORCE_SEND_SOCKET LPAREN error RPAREN {
2410 $$=0; yyerror("bad argument, [proto:]host[:port] expected");
2412 | FORCE_SEND_SOCKET error {$$=0; yyerror("missing '(' or ')' ?"); }
2413 | ID {mod_func_action = mk_action(MODULE_T, 2, MODEXP_ST, NULL, NUMBER_ST, 0); } LPAREN func_params RPAREN {
2414 mod_func_action->val[0].u.data = find_export_record($1, mod_func_action->val[1].u.number, rt);
2415 if (mod_func_action->val[0].u.data == 0) {
2416 if (find_export_record($1, mod_func_action->val[1].u.number, 0) ) {
2417 yyerror("Command cannot be used in the block\n");
2419 yyerror("unknown command, missing loadmodule?\n");
2421 pkg_free(mod_func_action);
2424 $$ = mod_func_action;
2429 | func_params COMMA func_param { }
2431 | func_params error { yyerror("call params error\n"); YYABORT; }
2435 if (mod_func_action->val[1].u.number < MAX_ACTIONS-2) {
2436 mod_func_action->val[mod_func_action->val[1].u.number+2].type = NUMBER_ST;
2437 mod_func_action->val[mod_func_action->val[1].u.number+2].u.number = $1;
2438 mod_func_action->val[1].u.number++;
2440 yyerror("Too many arguments\n");
2444 if (mod_func_action->val[1].u.number < MAX_ACTIONS-2) {
2445 mod_func_action->val[mod_func_action->val[1].u.number+2].type = STRING_ST;
2446 mod_func_action->val[mod_func_action->val[1].u.number+2].u.string = $1;
2447 mod_func_action->val[1].u.number++;
2449 yyerror("Too many arguments\n");
2457 extern int startcolumn;
2458 static void warn(char* s)
2460 LOG(L_WARN, "cfg. warning: (%d,%d-%d): %s\n", line, startcolumn,
2465 static void yyerror(char* s)
2467 LOG(L_CRIT, "*** PARSE ERROR *** (%d,%d-%d): %s\n", line, startcolumn,
2473 static struct name_lst* mk_name_lst(char* host, int flags)
2476 l=pkg_malloc(sizeof(struct name_lst));
2478 LOG(L_CRIT,"ERROR: cfg. parser: out of memory.\n");
2488 static struct socket_id* mk_listen_id(char* host, int proto, int port)
2490 struct socket_id* l;
2491 l=pkg_malloc(sizeof(struct socket_id));
2493 LOG(L_CRIT,"ERROR: cfg. parser: out of memory.\n");
2495 l->addr_lst=mk_name_lst(host, 0);
2496 if (l->addr_lst==0){
2509 static void free_name_lst(struct name_lst* lst)
2511 struct name_lst* tmp;
2521 static struct socket_id* mk_listen_id2(struct name_lst* addr_l, int proto,
2524 struct socket_id* l;
2525 l=pkg_malloc(sizeof(struct socket_id));
2527 LOG(L_CRIT,"ERROR: cfg. parser: out of memory.\n");
2529 l->flags=addr_l->flags;
2539 static void free_socket_id(struct socket_id* i)
2541 free_name_lst(i->addr_lst);
2546 static void free_socket_id_lst(struct socket_id* lst)
2548 struct socket_id* tmp;
2553 free_socket_id(tmp);
2558 int main(int argc, char ** argv)
2561 fprintf(stderr, "parsing error\n");