summaryrefslogtreecommitdiffstats
path: root/src/neigh.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/neigh.c')
-rw-r--r--src/neigh.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/neigh.c b/src/neigh.c
index b89e284..252713c 100644
--- a/src/neigh.c
+++ b/src/neigh.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
-gp_babel_neigh_t* gp_babel_neigh_get(gp_babel_iface_t *iface, const gmrf_addr_t *addr) {
+gp_babel_neigh_t* gp_babel_neigh_get(gmrf_iface_state_t *iface, const gmrf_addr_t *addr) {
gp_babel_neigh_t *neigh = gp_babel_neigh_find(iface, addr);
if (!neigh) {
neigh = calloc(1, sizeof(gp_babel_neigh_t));
@@ -64,11 +64,11 @@ void gp_babel_neigh_unref(gp_babel_neigh_t *neigh) {
free(neigh);
}
-uint16_t gp_babel_neigh_get_rxcost(gmrf_t *gmrf, const gp_babel_neigh_t *neigh) {
+uint16_t gp_babel_neigh_get_rxcost(gmrf_context_t *ctx, const gp_babel_neigh_t *neigh) {
if (!neigh->hello_log || !neigh->hello_interval || !neigh->iface)
return GP_BABEL_INFINITY;
- int timediff = (gmrf_now(gmrf) - neigh->last_hello)/10;
+ int timediff = (gmrf_now(ctx->gmrf) - neigh->last_hello)/10;
int shift = (timediff - neigh->hello_interval/2)/neigh->hello_interval;
if (shift >= 16)
@@ -82,22 +82,22 @@ uint16_t gp_babel_neigh_get_rxcost(gmrf_t *gmrf, const gp_babel_neigh_t *neigh)
return (0x1000/received);
}
-uint16_t gp_babel_neigh_get_txcost(gmrf_t *gmrf, const gp_babel_neigh_t *neigh) {
- if ((gmrf_now(gmrf) - neigh->last_ihu)/10 > GP_BABEL_IHU_TIMEOUT(neigh->ihu_interval) || !neigh->iface)
+uint16_t gp_babel_neigh_get_txcost(gmrf_context_t *ctx, const gp_babel_neigh_t *neigh) {
+ if ((gmrf_now(ctx->gmrf) - neigh->last_ihu)/10 > GP_BABEL_IHU_TIMEOUT(neigh->ihu_interval) || !neigh->iface)
return GP_BABEL_INFINITY;
else
return neigh->txcost;
}
-uint16_t gp_babel_neigh_get_cost(gmrf_t *gmrf, const gp_babel_neigh_t *neigh) {
+uint16_t gp_babel_neigh_get_cost(gmrf_context_t *ctx, const gp_babel_neigh_t *neigh) {
if (!neigh) /* self */
return 0;
- uint16_t txcost = gp_babel_neigh_get_txcost(gmrf, neigh);
+ uint16_t txcost = gp_babel_neigh_get_txcost(ctx, neigh);
if (txcost < 256)
txcost = 256;
- uint32_t cost = (txcost * gp_babel_neigh_get_rxcost(gmrf, neigh)) >> 8;
+ uint32_t cost = (txcost * gp_babel_neigh_get_rxcost(ctx, neigh)) >> 8;
if (cost > GP_BABEL_INFINITY)
return GP_BABEL_INFINITY;
@@ -105,6 +105,6 @@ uint16_t gp_babel_neigh_get_cost(gmrf_t *gmrf, const gp_babel_neigh_t *neigh) {
return cost;
}
-void gp_babel_neigh_reset(gp_babel_iface_t *iface, gp_babel_neigh_t *neigh) {
+void gp_babel_neigh_reset(gmrf_iface_state_t *iface, gp_babel_neigh_t *neigh) {
//gp_babel_send_announce_request(iface, neigh, GMRF_PROTO_BABEL_NODE_ID_UNSPEC, 0, 0, true /* XXX change this later */);
}