riot_sys

Function gnrc_ipv6_nib_ft_iter

Source
pub unsafe extern "C" fn gnrc_ipv6_nib_ft_iter(
    next_hop: *const ipv6_addr_t,
    iface: c_uint,
    state: *mut *mut c_void,
    fte: *mut gnrc_ipv6_nib_ft_t,
) -> bool
Expand description

@brief Iterates over all forwarding table entries in the NIB

@pre (state != NULL) && (fte != NULL)

@param[in] next_hop Restrict iteration to entries to this next hop. NULL for any next hop. Can be used to build a source routing tree. @param[in] iface Restrict iteration to entries on this interface. 0 for any interface. @param[in,out] state Iteration state of the forwarding table. Must point to a NULL pointer to start iteration. @param[out] fte The next forwarding table entry.

The iteration over all forwarding table entries in the NIB includes all entries added via @p gnrc_ipv6_nib_ft_add() and entries that are currently in the Destination Cache, in the Prefix List (only if they’re on-link), and in the Default Router List.

Usage example:

#include "net/gnrc/ipv6/nib/ft.h"

int main(void) {
    void *state = NULL;
    gnrc_ipv6_nib_ft_t fte;

    puts("My neighbors:");
    while (gnrc_ipv6_nib_ft_iter(NULL, 0, &state, &fte)) {
        gnrc_ipv6_nib_ft_print(&fte);
    }
    return 0;
}

@note The list may change during iteration.

@return true, if iteration can be continued. @return false, if @p fte is the last neighbor cache entry in the NIB.