[sr-dev] git:master:98fa9495: core: cfgengine - new global parameter/statement

Daniel-Constantin Mierla miconda at gmail.com
Tue Apr 12 14:45:29 CEST 2016


Module: kamailio
Branch: master
Commit: 98fa9495747fc89ef85f222bb37dbe63f82ed1b3
URL: https://github.com/kamailio/kamailio/commit/98fa9495747fc89ef85f222bb37dbe63f82ed1b3

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-04-12T14:10:28+02:00

core: cfgengine - new global parameter/statement

- set the config interpreter engine, can be used like:

  cfgengine="name"
  cfgengine "name"

If name is "native" or "default", it expects to have in native config
interpreter for routing logic.

The name can be the identifier of an embedded language interpreter, such
as "lua" which is registered by the app_lua module:

  cfgengine "lua"

---

Modified: cfg.lex
Modified: cfg.y

---

Diff:  https://github.com/kamailio/kamailio/commit/98fa9495747fc89ef85f222bb37dbe63f82ed1b3.diff
Patch: https://github.com/kamailio/kamailio/commit/98fa9495747fc89ef85f222bb37dbe63f82ed1b3.patch

---

diff --git a/cfg.lex b/cfg.lex
index 1544e6e..336322c 100644
--- a/cfg.lex
+++ b/cfg.lex
@@ -452,6 +452,8 @@ LOADMODULE	loadmodule
 LOADPATH	"loadpath"|"mpath"
 MODPARAM        modparam
 
+CFGENGINE	"cfgengine"
+
 /* values */
 YES			"yes"|"true"|"on"|"enable"
 NO			"no"|"false"|"off"|"disable"
@@ -916,6 +918,7 @@ IMPORTFILE      "import_file"
 <INITIAL>{LOADMODULE}	{ count(); yylval.strval=yytext; return LOADMODULE; }
 <INITIAL>{LOADPATH}		{ count(); yylval.strval=yytext; return LOADPATH; }
 <INITIAL>{MODPARAM}     { count(); yylval.strval=yytext; return MODPARAM; }
+<INITIAL>{CFGENGINE}	{ count(); yylval.strval=yytext; return CFGENGINE; }
 
 <INITIAL>{EQUAL}	{ count(); return EQUAL; }
 <INITIAL>{ADDEQ}          { count(); return ADDEQ; }
diff --git a/cfg.y b/cfg.y
index 24b2240..55d4220 100644
--- a/cfg.y
+++ b/cfg.y
@@ -67,6 +67,7 @@
 #include "msg_translator.h"
 #include "async_task.h"
 
+#include "kemi.h"
 #include "ppcfg.h"
 #include "pvapi.h"
 #include "config.h"
@@ -390,6 +391,7 @@ extern char *default_routename;
 %token LOADMODULE
 %token LOADPATH
 %token MODPARAM
+%token CFGENGINE
 %token MAXBUFFER
 %token SQL_BUFFER_SIZE
 %token USER
@@ -1643,6 +1645,21 @@ module_stm:
 		}
 	}
 	| MODPARAM error { yyerror("Invalid arguments"); }
+	| CFGENGINE STRING {
+		if(sr_kemi_eng_setz($2, NULL)) {
+			yyerror("Can't set config routing engine");
+			YYABORT;
+		}
+	}
+	| CFGENGINE error	{ yyerror("string expected"); }
+	| CFGENGINE EQUAL STRING {
+		if(sr_kemi_eng_setz($3, NULL)) {
+			yyerror("Can't set config routing engine");
+			YYABORT;
+		}
+	}
+	| CFGENGINE EQUAL error	{ yyerror("string expected"); }
+
 	;
 ip:
 	ipv4  { $$=$1; }




More information about the sr-dev mailing list