summaryrefslogtreecommitdiff
path: root/proto/mrt/config.Y
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2018-09-18 17:29:00 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2018-09-18 17:50:45 +0200
commitc0fc3e67185c1e0ff2d083572c6ad3983ba4ef25 (patch)
tree9fe17603f4fec18b7f9fbd8d8efc1f13a9bef8ee /proto/mrt/config.Y
parentafa14f1868f2c753efdc81ce8e2c2d44e6bdd80e (diff)
The MRT protocol
The new MRT protocol is responsible for periodic RIB table dumps in the MRT format (RFC 6396). Also the existing code for BGP4MP MRT dumps is refactored and splitted between BGP to MRT protocols, will be more integrated into MRT in the future. Example: protocol mrt { table "*"; filename "%N_%F_%T.mrt"; period 60; } It is partially based on the old MRT code from Pavel Tvrdik.
Diffstat (limited to 'proto/mrt/config.Y')
-rw-r--r--proto/mrt/config.Y67
1 files changed, 67 insertions, 0 deletions
diff --git a/proto/mrt/config.Y b/proto/mrt/config.Y
new file mode 100644
index 00000000..b6fecd1e
--- /dev/null
+++ b/proto/mrt/config.Y
@@ -0,0 +1,67 @@
+/*
+ * BIRD -- Multi-Threaded Routing Toolkit (MRT) Protocol
+ *
+ * (c) 2017--2018 Ondrej Zajicek <santiago@crfreenet.org>
+ * (c) 2017--2018 CZ.NIC z.s.p.o.
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+CF_HDR
+
+#include "proto/mrt/mrt.h"
+
+CF_DEFINES
+
+#define MRT_CFG ((struct mrt_config *) this_proto)
+
+CF_DECLS
+
+CF_KEYWORDS(MRT, TABLE, FILTER, FILENAME, PERIOD, ALWAYS, ADD, PATH, DUMP, TO)
+
+%type <md> mrt_dump_args
+
+CF_GRAMMAR
+
+CF_ADDTO(proto, mrt_proto)
+
+mrt_proto_start: proto_start MRT
+{
+ this_proto = proto_config_new(&proto_mrt, $1);
+};
+
+mrt_proto_item:
+ proto_item
+ | TABLE TEXT { MRT_CFG->table_expr = $2; }
+ | FILTER filter { MRT_CFG->filter = $2; }
+ | where_filter { MRT_CFG->filter = $1; }
+ | FILENAME text { MRT_CFG->filename = $2; }
+ | PERIOD expr { MRT_CFG->period = $2; }
+ | ALWAYS ADD PATH bool { MRT_CFG->always_add_path = $4; }
+ ;
+
+mrt_proto_opts:
+ /* empty */
+ | mrt_proto_opts mrt_proto_item ';'
+ ;
+
+mrt_proto:
+ mrt_proto_start proto_name '{' mrt_proto_opts '}' { mrt_check_config(this_proto); };
+
+CF_CLI_HELP(MRT DUMP, [table <name>|\"<pattern>\"] [to \"<file>\"] [filter <filter>|where <where filter>] , [[Save MRT Table Dump into a file]])
+CF_CLI(MRT DUMP, mrt_dump_args, [table <name>|\"<pattern>\"] [to \"<file>\"] [filter <filter>|where <where filter>], [[Save mrt table dump v2 of table name <t> right now]])
+{ mrt_dump_cmd($3); } ;
+
+mrt_dump_args:
+ /* empty */ { $$ = cfg_allocz(sizeof(struct mrt_dump_data)); }
+ | mrt_dump_args TABLE rtable { $$ = $1; $$->table_ptr = $3->table; }
+ | mrt_dump_args TABLE TEXT { $$ = $1; $$->table_expr = $3; }
+ | mrt_dump_args FILTER filter { $$ = $1; $$->filter = $3; }
+ | mrt_dump_args where_filter { $$ = $1; $$->filter = $2; }
+ | mrt_dump_args TO text { $$ = $1; $$->filename = $3; }
+ ;
+
+
+CF_CODE
+
+CF_END