FIB implementation. More...
FIB implementation.
This module is unused by RIOT's networking stacks, see Forwarding table instead.
Files | |
file | fib.h |
Types and functions for FIB. | |
file | table.h |
Types and functions for operating fib tables. | |
Data Structures | |
struct | rp_address_msg_t |
Routing Protocol (RP) message content to request/reply notification. More... | |
struct | fib_destination_set_entry_t |
entry used to collect available destinations More... | |
Macros | |
#define | FIB_MSG_RP_SIGNAL_UNREACHABLE_DESTINATION (0x99) |
message type for RP notification: no route to destination available, start route discovery if appropriate | |
#define | FIB_MSG_RP_SIGNAL_DESTINATION_USED (0x98) |
message type for RP notification: entry used | |
#define | FIB_MSG_RP_SIGNAL_SOURCE_ROUTE_CREATED (0x97) |
message type for RP notification: source route created | |
#define | FIB_LIFETIME_NO_EXPIRE (0xFFFFFFFFffffffff) |
indicator of a lifetime that does not expire (2^64 - 1) | |
#define | FIB_FLAG_RPL_ROUTE (1UL << 0) |
flag to identify if a route was set by RPL | |
#define | FIB_FLAG_NET_PREFIX_SHIFT (24) |
flag used as shift for the net prefix length in bits | |
#define | FIB_FLAG_NET_PREFIX_MASK (0xffUL << FIB_FLAG_NET_PREFIX_SHIFT) |
flag used as mask for the net prefix length in bits | |
Functions | |
void | fib_init (fib_table_t *table) |
initializes all FIB entries with 0 | |
void | fib_deinit (fib_table_t *table) |
de-initializes the FIB entries and source route entries | |
int | fib_register_rp (fib_table_t *table, uint8_t *prefix, size_t prefix_addr_type_size) |
Registration of a routing protocol handler function. | |
int | fib_add_entry (fib_table_t *table, kernel_pid_t iface_id, uint8_t *dst, size_t dst_size, uint32_t dst_flags, uint8_t *next_hop, size_t next_hop_size, uint32_t next_hop_flags, uint32_t lifetime) |
Adds a new entry in the corresponding FIB table for global destination and next hop. | |
int | fib_update_entry (fib_table_t *table, uint8_t *dst, size_t dst_size, uint8_t *next_hop, size_t next_hop_size, uint32_t next_hop_flags, uint32_t lifetime) |
Updates an entry in the FIB table with next hop and lifetime. | |
void | fib_remove_entry (fib_table_t *table, uint8_t *dst, size_t dst_size) |
removes an entry from the corresponding FIB table | |
void | fib_flush (fib_table_t *table, kernel_pid_t interface) |
removes all entries from the corresponding FIB table and interface combination | |
int | fib_get_next_hop (fib_table_t *table, kernel_pid_t *iface_id, uint8_t *next_hop, size_t *next_hop_size, uint32_t *next_hop_flags, uint8_t *dst, size_t dst_size, uint32_t dst_flags) |
provides a next hop for a given destination | |
int | fib_get_destination_set (fib_table_t *table, uint8_t *prefix, size_t prefix_size, fib_destination_set_entry_t *dst_set, size_t *dst_set_size) |
provides a set of destination addresses matching the given prefix If the out buffer is insufficient low or passed as NULL, the function will continue to count the number of matching entries and provide the number to the caller. | |
int | fib_sr_create (fib_table_t *table, fib_sr_t **fib_sr, kernel_pid_t sr_iface_id, uint32_t sr_flags, uint32_t sr_lifetime) |
creates a new source route | |
int | fib_sr_read_head (fib_table_t *table, fib_sr_t *fib_sr, kernel_pid_t *sr_iface_id, uint32_t *sr_flags, uint32_t *sr_lifetime) |
reads the information from the sr head to the given locations | |
int | fib_sr_read_destination (fib_table_t *table, fib_sr_t *fib_sr, uint8_t *dst, size_t *dst_size) |
reads the destination address from the sr head to the given location | |
int | fib_sr_set (fib_table_t *table, fib_sr_t *fib_sr, kernel_pid_t *sr_iface_id, uint32_t *sr_flags, uint32_t *sr_lifetime) |
sets the provided parameters in the given sr header if a given parameter is NULL its considered not to be changed | |
int | fib_sr_delete (fib_table_t *table, fib_sr_t *fib_sr) |
deletes the sr | |
int | fib_sr_next (fib_table_t *table, fib_sr_t *fib_sr, fib_sr_entry_t **sr_path_entry) |
iterates to the next entry in the sr_path | |
int | fib_sr_search (fib_table_t *table, fib_sr_t *fib_sr, uint8_t *addr, size_t addr_size, fib_sr_entry_t **sr_path_entry) |
searches the entry containing the given address | |
int | fib_sr_entry_append (fib_table_t *table, fib_sr_t *fib_sr, uint8_t *dst, size_t dst_size) |
append a new entry at the end of the source route, i.e. | |
int | fib_sr_entry_add (fib_table_t *table, fib_sr_t *fib_sr, fib_sr_entry_t *sr_path_entry, uint8_t *addr, size_t addr_size, bool keep_remaining_route) |
adds a new entry behind a given sr entry | |
int | fib_sr_entry_delete (fib_table_t *table, fib_sr_t *fib_sr, uint8_t *addr, size_t addr_size, bool keep_remaining_route) |
removes an entry from a source route | |
int | fib_sr_entry_overwrite (fib_table_t *table, fib_sr_t *fib_sr, uint8_t *addr_old, size_t addr_old_size, uint8_t *addr_new, size_t addr_new_size) |
overwrites the address of an entry with a new address | |
int | fib_sr_entry_get_address (fib_table_t *table, fib_sr_t *fib_sr, fib_sr_entry_t *sr_path_entry, uint8_t *addr, size_t *addr_size) |
writes the address of an entry to the given out pointers | |
int | fib_sr_get_route (fib_table_t *table, uint8_t *dst, size_t dst_size, kernel_pid_t *sr_iface_id, uint32_t *sr_flags, uint8_t *addr_list, size_t *addr_list_size, size_t *element_size, bool reverse, fib_sr_t **fib_sr) |
copies a source route to the given destination | |
int | fib_get_num_used_entries (fib_table_t *table) |
returns the actual number of used FIB entries | |
void | fib_print_notify_rrp (void) |
Prints the kernel_pid_t for all registered RRPs. | |
void | fib_print_fib_table (fib_table_t *table) |
Prints the FIB content (does not print the entries) | |
void | fib_print_routes (fib_table_t *table) |
Prints the FIB content. | |
void | fib_print_sr (fib_table_t *table, fib_sr_t *sr) |
Prints the given FIB sourceroute. | |
#define FIB_FLAG_NET_PREFIX_MASK (0xffUL << FIB_FLAG_NET_PREFIX_SHIFT) |
#define FIB_FLAG_NET_PREFIX_SHIFT (24) |
#define FIB_FLAG_RPL_ROUTE (1UL << 0) |
#define FIB_LIFETIME_NO_EXPIRE (0xFFFFFFFFffffffff) |
#define FIB_MSG_RP_SIGNAL_DESTINATION_USED (0x98) |
#define FIB_MSG_RP_SIGNAL_SOURCE_ROUTE_CREATED (0x97) |
#define FIB_MSG_RP_SIGNAL_UNREACHABLE_DESTINATION (0x99) |
int fib_add_entry | ( | fib_table_t * | table, |
kernel_pid_t | iface_id, | ||
uint8_t * | dst, | ||
size_t | dst_size, | ||
uint32_t | dst_flags, | ||
uint8_t * | next_hop, | ||
size_t | next_hop_size, | ||
uint32_t | next_hop_flags, | ||
uint32_t | lifetime | ||
) |
Adds a new entry in the corresponding FIB table for global destination and next hop.
[in] | table | the fib table the entry should be added to |
[in] | iface_id | the interface ID |
[in] | dst | the destination address |
[in] | dst_size | the destination address size |
[in] | dst_flags | the destination address flags |
[in] | next_hop | the next hop address to be updated |
[in] | next_hop_size | the next hop address size |
[in] | next_hop_flags | the next-hop address flags |
[in] | lifetime | the lifetime in ms to be updates |
void fib_deinit | ( | fib_table_t * | table | ) |
de-initializes the FIB entries and source route entries
[in] | table | the fib instance to de-initialize |
void fib_flush | ( | fib_table_t * | table, |
kernel_pid_t | interface | ||
) |
removes all entries from the corresponding FIB table and interface combination
[in] | table | the fib table to flush |
[in] | interface | entries associated with this interface will be removed |
int fib_get_destination_set | ( | fib_table_t * | table, |
uint8_t * | prefix, | ||
size_t | prefix_size, | ||
fib_destination_set_entry_t * | dst_set, | ||
size_t * | dst_set_size | ||
) |
provides a set of destination addresses matching the given prefix If the out buffer is insufficient low or passed as NULL, the function will continue to count the number of matching entries and provide the number to the caller.
[in] | table | the fib table that should be searched |
[in] | prefix | the destination address |
[in] | prefix_size | the destination address size |
[out] | dst_set | the destination addresses matching the prefix |
[in,out] | dst_set_size | the number of entries available on in and used on out |
int fib_get_next_hop | ( | fib_table_t * | table, |
kernel_pid_t * | iface_id, | ||
uint8_t * | next_hop, | ||
size_t * | next_hop_size, | ||
uint32_t * | next_hop_flags, | ||
uint8_t * | dst, | ||
size_t | dst_size, | ||
uint32_t | dst_flags | ||
) |
provides a next hop for a given destination
[in] | table | the fib table that should be searched |
[in,out] | iface_id | pointer to store the interface ID for the next hop |
[out] | next_hop | pointer where the next hop address should be stored |
[in,out] | next_hop_size | the next hop address size. The value is overwritten with the actual next hop size |
[out] | next_hop_flags | the next-hop address flags, e.g. compression type |
[in] | dst | the destination address |
[in] | dst_size | the destination address size |
[in] | dst_flags | the destination address flags |
int fib_get_num_used_entries | ( | fib_table_t * | table | ) |
returns the actual number of used FIB entries
[in] | table | the fib instance to check |
void fib_init | ( | fib_table_t * | table | ) |
initializes all FIB entries with 0
[in] | table | the fib instance to initialize |
void fib_print_fib_table | ( | fib_table_t * | table | ) |
Prints the FIB content (does not print the entries)
[in] | table | the fib instance to print |
void fib_print_routes | ( | fib_table_t * | table | ) |
Prints the FIB content.
[in] | table | the fib instance to print |
void fib_print_sr | ( | fib_table_t * | table, |
fib_sr_t * | sr | ||
) |
Prints the given FIB sourceroute.
[in] | table | the fib instance to print |
[in] | sr | the source route to print |
int fib_register_rp | ( | fib_table_t * | table, |
uint8_t * | prefix, | ||
size_t | prefix_addr_type_size | ||
) |
Registration of a routing protocol handler function.
[in] | table | the fib table the RP should be registered to |
[in] | prefix | the prefix handled by the according RP |
[in] | prefix_addr_type_size | the size of the address type used for the prefix |
void fib_remove_entry | ( | fib_table_t * | table, |
uint8_t * | dst, | ||
size_t | dst_size | ||
) |
removes an entry from the corresponding FIB table
[in] | table | the fib table containing the entry to remove |
[in] | dst | the destination address |
[in] | dst_size | the destination address size |
int fib_sr_create | ( | fib_table_t * | table, |
fib_sr_t ** | fib_sr, | ||
kernel_pid_t | sr_iface_id, | ||
uint32_t | sr_flags, | ||
uint32_t | sr_lifetime | ||
) |
creates a new source route
[in,out] | table | the table the new source route belongs to |
[in,out] | fib_sr | pointer to store the new created source route pointer |
[in] | sr_iface_id | the interface ID used for the created source route |
[in] | sr_flags | the flags for the source route |
[in] | sr_lifetime | the lifetime in ms of the source route |
int fib_sr_delete | ( | fib_table_t * | table, |
fib_sr_t * | fib_sr | ||
) |
deletes the sr
[in] | table | the fib instance to access |
[in,out] | fib_sr | pointer to the source route to be deleted |
int fib_sr_entry_add | ( | fib_table_t * | table, |
fib_sr_t * | fib_sr, | ||
fib_sr_entry_t * | sr_path_entry, | ||
uint8_t * | addr, | ||
size_t | addr_size, | ||
bool | keep_remaining_route | ||
) |
adds a new entry behind a given sr entry
[in] | table | the table with the source route to add the new entry |
[in] | fib_sr | pointer to the sr to add a hop address |
[in] | sr_path_entry | pointer to the entry after which we add the new one |
[in] | addr | pointer to the new address bytes |
[in] | addr_size | the size in bytes of the address type |
[in] | keep_remaining_route | indicate if the remaining route after sr_path_entry should be kept and appended after the new entry |
int fib_sr_entry_append | ( | fib_table_t * | table, |
fib_sr_t * | fib_sr, | ||
uint8_t * | dst, | ||
size_t | dst_size | ||
) |
append a new entry at the end of the source route, i.e.
a new destination
[in] | table | the table with the source route to append the new entry |
[in] | fib_sr | pointer to the sr to append a hop address |
[in] | dst | pointer to the new destination address bytes |
[in] | dst_size | the size in bytes of the destination address type |
int fib_sr_entry_delete | ( | fib_table_t * | table, |
fib_sr_t * | fib_sr, | ||
uint8_t * | addr, | ||
size_t | addr_size, | ||
bool | keep_remaining_route | ||
) |
removes an entry from a source route
[in] | table | the fib instance to access |
[in] | fib_sr | pointer to the sr to delete a hop address |
[in] | addr | pointer to the address bytes to delete |
[in] | addr_size | the size in bytes of the address type |
[in] | keep_remaining_route | indicate if the remaining route should be kept and appended after the predecessor of the removed entry |
int fib_sr_entry_get_address | ( | fib_table_t * | table, |
fib_sr_t * | fib_sr, | ||
fib_sr_entry_t * | sr_path_entry, | ||
uint8_t * | addr, | ||
size_t * | addr_size | ||
) |
writes the address of an entry to the given out pointers
[in] | table | the fib instance to access |
[in] | fib_sr | pointer to the sr to get a hop address |
[in] | sr_path_entry | pointer to the entry with the address |
[out] | addr | pointer to store the address bytes |
[in,out] | addr_size | the size in bytes of the address type |
int fib_sr_entry_overwrite | ( | fib_table_t * | table, |
fib_sr_t * | fib_sr, | ||
uint8_t * | addr_old, | ||
size_t | addr_old_size, | ||
uint8_t * | addr_new, | ||
size_t | addr_new_size | ||
) |
overwrites the address of an entry with a new address
[in] | table | the fib instance to access |
[in] | fib_sr | pointer to the sr to overwrite a hop address |
[in] | addr_old | pointer to the address bytes to overwrite |
[in] | addr_old_size | the size in bytes of the address type |
[in] | addr_new | pointer to the new address bytes |
[in] | addr_new_size | the size in bytes of the address type |
int fib_sr_get_route | ( | fib_table_t * | table, |
uint8_t * | dst, | ||
size_t | dst_size, | ||
kernel_pid_t * | sr_iface_id, | ||
uint32_t * | sr_flags, | ||
uint8_t * | addr_list, | ||
size_t * | addr_list_size, | ||
size_t * | element_size, | ||
bool | reverse, | ||
fib_sr_t ** | fib_sr | ||
) |
copies a source route to the given destination
[in] | table | table to search for a source route |
[in] | dst | pointer to the destination address bytes |
[in] | dst_size | the size in bytes of the destination address type |
[out] | sr_iface_id | pointer to the store the iface_id for this route |
[in,out] | sr_flags | pointer to store the flags of this route |
[out] | addr_list | pointer to the location for storing the source route addresses |
[in,out] | addr_list_size | the number of elements available in addr_list |
[in,out] | element_size | the provided size for one element in addr_list |
[in] | reverse | indicator if the hops should be stored in reverse order |
[in,out] | fib_sr | pointer for cosecutive receiving matching source routes. If NULL only the first matching source route is returned. If !NULL the pointer will be overwritten with the current returned fib_sr. The FIB skips all entries until the provided fib_sr+1. The fib_sr pointer is only overwritten when a further matching sr has been found. |
int fib_sr_next | ( | fib_table_t * | table, |
fib_sr_t * | fib_sr, | ||
fib_sr_entry_t ** | sr_path_entry | ||
) |
iterates to the next entry in the sr_path
[in] | table | the fib instance to access |
[in] | fib_sr | pointer to the sr to iterate |
[in,out] | sr_path_entry | pointer to the entry for iterating to the next entry |
int fib_sr_read_destination | ( | fib_table_t * | table, |
fib_sr_t * | fib_sr, | ||
uint8_t * | dst, | ||
size_t * | dst_size | ||
) |
reads the destination address from the sr head to the given location
[in] | table | the fib instance to access |
[in] | fib_sr | pointer to the sr to read from |
[in,out] | dst | pointer to the store destination address bytes |
[in,out] | dst_size | pointer to store the destination address size |
int fib_sr_read_head | ( | fib_table_t * | table, |
fib_sr_t * | fib_sr, | ||
kernel_pid_t * | sr_iface_id, | ||
uint32_t * | sr_flags, | ||
uint32_t * | sr_lifetime | ||
) |
reads the information from the sr head to the given locations
[in] | table | the fib instance to access |
[in] | fib_sr | pointer to the sr to read from |
[in,out] | sr_iface_id | pointer to store the iface_id |
[in,out] | sr_flags | pointer to store the flags |
[in,out] | sr_lifetime | pointer to store the current left lifetime |
int fib_sr_search | ( | fib_table_t * | table, |
fib_sr_t * | fib_sr, | ||
uint8_t * | addr, | ||
size_t | addr_size, | ||
fib_sr_entry_t ** | sr_path_entry | ||
) |
searches the entry containing the given address
[in] | table | the fib instance to access |
[in] | fib_sr | pointer to the sr to search for a hop address |
[in] | addr | pointer to the searched address bytes |
[in] | addr_size | the size in bytes of the searched address type |
[out] | sr_path_entry | pointer to the found address entry |
int fib_sr_set | ( | fib_table_t * | table, |
fib_sr_t * | fib_sr, | ||
kernel_pid_t * | sr_iface_id, | ||
uint32_t * | sr_flags, | ||
uint32_t * | sr_lifetime | ||
) |
sets the provided parameters in the given sr header if a given parameter is NULL its considered not to be changed
[in] | table | the fib instance to access |
[in] | fib_sr | pointer to the sr to write to |
[in] | sr_iface_id | pointer to the new iface_id |
[in] | sr_flags | pointer to the new flags |
[in] | sr_lifetime | pointer to store the new lifetime |
int fib_update_entry | ( | fib_table_t * | table, |
uint8_t * | dst, | ||
size_t | dst_size, | ||
uint8_t * | next_hop, | ||
size_t | next_hop_size, | ||
uint32_t | next_hop_flags, | ||
uint32_t | lifetime | ||
) |
Updates an entry in the FIB table with next hop and lifetime.
[in] | table | the fib table containing the entry to update |
[in] | dst | the destination address |
[in] | dst_size | the destination address size |
[in] | next_hop | the next hop address to be updated |
[in] | next_hop_size | the next hop address size |
[in] | next_hop_flags | the next-hop address flags |
[in] | lifetime | the lifetime in ms to be updates |