Browse code

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"

Daniel-Constantin Mierla authored on 12/04/2016 12:10:28
Showing 2 changed files
... ...
@@ -452,6 +452,8 @@ LOADMODULE	loadmodule
452 452
 LOADPATH	"loadpath"|"mpath"
453 453
 MODPARAM        modparam
454 454
 
455
+CFGENGINE	"cfgengine"
456
+
455 457
 /* values */
456 458
 YES			"yes"|"true"|"on"|"enable"
457 459
 NO			"no"|"false"|"off"|"disable"
... ...
@@ -916,6 +918,7 @@ IMPORTFILE      "import_file"
916 918
 <INITIAL>{LOADMODULE}	{ count(); yylval.strval=yytext; return LOADMODULE; }
917 919
 <INITIAL>{LOADPATH}		{ count(); yylval.strval=yytext; return LOADPATH; }
918 920
 <INITIAL>{MODPARAM}     { count(); yylval.strval=yytext; return MODPARAM; }
921
+<INITIAL>{CFGENGINE}	{ count(); yylval.strval=yytext; return CFGENGINE; }
919 922
 
920 923
 <INITIAL>{EQUAL}	{ count(); return EQUAL; }
921 924
 <INITIAL>{ADDEQ}          { count(); return ADDEQ; }
... ...
@@ -67,6 +67,7 @@
67 67
 #include "msg_translator.h"
68 68
 #include "async_task.h"
69 69
 
70
+#include "kemi.h"
70 71
 #include "ppcfg.h"
71 72
 #include "pvapi.h"
72 73
 #include "config.h"
... ...
@@ -390,6 +391,7 @@ extern char *default_routename;
390 391
 %token LOADMODULE
391 392
 %token LOADPATH
392 393
 %token MODPARAM
394
+%token CFGENGINE
393 395
 %token MAXBUFFER
394 396
 %token SQL_BUFFER_SIZE
395 397
 %token USER
... ...
@@ -1643,6 +1645,21 @@ module_stm:
1643 1645
 		}
1644 1646
 	}
1645 1647
 	| MODPARAM error { yyerror("Invalid arguments"); }
1648
+	| CFGENGINE STRING {
1649
+		if(sr_kemi_eng_setz($2, NULL)) {
1650
+			yyerror("Can't set config routing engine");
1651
+			YYABORT;
1652
+		}
1653
+	}
1654
+	| CFGENGINE error	{ yyerror("string expected"); }
1655
+	| CFGENGINE EQUAL STRING {
1656
+		if(sr_kemi_eng_setz($3, NULL)) {
1657
+			yyerror("Can't set config routing engine");
1658
+			YYABORT;
1659
+		}
1660
+	}
1661
+	| CFGENGINE EQUAL error	{ yyerror("string expected"); }
1662
+
1646 1663
 	;
1647 1664
 ip:
1648 1665
 	ipv4  { $$=$1; }