gnrc_ipv6_nib: add _nib_onl_nc_get()

This commit is contained in:
Benjamin Valentin 2021-07-22 13:24:03 +02:00
parent 11e9b7c08f
commit c189ed5d1b

View File

@ -350,6 +350,26 @@ _nib_onl_entry_t *_nib_onl_iter(const _nib_onl_entry_t *last);
*/
_nib_onl_entry_t *_nib_onl_get(const ipv6_addr_t *addr, unsigned iface);
/**
* @brief Gets a node by IPv6 address and interface from the neighbor cache
*
* @pre `(addr != NULL)`
*
* @param[in] addr The address of a node. Must not be NULL.
* @param[in] iface The interface to the node. May be 0 for any interface.
*
* @return The Neighbor Cache entry for node with @p addr and @p iface on success.
* @return NULL, if there is no such entry.
*/
static inline _nib_onl_entry_t *_nib_onl_nc_get(const ipv6_addr_t *addr, unsigned iface)
{
_nib_onl_entry_t *nce = _nib_onl_get(addr, iface);
if (nce && (nce->mode & _NC)) {
return nce;
}
return NULL;
}
/**
* @brief Creates or gets an existing node from the neighbor cache by address
*