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 916
 <INITIAL>{LOADMODULE}	{ count(); yylval.strval=yytext; return LOADMODULE; }
917 917
 <INITIAL>{LOADPATH}		{ count(); yylval.strval=yytext; return LOADPATH; }
918 918
 <INITIAL>{MODPARAM}     { count(); yylval.strval=yytext; return MODPARAM; }
919
+<INITIAL>{CFGENGINE}	{ count(); yylval.strval=yytext; return CFGENGINE; }
919 920
 
920 921
 <INITIAL>{EQUAL}	{ count(); return EQUAL; }
921 922
 <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 390
 %token LOADMODULE
391 391
 %token LOADPATH
392 392
 %token MODPARAM
393
+%token CFGENGINE
393 394
 %token MAXBUFFER
394 395
 %token SQL_BUFFER_SIZE
395 396
 %token USER
... ...
@@ -1643,6 +1645,21 @@ module_stm:
1643 1643
 		}
1644 1644
 	}
1645 1645
 	| MODPARAM error { yyerror("Invalid arguments"); }
1646
+	| CFGENGINE STRING {
1647
+		if(sr_kemi_eng_setz($2, NULL)) {
1648
+			yyerror("Can't set config routing engine");
1649
+			YYABORT;
1650
+		}
1651
+	}
1652
+	| CFGENGINE error	{ yyerror("string expected"); }
1653
+	| CFGENGINE EQUAL STRING {
1654
+		if(sr_kemi_eng_setz($3, NULL)) {
1655
+			yyerror("Can't set config routing engine");
1656
+			YYABORT;
1657
+		}
1658
+	}
1659
+	| CFGENGINE EQUAL error	{ yyerror("string expected"); }
1660
+
1646 1661
 	;
1647 1662
 ip:
1648 1663
 	ipv4  { $$=$1; }