dtn::RouteTable Class Reference

#include <RouteTable.h>

List of all members.


Detailed Description

Class that implements the routing table, implemented with an stl vector.

Definition at line 34 of file RouteTable.h.


Public Member Functions

 RouteTable (const std::string &router_name)
 Constructor.
virtual ~RouteTable ()
 Destructor.
bool add_entry (RouteEntry *entry)
 Add a route entry.
bool del_entry (const EndpointIDPattern &dest, const LinkRef &next_hop)
 Remove a route entry.
template<typename Predicate>
size_t del_matching_entries (Predicate test)
 Remove entries that match the given predicate.
size_t del_entries (const EndpointIDPattern &dest)
 Remove all entries to the given endpoint id pattern.
size_t del_entries_for_nexthop (const LinkRef &next_hop)
 Remove all entries that rely on the given next_hop link.
void clear ()
 Clear the whole route table.
size_t get_matching (const EndpointID &eid, const LinkRef &next_hop, RouteEntryVec *entry_vec) const
 Fill in the entry_vec with the list of all entries whose patterns match the given eid and next hop.
size_t get_matching (const EndpointID &eid, RouteEntryVec *entry_vec) const
 Syntactic sugar to call get_matching for all links.
void dump (oasys::StringBuffer *buf) const
 Dump a string representation of the routing table.
int size ()
 Return the size of the table.
const RouteEntryVecroute_table ()
 Return the routing table.
oasys::Lock * lock ()
 Accessor for the RouteTable internal lock.

Protected Member Functions

size_t get_matching_helper (const EndpointID &eid, const LinkRef &next_hop, RouteEntryVec *entry_vec, bool *loop, int level) const
 Helper function for get_matching.

Protected Attributes

RouteEntryVec route_table_
 The routing table itself.
oasys::SpinLock lock_
 Lock to protect internal data structures.

Constructor & Destructor Documentation

dtn::RouteTable::RouteTable ( const std::string &  router_name  ) 

Constructor.

Definition at line 27 of file RouteTable.cc.

dtn::RouteTable::~RouteTable (  )  [virtual]

Destructor.

Definition at line 33 of file RouteTable.cc.


Member Function Documentation

bool dtn::RouteTable::add_entry ( RouteEntry entry  ) 

bool dtn::RouteTable::del_entry ( const EndpointIDPattern dest,
const LinkRef next_hop 
)

template<typename Predicate>
size_t dtn::RouteTable::del_matching_entries ( Predicate  test  )  [inline]

Remove entries that match the given predicate.

Definition at line 144 of file RouteTable.h.

References lock_, and route_table_.

Referenced by del_entries(), del_entries_for_nexthop(), and dtn::DTLSRRouter::recompute_routes().

size_t dtn::RouteTable::del_entries ( const EndpointIDPattern dest  ) 

Remove all entries to the given endpoint id pattern.

Returns:
the number of entries removed

Definition at line 78 of file RouteTable.cc.

References del_matching_entries(), and lock_.

Referenced by dtn::TableBasedRouter::del_route(), and dtn::TcaRouter::handle_del_route().

size_t dtn::RouteTable::del_entries_for_nexthop ( const LinkRef next_hop  ) 

Remove all entries that rely on the given next_hop link.

Returns:
the number of entries removed

Definition at line 86 of file RouteTable.cc.

References del_matching_entries(), and lock_.

Referenced by dtn::TableBasedRouter::handle_link_deleted().

void dtn::RouteTable::clear (  ) 

Clear the whole route table.

Definition at line 94 of file RouteTable.cc.

References lock_, and route_table_.

size_t dtn::RouteTable::get_matching ( const EndpointID eid,
const LinkRef next_hop,
RouteEntryVec entry_vec 
) const

Fill in the entry_vec with the list of all entries whose patterns match the given eid and next hop.

If the next hop is NULL, it is ignored.

Returns:
the count of matching entries

Definition at line 107 of file RouteTable.cc.

References dtn::EndpointID::c_str(), get_matching_helper(), and lock_.

Referenced by dtn::TableBasedRouter::add_nexthop_route(), dtn::TableBasedRouter::find_session_upstream(), dtn::TcaRouter::fwd_to_all(), dtn::TcaRouter::fwd_to_matching_r(), get_matching(), dtn::TcaRouter::handle_get_routes(), and dtn::TableBasedRouter::route_bundle().

size_t dtn::RouteTable::get_matching ( const EndpointID eid,
RouteEntryVec entry_vec 
) const [inline]

Syntactic sugar to call get_matching for all links.

Returns:
the count of matching entries

Definition at line 96 of file RouteTable.h.

References get_matching().

void dtn::RouteTable::dump ( oasys::StringBuffer *  buf  )  const

int dtn::RouteTable::size (  )  [inline]

Return the size of the table.

Definition at line 111 of file RouteTable.h.

References route_table_.

const RouteEntryVec * dtn::RouteTable::route_table (  ) 

Return the routing table.

Asserts that the RouteTable spin lock is held by the caller.

Definition at line 225 of file RouteTable.cc.

References lock_, and route_table_.

Referenced by dtn::TableBasedRouter::tcl_dump_state().

oasys::Lock* dtn::RouteTable::lock (  )  [inline]

Accessor for the RouteTable internal lock.

Definition at line 122 of file RouteTable.h.

References lock_.

Referenced by dtn::TableBasedRouter::tcl_dump_state().

size_t dtn::RouteTable::get_matching_helper ( const EndpointID eid,
const LinkRef next_hop,
RouteEntryVec entry_vec,
bool loop,
int  level 
) const [protected]


Member Data Documentation

The routing table itself.

Definition at line 133 of file RouteTable.h.

Referenced by add_entry(), clear(), del_entry(), del_matching_entries(), dump(), get_matching_helper(), route_table(), and size().

oasys::SpinLock dtn::RouteTable::lock_ [mutable, protected]

Lock to protect internal data structures.

Definition at line 138 of file RouteTable.h.

Referenced by add_entry(), clear(), del_entries(), del_entries_for_nexthop(), del_entry(), del_matching_entries(), dump(), get_matching(), lock(), and route_table().


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

Generated on Mon Jul 21 14:12:21 2008 for DTN Reference Implementation by  doxygen 1.5.6