Detailed Description

Files

file  ft.h
 Forwarding table definitions.
 

Data Structures

struct  gnrc_ipv6_nib_ft_t
 Forwarding table entry view on NIB. More...
 

Functions

int gnrc_ipv6_nib_ft_get (const ipv6_addr_t *dst, gnrc_pktsnip_t *pkt, gnrc_ipv6_nib_ft_t *fte)
 Gets the best matching forwarding table entry to a destination. More...
 
int gnrc_ipv6_nib_ft_add (const ipv6_addr_t *dst, unsigned dst_len, const ipv6_addr_t *next_hop, unsigned iface, uint16_t lifetime)
 Adds a new route to the forwarding table. More...
 
void gnrc_ipv6_nib_ft_del (const ipv6_addr_t *dst, unsigned dst_len)
 Deletes a route from forwarding table. More...
 
bool gnrc_ipv6_nib_ft_iter (const ipv6_addr_t *next_hop, unsigned iface, void **state, gnrc_ipv6_nib_ft_t *fte)
 Iterates over all forwarding table entries in the NIB. More...
 
void gnrc_ipv6_nib_ft_print (const gnrc_ipv6_nib_ft_t *fte)
 Prints a forwarding table entry. More...
 

Function Documentation

◆ gnrc_ipv6_nib_ft_add()

int gnrc_ipv6_nib_ft_add ( const ipv6_addr_t dst,
unsigned  dst_len,
const ipv6_addr_t next_hop,
unsigned  iface,
uint16_t  lifetime 
)

Adds a new route to the forwarding table.

If dst is the default route, the route will be configured to be the default route.

Parameters
[in]dstThe destination to the route. May be NULL or :: for default route.
[in]dst_lenThe prefix length of dst in bits. May be 0 for default route.
[in]next_hopThe next hop to dst/dst_len. May be NULL, if dst/dst_len is no the default route.
[in]ifaceThe interface to next_hop. May not be 0.
[in]lifetimeLifetime of the route in seconds. 0 for infinite lifetime.
Returns
0, on success.
-EINVAL, if a parameter was of invalid value.
-ENOMEM, if there was no space left in forwarding table.

◆ gnrc_ipv6_nib_ft_del()

void gnrc_ipv6_nib_ft_del ( const ipv6_addr_t dst,
unsigned  dst_len 
)

Deletes a route from forwarding table.

If dst is the default route, the function assures, that the current primary default route is removed first.

Parameters
[in]dstThe destination of the route. May be NULL or :: for default route.
[in]dst_lenThe prefix length of dst in bits. May be 0 for default route.

◆ gnrc_ipv6_nib_ft_get()

int gnrc_ipv6_nib_ft_get ( const ipv6_addr_t dst,
gnrc_pktsnip_t pkt,
gnrc_ipv6_nib_ft_t fte 
)

Gets the best matching forwarding table entry to a destination.

Precondition
(dst != NULL) && (fte != NULL)
Parameters
[in]dstThe destination.
[in]pktPacket that is supposed to go to that destination (is handed over to a reactive routing protocol if one exists on the interface found and no route is found)
[out]fteThe resulting forwarding table entry.
Returns
0, on success.
-ENETUNREACH, if no route was found.

◆ gnrc_ipv6_nib_ft_iter()

bool gnrc_ipv6_nib_ft_iter ( const ipv6_addr_t next_hop,
unsigned  iface,
void **  state,
gnrc_ipv6_nib_ft_t fte 
)

Iterates over all forwarding table entries in the NIB.

Precondition
(state != NULL) && (fte != NULL)
Parameters
[in]next_hopRestrict iteration to entries to this next hop. NULL for any next hop. Can be used to build a source routing tree.
[in]ifaceRestrict iteration to entries on this interface. 0 for any interface.
[in,out]stateIteration state of the forwarding table. Must point to a NULL pointer to start iteration.
[out]fteThe next forwarding table entry.

The iteration over all forwarding table entries in the NIB includes all entries added via gnrc_ipv6_nib_ft_add() and entries that are currently in the Destination Cache, in the Prefix List, and in the Default Router List.

Usage example:

int main(void) {
void *state = NULL;
puts("My neighbors:");
while (gnrc_ipv6_nib_ft_iter(NULL, 0, &state, &fte)) {
}
return 0;
}
Note
The list may change during iteration.
Returns
true, if iteration can be continued.
false, if fte is the last neighbor cache entry in the NIB.

◆ gnrc_ipv6_nib_ft_print()

void gnrc_ipv6_nib_ft_print ( const gnrc_ipv6_nib_ft_t fte)

Prints a forwarding table entry.

Precondition
fce != NULL
Parameters
[in]fteA forwarding table entry.