dtn::RouteTable Class Reference

#include <RouteTable.h>

Inheritance diagram for dtn::RouteTable:

oasys::Logger List of all members.

Detailed Description

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

Definition at line 33 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, Link *next_hop)
 Remove a route entry.
size_t del_entries (const EndpointIDPattern &dest)
 Remove all entries to the given endpoint id pattern.
size_t del_entries_for_nexthop (Link *next_hop)
 Remove all entries that rely on the given next_hop link.
size_t get_matching (const EndpointID &eid, Link *next_hop, RouteEntryVec *entry_set) const
 Fill in the entry_set with the list of all entries whose patterns match the given eid and next hop.
size_t get_matching (const EndpointID &eid, RouteEntryVec *entry_set) const
 Syntactic sugar to call get_matching for all links.
void dump (oasys::StringBuffer *buf, EndpointIDVector *long_eids) const
 Dump the routing table.
int size ()
 Return the size of the table.
const RouteEntryVecroute_table ()
 Return the routing table.
oasys::Locklock ()
 Accessor for the RouteTable internal lock.

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 26 of file RouteTable.cc.

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

Destructor.

Definition at line 34 of file RouteTable.cc.


Member Function Documentation

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

Add a route entry.

Definition at line 42 of file RouteTable.cc.

References log_debug, and route_table_.

Referenced by dtn::TableBasedRouter::add_route(), and dtn::TcaRouter::create_route().

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

Remove a route entry.

Definition at line 55 of file RouteTable.cc.

References dtn::EndpointID::c_str(), dtn::RouteEntry::dest_pattern_, dtn::EndpointID::equals(), ExamineDump::l, lock_, log_debug, dtn::RouteEntry::next_hop_, dtn::Link::nexthop(), and route_table_.

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 83 of file RouteTable.cc.

References dtn::EndpointID::c_str(), dtn::RouteEntry::dest_pattern_, dtn::EndpointID::equals(), ExamineDump::l, lock_, log_debug, and route_table_.

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

size_t dtn::RouteTable::del_entries_for_nexthop ( Link next_hop  ) 

Remove all entries that rely on the given next_hop link.

Returns:
the number of entries removed

Definition at line 122 of file RouteTable.cc.

References ExamineDump::l, lock_, log_debug, dtn::Link::name(), dtn::RouteEntry::next_hop_, and route_table_.

Referenced by dtn::NeighborhoodRouter::handle_contact_down().

size_t dtn::RouteTable::get_matching ( const EndpointID eid,
Link next_hop,
RouteEntryVec entry_set 
) const

Fill in the entry_set 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 172 of file RouteTable.cc.

References dtn::EndpointID::c_str(), count, dtn::RouteEntry::dest_pattern_, ExamineDump::l, lock_, log_debug, dtn::EndpointIDPattern::match(), dtn::RouteEntry::next_hop_, and route_table_.

Referenced by dtn::TcaRouter::fwd_to_all(), dtn::TableBasedRouter::fwd_to_matching(), dtn::TcaRouter::fwd_to_matching_r(), get_matching(), and dtn::TcaRouter::handle_get_routes().

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

Syntactic sugar to call get_matching for all links.

Returns:
the count of matching entries

Definition at line 84 of file RouteTable.h.

References get_matching().

void dtn::RouteTable::dump ( oasys::StringBuffer buf,
EndpointIDVector long_eids 
) const

Dump the routing table.

Definition at line 207 of file RouteTable.cc.

References dtn::RouteEntry::dump_header(), and route_table_.

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

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

Return the size of the table.

Definition at line 98 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 221 of file RouteTable.cc.

References oasys::Lock::is_locked_by_me(), lock_, and route_table_.

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

Accessor for the RouteTable internal lock.

Definition at line 109 of file RouteTable.h.

References lock_.


Member Data Documentation

RouteEntryVec dtn::RouteTable::route_table_ [protected]

The routing table itself.

Definition at line 113 of file RouteTable.h.

Referenced by add_entry(), del_entries(), del_entries_for_nexthop(), del_entry(), dump(), get_matching(), route_table(), and size().

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

Lock to protect internal data structures.

Definition at line 118 of file RouteTable.h.

Referenced by del_entries(), del_entries_for_nexthop(), del_entry(), get_matching(), lock(), and route_table().


The documentation for this class was generated from the following files:
Generated on Thu Jun 7 16:56:58 2007 for DTN Reference Implementation by  doxygen 1.5.1