浏览代码

- support for str param type (xxx_PARAM->PARAM_xxx, PARAM_STRING)

Tomas Mandys 19 年之前
父节点
当前提交
fb851d7e8a
共有 7 个文件被更改,包括 215 次插入184 次删除
  1. 83 82
      cfg.y
  2. 8 5
      doc/serdev/modiface.xml
  3. 2 2
      doc/serdev/module_exports.xml
  4. 2 2
      doc/serdev/startup.xml
  5. 59 48
      modparam.c
  6. 46 37
      sr_module.c
  7. 15 8
      sr_module.h

+ 83 - 82
cfg.y

@@ -22,8 +22,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
  /*
@@ -39,7 +39,7 @@
  * 2003-04-12  added force_rport, chroot and wdir (andrei)
  * 2003-04-15  added tcp_children, disable_tcp (andrei)
  * 2003-04-22  strip_tail added (jiri)
- * 2003-07-03  tls* (disable, certificate, private_key, ca_list, verify, 
+ * 2003-07-03  tls* (disable, certificate, private_key, ca_list, verify,
  *              require_certificate added (andrei)
  * 2003-07-06  more tls config. vars added: tls_method, tls_port_no (andrei)
  * 2003-10-02  added {,set_}advertised_{address,port} (andrei)
@@ -68,7 +68,7 @@
  *             snd_{ip,port,proto,af}, to_{ip,proto} (andrei)
  * 2005-12-19  select framework (mma)
  * 2006-01-06  AVP index support (mma)
- *
+ * 2005-01-07  optional semicolon in statement, PARAM_STR&PARAM_STRING
  */
 
 %{
@@ -157,7 +157,7 @@ static struct socket_id* mk_listen_id(char*, int, int);
 %token SEND
 %token SEND_TCP
 %token DROP
-%token RETURN 
+%token RETURN
 %token BREAK
 %token LOG_TOK
 %token ERROR
@@ -208,8 +208,8 @@ static struct socket_id* mk_listen_id(char*, int, int);
 %token PROTO
 %token AF
 %token MYSELF
-%token MSGLEN 
-%token RETCODE 
+%token MSGLEN
+%token RETCODE
 %token UDP
 %token TCP
 %token TLS
@@ -297,7 +297,7 @@ static struct socket_id* mk_listen_id(char*, int, int);
 %left LOG_OR
 %left LOG_AND
 %left BIN_OR
-%left BIN_AND 
+%left BIN_AND
 %left PLUS MINUS
 %right NOT
 
@@ -362,13 +362,14 @@ statements:	statements statement {}
 		| statements error { yyerror(""); YYABORT;}
 	;
 
-statement:	assign_stm 
+statement:	assign_stm
 		| module_stm
-		| {rt=REQUEST_ROUTE;} route_stm 
+		| {rt=REQUEST_ROUTE;} route_stm
 		| {rt=FAILURE_ROUTE;} failure_route_stm
 		| {rt=ONREPLY_ROUTE;} onreply_route_stm
 		| {rt=BRANCH_ROUTE;} branch_route_stm
 		| {rt=ONSEND_ROUTE;}   send_route_stm
+		| SEMICOLON	/* null statement */
 		| CR	/* null statement*/
 	;
 
@@ -462,9 +463,9 @@ assign_stm:	DEBUG_V EQUAL NUMBER { debug=$3; }
 							}
 		| MAXBUFFER EQUAL NUMBER { maxbuffer=$3; }
 		| MAXBUFFER EQUAL error { yyerror("number expected"); }
-		| PORT EQUAL error    { yyerror("number expected"); } 
+		| PORT EQUAL error    { yyerror("number expected"); }
 		| CHILDREN EQUAL NUMBER { children_no=$3; }
-		| CHILDREN EQUAL error { yyerror("number expected"); } 
+		| CHILDREN EQUAL error { yyerror("number expected"); }
 		| CHECK_VIA EQUAL NUMBER { check_via=$3; }
 		| CHECK_VIA EQUAL error { yyerror("boolean value expected"); }
 		| SYN_BRANCH EQUAL NUMBER { syn_branch=$3; }
@@ -580,7 +581,7 @@ assign_stm:	DEBUG_V EQUAL NUMBER { debug=$3; }
 									#endif
 									}
 		| DISABLE_TLS EQUAL error { yyerror("boolean value expected"); }
