summaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1998-12-06 19:21:23 +0100
committerMartin Mares <mj@ucw.cz>1998-12-06 19:21:23 +0100
commita1bf6440b5c27f7fb829eb25f6ac1c2629eb72eb (patch)
tree754d594eadd2439383bc8bbcb97d91265a090651 /proto
parent980ffedbb04bf3beedf147fc7dfed40cdbf968aa (diff)
downloadbird-a1bf6440b5c27f7fb829eb25f6ac1c2629eb72eb.tar
bird-a1bf6440b5c27f7fb829eb25f6ac1c2629eb72eb.zip
Added skeleton of static route protocol.
Diffstat (limited to 'proto')
-rw-r--r--proto/static/Makefile4
-rw-r--r--proto/static/config.Y34
-rw-r--r--proto/static/static.c73
-rw-r--r--proto/static/static.h30
4 files changed, 141 insertions, 0 deletions
diff --git a/proto/static/Makefile b/proto/static/Makefile
new file mode 100644
index 0000000..7771c2f
--- /dev/null
+++ b/proto/static/Makefile
@@ -0,0 +1,4 @@
+THISDIR=proto/static
+OBJS=static.o
+
+include ../../Rules
diff --git a/proto/static/config.Y b/proto/static/config.Y
new file mode 100644
index 0000000..a9eaa87
--- /dev/null
+++ b/proto/static/config.Y
@@ -0,0 +1,34 @@
+/*
+ * BIRD -- Static Protocol Configuration
+ *
+ * (c) 1998 Martin Mares <mj@ucw.cz>
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+CF_HDR
+
+#include "proto/static/static.h"
+
+CF_DECLS
+
+CF_KEYWORDS(STATIC)
+
+CF_GRAMMAR
+
+CF_ADDTO(proto, static_proto '}')
+
+static_proto_start: proto_start STATIC {
+ this_proto = proto_new(&proto_static, sizeof(struct static_proto));
+ static_init_instance((struct static_proto *) this_proto);
+ }
+ ;
+
+static_proto:
+ static_proto_start proto_name '{'
+ | static_proto proto_item ';'
+ ;
+
+CF_CODE
+
+CF_END
diff --git a/proto/static/static.c b/proto/static/static.c
new file mode 100644
index 0000000..679ee6e
--- /dev/null
+++ b/proto/static/static.c
@@ -0,0 +1,73 @@
+/*
+ * BIRD -- Static Route Generator
+ *
+ * (c) 1998 Martin Mares <mj@ucw.cz>
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+#define LOCAL_DEBUG
+
+#include "nest/bird.h"
+#include "nest/iface.h"
+#include "nest/protocol.h"
+#include "nest/route.h"
+#include "conf/conf.h"
+
+#include "static.h"
+
+#define GET_DATA struct static_proto *p = (struct static_proto *) P
+
+static void
+static_start(struct proto *P)
+{
+ DBG("Static: take off!\n");
+}
+
+static void
+static_neigh_notify(struct neighbor *n)
+{
+ DBG("Static: neighbor notify got, don't know why.\n");
+}
+
+static void
+static_dump(struct proto *P)
+{
+ DBG("Static: no dumps available in demo version.\n");
+}
+
+void
+static_init_instance(struct static_proto *P)
+{
+ struct proto *p = &P->p;
+
+ p->preference = DEF_PREF_STATIC;
+ p->start = static_start;
+ p->neigh_notify = static_neigh_notify;
+ p->dump = static_dump;
+ /* FIXME: Should shutdown remove all routes? */
+}
+
+static void
+static_init(struct protocol *p)
+{
+}
+
+static void
+static_preconfig(struct protocol *x)
+{
+}
+
+static void
+static_postconfig(struct protocol *p)
+{
+}
+
+struct protocol proto_static = {
+ { NULL, NULL },
+ "Static",
+ 0,
+ static_init,
+ static_preconfig,
+ static_postconfig
+};
diff --git a/proto/static/static.h b/proto/static/static.h
new file mode 100644
index 0000000..df18c13
--- /dev/null
+++ b/proto/static/static.h
@@ -0,0 +1,30 @@
+/*
+ * BIRD -- Static Route Generator
+ *
+ * (c) 1998 Martin Mares <mj@ucw.cz>
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+#ifndef _BIRD_STATIC_H_
+#define _BIRD_STATIC_H_
+
+struct static_proto {
+ struct proto p;
+ list routes;
+};
+
+void static_init_instance(struct static_proto *);
+
+struct static_route {
+ node n;
+ u32 net; /* Network we route */
+ int masklen; /* Mask length */
+ int dest; /* Destination type (RTD_*) */
+ u32 via; /* Destination router */
+ struct neighbor *neigh;
+ /* FIXME: Device routes, maybe via device patterns? */
+ /* FIXME: More route attributes, probably via filter syntax */
+};
+
+#endif