summaryrefslogtreecommitdiffstats
path: root/src/announce.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/announce.c')
-rw-r--r--src/announce.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/announce.c b/src/announce.c
index dbe7a4c..1891341 100644
--- a/src/announce.c
+++ b/src/announce.c
@@ -25,6 +25,7 @@
#include "babel.h"
+#include "neigh.h"
#include <stdlib.h>
@@ -68,3 +69,25 @@ gp_babel_announce_t* gp_babel_announce_get(gmrf_t *gmrf, gmrf_context_t *ctx, co
void gp_babel_announce_free(gmrf_t *gmrf, gmrf_context_t *ctx, gp_babel_announce_t *announce) {
free(announce);
}
+
+gp_babel_nexthop_t* gp_babel_announce_nexthop_find(const gp_babel_announce_t *announce, gp_babel_neigh_t *neigh) {
+ gp_babel_nexthop_t *nexthop;
+ for (nexthop = announce->nexthops; nexthop; nexthop = nexthop->next) {
+ if (nexthop->neigh == neigh)
+ return nexthop;
+ }
+
+ return NULL;
+}
+
+gp_babel_nexthop_t* gp_babel_announce_nexthop_new(gp_babel_announce_t *announce, gp_babel_neigh_t *neigh) {
+ gp_babel_nexthop_t *nexthop = calloc(1, sizeof(gp_babel_nexthop_t));
+ nexthop->neigh = neigh;
+
+ nexthop->next = announce->nexthops;
+ announce->nexthops = nexthop;
+
+ gp_babel_neigh_ref(neigh);
+
+ return nexthop;
+}