Public Member Functions

OLSR_rtable Class Reference

This class is a representation of the OLSR's Routing Table. More...

#include <OLSR_rtable.h>

List of all members.

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_entryadd_entry (nsaddr_t dest, nsaddr_t next, nsaddr_t iface, u_int32_t dist)
 Adds a new entry into the routing table.
OLSR_rt_entrylookup (nsaddr_t dest)
 Looks up an entry for the specified destination address.
OLSR_rt_entryfind_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_entryadd_entry (nsaddr_t dest, nsaddr_t next, nsaddr_t iface, u_int32_t dist)
OLSR_rt_entrylookup (nsaddr_t dest)
OLSR_rt_entryfind_send_entry (OLSR_rt_entry *)
u_int32_t size ()
void print (Trace *)

Detailed Description

This class is a representation of the OLSR's Routing Table.


Member Function Documentation

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.

Parameters:
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.
Returns:
the routing table entry which has been added.
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.

Parameters:
entry the routing table entry which indicates the destination node we are interested in.
Returns:
the appropiate routing table entry which indicates the next hop which must be used for forwarding a data packet, or NULL if there is no such entry.
OLSR_rt_entry * OLSR_rtable::lookup ( nsaddr_t  dest  ) 

Looks up an entry for the specified destination address.

Parameters:
dest destination address.
Returns:
the routing table entry for that destination address, or NULL if such an entry does not exist
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.

Parameters:
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.

Parameters:
dest address of the destination node.
u_int32_t OLSR_rtable::size (  ) 

Returns the number of entries in the routing table.

Returns:
the number of entries in the routing table.

The documentation for this class was generated from the following files: