summaryrefslogtreecommitdiffstats
path: root/src/config.y
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-04-11 18:56:47 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-04-11 18:56:47 +0200
commit7cac6770e0b380d6e5f37b9fad71c9f7f15952ba (patch)
tree8d2c695f27361aa8b3b6d91038f4c78182f64a16 /src/config.y
parenta45a313422efa33f261cb1b53a08646a6b3ab947 (diff)
downloadfastd-7cac6770e0b380d6e5f37b9fad71c9f7f15952ba.tar
fastd-7cac6770e0b380d6e5f37b9fad71c9f7f15952ba.zip
Add support for async commands
Diffstat (limited to 'src/config.y')
-rw-r--r--src/config.y44
1 files changed, 30 insertions, 14 deletions
diff --git a/src/config.y b/src/config.y
index 70ee4a2..2bdd5d3 100644
--- a/src/config.y
+++ b/src/config.y
@@ -69,6 +69,7 @@
%token TOK_ADDRESSES
%token TOK_ANY
%token TOK_AS
+%token TOK_ASYNC
%token TOK_AUTO
%token TOK_BIND
%token TOK_CAPABILITIES
@@ -118,6 +119,7 @@
%token TOK_SECRET
%token TOK_SECURE
%token TOK_STDERR
+%token TOK_SYNC
%token TOK_SYSLOG
%token TOK_TAP
%token TOK_TO
@@ -155,6 +157,9 @@
%type <uint64> bind_default
%type <uint64> drop_capabilities_enabled
%type <tristate> autobool
+%type <boolean> sync
+%type <boolean> sync_def_sync
+%type <boolean> sync_def_async
%%
start: START_CONFIG config
@@ -373,38 +378,38 @@ method: TOK_STRING {
secret: TOK_STRING { free(conf->secret); conf->secret = strdup($1->str); }
;
-on_pre_up: TOK_STRING {
- fastd_shell_command_set(&conf->on_pre_up, $1->str);
+on_pre_up: sync_def_sync TOK_STRING {
+ fastd_shell_command_set(&conf->on_pre_up, $2->str, $1);
}
;
-on_up: TOK_STRING {
- fastd_shell_command_set(&conf->on_up, $1->str);
+on_up: sync_def_sync TOK_STRING {
+ fastd_shell_command_set(&conf->on_up, $2->str, $1);
}
;
-on_down: TOK_STRING {
- fastd_shell_command_set(&conf->on_down, $1->str);
+on_down: sync_def_sync TOK_STRING {
+ fastd_shell_command_set(&conf->on_down, $2->str, $1);
}
;
-on_post_down: TOK_STRING {
- fastd_shell_command_set(&conf->on_post_down, $1->str);
+on_post_down: sync_def_sync TOK_STRING {
+ fastd_shell_command_set(&conf->on_post_down, $2->str, $1);
}
;
-on_establish: TOK_STRING {
- fastd_shell_command_set(&conf->on_establish, $1->str);
+on_establish: sync_def_async TOK_STRING {
+ fastd_shell_command_set(&conf->on_establish, $2->str, $1);
}
;
-on_disestablish: TOK_STRING {
- fastd_shell_command_set(&conf->on_disestablish, $1->str);
+on_disestablish: sync_def_async TOK_STRING {
+ fastd_shell_command_set(&conf->on_disestablish, $2->str, $1);
}
;
-on_verify: TOK_STRING {
- fastd_shell_command_set(&conf->on_verify, $1->str);
+on_verify: sync_def_async TOK_STRING {
+ fastd_shell_command_set(&conf->on_verify, $2->str, $1);
}
;
@@ -565,6 +570,17 @@ maybe_float: TOK_FLOAT { $$ = true; }
| { $$ = false; }
;
+sync_def_sync: sync { $$ = $1; }
+ | { $$ = true; }
+ ;
+
+sync_def_async: sync { $$ = $1; }
+ | { $$ = false; }
+ ;
+
+sync: TOK_SYNC { $$ = true; }
+ | TOK_ASYNC { $$ = false; }
+
boolean: TOK_YES { $$ = true; }
| TOK_NO { $$ = false; }
;