Types and functions for FIB. More...

Detailed Description

Note
The used fib_table_t* used in all essential FIB functions MUST be valid.
Author
Martin Landsmann marti.nosp@m.n.la.nosp@m.ndsma.nosp@m.nn@h.nosp@m.aw-ha.nosp@m.mbur.nosp@m.g.de
Oliver Hahm olive.nosp@m.r.ha.nosp@m.hm@in.nosp@m.ria..nosp@m.fr

Definition in file fib.h.

#include <stdint.h>
#include "net/fib/table.h"
#include "kernel_types.h"
+ Include dependency graph for fib.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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 More...
 
void fib_deinit (fib_table_t *table)
 de-initializes the FIB entries and source route entries More...
 
int fib_register_rp (fib_table_t *table, uint8_t *prefix, size_t prefix_addr_type_size)
 Registration of a routing protocol handler function. More...
 
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. More...
 
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. More...
 
void fib_remove_entry (fib_table_t *table, uint8_t *dst, size_t dst_size)
 removes an entry from the corresponding FIB table More...
 
void fib_flush (fib_table_t *table, kernel_pid_t interface)
 removes all entries from the corresponding FIB table and interface combination More...
 
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 More...
 
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. More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
int fib_sr_delete (fib_table_t *table, fib_sr_t *fib_sr)
 deletes the sr More...
 
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 More...
 
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 More...
 
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. More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
int fib_get_num_used_entries (fib_table_t *table)
 returns the actual number of used FIB entries More...
 
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) More...
 
void fib_print_routes (fib_table_t *table)
 Prints the FIB content. More...
 
void fib_print_sr (fib_table_t *table, fib_sr_t *sr)
 Prints the given FIB sourceroute. More...