summaryrefslogtreecommitdiffstats
path: root/src/config.y
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-04-05 20:38:30 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-04-05 20:38:30 +0200
commita6a5b5e00e98aa27644a1afa4a461819221b758d (patch)
treecf1fc8ba118e3114172f488f3b3fddde73399240 /src/config.y
parent9720307ab4d78bec3fc7bc7e44cf8ba217584a17 (diff)
downloadfastd-a6a5b5e00e98aa27644a1afa4a461819221b758d.tar
fastd-a6a5b5e00e98aa27644a1afa4a461819221b758d.zip
Add on-establish and on-disestablish commandsv0.2
Diffstat (limited to 'src/config.y')
-rw-r--r--src/config.y22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/config.y b/src/config.y
index 0af0980..ac5f808 100644
--- a/src/config.y
+++ b/src/config.y
@@ -73,6 +73,8 @@
%token TOK_ON
%token TOK_UP
%token TOK_DOWN
+%token TOK_ESTABLISH
+%token TOK_DISESTABLISH
%token TOK_PEERS
%token TOK_FROM
%token TOK_LOG
@@ -131,6 +133,8 @@ statement: TOK_LOG log ';'
| TOK_SECRET secret ';'
| TOK_ON TOK_UP on_up ';'
| TOK_ON TOK_DOWN on_down ';'
+ | TOK_ON TOK_ESTABLISH on_establish ';'
+ | TOK_ON TOK_DISESTABLISH on_disestablish ';'
| TOK_PEER peer '{' peer_conf '}'
| TOK_PEER_TO_PEER peer_to_peer ';'
| TOK_INCLUDE include ';'
@@ -212,6 +216,24 @@ on_down: TOK_STRING {
}
;
+on_establish: TOK_STRING {
+ free(conf->on_establish);
+ free(conf->on_establish_dir);
+
+ conf->on_establish = strdup($1->str);
+ conf->on_establish_dir = get_current_dir_name();
+ }
+ ;
+
+on_disestablish: TOK_STRING {
+ free(conf->on_disestablish);
+ free(conf->on_disestablish_dir);
+
+ conf->on_disestablish = strdup($1->str);
+ conf->on_disestablish_dir = get_current_dir_name();
+ }
+ ;
+
peer: maybe_string {
fastd_peer_config_new(ctx, conf);
conf->peers->name = strdup($1->str);