This class is a representation of the OLSR's Routing Table. More...
#include <OLSR_rtable.h>
Public Member Functions | |
OLSR_rtable () | |
Creates a new empty routing table. | |
~OLSR_rtable () | |
Destroys the routing table and all its entries. | |
void | clear () |
Clears the routing table and frees the memory assigned to each one of its entries. | |
void | rm_entry (nsaddr_t dest) |
Deletes the entry whose destination address is given. | |
OLSR_rt_entry * | add_entry (nsaddr_t dest, nsaddr_t next, nsaddr_t iface, u_int32_t dist) |
Adds a new entry into the routing table. | |
OLSR_rt_entry * | lookup (nsaddr_t dest) |
Looks up an entry for the specified destination address. | |
OLSR_rt_entry * | find_send_entry (OLSR_rt_entry *) |
Finds the appropiate entry which must be used in order to forward a data packet to a next hop (given a destination). | |
u_int32_t | size () |
Returns the number of entries in the routing table. | |
void | print (Trace *) |
Prints out the content of the routing table to a given trace file. | |
void | clear () |
void | rm_entry (nsaddr_t dest) |
OLSR_rt_entry * | add_entry (nsaddr_t dest, nsaddr_t next, nsaddr_t iface, u_int32_t dist) |
OLSR_rt_entry * | lookup (nsaddr_t dest) |
OLSR_rt_entry * | find_send_entry (OLSR_rt_entry *) |
u_int32_t | size () |
void | print (Trace *) |
This class is a representation of the OLSR's Routing Table.
OLSR_rt_entry * OLSR_rtable::add_entry | ( | nsaddr_t | dest, | |
nsaddr_t | next, | |||
nsaddr_t | iface, | |||
u_int32_t | dist | |||
) |
Adds a new entry into the routing table.
If an entry for the given destination existed, it is deleted and freed.
dest | address of the destination node. | |
next | address of the next hop node. | |
iface | address of the local interface. | |
dist | distance to the destination node. |
OLSR_rt_entry * OLSR_rtable::find_send_entry | ( | OLSR_rt_entry * | entry | ) |
Finds the appropiate entry which must be used in order to forward a data packet to a next hop (given a destination).
Imagine a routing table like this: [A,B] [B,C] [C,C]; being each pair of the form [dest addr,next-hop addr]. In this case, if this function is invoked with [A,B] then pair [C,C] is returned because C is the next hop that must be used to forward a data packet destined to A. That is, C is a neighbor of this node, but B isn't. This function finds the appropiate neighbor for forwarding a packet.
entry | the routing table entry which indicates the destination node we are interested in. |
OLSR_rt_entry * OLSR_rtable::lookup | ( | nsaddr_t | dest | ) |
Looks up an entry for the specified destination address.
dest | destination address. |
void OLSR_rtable::print | ( | Trace * | out | ) |
Prints out the content of the routing table to a given trace file.
Content is represented as a table in which each line is preceeded by a 'P'. First line contains the name of every column (dest, next, iface, dist) and the following ones are the values of each entry.
out | the Trace where the routing table must be written into. |
void OLSR_rtable::rm_entry | ( | nsaddr_t | dest | ) |
Deletes the entry whose destination address is given.
dest | address of the destination node. |
u_int32_t OLSR_rtable::size | ( | ) |
Returns the number of entries in the routing table.