Browse code

New script directive to allow specifying the modules' path. This is equivalent to the command line parameter -L.

Example:

loadpath "/usr/lib/ser/modules/"
loadmodule "maxfwd"



Closes issue #SER-364.

Bogdan Pintea authored on 31/03/2008 06:35:57
Showing 3 changed files
... ...
@@ -136,6 +136,9 @@ core:
136 136
                between the short name and long name in cache as CNAME record
137 137
 
138 138
 new config variables:
139
+  loadpath = <modules path> - directory where to load the modules from (-L
140
+     equivalent); modules can be loaded simply by specifying their name
141
+     (loadmodule "maxfwd")
139 142
   tcp_fd_cache = yes | no (default yes) - if enabled FDs used for sending
140 143
      will be cached inside the process calling tcp_send (performance increase
141 144
      for sending over tcp at the cost of slightly slower connection closing and
... ...
@@ -346,6 +346,7 @@ STUN_ALLOW_FP "stun_allow_fp"
346 346
 CFG_DESCRIPTION		"description"|"descr"|"desc"
347 347
 
348 348
 LOADMODULE	loadmodule
349
+LOADPATH	loadpath
349 350
 MODPARAM        modparam
350 351
 
351 352
 /* values */
... ...
@@ -653,6 +654,7 @@ EAT_ABLE	[\ \t\b\r]
653 653
 									return KILL_TIMEOUT; }
654 654
 <INITIAL>{CFG_DESCRIPTION}	{ count(); yylval.strval=yytext; return CFG_DESCRIPTION; }
655 655
 <INITIAL>{LOADMODULE}	{ count(); yylval.strval=yytext; return LOADMODULE; }
656
+<INITIAL>{LOADPATH}		{ count(); yylval.strval=yytext; return LOADPATH; }
656 657
 <INITIAL>{MODPARAM}     { count(); yylval.strval=yytext; return MODPARAM; }
657 658
 
658 659
 <INITIAL>{STUN_REFRESH_INTERVAL} { count(); yylval.strval=yytext; return STUN_REFRESH_INTERVAL;}
... ...
@@ -321,6 +321,7 @@ static struct socket_id* mk_listen_id(char*, int, int);
321 321
 %token SERVER_SIGNATURE
322 322
 %token REPLY_TO_VIA
323 323
 %token LOADMODULE
324
+%token LOADPATH
324 325
 %token MODPARAM
325 326
 %token MAXBUFFER
326 327
 %token USER
... ...
@@ -1145,6 +1146,12 @@ module_stm:
1145 1145
 			}
1146 1146
 	}
1147 1147
 	| LOADMODULE error	{ yyerror("string expected"); }
1148
+	| LOADPATH STRING {
1149
+		DBG("loading modules under %s\n", $2);
1150
+		printf("loading modules under %s\n", $2);
1151
+		mods_dir = $2;
1152
+	}
1153
+	| LOADPATH error	{ yyerror("string expected"); }
1148 1154
 	| MODPARAM LPAREN STRING COMMA STRING COMMA STRING RPAREN {
1149 1155
 		if (set_mod_param_regex($3, $5, PARAM_STRING, $7) != 0) {
1150 1156
 			 yyerror("Can't set module parameter");