diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-03-24 02:54:17 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-03-24 02:54:17 +0100 |
commit | 0af36311e10c0dd480bcfca5774db738e165066d (patch) | |
tree | 18d6b161e73f20b33b7505442f14af1e33265a8e /src/announce.c | |
parent | a5d0293827874ccce048c8654f58711f807a3e96 (diff) | |
download | babel-0af36311e10c0dd480bcfca5774db738e165066d.tar babel-0af36311e10c0dd480bcfca5774db738e165066d.zip |
Add nexthop data structure and receive updates
Diffstat (limited to 'src/announce.c')
-rw-r--r-- | src/announce.c | 23 |
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; +} |