diff options
Diffstat (limited to 'ffd/neigh.h')
-rw-r--r-- | ffd/neigh.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ffd/neigh.h b/ffd/neigh.h index d82025c..aa0d1f9 100644 --- a/ffd/neigh.h +++ b/ffd/neigh.h @@ -40,8 +40,18 @@ static inline ffd_neigh_t* ffd_neigh_find(const ffd_iface_t *iface, const eth_ad return NULL; } +static inline void ffd_neigh_ref(ffd_neigh_t *neigh) { + neigh->ref++; +} + +static inline void ffd_neigh_unref(ffd_neigh_t *neigh) { + if (!(--neigh->ref) && !neigh->iface) + free(neigh); +} + ffd_neigh_t* ffd_neigh_get(ffd_iface_t *iface, const eth_addr_t *addr); -void ffd_neigh_free_list(ffd_neigh_t *neigh); +void ffd_neigh_unref(ffd_neigh_t *neigh); +void ffd_neigh_unref_list(ffd_neigh_t *neigh); uint16_t ffd_neigh_get_rxcost(const ffd_neigh_t *neigh); uint16_t ffd_neigh_get_txcost(const ffd_neigh_t *neigh); |