-		| TLSLOG EQUAL NUMBER 		{ 
+		| TLSLOG EQUAL NUMBER 		{
 									#ifdef USE_TLS
 										tls_log=$3;
 									#else
@@ -632,7 +633,7 @@ assign_stm:	DEBUG_V EQUAL NUMBER { debug=$3; }
 										warn("tls support not compiled in");
 									#endif
 									}
-										
+
 		| TLS_VERIFY EQUAL NUMBER {
 									#ifdef USE_TLS
 										tls_verify_cert=$3;
@@ -650,7 +651,7 @@ assign_stm:	DEBUG_V EQUAL NUMBER { debug=$3; }
 									}
 		| TLS_REQUIRE_CERTIFICATE EQUAL error { yyerror("boolean value"
 																" expected"); }
-		| TLS_CERTIFICATE EQUAL STRING { 
+		| TLS_CERTIFICATE EQUAL STRING {
 									#ifdef USE_TLS
 											tls_cert_file=$3;
 									#else
@@ -658,7 +659,7 @@ assign_stm:	DEBUG_V EQUAL NUMBER { debug=$3; }
 									#endif
 									}
 		| TLS_CERTIFICATE EQUAL error { yyerror("string value expected"); }
-		| TLS_PRIVATE_KEY EQUAL STRING { 
+		| TLS_PRIVATE_KEY EQUAL STRING {
 									#ifdef USE_TLS
 											tls_pkey_file=$3;
 									#else
@@ -666,7 +667,7 @@ assign_stm:	DEBUG_V EQUAL NUMBER { debug=$3; }
 									#endif
 									}
 		| TLS_PRIVATE_KEY EQUAL error { yyerror("string value expected"); }
-		| TLS_CA_LIST EQUAL STRING { 
+		| TLS_CA_LIST EQUAL STRING {
 									#ifdef USE_TLS
 											tls_ca_file=$3;
 									#else
@@ -709,7 +710,7 @@ assign_stm:	DEBUG_V EQUAL NUMBER { debug=$3; }
 							 }
 		| LISTEN EQUAL  error { yyerror("ip address or hostname"
 						"expected"); }
-		| ALIAS EQUAL  id_lst { 
+		| ALIAS EQUAL  id_lst {
 							for(lst_tmp=$3; lst_tmp; lst_tmp=lst_tmp->next)
 								add_alias(lst_tmp->name, strlen(lst_tmp->name),
 											lst_tmp->port, lst_tmp->proto);
@@ -772,12 +773,12 @@ module_stm:	LOADMODULE STRING	{ DBG("loading module %s\n", $2);
 								}
 		 | LOADMODULE error	{ yyerror("string expected");  }
                  | MODPARAM LPAREN STRING COMMA STRING COMMA STRING RPAREN {
-			 if (set_mod_param_regex($3, $5, STR_PARAM, $7) != 0) {
+			 if (set_mod_param_regex($3, $5, PARAM_STR|PARAM_STRING, $7) != 0) {
 				 yyerror("Can't set module parameter");
 			 }
 		   }
                  | MODPARAM LPAREN STRING COMMA STRING COMMA NUMBER RPAREN {
-			 if (set_mod_param_regex($3, $5, INT_PARAM, (void*)$7) != 0) {
+			 if (set_mod_param_regex($3, $5, PARAM_INT, (void*)$7) != 0) {
 				 yyerror("Can't set module parameter");
 			 }
 		   }
@@ -789,7 +790,7 @@ ip:		 ipv4  { $$=$1; }
 		|ipv6  { $$=$1; }
 		;
 
-ipv4:	NUMBER DOT NUMBER DOT NUMBER DOT NUMBER { 
+ipv4:	NUMBER DOT NUMBER DOT NUMBER DOT NUMBER {
 											$$=pkg_malloc(
 													sizeof(struct ip_addr));
 											if ($$==0){
@@ -797,7 +798,7 @@ ipv4:	NUMBER DOT NUMBER DOT NUMBER DOT NUMBER {
 													"parser: out of memory.\n"
 													);
 											}else{
-												memset($$, 0, 
+												memset($$, 0,
 													sizeof(struct ip_addr));
 												$$->af=AF_INET;
 												$$->len=4;
@@ -850,7 +851,7 @@ ipv6:	ipv6addr { $$=$1; }
 
 route_stm:  ROUTE LBRACE actions RBRACE { push($3, &rlist[DEFAULT_RT]); }
 
-	    | ROUTE LBRACK NUMBER RBRACK LBRACE actions RBRACE { 
+	    | ROUTE LBRACK NUMBER RBRACK LBRACE actions RBRACE {
 										if (($3<RT_NO) && ($3>=0)){
 											push($6, &rlist[$3]);
 										}else{
@@ -941,7 +942,7 @@ exp:	exp LOG_AND exp 	{ $$=mk_exp(LOGAND_OP, $1, $3); }
 equalop:	  EQUAL_T {$$=EQUAL_OP; }
 			| DIFF	{$$=DIFF_OP; }
 		;
-		
+
 intop:	equalop	{$$=$1; }
 		|  GT	{$$=GT_OP; }
 		| LT	{$$=LT_OP; }
@@ -952,7 +953,7 @@ intop:	equalop	{$$=$1; }
 binop : BIN_OR { $$= BINOR_OP; }
       | BIN_AND { $$ = BINAND_OP; }
 ;
-		
+
 strop:	equalop	{$$=$1; }
 		| MATCH	{$$=MATCH_OP; }
 		;
@@ -1060,7 +1061,7 @@ exp_elem:	METHOD strop STRING	{$$= mk_elem($2, METHOD_O, 0, STRING_ST, $3);}
 										ip_tmp=str2ip6(&s_tmp);
 									if (ip_tmp){
 										$$=mk_elem(	$2, SRCIP_O, 0, NET_ST,
-												mk_net_bitlen(ip_tmp, 
+												mk_net_bitlen(ip_tmp,
 														ip_tmp->len*8) );
 									}else{
 										$$=mk_elem(	$2, SRCIP_O, 0, STRING_ST,
@@ -1073,7 +1074,7 @@ exp_elem:	METHOD strop STRING	{$$= mk_elem($2, METHOD_O, 0, STRING_ST, $3);}
 								}
 		| SRCIP strop error { $$=0; yyerror( "ip address or hostname"
 						 "expected" ); }
-		| SRCIP error  { $$=0; 
+		| SRCIP error  { $$=0;
 						 yyerror("invalid operator, ==, != or =~ expected");}
 		| DSTIP equalop ipnet	{ $$=mk_elem(	$2, DSTIP_O, 0, NET_ST,
 												(void*)$3);
@@ -1085,7 +1086,7 @@ exp_elem:	METHOD strop STRING	{$$= mk_elem($2, METHOD_O, 0, STRING_ST, $3);}
 										ip_tmp=str2ip6(&s_tmp);
 									if (ip_tmp){
 										$$=mk_elem(	$2, DSTIP_O, 0, NET_ST,
-												mk_net_bitlen(ip_tmp, 
+												mk_net_bitlen(ip_tmp,
 														ip_tmp->len*8) );
 									}else{
 										$$=mk_elem(	$2, DSTIP_O, 0, STRING_ST,
@@ -1100,7 +1101,7 @@ exp_elem:	METHOD strop STRING	{$$= mk_elem($2, METHOD_O, 0, STRING_ST, $3);}
 								}
 		| DSTIP strop error { $$=0; yyerror( "ip address or hostname"
 						 			"expected" ); }
-		| DSTIP error { $$=0; 
+		| DSTIP error { $$=0;
 						yyerror("invalid operator, ==, != or =~ expected");}
 		| SNDIP equalop ipnet	{ onsend_check("snd_ip");
 									$$=mk_elem($2, SNDIP_O, 0, NET_ST, $3); }
@@ -1112,7 +1113,7 @@ exp_elem:	METHOD strop STRING	{$$= mk_elem($2, METHOD_O, 0, STRING_ST, $3);}
 										ip_tmp=str2ip6(&s_tmp);
 									if (ip_tmp){
 										$$=mk_elem(	$2, SNDIP_O, 0, NET_ST,
-												mk_net_bitlen(ip_tmp, 
+												mk_net_bitlen(ip_tmp,
 														ip_tmp->len*8) );
 									}else{
 										$$=mk_elem(	$2, SNDIP_O, 0, STRING_ST,
@@ -1126,7 +1127,7 @@ exp_elem:	METHOD strop STRING	{$$= mk_elem($2, METHOD_O, 0, STRING_ST, $3);}
 								}
 		| SNDIP strop error { $$=0; yyerror( "ip address or hostname"
 						 "expected" ); }
-		| SNDIP error  { $$=0; 
+		| SNDIP error  { $$=0;
 						 yyerror("invalid operator, ==, != or =~ expected");}
 		| TOIP equalop ipnet	{ onsend_check("to_ip");
 									$$=mk_elem($2, TOIP_O, 0, NET_ST, $3); }
@@ -1138,7 +1139,7 @@ exp_elem:	METHOD strop STRING	{$$= mk_elem($2, METHOD_O, 0, STRING_ST, $3);}
 										ip_tmp=str2ip6(&s_tmp);
 									if (ip_tmp){
 										$$=mk_elem(	$2, TOIP_O, 0, NET_ST,
-												mk_net_bitlen(ip_tmp, 
+												mk_net_bitlen(ip_tmp,
 														ip_tmp->len*8) );
 									}else{
 										$$=mk_elem(	$2, TOIP_O, 0, STRING_ST,
@@ -1152,7 +1153,7 @@ exp_elem:	METHOD strop STRING	{$$= mk_elem($2, METHOD_O, 0, STRING_ST, $3);}
 								}
 		| TOIP strop error { $$=0; yyerror( "ip address or hostname"
 						 "expected" ); }
-		| TOIP error  { $$=0; 
+		| TOIP error  { $$=0;
 						 yyerror("invalid operator, ==, != or =~ expected");}
 
 		| MYSELF equalop uri_type	{ $$=mk_elem(	$2, $3, 0, MYSELF_ST,
@@ -1170,9 +1171,9 @@ exp_elem:	METHOD strop STRING	{$$= mk_elem($2, METHOD_O, 0, STRING_ST, $3);}
 		| MYSELF equalop TOIP  {	onsend_check("to_ip");
 									$$=mk_elem(	$2, TOIP_O, 0, MYSELF_ST, 0);
 								}
-		| MYSELF equalop error {	$$=0; 
+		| MYSELF equalop error {	$$=0;
 									yyerror(" URI, SRCIP or DSTIP expected"); }
-		| MYSELF error	{ $$=0; 
+		| MYSELF error	{ $$=0;
 							yyerror ("invalid operator, == or != expected");
 						}
 		| exp_stm			{ $$=mk_elem( NO_OP, ACTION_O, 0, ACTIONS_ST, $1);  }
@@ -1192,14 +1193,14 @@ exp_elem:	METHOD strop STRING	{$$= mk_elem($2, METHOD_O, 0, STRING_ST, $3);}
 ;
 
 
-ipnet:	ip SLASH ip	{ $$=mk_net($1, $3); } 
+ipnet:	ip SLASH ip	{ $$=mk_net($1, $3); }
 	| ip SLASH NUMBER 	{	if (($3<0) || ($3>$1->len*8)){
 								yyerror("invalid bit number in netmask");
 								$$=0;
 							}else{
 								$$=mk_net_bitlen($1, $3);
 							/*
-								$$=mk_net($1, 
+								$$=mk_net($1,
 										htonl( ($3)?~( (1<<(32-$3))-1 ):0 ) );
 							*/
 							}
@@ -1303,11 +1304,11 @@ if_cmd:		IF exp stm				{ $$=mk_action3( IF_T,
 //         | LBRACK ATTR_GLOBAL RBRACK { $$ = AVP_CLASS_GLOBAL; }
 //;
 
-select_param : ID { 
+select_param : ID {
 		    if (sel.n >= MAX_SELECT_PARAMS-1) {
 			    yyerror("Select identifier too long\n");
 		    }
-		    sel.params[sel.n].type = SEL_PARAM_STR; 
+		    sel.params[sel.n].type = SEL_PARAM_STR;
 		    sel.params[sel.n].v.s.s = $1;
 		    sel.params[sel.n].v.s.len = strlen($1);
 		    sel.n++;
@@ -1340,40 +1341,40 @@ select_id : SELECT_MARK { sel.n = 0; sel.f = 0; } select_params {
 }
 ;
 
-attr_class_spec: ATTR_FROMUSER { s_attr->type |= AVP_TRACK_FROM | AVP_CLASS_USER; } 
-		|ATTR_TOUSER { s_attr->type |= AVP_TRACK_TO | AVP_CLASS_USER; } 
-		|ATTR_FROMDOMAIN { s_attr->type |= AVP_TRACK_FROM | AVP_CLASS_DOMAIN; } 
-		|ATTR_TODOMAIN { s_attr->type |= AVP_TRACK_TO | AVP_CLASS_DOMAIN; } 
-		|ATTR_GLOBAL { s_attr->type |= AVP_TRACK_ALL | AVP_CLASS_GLOBAL; } 
+attr_class_spec: ATTR_FROMUSER { s_attr->type |= AVP_TRACK_FROM | AVP_CLASS_USER; }
+		|ATTR_TOUSER { s_attr->type |= AVP_TRACK_TO | AVP_CLASS_USER; }
+		|ATTR_FROMDOMAIN { s_attr->type |= AVP_TRACK_FROM | AVP_CLASS_DOMAIN; }
+		|ATTR_TODOMAIN { s_attr->type |= AVP_TRACK_TO | AVP_CLASS_DOMAIN; }
+		|ATTR_GLOBAL { s_attr->type |= AVP_TRACK_ALL | AVP_CLASS_GLOBAL; }
 
 attr_name_spec : ID { s_attr->type |= AVP_NAME_STR; s_attr->name.s.s = $1; s_attr->name.s.len = strlen ($1); }
 ;
-	       
+
 attr_spec : attr_name_spec |
 	    attr_class_spec DOT attr_name_spec
 ;
 
-attr_mark : ATTR_MARK 
+attr_mark : ATTR_MARK
 	{	s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
                 if (!s_attr) { yyerror("No memory left"); }
-                s_attr->type = 0;  
+                s_attr->type = 0;
 	}
 ;
 
-attr_id : attr_mark attr_spec { $$ = s_attr; }	  
+attr_id : attr_mark attr_spec { $$ = s_attr; }
 ;
 
 attr_id_num_idx : attr_mark attr_spec LBRACK NUMBER RBRACK
-	       	{	s_attr->type|= (AVP_NAME_STR | ($4<0?AVP_INDEX_BACKWARD:AVP_INDEX_FORWARD)); 
+	       	{	s_attr->type|= (AVP_NAME_STR | ($4<0?AVP_INDEX_BACKWARD:AVP_INDEX_FORWARD));
 			s_attr->index = ($4<0?-$4:$4);
-	       		$$ = s_attr; 
-	       	}	  
+	       		$$ = s_attr;
+	       	}
 ;
 
 attr_id_no_idx : attr_mark attr_spec LBRACK RBRACK
-	       	{	s_attr->type|= AVP_INDEX_ALL; 
+	       	{	s_attr->type|= AVP_INDEX_ALL;
 	       		$$ = s_attr;
-		}	  
+		}
 ;
 
 attr_id_ass : attr_id | attr_id_no_idx
@@ -1441,8 +1442,8 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 																0,
 																0);
 													}
-													
-									
+
+
 		| FORWARD LPAREN URIHOST COMMA NUMBER RPAREN {
 													$$=mk_action(FORWARD_T,
 																 URIHOST_ST,
@@ -1506,8 +1507,8 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 																0,
 																0);
 													}
-													
-									
+
+
 		| FORWARD_UDP LPAREN URIHOST COMMA NUMBER RPAREN {
 													$$=mk_action(FORWARD_UDP_T,
 																 URIHOST_ST,
@@ -1570,8 +1571,8 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 																0,
 																0);
 													}
-													
-									
+
+
 		| FORWARD_TCP LPAREN URIHOST COMMA NUMBER RPAREN {
 													$$=mk_action(FORWARD_TCP_T,
 																 URIHOST_ST,
@@ -1615,7 +1616,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 													"compiled in");
 										#endif
 										}
-		| FORWARD_TLS LPAREN ip RPAREN	{ 
+		| FORWARD_TLS LPAREN ip RPAREN	{
 										#ifdef USE_TLS
 											$$=mk_action(	FORWARD_TLS_T,
 															IP_ST,
@@ -1628,7 +1629,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 													"compiled in");
 										#endif
 										}
-		| FORWARD_TLS LPAREN host COMMA NUMBER RPAREN { 
+		| FORWARD_TLS LPAREN host COMMA NUMBER RPAREN {
 										#ifdef USE_TLS
 											$$=mk_action(	FORWARD_TLS_T,
 															 STRING_ST,
@@ -1680,8 +1681,8 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 													"compiled in");
 										#endif
 													}
-													
-									
+
+
 		| FORWARD_TLS LPAREN URIHOST COMMA NUMBER RPAREN {
 										#ifdef USE_TLS
 											$$=mk_action(	FORWARD_TLS_T,
@@ -1711,7 +1712,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 		| FORWARD_TLS error { $$=0; yyerror("missing '(' or ')' ?"); }
 		| FORWARD_TLS LPAREN error RPAREN { $$=0; yyerror("bad forward_tls"
 										"argument"); }
-		
+
 		| SEND LPAREN host RPAREN	{ $$=mk_action(	SEND_T,
 													STRING_ST,
 													NUMBER_ST,
@@ -1802,17 +1803,17 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 												0, (void*)EXIT_R_F); }
 		| RETURN				{$$=mk_action(DROP_T,0, 0,
 												(void*)1, (void*)RETURN_R_F); }
-		| RETURN NUMBER			{$$=mk_action(DROP_T,0, 0, 
+		| RETURN NUMBER			{$$=mk_action(DROP_T,0, 0,
 												(void*)$2, (void*)RETURN_R_F);}
-		| RETURN RETCODE		{$$=mk_action(DROP_T, RETCODE_ST, 0, 
+		| RETURN RETCODE		{$$=mk_action(DROP_T, RETCODE_ST, 0,
 														0, (void*)RETURN_R_F);}
 		| BREAK					{$$=mk_action(DROP_T,0, 0,
 												0, (void*)RETURN_R_F); }
-		| LOG_TOK LPAREN STRING RPAREN	{$$=mk_action(	LOG_T, NUMBER_ST, 
+		| LOG_TOK LPAREN STRING RPAREN	{$$=mk_action(	LOG_T, NUMBER_ST,
 													STRING_ST,(void*)4,$3);
 									}
 		| LOG_TOK LPAREN NUMBER COMMA STRING RPAREN	{$$=mk_action(	LOG_T,
-																NUMBER_ST, 
+																NUMBER_ST,
 																STRING_ST,
 																(void*)$3,
 																$5);
@@ -1830,7 +1831,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 													(void *)$3, 0 ); }
 		| ISFLAGSET error { $$=0; yyerror("missing '(' or ')'?"); }
 		| ERROR LPAREN STRING COMMA STRING RPAREN {$$=mk_action(ERROR_T,
-																STRING_ST, 
+																STRING_ST,
 																STRING_ST,
 																$3,
 																$5);
@@ -1858,7 +1859,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 		| PREFIX error { $$=0; yyerror("missing '(' or ')' ?"); }
 		| PREFIX LPAREN error RPAREN { $$=0; yyerror("bad argument, "
 														"string expected"); }
-		| STRIP_TAIL LPAREN NUMBER RPAREN { $$=mk_action(STRIP_TAIL_T, 
+		| STRIP_TAIL LPAREN NUMBER RPAREN { $$=mk_action(STRIP_TAIL_T,
 									NUMBER_ST, 0, (void *) $3, 0); }
 		| STRIP_TAIL error { $$=0; yyerror("missing '(' or ')' ?"); }
 		| STRIP_TAIL LPAREN error RPAREN { $$=0; yyerror("bad argument, "
@@ -1869,22 +1870,22 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 		| STRIP error { $$=0; yyerror("missing '(' or ')' ?"); }
 		| STRIP LPAREN error RPAREN { $$=0; yyerror("bad argument, "
 														"number expected"); }
-                | APPEND_BRANCH LPAREN STRING COMMA STRING RPAREN { 
+                | APPEND_BRANCH LPAREN STRING COMMA STRING RPAREN {
 		    {   qvalue_t q;
 			if (str2q(&q, $5, strlen($5)) < 0) {
 				yyerror("bad argument, q value expected");
 			}
-			$$=mk_action(APPEND_BRANCH_T, STRING_ST, NUMBER_ST, $3, 
-							(void *)(long)q); } 
+			$$=mk_action(APPEND_BRANCH_T, STRING_ST, NUMBER_ST, $3,
+							(void *)(long)q); }
 		}
-	
+
 		| APPEND_BRANCH LPAREN STRING RPAREN { $$=mk_action( APPEND_BRANCH_T,
 													STRING_ST, NUMBER_ST, $3, (void *)Q_UNSPECIFIED) ; }
 		| APPEND_BRANCH LPAREN RPAREN { $$=mk_action( APPEND_BRANCH_T,
 													STRING_ST, NUMBER_ST, 0, (void *)Q_UNSPECIFIED ) ; }
 		| APPEND_BRANCH {  $$=mk_action( APPEND_BRANCH_T, STRING_ST, 0, 0, 0 ) ; }
 
-		| SET_HOSTPORT LPAREN STRING RPAREN { $$=mk_action( SET_HOSTPORT_T, 
+		| SET_HOSTPORT LPAREN STRING RPAREN { $$=mk_action( SET_HOSTPORT_T,
 														STRING_ST, 0, $3, 0); }
 		| SET_HOSTPORT error { $$=0; yyerror("missing '(' or ')' ?"); }
 		| SET_HOSTPORT LPAREN error RPAREN { $$=0; yyerror("bad argument,"
@@ -1899,12 +1900,12 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 		| SET_USER error { $$=0; yyerror("missing '(' or ')' ?"); }
 		| SET_USER LPAREN error RPAREN { $$=0; yyerror("bad argument, "
 														"string expected"); }
-		| SET_USERPASS LPAREN STRING RPAREN { $$=mk_action( SET_USERPASS_T, 
+		| SET_USERPASS LPAREN STRING RPAREN { $$=mk_action( SET_USERPASS_T,
 														STRING_ST, 0, $3, 0); }
 		| SET_USERPASS error { $$=0; yyerror("missing '(' or ')' ?"); }
 		| SET_USERPASS LPAREN error RPAREN { $$=0; yyerror("bad argument, "
 														"string expected"); }
-		| SET_URI LPAREN STRING RPAREN { $$=mk_action( SET_URI_T, STRING_ST, 
+		| SET_URI LPAREN STRING RPAREN { $$=mk_action( SET_URI_T, STRING_ST,
 														0, $3, 0); }
 		| SET_URI error { $$=0; yyerror("missing '(' or ')' ?"); }
 		| SET_URI LPAREN error RPAREN { $$=0; yyerror("bad argument, "
@@ -1923,7 +1924,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 												}
 		| FORCE_TCP_ALIAS LPAREN RPAREN	{
 					#ifdef USE_TCP
-						$$=mk_action(FORCE_TCP_ALIAS_T,0, 0, 0, 0); 
+						$$=mk_action(FORCE_TCP_ALIAS_T,0, 0, 0, 0);
 					#else
 						yyerror("tcp support not compiled in");
 					#endif
@@ -1935,7 +1936,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 						yyerror("tcp support not compiled in");
 					#endif
 										}
-		| FORCE_TCP_ALIAS LPAREN error RPAREN	{$$=0; 
+		| FORCE_TCP_ALIAS LPAREN error RPAREN	{$$=0;
 					yyerror("bad argument, number expected");
 					}
 		| SET_ADV_ADDRESS LPAREN listen_id RPAREN {
@@ -2017,7 +2018,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
 													);
 									}
 								  }
-		| ID LPAREN STRING  COMMA STRING RPAREN 
+		| ID LPAREN STRING  COMMA STRING RPAREN
 								  { f_tmp=(void*)find_export($1, 2, rt);
 									if (f_tmp==0){
 										if (find_export($1, 2, 0)) {
@@ -2049,14 +2050,14 @@ extern int column;
 extern int startcolumn;
 static void warn(char* s)
 {
-	LOG(L_WARN, "cfg. warning: (%d,%d-%d): %s\n", line, startcolumn, 
+	LOG(L_WARN, "cfg. warning: (%d,%d-%d): %s\n", line, startcolumn,
 			column, s);
 	cfg_errors++;
 }
 
 static void yyerror(char* s)
 {
-	LOG(L_CRIT, "parse error (%d,%d-%d): %s\n", line, startcolumn, 
+	LOG(L_CRIT, "parse error (%d,%d-%d): %s\n", line, startcolumn,
 			column, s);
 	cfg_errors++;
 }

+ 8 - 5
doc/serdev/modiface.xml

@@ -272,9 +272,10 @@ typedef struct param_export_ param_export_t;
 		<simpara><varname>modparam_t type</varname></simpara>
 		<simpara>
 		    Type of the parameter. Currently only two types are
-		    defined. INT_PARAM for integer parameters (corresponding
-		    variable must be of type int) and STR_PARAM for string
-		    parameters (corresponding variable must be of type char*).
+		    defined. PARAM_INT for integer parameters (corresponding
+		    variable must be of type int), PARAM_STR for str parameters
+		    (corresponding variable must be of type char*)  and PARAM_STRING 
+		    for string parameters (corresponding variable must be of type char*).
 		</simpara>
 	    </listitem>
 	    <listitem>
@@ -436,10 +437,12 @@ static cmd_export cmds[] = {
 	<programlisting>
 int foo_bar = 0;
 char* bar_foo = "default value";
+str bar_bar = STR_STATIC_INIT("default");
 
 static param_export params[] = {
-    {"foo_bar", INT_PARAM, &amp;foo_bar},
-    {"bar_foo", STR_PARAM, bar_foo     },
+    {"foo_bar", PARAM_INT, &amp;foo_bar},
+    {"bar_foo", PARAM_STRING, &bar_foo},
+    {"bar_bar", PARAM_STR, &bar_bar.s},
     {0, 0, 0}
 }; 
 	</programlisting>

+ 2 - 2
doc/serdev/module_exports.xml

@@ -172,8 +172,8 @@ struct module_exports{
 	<listitem>
 	    <para>
 		<structfield>param_types</structfield> - Array of types of
-		parameters, each field of the array can be either STR_PARAM or
-		INT_PARAM (currently only two parameter types are defined).
+		parameters, each field of the array can be either PARAM_STR/PARAM_STRING or
+		PARAM_INT (currently only three parameter types are defined).
 	    </para>
 	</listitem>
 	<listitem>

+ 2 - 2
doc/serdev/startup.xml

@@ -444,14 +444,14 @@ module_stm = "loadmodule" STRING
 | "loadmodule" error	 { yyerror("string expected");  }
 | "modparam" "(" STRING "," STRING "," STRING ")" 
 {
-    if (set_mod_param($3, $5, STR_PARAM, $7) != 0) {
+    if (set_mod_param($3, $5, PARAM_STR|PARAM_STRING, $7) != 0) {
         yyerror("Can't set module parameter");
     }
 }
 
 | "modparam" "(" STRING "," STRING "," NUMBER ")" 
 {
-    if (set_mod_param($3, $5, INT_PARAM, (void*)$7) != 0) {
+    if (set_mod_param($3, $5, PARAM_INT, (void*)$7) != 0) {
         yyerror("Can't set module parameter");
     }
 }

+ 59 - 48
modparam.c

@@ -21,8 +21,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * History:
@@ -30,6 +30,7 @@
  * 2003-03-20  regex support in modparam (janakj)
  * 2004-03-12  extra flag USE_FUNC_PARAM added to modparam type -
  *             instead of copying the param value, a func is called (bogdan)
+ * 2005-07-01  PARAM_STRING & PARAM_STR support
  */
 
 
@@ -44,7 +45,8 @@
 int set_mod_param(char* _mod, char* _name, modparam_t _type, void* _val)
 {
 	void* ptr;
-	
+	modparam_t param_type;
+
 	if (!_mod) {
 		LOG(L_ERR, "set_mod_param(): Invalid _mod parameter value\n");
 		return -1;
@@ -55,22 +57,34 @@ int set_mod_param(char* _mod, char* _name, modparam_t _type, void* _val)
 		return -2;
 	}
 
-	ptr = find_param_export(_mod, _name, _type);
+
+	ptr = find_param_export(find_module_by_name(_mod), _name, _type, &param_type);
 	if (!ptr) {
 		LOG(L_ERR, "set_mod_param(): Parameter not found\n");
 		return -3;
 	}
 
-	switch(_type) {
-	case STR_PARAM:
-		*((char**)ptr) = strdup((char*)_val);
-		break;
-
-	case INT_PARAM:
-		*((int*)ptr) = (int)(long)_val;
-		break;
+	if (param_type & PARAM_USE_FUNC) {
+		if ( ((param_func_t)(ptr))(param_type, _val) < 0) {
+			return -4;
+		}
+	}
+	else {
+		switch(PARAM_TYPE_MASK(param_type)) {
+			case PARAM_STRING:
+				*((char**)ptr) = strdup((char*)_val);
+				break;
+
+			case PARAM_STR:
+				((str*)ptr)->s = strdup((char*)_val);
+				((str*)ptr)->len = strlen(((str*)ptr)->s);
+				break;
+
+			case PARAM_INT:
+				*((int*)ptr) = (int)(long)_val;
+				break;
+		}
 	}
-
 	return 0;
 }
 
@@ -78,11 +92,11 @@ int set_mod_param(char* _mod, char* _name, modparam_t _type, void* _val)
 int set_mod_param_regex(char* regex, char* name, modparam_t type, void* val)
 {
 	struct sr_module* t;
-	param_export_t* param;
 	regex_t preg;
 	int mod_found, len;
 	char* reg;
-	int n;
+	void *ptr;
+	modparam_t param_type;
 
 	len = strlen(regex);
 	reg = pkg_malloc(len + 2 + 1);
@@ -94,47 +108,46 @@ int set_mod_param_regex(char* regex, char* name, modparam_t type, void* val)
 	memcpy(reg + 1, regex, len);
 	reg[len + 1] = '$';
 	reg[len + 2] = '\0';
-	
+
 	if (regcomp(&preg, reg, REG_EXTENDED | REG_NOSUB | REG_ICASE)) {
 		LOG(L_ERR, "set_mod_param_regex(): Error while compiling regular expression\n");
 		pkg_free(reg);
 		return -2;
 	}
-	
-	mod_found = 0;
 
+	mod_found = 0;
 	for(t = modules; t; t = t->next) {
 		if (regexec(&preg, t->exports->name, 0, 0, 0) == 0) {
-			DBG("set_mod_param_regex: %s matches module %s\n",
-					regex, t->exports->name);
+			DBG("set_mod_param_regex: '%s' matches module '%s'\n", regex, t->exports->name);
 			mod_found = 1;
-			for(param=t->exports->params;param && param->name ; param++) {
-				if ((strcmp(name, param->name) == 0) &&
-				( PARAM_TYPE_MASK(param->type) == type)) {
-					DBG("set_mod_param_regex: found <%s> in module %s [%s]\n",
-						name, t->exports->name, t->path);
-
-					if (param->type&USE_FUNC_PARAM) {
-						n = ((param_func_t)(param->param_pointer))(type, val );
-						if (n<0)
-							return -4;
-					} else {
-						switch(type) {
-							case STR_PARAM:
-								*((char**)(param->param_pointer)) =
-									strdup((char*)val);
-								break;
-							case INT_PARAM:
-								*((int*)(param->param_pointer)) =
-									(int)(long)val;
-								break;
-						}
+			ptr = find_param_export(t, name, type, &param_type);
+			if (ptr) {
+				DBG("set_mod_param_regex: found <%s> in module %s [%s]\n", name, t->exports->name, t->path);
+				if (param_type & PARAM_USE_FUNC) {
+					if ( ((param_func_t)(ptr))(param_type, val) < 0) {
+						regfree(&preg);
+						pkg_free(reg);
+						return -4;
+					}
+				}
+				else {
+					switch(PARAM_TYPE_MASK(param_type)) {
+						case PARAM_STRING:
+							*((char**)ptr) = strdup((char*)val);
+							break;
+
+						case PARAM_STR:
+							((str*)ptr)->s = strdup((char*)val);
+							((str*)ptr)->len = strlen(((str*)ptr)->s);
+							break;
+
+						case PARAM_INT:
+							*((int*)ptr) = (int)(long)val;
+							break;
 					}
-
-					break;
 				}
 			}
-			if (!param || !param->name) {
+			else {
 				LOG(L_ERR, "set_mod_param_regex: parameter <%s> not found in module <%s>\n",
 				    name, t->exports->name);
 				regfree(&preg);
@@ -145,12 +158,10 @@ int set_mod_param_regex(char* regex, char* name, modparam_t type, void* val)
 	}
 
 	regfree(&preg);
+	pkg_free(reg);
 	if (!mod_found) {
-		LOG(L_ERR, "set_mod_param_regex: No module matching %s found\n|", regex);
-		pkg_free(reg);
+		LOG(L_ERR, "set_mod_param_regex: No module matching <%s> found\n", regex);
 		return -4;
 	}
-
-	pkg_free(reg);
 	return 0;
 }

+ 46 - 37
sr_module.c

@@ -19,8 +19,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 /*
@@ -87,12 +87,12 @@ int register_builtin_modules()
 
 	ret=0;
 #ifdef STATIC_TM
-	ret=register_module(tm_exports,"built-in", 0); 
+	ret=register_module(tm_exports,"built-in", 0);
 	if (ret<0) return ret;
 #endif
 
 #ifdef STATIC_EXEC
-	ret=register_module(exec_exports,"built-in", 0); 
+	ret=register_module(exec_exports,"built-in", 0);
 	if (ret<0) return ret;
 #endif
 
@@ -102,15 +102,15 @@ int register_builtin_modules()
 #endif
 
 #ifdef STATIC_AUTH
-	ret=register_module(auth_exports, "built-in", 0); 
+	ret=register_module(auth_exports, "built-in", 0);
 	if (ret<0) return ret;
 #endif
-	
+
 #ifdef STATIC_RR
 	ret=register_module(rr_exports, "built-in", 0);
 	if (ret<0) return ret;
 #endif
-	
+
 #ifdef STATIC_USRLOC
 	ret=register_module(usrloc_exports, "built-in", 0);
 	if (ret<0) return ret;
@@ -120,7 +120,7 @@ int register_builtin_modules()
 	ret=register_module(sl_exports, "built-in", 0);
 	if (ret<0) return ret;
 #endif
-	
+
 	return ret;
 }
 
@@ -132,7 +132,7 @@ int register_module(struct module_exports* e, char* path, void* handle)
 {
 	int ret;
 	struct sr_module* mod;
-	
+
 	ret=-1;
 
 	/* add module to the list */
@@ -183,7 +183,7 @@ static inline int version_control(void *handle, char *path)
 		LOG(L_ERR, "ERROR: no compile flags in module <%s>\n", path );
 		return 0;
 	}
-	
+
 	if (strcmp(SER_FULL_VERSION, *m_ver)==0){
 		if (strcmp(SER_COMPILE_FLAGS, *m_flags)==0)
 			return 1;
@@ -206,7 +206,7 @@ int load_module(char* path)
 	char* error;
 	struct module_exports* exp;
 	struct sr_module* t;
-	
+
 #ifndef RTLD_NOW
 /* for openbsd */
 #define RTLD_NOW DL_LAZY
@@ -217,7 +217,7 @@ int load_module(char* path)
 					path, dlerror() );
 		goto error;
 	}
-	
+
 	for(t=modules;t; t=t->next){
 		if (t->handle==handle){
 			LOG(L_WARN, "WARNING: load_module: attempting to load the same"
@@ -248,7 +248,7 @@ skip:
 
 
 /* searches the module list and returns pointer to the "name" function or
- * 0 if not found 
+ * 0 if not found
  * flags parameter is OR value of all flags that must match
  */
 cmd_function find_export(char* name, int param_no, int flags)
@@ -327,32 +327,41 @@ cmd_function find_mod_export(char* mod, char* name, int param_no, int flags)
 		}
 	}
 
-	DBG("find_mod_export: <%s> in module %s not found\n", name, mod);
+	DBG("find_mod_export: <%s> in module <%s> not found\n", name, mod);
 	return 0;
 }
 
 
+struct sr_module* find_module_by_name(char* mod) {
+	struct sr_module* t;
+
+	for(t = modules; t; t = t->next) {
+		if (strcmp(mod, t->exports->name) == 0) {
+			return t;
+		}
+	}
+	DBG("find_module_by_name: module <%s> not found\n", mod);
+	return 0;
+}
 
 
-void* find_param_export(char* mod, char* name, modparam_t type)
+void* find_param_export(struct sr_module* mod, char* name, modparam_t type_mask, modparam_t *param_type)
 {
-	struct sr_module* t;
 	param_export_t* param;
 
-	for(t = modules; t; t = t->next) {
-		if (strcmp(mod, t->exports->name) == 0) {
-			for(param=t->exports->params;param && param->name ; param++) {
-				if ((strcmp(name, param->name) == 0) &&
-				    (param->type == type)) {
-					DBG("find_param_export: found <%s> in module %s [%s]\n",
-					    name, t->exports->name, t->path);
-					return param->param_pointer;
-				}
-			}
+	if (!mod)
+		return 0;
+	for(param=mod->exports->params;param && param->name ; param++) {
+		if ((strcmp(name, param->name) == 0) &&
+			((param->type & PARAM_TYPE_MASK(type_mask)) != 0)) {
+			DBG("find_param_export: found <%s> in module %s [%s]\n",
+				name, mod->exports->name, mod->path);
+			*param_type = param->type;
+			return param->param_pointer;
 		}
 	}
-	DBG("find_param_export: parameter <%s> or module <%s> not found\n",
-			name, mod);
+	DBG("find_param_export: parameter <%s> not found in module <%s>\n",
+			name, mod->exports->name);
 	return 0;
 }
 
@@ -364,9 +373,9 @@ struct sr_module* find_module(void* f, cmd_export_t  **c)
 {
 	struct sr_module* t;
 	cmd_export_t* cmd;
-	
+
 	for (t=modules;t;t=t->next){
-		for(cmd=t->exports->cmds; cmd && cmd->name; cmd++) 
+		for(cmd=t->exports->cmds; cmd && cmd->name; cmd++)
 			if (f==(void*)cmd->function) {
 				if (c) *c=cmd;
 				return t;
@@ -400,7 +409,7 @@ void destroy_modules()
 int init_modules(void)
 {
 	struct sr_module* t;
-	
+
 	for(t = modules; t; t = t->next) {
 		if ((t->exports) && (t->exports->init_f))
 			if (t->exports->init_f() != 0) {
@@ -428,7 +437,7 @@ int init_child(int rank)
 	default:            type = "CHILD";         break;
 	}
 	DBG("init_child: initializing %s with rank %d\n", type, rank);
-	
+
 
 	for(t = modules; t; t = t->next) {
 		if (t->exports->init_child_f) {
@@ -458,7 +467,7 @@ static int init_mod_child( struct sr_module* m, int rank )
 		 */
 		if (init_mod_child(m->next, rank)!=0) return -1;
 		if (m->exports && m->exports->init_child_f) {
-			DBG("DEBUG: init_mod_child (%d): %s\n", 
+			DBG("DEBUG: init_mod_child (%d): %s\n",
 					rank, m->exports->name);
 			if (m->exports->init_child_f(rank)<0) {
 				LOG(L_ERR, "init_mod_child(): Error while initializing"
@@ -538,13 +547,13 @@ int init_modules(void)
 int fixup_str_12(void** param, int param_no)
 {
 	str* s;
-	
+
 	s = (str*)pkg_malloc(sizeof(str));
 	if (!s) {
 		LOG(L_ERR, "fixup_str_12: No memory left\n");
 		return E_UNSPEC;
 	}
-	
+
 	s->s = (char*)*param;
 	s->len = strlen(s->s);
 	*param = (void*)s;
@@ -578,7 +587,7 @@ int fixup_int_12(void** param, int param_no)
 	int err;
 
 	num = str2s(*param, strlen(*param), &err);
-	
+
 	if (err == 0) {
 		pkg_free(*param);
 		*param=(void*)num;
@@ -607,7 +616,7 @@ int fixup_int_2(void** param, int param_no)
 	if (param_no == 2) {
 		return fixup_int_12(param, param_no);
 	}
-	
+
 	return 0;
 }
 

+ 15 - 8
sr_module.h

@@ -22,8 +22,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 /*
@@ -58,10 +58,16 @@ typedef int (*init_function)(void);
 typedef int (*child_init_function)(int rank);
 
 
-#define STR_PARAM        (1U<<0)  /* String parameter type */
-#define INT_PARAM        (1U<<1)  /* Integer parameter type */
-#define USE_FUNC_PARAM   (1U<<(8*sizeof(int)-1))
-#define PARAM_TYPE_MASK(_x)   ((_x)&(~USE_FUNC_PARAM))
+#define PARAM_STRING     (1U<<0)  /* String (char *) parameter type */
+#define PARAM_INT        (1U<<1)  /* Integer parameter type */
+#define PARAM_STR        (1U<<2)  /* struct str parameter type */
+#define PARAM_USE_FUNC   (1U<<(8*sizeof(int)-1))
+#define PARAM_TYPE_MASK(_x)   ((_x)&(~PARAM_USE_FUNC))
+
+/* temporary, for backward compatibility only until all modules adjust it */
+#define STR_PARAM PARAM_STRING
+#define INT_PARAM PARAM_INT
+#define USE_FUNC_PARAM PARAM_USE_FUNC
 
 typedef unsigned int modparam_t;
 
@@ -108,7 +114,7 @@ typedef struct param_export_ param_export_t;
 
 struct module_exports{
 	char* name;                     /* null terminated module name */
-	
+
 	cmd_export_t* cmds;             /* null terminated array of the exported
 									   commands */
 	rpc_export_t* rpc_methods;      /* null terminated array of exported rpc methods */
@@ -150,13 +156,14 @@ struct sr_module* find_module(void *f, cmd_export_t** cmd);
 void destroy_modules();
 int init_child(int rank);
 int init_modules(void);
+struct sr_module* find_module_by_name(char* mod);
 
 /*
  * Find a parameter with given type and return it's
  * address in memory
  * If there is no such parameter, NULL is returned
  */
-void* find_param_export(char* mod, char* name, modparam_t type);
+void* find_param_export(struct sr_module* mod, char* name, modparam_t type_mask, modparam_t *param_type);
 
 /* modules function prototypes:
  * struct module_exports* mod_register(); (type module_register)