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)
97 #include <sys/types.h>
98 #include <sys/socket.h>
99 #include <netinet/in.h>
100 #include <arpa/inet.h>
103 #include "route_struct.h"
107 #include "sr_module.h"
108 #include "modparam.h"
111 #include "socket_info.h"
112 #include "name_alias.h"
117 #include "tcp_init.h"
118 #include "tcp_options.h"
119 #include "sctp_options.h"
120 #include "msg_translator.h"
123 #include "cfg_core.h"
126 #include "tls/tls_config.h"
128 #include "timer_ticks.h"
134 /* hack to avoid alloca usage in the generated C file (needed for compiler
135 with no built in alloca, like icc*/
138 #define onsend_check(s) \
140 if (rt!=ONSEND_ROUTE) yyerror( s " allowed only in onsend_routes");\
145 #define IF_DNS_CACHE(x) x
147 #define IF_DNS_CACHE(x) warn("dns cache support not compiled in")
150 #ifdef USE_DNS_FAILOVER
151 #define IF_DNS_FAILOVER(x) x
153 #define IF_DNS_FAILOVER(x) warn("dns failover support not compiled in")
157 #define IF_NAPTR(x) x
159 #define IF_NAPTR(x) warn("dns naptr support not compiled in")
162 #ifdef USE_DST_BLACKLIST
163 #define IF_DST_BLACKLIST(x) x
165 #define IF_DST_BLACKLIST(x) warn("dst blacklist support not compiled in")
171 #define IF_STUN(x) warn("stun support not compiled in")
176 static void yyerror(char* s);
179 static struct socket_id* lst_tmp;
180 static struct name_lst* nl_tmp;
181 static int rt; /* Type of route block for find_export */
184 static struct ip_addr* ip_tmp;
185 static struct avp_spec* s_attr;
187 static select_t* sel_ptr;
188 static struct action *mod_func_action;
190 static void warn(char* s);
191 static struct socket_id* mk_listen_id(char*, int, int);
192 static struct name_lst* mk_name_lst(char* name, int flags);
193 static struct socket_id* mk_listen_id2(struct name_lst*, int, int);
194 static void free_name_lst(struct name_lst* lst);
195 static void free_socket_id_lst(struct socket_id* i);
204 struct action* action;
206 struct ip_addr* ipaddr;
207 struct socket_id* sockid;
208 struct name_lst* name_l;
209 struct avp_spec* attr;
237 %token SET_HOSTPORTTRANS
248 %token FORCE_TCP_ALIAS
250 %token UDP_MTU_TRY_PROTO
253 %token SET_ADV_ADDRESS
255 %token FORCE_SEND_SOCKET
307 %token DNS_SERVERS_NO
308 %token DNS_USE_SEARCH
309 %token DNS_SEARCH_FMATCH
310 %token DNS_CACHE_INIT
312 %token DNS_USE_FAILOVER
313 %token DNS_CACHE_FLAGS
314 %token DNS_CACHE_NEG_TTL
315 %token DNS_CACHE_MIN_TTL
316 %token DNS_CACHE_MAX_TTL
318 %token DNS_CACHE_GC_INT
319 %token DNS_CACHE_DEL_NONEXP
325 %token DST_BLST_GC_INT
336 %token SERVER_SIGNATURE
348 %token TCP_ACCEPT_ALIASES
350 %token TCP_CONNECT_TIMEOUT
351 %token TCP_SEND_TIMEOUT
352 %token TCP_CON_LIFETIME
353 %token TCP_POLL_METHOD
354 %token TCP_MAX_CONNECTIONS
355 %token TCP_NO_CONNECT
356 %token TCP_SOURCE_IPV4
357 %token TCP_SOURCE_IPV6
358 %token TCP_OPT_FD_CACHE
359 %token TCP_OPT_BUF_WRITE
360 %token TCP_OPT_CONN_WQ_MAX
361 %token TCP_OPT_WQ_MAX
362 %token TCP_OPT_RD_BUF
363 %token TCP_OPT_WQ_BLK
364 %token TCP_OPT_DEFER_ACCEPT
365 %token TCP_OPT_DELAYED_ACK
366 %token TCP_OPT_SYNCNT
367 %token TCP_OPT_LINGER2
368 %token TCP_OPT_KEEPALIVE
369 %token TCP_OPT_KEEPIDLE
370 %token TCP_OPT_KEEPINTVL
371 %token TCP_OPT_KEEPCNT
372 %token TCP_OPT_CRLF_PING
378 %token TLS_HANDSHAKE_TIMEOUT
379 %token TLS_SEND_TIMEOUT
385 %token TLS_REQUIRE_CERTIFICATE
386 %token TLS_CERTIFICATE
387 %token TLS_PRIVATE_KEY
392 %token SCTP_SOCKET_RCVBUF
393 %token SCTP_SOCKET_SNDBUF
394 %token SCTP_AUTOCLOSE
396 %token SCTP_SEND_RETRIES
397 %token ADVERTISED_ADDRESS
398 %token ADVERTISED_PORT
401 %token SHM_FORCE_ALLOC
406 %token RT_TIMER1_PRIO
407 %token RT_TIMER1_POLICY
408 %token RT_TIMER2_PRIO
409 %token RT_TIMER2_POLICY
410 %token MCAST_LOOPBACK
413 %token PMTU_DISCOVERY
415 %token CFG_DESCRIPTION
429 %token ATTR_FROMDOMAIN
434 %token STUN_REFRESH_INTERVAL
435 %token STUN_ALLOW_STUN
456 %token <intval> NUMBER
458 %token <strval> STRING
459 %token <strval> IPV6ADDR
478 %type <expr> exp exp_elem /*, condition*/
479 %type <action> action actions cmd fcmd if_cmd stm exp_stm assign_action
480 %type <ipaddr> ipv4 ipv6 ipv6addr ip
483 %type <strval> listen_id
484 %type <name_l> listen_id_lst
485 %type <name_l> listen_id2
486 %type <sockid> id_lst
487 %type <sockid> phostport
488 %type <sockid> listen_phostport
489 %type <intval> proto port
490 %type <intval> equalop strop intop binop
491 %type <strval> host_sep
492 %type <intval> uri_type
494 %type <attr> attr_id_num_idx
495 %type <attr> attr_id_no_idx
496 %type <attr> attr_id_ass
497 %type <attr> attr_id_val
498 %type <attr> attr_id_any
499 %type <attr> attr_id_any_str
500 /* %type <intval> class_id */
501 %type <intval> assign_op
502 %type <select> select_id
503 %type <strval> flag_name;
504 %type <strval> route_name;
505 %type <intval> avpflag_oper
507 /*%type <route_el> rules;
508 %type <route_el> rule;
518 statements statement {}
520 | statements error { yyerror(""); YYABORT;}
527 | {rt=REQUEST_ROUTE;} route_stm
528 | {rt=FAILURE_ROUTE;} failure_route_stm
529 | {rt=ONREPLY_ROUTE;} onreply_route_stm
530 | {rt=BRANCH_ROUTE;} branch_route_stm
531 | {rt=ONSEND_ROUTE;} send_route_stm
532 | SEMICOLON /* null statement */
533 | CR /* null statement*/
539 LOG(L_CRIT, "ERROR: cfg. parser: bad ip "
543 $$=pkg_malloc(strlen(tmp)+1);
545 LOG(L_CRIT, "ERROR: cfg. parser: out of "
548 strncpy($$, tmp, strlen(tmp)+1);
553 $$=pkg_malloc(strlen($1)+1);
555 LOG(L_CRIT, "ERROR: cfg. parser: out of "
558 strncpy($$, $1, strlen($1)+1);
562 $$=pkg_malloc(strlen($1)+1);
564 LOG(L_CRIT, "ERROR: cfg. parser: out of "
567 strncpy($$, $1, strlen($1)+1);
574 listen_id { $$=mk_name_lst($1, SI_IS_MHOMED); }
575 | listen_id COMMA listen_id_lst { $$=mk_name_lst($1, SI_IS_MHOMED);
581 LPAREN listen_id_lst RPAREN { $$=$2; }
582 | listen_id { $$=mk_name_lst($1, 0); }
586 UDP { $$=PROTO_UDP; }
587 | TCP { $$=PROTO_TCP; }
588 | TLS { $$=PROTO_TLS; }
589 | SCTP { $$=PROTO_SCTP; }
597 listen_id { $$=mk_listen_id($1, 0, 0); }
598 | listen_id COLON port { $$=mk_listen_id($1, 0, $3); }
599 | proto COLON listen_id { $$=mk_listen_id($3, $1, 0); }
600 | proto COLON listen_id COLON port { $$=mk_listen_id($3, $1, $5);}
601 | listen_id COLON error { $$=0; yyerror(" port number expected"); }
605 listen_id2 { $$=mk_listen_id2($1, 0, 0); }
606 | listen_id2 COLON port { $$=mk_listen_id2($1, 0, $3); }
607 | proto COLON listen_id2 { $$=mk_listen_id2($3, $1, 0); }
608 | proto COLON listen_id2 COLON port { $$=mk_listen_id2($3, $1, $5);}
609 | listen_id2 COLON error { $$=0; yyerror(" port number expected"); }
613 listen_phostport { $$=$1 ; }
614 | listen_phostport id_lst { $$=$1; $$->next=$2; }
617 flags_decl: FLAGS_DECL flag_list
618 | FLAGS_DECL error { yyerror("flag list expected\n"); }
621 | flag_spec COMMA flag_list
624 flag_spec: flag_name { if (register_flag($1,-1)<0)
625 yyerror("register flag failed");
627 | flag_name COLON NUMBER {
628 if (register_flag($1, $3)<0)
629 yyerror("register flag failed");
633 flag_name: STRING { $$=$1; }
638 AVPFLAGS_DECL avpflag_list
639 | AVPFLAGS_DECL error { yyerror("avpflag list expected\n"); }
643 | avpflag_spec COMMA avpflag_list
647 if (register_avpflag($1)==0)
648 yyerror("cannot declare avpflag");
652 DEBUG_V EQUAL NUMBER { default_core_cfg.debug=$3; }
653 | DEBUG_V EQUAL error { yyerror("number expected"); }
654 | FORK EQUAL NUMBER { dont_fork= ! $3; }
655 | FORK EQUAL error { yyerror("boolean value expected"); }
656 | LOGSTDERROR EQUAL NUMBER { if (!config_check) log_stderr=$3; }
657 | LOGSTDERROR EQUAL error { yyerror("boolean value expected"); }
658 | LOGFACILITY EQUAL ID {
659 if ( (i_tmp=str2facility($3))==-1)
660 yyerror("bad facility (see syslog(3) man page)");
662 default_core_cfg.log_facility=i_tmp;
664 | LOGFACILITY EQUAL error { yyerror("ID expected"); }
665 | DNS EQUAL NUMBER { received_dns|= ($3)?DO_DNS:0; }
666 | DNS EQUAL error { yyerror("boolean value expected"); }
667 | REV_DNS EQUAL NUMBER { received_dns|= ($3)?DO_REV_DNS:0; }
668 | REV_DNS EQUAL error { yyerror("boolean value expected"); }
669 | DNS_TRY_IPV6 EQUAL NUMBER { default_core_cfg.dns_try_ipv6=$3; }
670 | DNS_TRY_IPV6 error { yyerror("boolean value expected"); }
671 | DNS_TRY_NAPTR EQUAL NUMBER { IF_NAPTR(default_core_cfg.dns_try_naptr=$3); }
672 | DNS_TRY_NAPTR error { yyerror("boolean value expected"); }
673 | DNS_SRV_LB EQUAL NUMBER { IF_DNS_FAILOVER(default_core_cfg.dns_srv_lb=$3); }
674 | DNS_SRV_LB error { yyerror("boolean value expected"); }
675 | DNS_UDP_PREF EQUAL NUMBER { IF_NAPTR(default_core_cfg.dns_udp_pref=$3);}
676 | DNS_UDP_PREF error { yyerror("number expected"); }
677 | DNS_TCP_PREF EQUAL NUMBER { IF_NAPTR(default_core_cfg.dns_tcp_pref=$3);}
678 | DNS_TCP_PREF error { yyerror("number expected"); }
679 | DNS_TLS_PREF EQUAL NUMBER { IF_NAPTR(default_core_cfg.dns_tls_pref=$3);}
680 | DNS_TLS_PREF error { yyerror("number expected"); }
681 | DNS_SCTP_PREF EQUAL NUMBER {
682 IF_NAPTR(default_core_cfg.dns_sctp_pref=$3); }
683 | DNS_SCTP_PREF error { yyerror("number expected"); }
684 | DNS_RETR_TIME EQUAL NUMBER { default_core_cfg.dns_retr_time=$3; }
685 | DNS_RETR_TIME error { yyerror("number expected"); }
686 | DNS_RETR_NO EQUAL NUMBER { default_core_cfg.dns_retr_no=$3; }
687 | DNS_RETR_NO error { yyerror("number expected"); }
688 | DNS_SERVERS_NO EQUAL NUMBER { default_core_cfg.dns_servers_no=$3; }
689 | DNS_SERVERS_NO error { yyerror("number expected"); }
690 | DNS_USE_SEARCH EQUAL NUMBER { default_core_cfg.dns_search_list=$3; }
691 | DNS_USE_SEARCH error { yyerror("boolean value expected"); }
692 | DNS_SEARCH_FMATCH EQUAL NUMBER { default_core_cfg.dns_search_fmatch=$3; }
693 | DNS_SEARCH_FMATCH error { yyerror("boolean value expected"); }
694 | DNS_CACHE_INIT EQUAL NUMBER { IF_DNS_CACHE(dns_cache_init=$3); }
695 | DNS_CACHE_INIT error { yyerror("boolean value expected"); }
696 | DNS_USE_CACHE EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.use_dns_cache=$3); }
697 | DNS_USE_CACHE error { yyerror("boolean value expected"); }
698 | DNS_USE_FAILOVER EQUAL NUMBER { IF_DNS_FAILOVER(default_core_cfg.use_dns_failover=$3);}
699 | DNS_USE_FAILOVER error { yyerror("boolean value expected"); }
700 | DNS_CACHE_FLAGS EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_flags=$3); }
701 | DNS_CACHE_FLAGS error { yyerror("boolean value expected"); }
702 | DNS_CACHE_NEG_TTL EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_neg_cache_ttl=$3); }
703 | DNS_CACHE_NEG_TTL error { yyerror("boolean value expected"); }
704 | DNS_CACHE_MAX_TTL EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_max_ttl=$3); }
705 | DNS_CACHE_MAX_TTL error { yyerror("boolean value expected"); }
706 | DNS_CACHE_MIN_TTL EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_min_ttl=$3); }
707 | DNS_CACHE_MIN_TTL error { yyerror("boolean value expected"); }
708 | DNS_CACHE_MEM EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_max_mem=$3); }
709 | DNS_CACHE_MEM error { yyerror("boolean value expected"); }
710 | DNS_CACHE_GC_INT EQUAL NUMBER { IF_DNS_CACHE(dns_timer_interval=$3); }
711 | DNS_CACHE_GC_INT error { yyerror("boolean value expected"); }
712 | DNS_CACHE_DEL_NONEXP EQUAL NUMBER { IF_DNS_CACHE(default_core_cfg.dns_cache_del_nonexp=$3); }
713 | DNS_CACHE_DEL_NONEXP error { yyerror("boolean value expected"); }
714 | DST_BLST_INIT EQUAL NUMBER { IF_DST_BLACKLIST(dst_blacklist_init=$3); }
715 | DST_BLST_INIT error { yyerror("boolean value expected"); }
716 | USE_DST_BLST EQUAL NUMBER { IF_DST_BLACKLIST(default_core_cfg.use_dst_blacklist=$3); }
717 | USE_DST_BLST error { yyerror("boolean value expected"); }
718 | DST_BLST_MEM EQUAL NUMBER { IF_DST_BLACKLIST(default_core_cfg.blst_max_mem=$3); }
719 | DST_BLST_MEM error { yyerror("boolean value expected"); }
720 | DST_BLST_TTL EQUAL NUMBER { IF_DST_BLACKLIST(default_core_cfg.blst_timeout=$3); }
721 | DST_BLST_TTL error { yyerror("boolean value expected"); }
722 | DST_BLST_GC_INT EQUAL NUMBER { IF_DST_BLACKLIST(blst_timer_interval=$3);}
723 | DST_BLST_GC_INT error { yyerror("boolean value expected"); }
724 | PORT EQUAL NUMBER { port_no=$3; }
725 | STAT EQUAL STRING {
730 | MAXBUFFER EQUAL NUMBER { maxbuffer=$3; }
731 | MAXBUFFER EQUAL error { yyerror("number expected"); }
732 | PORT EQUAL error { yyerror("number expected"); }
733 | CHILDREN EQUAL NUMBER { children_no=$3; }
734 | CHILDREN EQUAL error { yyerror("number expected"); }
735 | CHECK_VIA EQUAL NUMBER { check_via=$3; }
736 | CHECK_VIA EQUAL error { yyerror("boolean value expected"); }
737 | PHONE2TEL EQUAL NUMBER { phone2tel=$3; }
738 | PHONE2TEL EQUAL error { yyerror("boolean value expected"); }
739 | SYN_BRANCH EQUAL NUMBER { syn_branch=$3; }
740 | SYN_BRANCH EQUAL error { yyerror("boolean value expected"); }
741 | MEMLOG EQUAL NUMBER { memlog=$3; }
742 | MEMLOG EQUAL error { yyerror("int value expected"); }
743 | MEMDBG EQUAL NUMBER { memdbg=$3; }
744 | MEMDBG EQUAL error { yyerror("int value expected"); }
745 | SIP_WARNING EQUAL NUMBER { sip_warning=$3; }
746 | SIP_WARNING EQUAL error { yyerror("boolean value expected"); }
747 | USER EQUAL STRING { user=$3; }
748 | USER EQUAL ID { user=$3; }
749 | USER EQUAL error { yyerror("string value expected"); }
750 | GROUP EQUAL STRING { group=$3; }
751 | GROUP EQUAL ID { group=$3; }
752 | GROUP EQUAL error { yyerror("string value expected"); }
753 | CHROOT EQUAL STRING { chroot_dir=$3; }
754 | CHROOT EQUAL ID { chroot_dir=$3; }
755 | CHROOT EQUAL error { yyerror("string value expected"); }
756 | WDIR EQUAL STRING { working_dir=$3; }
757 | WDIR EQUAL ID { working_dir=$3; }
758 | WDIR EQUAL error { yyerror("string value expected"); }
759 | MHOMED EQUAL NUMBER { mhomed=$3; }
760 | MHOMED EQUAL error { yyerror("boolean value expected"); }
761 | DISABLE_TCP EQUAL NUMBER {
765 warn("tcp support not compiled in");
768 | DISABLE_TCP EQUAL error { yyerror("boolean value expected"); }
769 | TCP_ACCEPT_ALIASES EQUAL NUMBER {
771 tcp_default_cfg.accept_aliases=$3;
773 warn("tcp support not compiled in");
776 | TCP_ACCEPT_ALIASES EQUAL error { yyerror("boolean value expected"); }
777 | TCP_CHILDREN EQUAL NUMBER {
781 warn("tcp support not compiled in");
784 | TCP_CHILDREN EQUAL error { yyerror("number expected"); }
785 | TCP_CONNECT_TIMEOUT EQUAL NUMBER {
787 tcp_default_cfg.connect_timeout_s=$3;
789 warn("tcp support not compiled in");
792 | TCP_CONNECT_TIMEOUT EQUAL error { yyerror("number expected"); }
793 | TCP_SEND_TIMEOUT EQUAL NUMBER {
795 tcp_default_cfg.send_timeout_s=$3;
797 warn("tcp support not compiled in");
800 | TCP_SEND_TIMEOUT EQUAL error { yyerror("number expected"); }
801 | TCP_CON_LIFETIME EQUAL NUMBER {
804 tcp_default_cfg.con_lifetime=-1;
806 tcp_default_cfg.con_lifetime=S_TO_TICKS($3);
808 warn("tcp support not compiled in");
811 | TCP_CON_LIFETIME EQUAL error { yyerror("number expected"); }
812 | TCP_POLL_METHOD EQUAL ID {
814 tcp_poll_method=get_poll_type($3);
815 if (tcp_poll_method==POLL_NONE) {
816 LOG(L_CRIT, "bad poll method name:"
817 " %s\n, try one of %s.\n",
819 yyerror("bad tcp_poll_method "
823 warn("tcp support not compiled in");
826 | TCP_POLL_METHOD EQUAL STRING {
828 tcp_poll_method=get_poll_type($3);
829 if (tcp_poll_method==POLL_NONE) {
830 LOG(L_CRIT, "bad poll method name:"
831 " %s\n, try one of %s.\n",
833 yyerror("bad tcp_poll_method "
837 warn("tcp support not compiled in");
840 | TCP_POLL_METHOD EQUAL error { yyerror("poll method name expected"); }
841 | TCP_MAX_CONNECTIONS EQUAL NUMBER {
843 tcp_max_connections=$3;
845 warn("tcp support not compiled in");
848 | TCP_MAX_CONNECTIONS EQUAL error { yyerror("number expected"); }
849 | TCP_NO_CONNECT EQUAL NUMBER {
851 tcp_default_cfg.no_connect=$3;
853 warn("tcp support not compiled in");
856 | TCP_NO_CONNECT EQUAL error { yyerror("boolean value expected"); }
857 | TCP_SOURCE_IPV4 EQUAL ipv4 {
859 if (tcp_set_src_addr($3)<0)
860 warn("tcp_source_ipv4 failed");
862 warn("tcp support not compiled in");
866 | TCP_SOURCE_IPV4 EQUAL error { yyerror("IPv4 address expected"); }
867 | TCP_SOURCE_IPV6 EQUAL ipv6 {
870 if (tcp_set_src_addr($3)<0)
871 warn("tcp_source_ipv6 failed");
873 warn("IPv6 support not compiled in");
876 warn("tcp support not compiled in");
880 | TCP_SOURCE_IPV6 EQUAL error { yyerror("IPv6 address expected"); }
881 | TCP_OPT_FD_CACHE EQUAL NUMBER {
883 tcp_default_cfg.fd_cache=$3;
885 warn("tcp support not compiled in");
888 | TCP_OPT_FD_CACHE EQUAL error { yyerror("boolean value expected"); }
889 | TCP_OPT_BUF_WRITE EQUAL NUMBER {
891 tcp_default_cfg.async=$3;
893 warn("tcp support not compiled in");
896 | TCP_OPT_BUF_WRITE EQUAL error { yyerror("boolean value expected"); }
897 | TCP_OPT_CONN_WQ_MAX EQUAL NUMBER {
899 tcp_default_cfg.tcpconn_wq_max=$3;
901 warn("tcp support not compiled in");
904 | TCP_OPT_CONN_WQ_MAX error { yyerror("boolean value expected"); }
905 | TCP_OPT_WQ_MAX EQUAL NUMBER {
907 tcp_default_cfg.tcp_wq_max=$3;
909 warn("tcp support not compiled in");
912 | TCP_OPT_WQ_MAX error { yyerror("number expected"); }
913 | TCP_OPT_RD_BUF EQUAL NUMBER {
915 tcp_default_cfg.rd_buf_size=$3;
917 warn("tcp support not compiled in");
920 | TCP_OPT_RD_BUF error { yyerror("number expected"); }
921 | TCP_OPT_WQ_BLK EQUAL NUMBER {
923 tcp_default_cfg.wq_blk_size=$3;
925 warn("tcp support not compiled in");
928 | TCP_OPT_WQ_BLK error { yyerror("number expected"); }
929 | TCP_OPT_DEFER_ACCEPT EQUAL NUMBER {
931 tcp_default_cfg.defer_accept=$3;
933 warn("tcp support not compiled in");
936 | TCP_OPT_DEFER_ACCEPT EQUAL error { yyerror("boolean value expected"); }
937 | TCP_OPT_DELAYED_ACK EQUAL NUMBER {
939 tcp_default_cfg.delayed_ack=$3;
941 warn("tcp support not compiled in");
944 | TCP_OPT_DELAYED_ACK EQUAL error { yyerror("boolean value expected"); }
945 | TCP_OPT_SYNCNT EQUAL NUMBER {
947 tcp_default_cfg.syncnt=$3;
949 warn("tcp support not compiled in");
952 | TCP_OPT_SYNCNT EQUAL error { yyerror("number expected"); }
953 | TCP_OPT_LINGER2 EQUAL NUMBER {
955 tcp_default_cfg.linger2=$3;
957 warn("tcp support not compiled in");
960 | TCP_OPT_LINGER2 EQUAL error { yyerror("number expected"); }
961 | TCP_OPT_KEEPALIVE EQUAL NUMBER {
963 tcp_default_cfg.keepalive=$3;
965 warn("tcp support not compiled in");
968 | TCP_OPT_KEEPALIVE EQUAL error { yyerror("boolean value expected");}
969 | TCP_OPT_KEEPIDLE EQUAL NUMBER {
971 tcp_default_cfg.keepidle=$3;
973 warn("tcp support not compiled in");
976 | TCP_OPT_KEEPIDLE EQUAL error { yyerror("number expected"); }
977 | TCP_OPT_KEEPINTVL EQUAL NUMBER {
979 tcp_default_cfg.keepintvl=$3;
981 warn("tcp support not compiled in");
984 | TCP_OPT_KEEPINTVL EQUAL error { yyerror("number expected"); }
985 | TCP_OPT_KEEPCNT EQUAL NUMBER {
987 tcp_default_cfg.keepcnt=$3;
989 warn("tcp support not compiled in");
992 | TCP_OPT_KEEPCNT EQUAL error { yyerror("number expected"); }
993 | TCP_OPT_CRLF_PING EQUAL NUMBER {
995 tcp_default_cfg.crlf_ping=$3;
997 warn("tcp support not compiled in");
1000 | TCP_OPT_CRLF_PING EQUAL error { yyerror("boolean value expected"); }
1001 | DISABLE_TLS EQUAL NUMBER {
1005 warn("tls support not compiled in");
1008 | DISABLE_TLS EQUAL error { yyerror("boolean value expected"); }
1009 | ENABLE_TLS EQUAL NUMBER {
1013 warn("tls support not compiled in");
1016 | ENABLE_TLS EQUAL error { yyerror("boolean value expected"); }
1017 | TLSLOG EQUAL NUMBER {
1021 warn("tls-in-core support not compiled in");
1024 | TLSLOG EQUAL error { yyerror("int value expected"); }
1025 | TLS_PORT_NO EQUAL NUMBER {
1029 warn("tls support not compiled in");
1032 | TLS_PORT_NO EQUAL error { yyerror("number expected"); }
1033 | TLS_METHOD EQUAL SSLv23 {
1035 tls_method=TLS_USE_SSLv23;
1037 warn("tls-in-core support not compiled in");
1040 | TLS_METHOD EQUAL SSLv2 {
1042 tls_method=TLS_USE_SSLv2;
1044 warn("tls-in-core support not compiled in");
1047 | TLS_METHOD EQUAL SSLv3 {
1049 tls_method=TLS_USE_SSLv3;
1051 warn("tls-in-core support not compiled in");
1054 | TLS_METHOD EQUAL TLSv1 {
1056 tls_method=TLS_USE_TLSv1;
1058 warn("tls-in-core support not compiled in");
1061 | TLS_METHOD EQUAL error {
1063 yyerror("SSLv23, SSLv2, SSLv3 or TLSv1 expected");
1065 warn("tls-in-core support not compiled in");
1068 | TLS_VERIFY EQUAL NUMBER {
1072 warn("tls-in-core support not compiled in");
1075 | TLS_VERIFY EQUAL error { yyerror("boolean value expected"); }
1076 | TLS_REQUIRE_CERTIFICATE EQUAL NUMBER {
1078 tls_require_cert=$3;
1080 warn( "tls-in-core support not compiled in");
1083 | TLS_REQUIRE_CERTIFICATE EQUAL error { yyerror("boolean value expected"); }
1084 | TLS_CERTIFICATE EQUAL STRING {
1088 warn("tls-in-core support not compiled in");
1091 | TLS_CERTIFICATE EQUAL error { yyerror("string value expected"); }
1092 | TLS_PRIVATE_KEY EQUAL STRING {
1096 warn("tls-in-core support not compiled in");
1099 | TLS_PRIVATE_KEY EQUAL error { yyerror("string value expected"); }
1100 | TLS_CA_LIST EQUAL STRING {
1104 warn("tls-in-core support not compiled in");
1107 | TLS_CA_LIST EQUAL error { yyerror("string value expected"); }
1108 | TLS_HANDSHAKE_TIMEOUT EQUAL NUMBER {
1110 tls_handshake_timeout=$3;
1112 warn("tls-in-core support not compiled in");
1115 | TLS_HANDSHAKE_TIMEOUT EQUAL error { yyerror("number expected"); }
1116 | TLS_SEND_TIMEOUT EQUAL NUMBER {
1118 tls_send_timeout=$3;
1120 warn("tls-in-core support not compiled in");
1123 | TLS_SEND_TIMEOUT EQUAL error { yyerror("number expected"); }
1124 | DISABLE_SCTP EQUAL NUMBER {
1128 warn("sctp support not compiled in");
1131 | DISABLE_SCTP EQUAL error { yyerror("boolean value expected"); }
1132 | ENABLE_SCTP EQUAL NUMBER {
1134 sctp_disable=($3<=1)?!$3:$3;
1136 warn("sctp support not compiled in");
1139 | ENABLE_SCTP EQUAL error { yyerror("boolean or number expected"); }
1140 | SCTP_CHILDREN EQUAL NUMBER {
1142 sctp_children_no=$3;
1144 warn("sctp support not compiled in");
1147 | SCTP_CHILDREN EQUAL error { yyerror("number expected"); }
1148 | SCTP_SOCKET_RCVBUF EQUAL NUMBER {
1150 sctp_options.sctp_so_rcvbuf=$3;
1152 warn("sctp support not compiled in");
1155 | SCTP_SOCKET_RCVBUF EQUAL error { yyerror("number expected"); }
1156 | SCTP_SOCKET_SNDBUF EQUAL NUMBER {
1158 sctp_options.sctp_so_sndbuf=$3;
1160 warn("sctp support not compiled in");
1163 | SCTP_SOCKET_SNDBUF EQUAL error { yyerror("number expected"); }
1164 | SCTP_AUTOCLOSE EQUAL NUMBER {
1166 sctp_options.sctp_autoclose=$3;
1168 warn("sctp support not compiled in");
1171 | SCTP_AUTOCLOSE EQUAL error { yyerror("number expected"); }
1172 | SCTP_SEND_TTL EQUAL NUMBER {
1174 sctp_options.sctp_send_ttl=$3;
1176 warn("sctp support not compiled in");
1179 | SCTP_SEND_TTL EQUAL error { yyerror("number expected"); }
1180 | SCTP_SEND_RETRIES EQUAL NUMBER {
1182 sctp_options.sctp_send_retries=$3;
1184 warn("sctp support not compiled in");
1187 | SCTP_SEND_RETRIES EQUAL error { yyerror("number expected"); }
1188 | SERVER_SIGNATURE EQUAL NUMBER { server_signature=$3; }
1189 | SERVER_SIGNATURE EQUAL error { yyerror("boolean value expected"); }
1190 | REPLY_TO_VIA EQUAL NUMBER { reply_to_via=$3; }
1191 | REPLY_TO_VIA EQUAL error { yyerror("boolean value expected"); }
1192 | LISTEN EQUAL id_lst {
1193 for(lst_tmp=$3; lst_tmp; lst_tmp=lst_tmp->next) {
1194 if (add_listen_iface( lst_tmp->addr_lst->name,
1195 lst_tmp->addr_lst->next,
1196 lst_tmp->port, lst_tmp->proto,
1197 lst_tmp->flags)!=0) {
1198 LOG(L_CRIT, "ERROR: cfg. parser: failed to add listen"
1203 free_socket_id_lst($3);
1205 | LISTEN EQUAL error { yyerror("ip address or hostname expected"); }
1206 | ALIAS EQUAL id_lst {
1207 for(lst_tmp=$3; lst_tmp; lst_tmp=lst_tmp->next){
1208 add_alias( lst_tmp->addr_lst->name,
1209 strlen(lst_tmp->addr_lst->name),
1210 lst_tmp->port, lst_tmp->proto);
1211 for (nl_tmp=lst_tmp->addr_lst->next; nl_tmp; nl_tmp=nl_tmp->next)
1212 add_alias(nl_tmp->name, strlen(nl_tmp->name),
1213 lst_tmp->port, lst_tmp->proto);
1215 free_socket_id_lst($3);
1217 | ALIAS EQUAL error { yyerror(" hostname expected"); }
1218 | ADVERTISED_ADDRESS EQUAL listen_id {
1219 default_global_address.s=$3;
1220 default_global_address.len=strlen($3);
1222 | ADVERTISED_ADDRESS EQUAL error {yyerror("ip address or hostname expected"); }
1223 | ADVERTISED_PORT EQUAL NUMBER {
1224 tmp=int2str($3, &i_tmp);
1225 if ((default_global_port.s=pkg_malloc(i_tmp))==0) {
1226 LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
1227 default_global_port.len=0;
1229 default_global_port.len=i_tmp;
1230 memcpy(default_global_port.s, tmp, default_global_port.len);
1233 |ADVERTISED_PORT EQUAL error {yyerror("ip address or hostname expected"); }
1234 | DISABLE_CORE EQUAL NUMBER { disable_core_dump=$3; }
1235 | DISABLE_CORE EQUAL error { yyerror("boolean value expected"); }
1236 | OPEN_FD_LIMIT EQUAL NUMBER { open_files_limit=$3; }
1237 | OPEN_FD_LIMIT EQUAL error { yyerror("number expected"); }
1238 | SHM_FORCE_ALLOC EQUAL NUMBER { shm_force_alloc=$3; }
1239 | SHM_FORCE_ALLOC EQUAL error { yyerror("boolean value expected"); }
1240 | MLOCK_PAGES EQUAL NUMBER { mlock_pages=$3; }
1241 | MLOCK_PAGES EQUAL error { yyerror("boolean value expected"); }
1242 | REAL_TIME EQUAL NUMBER { real_time=$3; }
1243 | REAL_TIME EQUAL error { yyerror("boolean value expected"); }
1244 | RT_PRIO EQUAL NUMBER { rt_prio=$3; }
1245 | RT_PRIO EQUAL error { yyerror("boolean value expected"); }
1246 | RT_POLICY EQUAL NUMBER { rt_policy=$3; }
1247 | RT_POLICY EQUAL error { yyerror("boolean value expected"); }
1248 | RT_TIMER1_PRIO EQUAL NUMBER { rt_timer1_prio=$3; }
1249 | RT_TIMER1_PRIO EQUAL error { yyerror("boolean value expected"); }
1250 | RT_TIMER1_POLICY EQUAL NUMBER { rt_timer1_policy=$3; }
1251 | RT_TIMER1_POLICY EQUAL error { yyerror("boolean value expected"); }
1252 | RT_TIMER2_PRIO EQUAL NUMBER { rt_timer2_prio=$3; }
1253 | RT_TIMER2_PRIO EQUAL error { yyerror("boolean value expected"); }
1254 | RT_TIMER2_POLICY EQUAL NUMBER { rt_timer2_policy=$3; }
1255 | RT_TIMER2_POLICY EQUAL error { yyerror("boolean value expected"); }
1256 | MCAST_LOOPBACK EQUAL NUMBER {
1260 warn("no multicast support compiled in");
1263 | MCAST_LOOPBACK EQUAL error { yyerror("boolean value expected"); }
1264 | MCAST_TTL EQUAL NUMBER {
1268 warn("no multicast support compiled in");
1271 | MCAST_TTL EQUAL error { yyerror("number expected"); }
1272 | TOS EQUAL NUMBER { tos=$3; }
1273 | TOS EQUAL error { yyerror("number expected"); }
1274 | PMTU_DISCOVERY EQUAL NUMBER { pmtu_discovery=$3; }
1275 | PMTU_DISCOVERY error { yyerror("number expected"); }
1276 | KILL_TIMEOUT EQUAL NUMBER { ser_kill_timeout=$3; }
1277 | KILL_TIMEOUT EQUAL error { yyerror("number expected"); }
1278 | STUN_REFRESH_INTERVAL EQUAL NUMBER { IF_STUN(stun_refresh_interval=$3); }
1279 | STUN_REFRESH_INTERVAL EQUAL error{ yyerror("number expected"); }
1280 | STUN_ALLOW_STUN EQUAL NUMBER { IF_STUN(stun_allow_stun=$3); }
1281 | STUN_ALLOW_STUN EQUAL error{ yyerror("number expected"); }
1282 | STUN_ALLOW_FP EQUAL NUMBER { IF_STUN(stun_allow_fp=$3) ; }
1283 | STUN_ALLOW_FP EQUAL error{ yyerror("number expected"); }
1284 | SERVER_ID EQUAL NUMBER { server_id=$3; }
1285 | UDP_MTU EQUAL NUMBER { default_core_cfg.udp_mtu=$3; }
1286 | UDP_MTU EQUAL error { yyerror("number expected"); }
1287 | FORCE_RPORT EQUAL NUMBER
1288 { default_core_cfg.force_rport=$3; fix_global_req_flags(0); }
1289 | FORCE_RPORT EQUAL error { yyerror("boolean value expected"); }
1290 | UDP_MTU_TRY_PROTO EQUAL proto
1291 { default_core_cfg.udp_mtu_try_proto=$3; fix_global_req_flags(0); }
1292 | UDP_MTU_TRY_PROTO EQUAL error
1293 { yyerror("TCP, TLS, SCTP or UDP expected"); }
1295 | error EQUAL { yyerror("unknown config variable"); }
1298 ID DOT ID EQUAL NUMBER {
1299 if (cfg_declare_int($1, $3, $5, 0, 0, NULL)) {
1300 yyerror("variable cannot be declared");
1303 | ID DOT ID EQUAL STRING {
1304 if (cfg_declare_str($1, $3, $5, NULL)) {
1305 yyerror("variable cannot be declared");
1308 | ID DOT ID EQUAL NUMBER CFG_DESCRIPTION STRING {
1309 if (cfg_declare_int($1, $3, $5, 0, 0, $7)) {
1310 yyerror("variable cannot be declared");
1313 | ID DOT ID EQUAL STRING CFG_DESCRIPTION STRING {
1314 if (cfg_declare_str($1, $3, $5, $7)) {
1315 yyerror("variable cannot be declared");
1318 | ID DOT ID EQUAL error { yyerror("number or string expected"); }
1322 DBG("loading module %s\n", $2);
1323 if (load_module($2)!=0) {
1324 yyerror("failed to load module");
1327 | LOADMODULE error { yyerror("string expected"); }
1329 DBG("loading modules under %s\n", $2);
1330 printf("loading modules under %s\n", $2);
1333 | LOADPATH error { yyerror("string expected"); }
1334 | MODPARAM LPAREN STRING COMMA STRING COMMA STRING RPAREN {
1335 if (set_mod_param_regex($3, $5, PARAM_STRING, $7) != 0) {
1336 yyerror("Can't set module parameter");
1339 | MODPARAM LPAREN STRING COMMA STRING COMMA NUMBER RPAREN {
1340 if (set_mod_param_regex($3, $5, PARAM_INT, (void*)$7) != 0) {
1341 yyerror("Can't set module parameter");
1344 | MODPARAM error { yyerror("Invalid arguments"); }
1351 NUMBER DOT NUMBER DOT NUMBER DOT NUMBER {
1352 $$=pkg_malloc(sizeof(struct ip_addr));
1354 LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
1356 memset($$, 0, sizeof(struct ip_addr));
1359 if (($1>255) || ($1<0) ||
1360 ($3>255) || ($3<0) ||
1361 ($5>255) || ($5<0) ||
1362 ($7>255) || ($7<0)) {
1363 yyerror("invalid ipv4 address");
1373 ($3<<16)| ($5<<8)|$7 );
1381 $$=pkg_malloc(sizeof(struct ip_addr));
1383 LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
1386 memset($$, 0, sizeof(struct ip_addr));
1389 if (inet_pton(AF_INET6, $1, $$->u.addr)<=0) {
1390 yyerror("bad ipv6 address");
1393 yyerror("ipv6 address & no ipv6 support compiled in");
1401 | LBRACK ipv6addr RBRACK {$$=$2; }
1405 route_name: NUMBER {
1406 tmp=int2str($1, &i_tmp);
1407 if (($$=pkg_malloc(i_tmp+1))==0) {
1408 yyerror("out of memory");
1411 memcpy($$, tmp, i_tmp);
1420 ROUTE LBRACE actions RBRACE { push($3, &main_rt.rlist[DEFAULT_RT]); }
1421 | ROUTE LBRACK route_name RBRACK LBRACE actions RBRACE {
1422 i_tmp=route_get(&main_rt, $3);
1424 yyerror("internal error");
1427 if (main_rt.rlist[i_tmp]){
1428 yyerror("duplicate route");
1431 push($6, &main_rt.rlist[i_tmp]);
1433 | ROUTE error { yyerror("invalid route statement"); }
1436 ROUTE_FAILURE LBRACE actions RBRACE {
1437 push($3, &failure_rt.rlist[DEFAULT_RT]);
1439 | ROUTE_FAILURE LBRACK route_name RBRACK LBRACE actions RBRACE {
1440 i_tmp=route_get(&failure_rt, $3);
1442 yyerror("internal error");
1445 if (failure_rt.rlist[i_tmp]){
1446 yyerror("duplicate route");
1449 push($6, &failure_rt.rlist[i_tmp]);
1451 | ROUTE_FAILURE error { yyerror("invalid failure_route statement"); }
1454 ROUTE_ONREPLY LBRACE actions RBRACE {
1455 push($3, &onreply_rt.rlist[DEFAULT_RT]);
1457 | ROUTE_ONREPLY LBRACK route_name RBRACK LBRACE actions RBRACE {
1458 i_tmp=route_get(&onreply_rt, $3);
1460 yyerror("internal error");
1463 if (onreply_rt.rlist[i_tmp]){
1464 yyerror("duplicate route");
1467 push($6, &onreply_rt.rlist[i_tmp]);
1469 | ROUTE_ONREPLY error { yyerror("invalid onreply_route statement"); }
1472 ROUTE_BRANCH LBRACE actions RBRACE {
1473 push($3, &branch_rt.rlist[DEFAULT_RT]);
1475 | ROUTE_BRANCH LBRACK route_name RBRACK LBRACE actions RBRACE {
1476 i_tmp=route_get(&branch_rt, $3);
1478 yyerror("internal error");
1481 if (branch_rt.rlist[i_tmp]){
1482 yyerror("duplicate route");
1485 push($6, &branch_rt.rlist[i_tmp]);
1487 | ROUTE_BRANCH error { yyerror("invalid branch_route statement"); }
1489 send_route_stm: ROUTE_SEND LBRACE actions RBRACE {
1490 push($3, &onsend_rt.rlist[DEFAULT_RT]);
1492 | ROUTE_SEND LBRACK route_name RBRACK LBRACE actions RBRACE {
1493 i_tmp=route_get(&onsend_rt, $3);
1495 yyerror("internal error");
1498 if (onsend_rt.rlist[i_tmp]){
1499 yyerror("duplicate route");
1502 push($6, &onsend_rt.rlist[i_tmp]);
1504 | ROUTE_SEND error { yyerror("invalid onsend_route statement"); }
1508 rules rule { push($2, &$1); $$=$1; }
1510 | rules error { $$=0; yyerror("invalid rule"); }
1513 condition actions CR {
1515 if (add_rule($1, $2, &$$)<0) {
1516 yyerror("error calling add_rule");
1521 | condition error { $$=0; yyerror("bad actions in rule"); }
1526 exp: exp LOG_AND exp { $$=mk_exp(LOGAND_OP, $1, $3); }
1527 | exp LOG_OR exp { $$=mk_exp(LOGOR_OP, $1, $3); }
1528 | NOT exp { $$=mk_exp(NOT_OP, $2, 0); }
1529 | LPAREN exp RPAREN { $$=$2; }
1530 | exp_elem { $$=$1; }
1533 EQUAL_T {$$=EQUAL_OP; }
1534 | DIFF {$$=DIFF_OP; }
1536 intop: equalop {$$=$1; }
1543 BIN_OR { $$= BINOR_OP; }
1544 | BIN_AND { $$ = BINAND_OP; }
1548 | MATCH {$$=MATCH_OP; }
1552 | FROM_URI {$$=FROM_URI_O;}
1553 | TO_URI {$$=TO_URI_O;}
1557 METHOD strop STRING {$$= mk_elem($2, METHOD_O, 0, STRING_ST, $3);}
1558 | METHOD strop attr_id_val {$$ = mk_elem($2, METHOD_O, 0, AVP_ST, $3); }
1559 | METHOD strop select_id {$$ = mk_elem($2, METHOD_O, 0, SELECT_ST, $3); }
1560 | METHOD strop ID {$$ = mk_elem($2, METHOD_O, 0, STRING_ST,$3); }
1561 | METHOD strop error { $$=0; yyerror("string expected"); }
1562 | METHOD error { $$=0; yyerror("invalid operator,== , !=, or =~ expected"); }
1563 | uri_type strop STRING {$$ = mk_elem($2, $1, 0, STRING_ST, $3); }
1564 | uri_type strop host {$$ = mk_elem($2, $1, 0, STRING_ST, $3); }
1565 | uri_type strop attr_id_val {$$ = mk_elem($2, $1, 0, AVP_ST, $3); }
1566 | uri_type strop select_id {$$ = mk_elem($2, $1, 0, SELECT_ST, $3); }
1567 | uri_type equalop MYSELF {$$=mk_elem($2, $1, 0, MYSELF_ST, 0); }
1568 | uri_type strop error { $$=0; yyerror("string or MYSELF expected"); }
1569 | uri_type error { $$=0; yyerror("invalid operator, == , != or =~ expected"); }
1571 | SRCPORT intop NUMBER { $$=mk_elem($2, SRCPORT_O, 0, NUMBER_ST, (void*)$3 ); }
1572 | SRCPORT intop attr_id_val { $$=mk_elem($2, SRCPORT_O, 0, AVP_ST, (void*)$3 ); }
1573 | SRCPORT intop error { $$=0; yyerror("number expected"); }
1574 | SRCPORT error { $$=0; yyerror("==, !=, <,>, >= or <= expected"); }
1576 | DSTPORT intop NUMBER { $$=mk_elem($2, DSTPORT_O, 0, NUMBER_ST, (void*)$3 ); }
1577 | DSTPORT intop attr_id_val { $$=mk_elem($2, DSTPORT_O, 0, AVP_ST, (void*)$3 ); }
1578 | DSTPORT intop error { $$=0; yyerror("number expected"); }
1579 | DSTPORT error { $$=0; yyerror("==, !=, <,>, >= or <= expected"); }
1581 | SNDPORT intop NUMBER {
1582 onsend_check("snd_port");
1583 $$=mk_elem($2, SNDPORT_O, 0, NUMBER_ST, (void*)$3 );
1585 | SNDPORT intop attr_id_val {
1586 onsend_check("snd_port");
1587 $$=mk_elem($2, SNDPORT_O, 0, AVP_ST, (void*)$3 );
1589 | SNDPORT intop error { $$=0; yyerror("number expected"); }
1590 | SNDPORT error { $$=0; yyerror("==, !=, <,>, >= or <= expected"); }
1592 | TOPORT intop NUMBER {
1593 onsend_check("to_port");
1594 $$=mk_elem($2, TOPORT_O, 0, NUMBER_ST, (void*)$3 );
1596 | TOPORT intop attr_id_val {
1597 onsend_check("to_port");
1598 $$=mk_elem($2, TOPORT_O, 0, AVP_ST, (void*)$3 );
1600 | TOPORT intop error { $$=0; yyerror("number expected"); }
1601 | TOPORT error { $$=0; yyerror("==, !=, <,>, >= or <= expected"); }
1603 | PROTO intop proto { $$=mk_elem($2, PROTO_O, 0, NUMBER_ST, (void*)$3 ); }
1604 | PROTO intop attr_id_val { $$=mk_elem($2, PROTO_O, 0, AVP_ST, (void*)$3 ); }
1605 | PROTO intop error { $$=0; yyerror("protocol expected (udp, tcp or tls)"); }
1607 | PROTO error { $$=0; yyerror("equal/!= operator expected"); }
1609 | SNDPROTO intop proto {
1610 onsend_check("snd_proto");
1611 $$=mk_elem($2, SNDPROTO_O, 0, NUMBER_ST, (void*)$3 );
1613 | SNDPROTO intop attr_id_val {
1614 onsend_check("snd_proto");
1615 $$=mk_elem($2, SNDPROTO_O, 0, AVP_ST, (void*)$3 );
1617 | SNDPROTO intop error { $$=0; yyerror("protocol expected (udp, tcp or tls)"); }
1618 | SNDPROTO error { $$=0; yyerror("equal/!= operator expected"); }
1620 | AF intop NUMBER { $$=mk_elem($2, AF_O, 0, NUMBER_ST,(void *) $3 ); }
1621 | AF intop attr_id_val { $$=mk_elem($2, AF_O, 0, AVP_ST,(void *) $3 ); }
1622 | AF intop error { $$=0; yyerror("number expected"); }
1623 | AF error { $$=0; yyerror("equal/!= operator expected"); }
1625 | SNDAF intop NUMBER {
1626 onsend_check("snd_af");
1627 $$=mk_elem($2, SNDAF_O, 0, NUMBER_ST, (void *) $3 ); }
1628 | SNDAF intop attr_id_val {
1629 onsend_check("snd_af");
1630 $$=mk_elem($2, SNDAF_O, 0, AVP_ST, (void *) $3 );
1632 | SNDAF intop error { $$=0; yyerror("number expected"); }
1633 | SNDAF error { $$=0; yyerror("equal/!= operator expected"); }
1635 | MSGLEN intop NUMBER { $$=mk_elem($2, MSGLEN_O, 0, NUMBER_ST, (void *) $3 ); }
1636 | MSGLEN intop attr_id_val { $$=mk_elem($2, MSGLEN_O, 0, AVP_ST, (void *) $3 ); }
1637 | MSGLEN intop MAX_LEN { $$=mk_elem($2, MSGLEN_O, 0, NUMBER_ST, (void *) BUF_SIZE); }
1638 | MSGLEN intop error { $$=0; yyerror("number expected"); }
1639 | MSGLEN error { $$=0; yyerror("equal/!= operator expected"); }
1641 | RETCODE intop NUMBER { $$=mk_elem($2, RETCODE_O, 0, NUMBER_ST, (void *) $3 ); }
1642 | RETCODE intop attr_id_val { $$=mk_elem($2, RETCODE_O, 0, AVP_ST, (void *) $3 ); }
1643 | RETCODE intop error { $$=0; yyerror("number expected"); }
1644 | RETCODE error { $$=0; yyerror("equal/!= operator expected"); }
1646 | SRCIP equalop ipnet { $$=mk_elem($2, SRCIP_O, 0, NET_ST, $3); }
1647 | SRCIP strop STRING {
1649 s_tmp.len=strlen($3);
1650 ip_tmp=str2ip(&s_tmp);
1653 ip_tmp=str2ip6(&s_tmp);
1656 $$=mk_elem($2, SRCIP_O, 0, NET_ST, mk_net_bitlen(ip_tmp, ip_tmp->len*8) );
1658 $$=mk_elem($2, SRCIP_O, 0, STRING_ST, $3);
1661 | SRCIP strop host { $$=mk_elem($2, SRCIP_O, 0, STRING_ST, $3); }
1662 | SRCIP equalop MYSELF { $$=mk_elem($2, SRCIP_O, 0, MYSELF_ST, 0);
1664 | SRCIP strop error { $$=0; yyerror( "ip address or hostname expected" ); }
1665 | SRCIP error { $$=0; yyerror("invalid operator, ==, != or =~ expected");}
1666 | DSTIP equalop ipnet { $$=mk_elem( $2, DSTIP_O, 0, NET_ST, (void*)$3); }
1667 | DSTIP strop STRING {
1669 s_tmp.len=strlen($3);
1670 ip_tmp=str2ip(&s_tmp);
1673 ip_tmp=str2ip6(&s_tmp);
1674 #endif /* USE_IPV6 */
1676 $$=mk_elem($2, DSTIP_O, 0, NET_ST, mk_net_bitlen(ip_tmp, ip_tmp->len*8) );
1678 $$=mk_elem($2, DSTIP_O, 0, STRING_ST, $3);
1681 | DSTIP strop host { $$=mk_elem( $2, DSTIP_O, 0, STRING_ST, $3); }
1682 | DSTIP equalop MYSELF { $$=mk_elem( $2, DSTIP_O, 0, MYSELF_ST, 0); }
1683 | DSTIP strop error { $$=0; yyerror( "ip address or hostname expected" ); }
1684 | DSTIP error { $$=0; yyerror("invalid operator, ==, != or =~ expected"); }
1685 | SNDIP equalop ipnet {
1686 onsend_check("snd_ip");
1687 $$=mk_elem($2, SNDIP_O, 0, NET_ST, $3);
1689 | SNDIP strop STRING {
1690 onsend_check("snd_ip");
1692 s_tmp.len=strlen($3);
1693 ip_tmp=str2ip(&s_tmp);
1696 ip_tmp=str2ip6(&s_tmp);
1697 #endif /* USE_IPV6 */
1699 $$=mk_elem($2, SNDIP_O, 0, NET_ST, mk_net_bitlen(ip_tmp, ip_tmp->len*8) );
1701 $$=mk_elem($2, SNDIP_O, 0, STRING_ST, $3);
1704 | SNDIP strop host {
1705 onsend_check("snd_ip");
1706 $$=mk_elem($2, SNDIP_O, 0, STRING_ST, $3);
1708 | SNDIP equalop attr_id_val {
1709 onsend_check("snd_ip");
1710 $$=mk_elem($2, SNDIP_O, 0, AVP_ST, (void*)$3 );
1712 | SNDIP equalop MYSELF {
1713 onsend_check("snd_ip");
1714 $$=mk_elem($2, SNDIP_O, 0, MYSELF_ST, 0);
1716 | SNDIP strop error { $$=0; yyerror( "ip address or hostname expected" ); }
1717 | SNDIP error { $$=0; yyerror("invalid operator, ==, != or =~ expected"); }
1718 | TOIP equalop ipnet {
1719 onsend_check("to_ip");
1720 $$=mk_elem($2, TOIP_O, 0, NET_ST, $3);
1722 | TOIP strop STRING {
1723 onsend_check("to_ip");
1725 s_tmp.len=strlen($3);
1726 ip_tmp=str2ip(&s_tmp);
1729 ip_tmp=str2ip6(&s_tmp);
1730 #endif /* USE_IPV6 */
1732 $$=mk_elem($2, TOIP_O, 0, NET_ST, mk_net_bitlen(ip_tmp, ip_tmp->len*8) );
1734 $$=mk_elem($2, TOIP_O, 0, STRING_ST, $3);
1738 onsend_check("to_ip");
1739 $$=mk_elem($2, TOIP_O, 0, STRING_ST, $3);
1741 | TOIP equalop attr_id_val {
1742 onsend_check("to_ip");
1743 $$=mk_elem($2, TOIP_O, 0, AVP_ST, (void*)$3 );
1745 | TOIP equalop MYSELF {
1746 onsend_check("to_ip");
1747 $$=mk_elem($2, TOIP_O, 0, MYSELF_ST, 0);
1749 | TOIP strop error { $$=0; yyerror( "ip address or hostname expected" ); }
1750 | TOIP error { $$=0; yyerror("invalid operator, ==, != or =~ expected"); }
1752 | MYSELF equalop uri_type { $$=mk_elem($2, $3, 0, MYSELF_ST, 0); }
1753 | MYSELF equalop SRCIP { $$=mk_elem($2, SRCIP_O, 0, MYSELF_ST, 0); }
1754 | MYSELF equalop DSTIP { $$=mk_elem($2, DSTIP_O, 0, MYSELF_ST, 0); }
1755 | MYSELF equalop SNDIP {
1756 onsend_check("snd_ip");
1757 $$=mk_elem($2, SNDIP_O, 0, MYSELF_ST, 0);
1759 | MYSELF equalop TOIP {
1760 onsend_check("to_ip");
1761 $$=mk_elem($2, TOIP_O, 0, MYSELF_ST, 0);
1763 | MYSELF equalop error { $$=0; yyerror(" URI, SRCIP or DSTIP expected"); }
1764 | MYSELF error { $$=0; yyerror ("invalid operator, == or != expected"); }
1765 | exp_stm { $$=mk_elem( NO_OP, ACTION_O, 0, ACTIONS_ST, $1); }
1766 | NUMBER { $$=mk_elem( NO_OP, NUMBER_O, 0, NUMBER_ST, (void*)$1 ); }
1768 | attr_id_any {$$=mk_elem( NO_OP, AVP_O, (void*)$1, 0, 0); }
1769 | attr_id_val strop STRING {$$=mk_elem( $2, AVP_O, (void*)$1, STRING_ST, $3); }
1770 | attr_id_val strop select_id {$$=mk_elem( $2, AVP_O, (void*)$1, SELECT_ST, $3); }
1771 | attr_id_val intop NUMBER {$$=mk_elem( $2, AVP_O, (void*)$1, NUMBER_ST, (void*)$3); }
1772 | attr_id_val binop NUMBER {$$=mk_elem( $2, AVP_O, (void*)$1, NUMBER_ST, (void*)$3); }
1773 | attr_id_val strop attr_id_val {$$=mk_elem( $2, AVP_O, (void*)$1, AVP_ST, (void*)$3); }
1774 | attr_id_val intop attr_id_val {$$=mk_elem( $2, AVP_O, (void*)$1, AVP_ST, (void*)$3); }
1776 | select_id { $$=mk_elem( NO_OP, SELECT_O, $1, 0, 0); }
1777 | select_id strop STRING { $$=mk_elem( $2, SELECT_O, $1, STRING_ST, $3); }
1778 | select_id strop attr_id_val { $$=mk_elem( $2, SELECT_O, $1, AVP_ST, (void*)$3); }
1779 | select_id strop select_id { $$=mk_elem( $2, SELECT_O, $1, SELECT_ST, $3); }
1782 ip SLASH ip { $$=mk_net($1, $3); }
1784 if (($3<0) || ($3>$1->len*8)) {
1785 yyerror("invalid bit number in netmask");
1788 $$=mk_net_bitlen($1, $3);
1790 $$=mk_net($1, htonl( ($3)?~( (1<<(32-$3))-1 ):0 ) );
1794 | ip { $$=mk_net_bitlen($1, $1->len*8); }
1795 | ip SLASH error { $$=0; yyerror("netmask (eg:255.0.0.0 or 8) expected"); }
1804 | host host_sep ID {
1805 $$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1);
1807 LOG(L_CRIT, "ERROR: cfg. parser: memory allocation failure while parsing host\n");
1809 memcpy($$, $1, strlen($1));
1811 memcpy($$+strlen($1)+1, $3, strlen($3));
1812 $$[strlen($1)+1+strlen($3)]=0;
1817 | host DOT error { $$=0; pkg_free($1); yyerror("invalid hostname"); }
1822 /* check if allowed */
1823 if ($1 && rt==ONSEND_ROUTE) {
1838 yyerror("command not allowed in onsend_route\n");
1848 | assign_action { $$ = $1; }
1849 | LBRACE actions RBRACE { $$=$2; }
1853 | LBRACE actions RBRACE { $$=$2; }
1856 actions action {$$=append_action($1, $2); }
1858 | actions error { $$=0; yyerror("bad command"); }
1861 fcmd SEMICOLON {$$=$1;}
1863 | assign_action SEMICOLON {$$=$1;}
1864 | SEMICOLON /* null action */ {$$=0;}
1865 | fcmd error { $$=0; yyerror("bad command: missing ';'?"); }
1868 IF exp stm { $$=mk_action( IF_T, 3, EXPR_ST, $2, ACTIONS_ST, $3, NOSUBTYPE, 0); }
1869 | IF exp stm ELSE stm { $$=mk_action( IF_T, 3, EXPR_ST, $2, ACTIONS_ST, $3, ACTIONS_ST, $5); }
1872 LBRACK ATTR_USER RBRACK { $$ = AVP_CLASS_USER; }
1873 | LBRACK ATTR_DOMAIN RBRACK { $$ = AVP_CLASS_DOMAIN; }
1874 | LBRACK ATTR_GLOBAL RBRACK { $$ = AVP_CLASS_GLOBAL; }
1879 if (sel.n >= MAX_SELECT_PARAMS-1) {
1880 yyerror("Select identifier too long\n");
1882 sel.params[sel.n].type = SEL_PARAM_STR;
1883 sel.params[sel.n].v.s.s = $1;
1884 sel.params[sel.n].v.s.len = strlen($1);
1887 | ID LBRACK NUMBER RBRACK {
1888 if (sel.n >= MAX_SELECT_PARAMS-2) {
1889 yyerror("Select identifier too long\n");
1891 sel.params[sel.n].type = SEL_PARAM_STR;
1892 sel.params[sel.n].v.s.s = $1;
1893 sel.params[sel.n].v.s.len = strlen($1);
1895 sel.params[sel.n].type = SEL_PARAM_INT;
1896 sel.params[sel.n].v.i = $3;
1899 | ID LBRACK STRING RBRACK {
1900 if (sel.n >= MAX_SELECT_PARAMS-2) {
1901 yyerror("Select identifier too long\n");
1903 sel.params[sel.n].type = SEL_PARAM_STR;
1904 sel.params[sel.n].v.s.s = $1;
1905 sel.params[sel.n].v.s.len = strlen($1);
1907 sel.params[sel.n].type = SEL_PARAM_STR;
1908 sel.params[sel.n].v.s.s = $3;
1909 sel.params[sel.n].v.s.len = strlen($3);
1914 select_params DOT select_param
1918 SELECT_MARK { sel.n = 0; sel.f[0] = 0; } select_params {
1919 sel_ptr = (select_t*)pkg_malloc(sizeof(select_t));
1921 yyerror("No memory left to allocate select structure\n");
1923 memcpy(sel_ptr, &sel, sizeof(select_t));
1928 ATTR_FROM { s_attr->type |= AVP_TRACK_FROM; }
1929 | ATTR_TO { s_attr->type |= AVP_TRACK_TO; }
1930 | ATTR_FROMURI { s_attr->type |= AVP_TRACK_FROM | AVP_CLASS_URI; }
1931 | ATTR_TOURI { s_attr->type |= AVP_TRACK_TO | AVP_CLASS_URI; }
1932 | ATTR_FROMUSER { s_attr->type |= AVP_TRACK_FROM | AVP_CLASS_USER; }
1933 | ATTR_TOUSER { s_attr->type |= AVP_TRACK_TO | AVP_CLASS_USER; }
1934 | ATTR_FROMDOMAIN { s_attr->type |= AVP_TRACK_FROM | AVP_CLASS_DOMAIN; }
1935 | ATTR_TODOMAIN { s_attr->type |= AVP_TRACK_TO | AVP_CLASS_DOMAIN; }
1936 | ATTR_GLOBAL { s_attr->type |= AVP_TRACK_ALL | AVP_CLASS_GLOBAL; }
1939 ID { s_attr->type |= AVP_NAME_STR; s_attr->name.s.s = $1; s_attr->name.s.len = strlen ($1); }
1943 | attr_class_spec DOT attr_name_spec
1947 s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
1948 if (!s_attr) { yyerror("No memory left"); }
1953 attr_mark attr_spec { $$ = s_attr; }
1956 attr_mark attr_spec LBRACK NUMBER RBRACK {
1957 s_attr->type|= (AVP_NAME_STR | ($4<0?AVP_INDEX_BACKWARD:AVP_INDEX_FORWARD));
1958 s_attr->index = ($4<0?-$4:$4);
1963 attr_mark attr_spec LBRACK RBRACK {
1964 s_attr->type|= AVP_INDEX_ALL;
1984 avp_spec_t *avp_spec;
1987 avp_spec = pkg_malloc(sizeof(*avp_spec));
1989 yyerror("Not enough memory");
1995 s.len = strlen(s.s);
1996 if (parse_avp_name(&s, &type, &avp_spec->name, &idx)) {
1997 yyerror("error when parsing AVP");
2001 avp_spec->type = type;
2002 avp_spec->index = idx;
2008 ADDEQ { $$ = ADD_T; }
2009 | EQUAL { $$ = ASSIGN_T; }
2013 EQUAL { $$ = ASSIGN_T; }
2016 attr_id_ass assign_op STRING { $$=mk_action($2, 2, AVP_ST, $1, STRING_ST, $3); }
2017 | attr_id_ass assign_op NUMBER { $$=mk_action($2, 2, AVP_ST, $1, NUMBER_ST, (void*)$3); }
2018 | attr_id_ass assign_op fcmd { $$=mk_action($2, 2, AVP_ST, $1, ACTION_ST, $3); }
2019 | attr_id_ass assign_op attr_id_any { $$=mk_action($2, 2, AVP_ST, $1, AVP_ST, $3); }
2020 | attr_id_ass assign_op select_id { $$=mk_action($2, 2, AVP_ST, (void*)$1, SELECT_ST, (void*)$3); }
2021 | attr_id_ass assign_op LPAREN exp RPAREN { $$ = mk_action($2, 2, AVP_ST, $1, EXPR_ST, $4); }
2024 SETAVPFLAG { $$ = 1; }
2025 | RESETAVPFLAG { $$ = 0; }
2026 | ISAVPFLAGSET { $$ = -1; }
2029 FORWARD LPAREN host RPAREN { $$=mk_action( FORWARD_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2030 | FORWARD LPAREN STRING RPAREN { $$=mk_action( FORWARD_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2031 | FORWARD LPAREN ip RPAREN { $$=mk_action( FORWARD_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); }
2032 | FORWARD LPAREN host COMMA NUMBER RPAREN { $$=mk_action(FORWARD_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2033 | FORWARD LPAREN STRING COMMA NUMBER RPAREN {$$=mk_action(FORWARD_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2034 | FORWARD LPAREN ip COMMA NUMBER RPAREN { $$=mk_action(FORWARD_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5); }
2035 | FORWARD LPAREN URIHOST COMMA URIPORT RPAREN { $$=mk_action(FORWARD_T, 2, URIHOST_ST, 0, URIPORT_ST, 0); }
2036 | FORWARD LPAREN URIHOST COMMA NUMBER RPAREN {$$=mk_action(FORWARD_T, 2, URIHOST_ST, 0, NUMBER_ST, (void*)$5); }
2037 | FORWARD LPAREN URIHOST RPAREN { $$=mk_action(FORWARD_T, 2, URIHOST_ST, 0, NUMBER_ST, 0); }
2038 | FORWARD error { $$=0; yyerror("missing '(' or ')' ?"); }
2039 | FORWARD LPAREN error RPAREN { $$=0; yyerror("bad forward argument"); }
2040 | FORWARD_UDP LPAREN host RPAREN { $$=mk_action(FORWARD_UDP_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2041 | FORWARD_UDP LPAREN STRING RPAREN { $$=mk_action(FORWARD_UDP_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2042 | FORWARD_UDP LPAREN ip RPAREN { $$=mk_action(FORWARD_UDP_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); }
2043 | FORWARD_UDP LPAREN host COMMA NUMBER RPAREN { $$=mk_action(FORWARD_UDP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2044 | FORWARD_UDP LPAREN STRING COMMA NUMBER RPAREN {$$=mk_action(FORWARD_UDP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2045 | FORWARD_UDP LPAREN ip COMMA NUMBER RPAREN { $$=mk_action(FORWARD_UDP_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5); }
2046 | FORWARD_UDP LPAREN URIHOST COMMA URIPORT RPAREN {$$=mk_action(FORWARD_UDP_T, 2, URIHOST_ST, 0, URIPORT_ST, 0); }
2047 | FORWARD_UDP LPAREN URIHOST COMMA NUMBER RPAREN { $$=mk_action(FORWARD_UDP_T, 2, URIHOST_ST, 0, NUMBER_ST, (void*)$5); }
2048 | FORWARD_UDP LPAREN URIHOST RPAREN { $$=mk_action(FORWARD_UDP_T, 2, URIHOST_ST, 0, NUMBER_ST, 0); }
2049 | FORWARD_UDP error { $$=0; yyerror("missing '(' or ')' ?"); }
2050 | FORWARD_UDP LPAREN error RPAREN { $$=0; yyerror("bad forward_udp argument"); }
2051 | FORWARD_TCP LPAREN host RPAREN { $$=mk_action(FORWARD_TCP_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2052 | FORWARD_TCP LPAREN STRING RPAREN { $$=mk_action(FORWARD_TCP_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2053 | FORWARD_TCP LPAREN ip RPAREN { $$=mk_action(FORWARD_TCP_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); }
2054 | FORWARD_TCP LPAREN host COMMA NUMBER RPAREN { $$=mk_action(FORWARD_TCP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2055 | FORWARD_TCP LPAREN STRING COMMA NUMBER RPAREN {$$=mk_action(FORWARD_TCP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2056 | FORWARD_TCP LPAREN ip COMMA NUMBER RPAREN { $$=mk_action(FORWARD_TCP_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5); }
2057 | FORWARD_TCP LPAREN URIHOST COMMA URIPORT RPAREN {$$=mk_action(FORWARD_TCP_T, 2, URIHOST_ST, 0, URIPORT_ST, 0); }
2058 | FORWARD_TCP LPAREN URIHOST COMMA NUMBER RPAREN { $$=mk_action(FORWARD_TCP_T, 2, URIHOST_ST, 0, NUMBER_ST, (void*)$5); }
2059 | FORWARD_TCP LPAREN URIHOST RPAREN { $$=mk_action(FORWARD_TCP_T, 2, URIHOST_ST, 0, NUMBER_ST, 0); }
2060 | FORWARD_TCP error { $$=0; yyerror("missing '(' or ')' ?"); }
2061 | FORWARD_TCP LPAREN error RPAREN { $$=0; yyerror("bad forward_tcp argument"); }
2062 | FORWARD_TLS LPAREN host RPAREN {
2064 $$=mk_action(FORWARD_TLS_T, 2, STRING_ST, $3, NUMBER_ST, 0);
2067 yyerror("tls support not compiled in");
2070 | FORWARD_TLS LPAREN STRING RPAREN {
2072 $$=mk_action(FORWARD_TLS_T, 2, STRING_ST, $3, NUMBER_ST, 0);
2075 yyerror("tls support not compiled in");
2078 | FORWARD_TLS LPAREN ip RPAREN {
2080 $$=mk_action(FORWARD_TLS_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0);
2083 yyerror("tls support not compiled in");
2086 | FORWARD_TLS LPAREN host COMMA NUMBER RPAREN {
2088 $$=mk_action(FORWARD_TLS_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5);
2091 yyerror("tls support not compiled in");
2094 | FORWARD_TLS LPAREN STRING COMMA NUMBER RPAREN {
2096 $$=mk_action(FORWARD_TLS_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5);
2099 yyerror("tls support not compiled in");
2102 | FORWARD_TLS LPAREN ip COMMA NUMBER RPAREN {
2104 $$=mk_action(FORWARD_TLS_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5);
2107 yyerror("tls support not compiled in");
2110 | FORWARD_TLS LPAREN URIHOST COMMA URIPORT RPAREN {
2112 $$=mk_action(FORWARD_TLS_T, 2, URIHOST_ST, 0, URIPORT_ST, 0);
2115 yyerror("tls support not compiled in");
2118 | FORWARD_TLS LPAREN URIHOST COMMA NUMBER RPAREN {
2120 $$=mk_action(FORWARD_TLS_T, 2, URIHOST_ST, 0, NUMBER_ST, (void*)$5);
2123 yyerror("tls support not compiled in");
2126 | FORWARD_TLS LPAREN URIHOST RPAREN {
2128 $$=mk_action(FORWARD_TLS_T, 2, URIHOST_ST, 0, NUMBER_ST, 0);
2131 yyerror("tls support not compiled in");
2134 | FORWARD_TLS error { $$=0; yyerror("missing '(' or ')' ?"); }
2135 | FORWARD_TLS LPAREN error RPAREN { $$=0;
2136 yyerror("bad forward_tls argument"); }
2137 | FORWARD_SCTP LPAREN host RPAREN {
2139 $$=mk_action(FORWARD_SCTP_T, 2, STRING_ST, $3, NUMBER_ST, 0);
2142 yyerror("sctp support not compiled in");
2145 | FORWARD_SCTP LPAREN STRING RPAREN {
2147 $$=mk_action(FORWARD_SCTP_T, 2, STRING_ST, $3, NUMBER_ST, 0);
2150 yyerror("sctp support not compiled in");
2153 | FORWARD_SCTP LPAREN ip RPAREN {
2155 $$=mk_action(FORWARD_SCTP_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0);
2158 yyerror("sctp support not compiled in");
2161 | FORWARD_SCTP LPAREN host COMMA NUMBER RPAREN {
2163 $$=mk_action(FORWARD_SCTP_T, 2, STRING_ST, $3, NUMBER_ST,
2167 yyerror("sctp support not compiled in");
2170 | FORWARD_SCTP LPAREN STRING COMMA NUMBER RPAREN {
2172 $$=mk_action(FORWARD_SCTP_T, 2, STRING_ST, $3, NUMBER_ST,
2176 yyerror("sctp support not compiled in");
2179 | FORWARD_SCTP LPAREN ip COMMA NUMBER RPAREN {
2181 $$=mk_action(FORWARD_SCTP_T, 2, IP_ST, (void*)$3, NUMBER_ST,
2185 yyerror("sctp support not compiled in");
2188 | FORWARD_SCTP LPAREN URIHOST COMMA URIPORT RPAREN {
2190 $$=mk_action(FORWARD_SCTP_T, 2, URIHOST_ST, 0, URIPORT_ST, 0);
2193 yyerror("sctp support not compiled in");
2196 | FORWARD_SCTP LPAREN URIHOST COMMA NUMBER RPAREN {
2198 $$=mk_action(FORWARD_SCTP_T, 2, URIHOST_ST, 0, NUMBER_ST,
2202 yyerror("sctp support not compiled in");
2205 | FORWARD_SCTP LPAREN URIHOST RPAREN {
2207 $$=mk_action(FORWARD_SCTP_T, 2, URIHOST_ST, 0, NUMBER_ST, 0);
2210 yyerror("tls support not compiled in");
2213 | FORWARD_SCTP error { $$=0; yyerror("missing '(' or ')' ?"); }
2214 | FORWARD_SCTP LPAREN error RPAREN { $$=0;
2215 yyerror("bad forward_tls argument"); }
2216 | SEND LPAREN host RPAREN { $$=mk_action(SEND_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2217 | SEND LPAREN STRING RPAREN { $$=mk_action(SEND_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2218 | SEND LPAREN ip RPAREN { $$=mk_action(SEND_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); }
2219 | SEND LPAREN host COMMA NUMBER RPAREN { $$=mk_action(SEND_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2220 | SEND LPAREN STRING COMMA NUMBER RPAREN {$$=mk_action(SEND_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2221 | SEND LPAREN ip COMMA NUMBER RPAREN { $$=mk_action(SEND_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5); }
2222 | SEND error { $$=0; yyerror("missing '(' or ')' ?"); }
2223 | SEND LPAREN error RPAREN { $$=0; yyerror("bad send argument"); }
2224 | SEND_TCP LPAREN host RPAREN { $$=mk_action(SEND_TCP_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2225 | SEND_TCP LPAREN STRING RPAREN { $$=mk_action(SEND_TCP_T, 2, STRING_ST, $3, NUMBER_ST, 0); }
2226 | SEND_TCP LPAREN ip RPAREN { $$=mk_action(SEND_TCP_T, 2, IP_ST, (void*)$3, NUMBER_ST, 0); }
2227 | SEND_TCP LPAREN host COMMA NUMBER RPAREN { $$=mk_action( SEND_TCP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5);}
2228 | SEND_TCP LPAREN STRING COMMA NUMBER RPAREN {$$=mk_action(SEND_TCP_T, 2, STRING_ST, $3, NUMBER_ST, (void*)$5); }
2229 | SEND_TCP LPAREN ip COMMA NUMBER RPAREN { $$=mk_action(SEND_TCP_T, 2, IP_ST, (void*)$3, NUMBER_ST, (void*)$5); }
2230 | SEND_TCP error { $$=0; yyerror("missing '(' or ')' ?"); }
2231 | SEND_TCP LPAREN error RPAREN { $$=0; yyerror("bad send_tcp argument"); }
2232 | DROP LPAREN RPAREN {$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, (void*)EXIT_R_F); }
2233 | DROP LPAREN NUMBER RPAREN {$$=mk_action(DROP_T, 2, NUMBER_ST, (void*)$3, NUMBER_ST, (void*)EXIT_R_F); }
2234 | DROP NUMBER {$$=mk_action(DROP_T, 2, NUMBER_ST, (void*)$2, NUMBER_ST, (void*)EXIT_R_F); }
2235 | DROP RETCODE {$$=mk_action(DROP_T, 2, RETCODE_ST, 0, NUMBER_ST, (void*)EXIT_R_F); }
2236 | DROP {$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, (void*)EXIT_R_F); }
2237 | RETURN {$$=mk_action(DROP_T, 2, NUMBER_ST, (void*)1, NUMBER_ST, (void*)RETURN_R_F); }
2238 | RETURN NUMBER {$$=mk_action(DROP_T, 2, NUMBER_ST, (void*)$2, NUMBER_ST, (void*)RETURN_R_F);}
2239 | RETURN RETCODE {$$=mk_action(DROP_T, 2, RETCODE_ST, 0, NUMBER_ST, (void*)RETURN_R_F);}
2240 | BREAK {$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, (void*)RETURN_R_F); }
2241 | LOG_TOK LPAREN STRING RPAREN {$$=mk_action(LOG_T, 2, NUMBER_ST,
2242 (void*)(L_DBG+1), STRING_ST, $3); }
2243 | LOG_TOK LPAREN NUMBER COMMA STRING RPAREN {$$=mk_action(LOG_T, 2, NUMBER_ST, (void*)$3, STRING_ST, $5); }
2244 | LOG_TOK error { $$=0; yyerror("missing '(' or ')' ?"); }
2245 | LOG_TOK LPAREN error RPAREN { $$=0; yyerror("bad log argument"); }
2246 | SETFLAG LPAREN NUMBER RPAREN {
2247 if (check_flag($3)==-1)
2248 yyerror("bad flag value");
2249 $$=mk_action(SETFLAG_T, 1, NUMBER_ST,
2252 | SETFLAG LPAREN flag_name RPAREN {
2253 i_tmp=get_flag_no($3, strlen($3));
2254 if (i_tmp<0) yyerror("flag not declared");
2255 $$=mk_action(SETFLAG_T, 1, NUMBER_ST,
2256 (void*)(long)i_tmp);
2258 | SETFLAG error { $$=0; yyerror("missing '(' or ')'?"); }
2259 | RESETFLAG LPAREN NUMBER RPAREN {
2260 if (check_flag($3)==-1)
2261 yyerror("bad flag value");
2262 $$=mk_action(RESETFLAG_T, 1, NUMBER_ST, (void*)$3);
2264 | RESETFLAG LPAREN flag_name RPAREN {
2265 i_tmp=get_flag_no($3, strlen($3));
2266 if (i_tmp<0) yyerror("flag not declared");
2267 $$=mk_action(RESETFLAG_T, 1, NUMBER_ST,
2268 (void*)(long)i_tmp);
2270 | RESETFLAG error { $$=0; yyerror("missing '(' or ')'?"); }
2271 | ISFLAGSET LPAREN NUMBER RPAREN {
2272 if (check_flag($3)==-1)
2273 yyerror("bad flag value");
2274 $$=mk_action(ISFLAGSET_T, 1, NUMBER_ST, (void*)$3);
2276 | ISFLAGSET LPAREN flag_name RPAREN {
2277 i_tmp=get_flag_no($3, strlen($3));
2278 if (i_tmp<0) yyerror("flag not declared");
2279 $$=mk_action(ISFLAGSET_T, 1, NUMBER_ST,
2280 (void*)(long)i_tmp);
2282 | ISFLAGSET error { $$=0; yyerror("missing '(' or ')'?"); }
2283 | avpflag_oper LPAREN attr_id_any_str COMMA flag_name RPAREN {
2284 i_tmp=get_avpflag_no($5);
2285 if (i_tmp==0) yyerror("avpflag not declared");
2286 $$=mk_action(AVPFLAG_OPER_T, 3, AVP_ST, $3, NUMBER_ST, (void*)(long)i_tmp, NUMBER_ST, (void*)$1);
2288 | avpflag_oper error { $$=0; yyerror("missing '(' or ')'?"); }
2289 | ERROR LPAREN STRING COMMA STRING RPAREN {$$=mk_action(ERROR_T, 2, STRING_ST, $3, STRING_ST, $5); }
2290 | ERROR error { $$=0; yyerror("missing '(' or ')' ?"); }
2291 | ERROR LPAREN error RPAREN { $$=0; yyerror("bad error argument"); }
2292 | ROUTE LPAREN route_name RPAREN {
2293 i_tmp=route_get(&main_rt, $3);
2295 yyerror("internal error");
2298 $$=mk_action(ROUTE_T, 1, NUMBER_ST,(void*)(long)i_tmp);
2300 | ROUTE error { $$=0; yyerror("missing '(' or ')' ?"); }
2301 | ROUTE LPAREN error RPAREN { $$=0; yyerror("bad route argument"); }
2302 | EXEC LPAREN STRING RPAREN { $$=mk_action(EXEC_T, 1, STRING_ST, $3); }
2303 | SET_HOST LPAREN STRING RPAREN { $$=mk_action(SET_HOST_T, 1, STRING_ST, $3); }
2304 | SET_HOST error { $$=0; yyerror("missing '(' or ')' ?"); }
2305 | SET_HOST LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2306 | PREFIX LPAREN STRING RPAREN { $$=mk_action(PREFIX_T, 1, STRING_ST, $3); }
2307 | PREFIX error { $$=0; yyerror("missing '(' or ')' ?"); }
2308 | PREFIX LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2309 | STRIP_TAIL LPAREN NUMBER RPAREN { $$=mk_action(STRIP_TAIL_T, 1, NUMBER_ST, (void*)$3); }
2310 | STRIP_TAIL error { $$=0; yyerror("missing '(' or ')' ?"); }
2311 | STRIP_TAIL LPAREN error RPAREN { $$=0; yyerror("bad argument, number expected"); }
2312 | STRIP LPAREN NUMBER RPAREN { $$=mk_action(STRIP_T, 1, NUMBER_ST, (void*) $3); }
2313 | STRIP error { $$=0; yyerror("missing '(' or ')' ?"); }
2314 | STRIP LPAREN error RPAREN { $$=0; yyerror("bad argument, number expected"); }
2315 | APPEND_BRANCH LPAREN STRING COMMA STRING RPAREN {
2317 if (str2q(&q, $5, strlen($5)) < 0) {
2318 yyerror("bad argument, q value expected");
2320 $$=mk_action(APPEND_BRANCH_T, 2, STRING_ST, $3, NUMBER_ST, (void *)(long)q);
2322 | APPEND_BRANCH LPAREN STRING RPAREN { $$=mk_action(APPEND_BRANCH_T, 2, STRING_ST, $3, NUMBER_ST, (void *)Q_UNSPECIFIED); }
2323 | APPEND_BRANCH LPAREN RPAREN { $$=mk_action(APPEND_BRANCH_T, 2, STRING_ST, 0, NUMBER_ST, (void *)Q_UNSPECIFIED); }
2324 | APPEND_BRANCH { $$=mk_action( APPEND_BRANCH_T, 1, STRING_ST, 0); }
2325 | SET_HOSTPORT LPAREN STRING RPAREN { $$=mk_action(SET_HOSTPORT_T, 1, STRING_ST, $3); }
2326 | SET_HOSTPORT error { $$=0; yyerror("missing '(' or ')' ?"); }
2327 | SET_HOSTPORT LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2328 | SET_HOSTPORTTRANS LPAREN STRING RPAREN { $$=mk_action(SET_HOSTPORTTRANS_T, 1, STRING_ST, $3); }
2329 | SET_HOSTPORTTRANS error { $$=0; yyerror("missing '(' or ')' ?"); }
2330 | SET_HOSTPORTTRANS LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2331 | SET_PORT LPAREN STRING RPAREN { $$=mk_action(SET_PORT_T, 1, STRING_ST, $3); }
2332 | SET_PORT error { $$=0; yyerror("missing '(' or ')' ?"); }
2333 | SET_PORT LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2334 | SET_USER LPAREN STRING RPAREN { $$=mk_action(SET_USER_T, 1, STRING_ST, $3); }
2335 | SET_USER error { $$=0; yyerror("missing '(' or ')' ?"); }
2336 | SET_USER LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2337 | SET_USERPASS LPAREN STRING RPAREN { $$=mk_action(SET_USERPASS_T, 1, STRING_ST, $3); }
2338 | SET_USERPASS error { $$=0; yyerror("missing '(' or ')' ?"); }
2339 | SET_USERPASS LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2340 | SET_URI LPAREN STRING RPAREN { $$=mk_action(SET_URI_T, 1, STRING_ST,$3); }
2341 | SET_URI error { $$=0; yyerror("missing '(' or ')' ?"); }
2342 | SET_URI LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2343 | REVERT_URI LPAREN RPAREN { $$=mk_action(REVERT_URI_T, 0); }
2344 | REVERT_URI { $$=mk_action(REVERT_URI_T, 0); }
2345 | FORCE_RPORT LPAREN RPAREN { $$=mk_action(FORCE_RPORT_T, 0); }
2346 | FORCE_RPORT {$$=mk_action(FORCE_RPORT_T, 0); }
2347 | FORCE_TCP_ALIAS LPAREN NUMBER RPAREN {
2349 $$=mk_action(FORCE_TCP_ALIAS_T, 1, NUMBER_ST, (void*)$3);
2351 yyerror("tcp support not compiled in");
2354 | FORCE_TCP_ALIAS LPAREN RPAREN {
2356 $$=mk_action(FORCE_TCP_ALIAS_T, 0);
2358 yyerror("tcp support not compiled in");
2363 $$=mk_action(FORCE_TCP_ALIAS_T, 0);
2365 yyerror("tcp support not compiled in");
2368 | FORCE_TCP_ALIAS LPAREN error RPAREN {$$=0; yyerror("bad argument, number expected"); }
2369 | UDP_MTU_TRY_PROTO LPAREN proto RPAREN
2370 { $$=mk_action(UDP_MTU_TRY_PROTO_T, 1, NUMBER_ST, $3); }
2371 | UDP_MTU_TRY_PROTO LPAREN error RPAREN
2372 { $$=0; yyerror("bad argument, UDP, TCP, TLS or SCTP expected"); }
2373 | SET_ADV_ADDRESS LPAREN listen_id RPAREN {
2375 if ((str_tmp=pkg_malloc(sizeof(str)))==0) {
2376 LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
2379 str_tmp->len=strlen($3);
2380 $$=mk_action(SET_ADV_ADDR_T, 1, STR_ST, str_tmp);
2383 | SET_ADV_ADDRESS LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2384 | SET_ADV_ADDRESS error {$$=0; yyerror("missing '(' or ')' ?"); }
2385 | SET_ADV_PORT LPAREN NUMBER RPAREN {
2387 tmp=int2str($3, &i_tmp);
2388 if ((str_tmp=pkg_malloc(sizeof(str)))==0) {
2389 LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
2391 if ((str_tmp->s=pkg_malloc(i_tmp))==0) {
2392 LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
2394 memcpy(str_tmp->s, tmp, i_tmp);
2396 $$=mk_action(SET_ADV_PORT_T, 1, STR_ST, str_tmp);
2400 | SET_ADV_PORT LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
2401 | SET_ADV_PORT error {$$=0; yyerror("missing '(' or ')' ?"); }
2402 | FORCE_SEND_SOCKET LPAREN phostport RPAREN {
2403 $$=mk_action(FORCE_SEND_SOCKET_T, 1, SOCKID_ST, $3);
2405 | FORCE_SEND_SOCKET LPAREN error RPAREN {
2406 $$=0; yyerror("bad argument, [proto:]host[:port] expected");
2408 | FORCE_SEND_SOCKET error {$$=0; yyerror("missing '(' or ')' ?"); }
2409 | ID {mod_func_action = mk_action(MODULE_T, 2, MODEXP_ST, NULL, NUMBER_ST, 0); } LPAREN func_params RPAREN {
2410 mod_func_action->val[0].u.data = find_export_record($1, mod_func_action->val[1].u.number, rt);
2411 if (mod_func_action->val[0].u.data == 0) {
2412 if (find_export_record($1, mod_func_action->val[1].u.number, 0) ) {
2413 yyerror("Command cannot be used in the block\n");
2415 yyerror("unknown command, missing loadmodule?\n");
2417 pkg_free(mod_func_action);
2420 $$ = mod_func_action;
2425 | func_params COMMA func_param { }
2427 | func_params error { yyerror("call params error\n"); YYABORT; }
2431 if (mod_func_action->val[1].u.number < MAX_ACTIONS-2) {
2432 mod_func_action->val[mod_func_action->val[1].u.number+2].type = NUMBER_ST;
2433 mod_func_action->val[mod_func_action->val[1].u.number+2].u.number = $1;
2434 mod_func_action->val[1].u.number++;
2436 yyerror("Too many arguments\n");
2440 if (mod_func_action->val[1].u.number < MAX_ACTIONS-2) {
2441 mod_func_action->val[mod_func_action->val[1].u.number+2].type = STRING_ST;
2442 mod_func_action->val[mod_func_action->val[1].u.number+2].u.string = $1;
2443 mod_func_action->val[1].u.number++;
2445 yyerror("Too many arguments\n");
2453 extern int startcolumn;
2454 static void warn(char* s)
2456 LOG(L_WARN, "cfg. warning: (%d,%d-%d): %s\n", line, startcolumn,
2461 static void yyerror(char* s)
2463 LOG(L_CRIT, "*** PARSE ERROR *** (%d,%d-%d): %s\n", line, startcolumn,
2469 static struct name_lst* mk_name_lst(char* host, int flags)
2472 l=pkg_malloc(sizeof(struct name_lst));
2474 LOG(L_CRIT,"ERROR: cfg. parser: out of memory.\n");
2484 static struct socket_id* mk_listen_id(char* host, int proto, int port)
2486 struct socket_id* l;
2487 l=pkg_malloc(sizeof(struct socket_id));
2489 LOG(L_CRIT,"ERROR: cfg. parser: out of memory.\n");
2491 l->addr_lst=mk_name_lst(host, 0);
2492 if (l->addr_lst==0){
2505 static void free_name_lst(struct name_lst* lst)
2507 struct name_lst* tmp;
2517 static struct socket_id* mk_listen_id2(struct name_lst* addr_l, int proto,
2520 struct socket_id* l;
2521 l=pkg_malloc(sizeof(struct socket_id));
2523 LOG(L_CRIT,"ERROR: cfg. parser: out of memory.\n");
2525 l->flags=addr_l->flags;
2535 static void free_socket_id(struct socket_id* i)
2537 free_name_lst(i->addr_lst);
2542 static void free_socket_id_lst(struct socket_id* lst)
2544 struct socket_id* tmp;
2549 free_socket_id(tmp);
2554 int main(int argc, char ** argv)
2557 fprintf(stderr, "parsing error\n");