#include <BundleRouter.h>

Public Member Functions | |
| BundleRouter (string eid) | |
| virtual | ~BundleRouter () |
| virtual const list< Node > & | getNeighbours () |
| virtual bool | isNeighbour (Node &node) |
| bool | isNeighbour (string eid) |
| Node | getNeighbour (string eid) |
| virtual void | tick () |
| virtual BundleSchedule | getSchedule (const Bundle &b) |
| bool | isLocal (const Bundle &b) const |
| void | raiseEvent (const Event *evt) |
Protected Member Functions | |
| void | terminate () |
Private Member Functions | |
| virtual void | discovered (const Node &node) |
Private Attributes | |
| list< Node > | m_neighbours |
| string | m_eid |
| dtn::utils::Mutex | m_lock |
| Conditional | m_nexttime |
This is a base class which can be extended to implement several routing protocols.
| dtn::core::BundleRouter::BundleRouter | ( | string | eid | ) |
| dtn::core::BundleRouter::~BundleRouter | ( | ) | [virtual] |
| const list< Node > & dtn::core::BundleRouter::getNeighbours | ( | ) | [virtual] |
Returns a list of currently reachable nodes.
References m_lock, and m_neighbours.
| bool dtn::core::BundleRouter::isNeighbour | ( | Node & | node | ) | [virtual] |
Determine of a specific node is currently reachable.
| node | The node to reach. |
References dtn::core::Node::equals(), m_lock, and m_neighbours.
Referenced by dtn::core::StaticBundleRouter::getSchedule(), and getSchedule().
| bool dtn::core::BundleRouter::isNeighbour | ( | string | eid | ) |
References m_lock, and m_neighbours.
| Node dtn::core::BundleRouter::getNeighbour | ( | string | eid | ) |
| void dtn::core::BundleRouter::tick | ( | ) | [virtual] |
Implements dtn::utils::Service.
References dtn::core::Node::decrementTimeout(), m_lock, m_neighbours, m_nexttime, dtn::core::NODE_UNAVAILABLE, dtn::core::PERMANENT, dtn::core::EventSwitch::raiseEvent(), dtn::utils::MutexLock::unlock(), and dtn::utils::Conditional::wait().
| BundleSchedule dtn::core::BundleRouter::getSchedule | ( | const Bundle & | b | ) | [virtual] |
Search for a route and return a schedule for the given bundle
| b | A bundle to route. |
Reimplemented in dtn::core::StaticBundleRouter.
References dtn::data::Bundle::getDestination(), dtn::data::Bundle::isExpired(), isLocal(), isNeighbour(), and m_eid.
Referenced by dtn::core::StaticBundleRouter::getSchedule(), and raiseEvent().
| bool dtn::core::BundleRouter::isLocal | ( | const Bundle & | b | ) | const |
References dtn::data::Bundle::getDestination(), and m_eid.
Referenced by getSchedule(), and raiseEvent().
| void dtn::core::BundleRouter::raiseEvent | ( | const Event * | evt | ) | [virtual] |
method to receive new events from the EventSwitch
Implements dtn::core::EventReceiver.
References dtn::core::BUNDLE_DELETED, dtn::core::CUSTODY_REJECT, dtn::core::BundleCore::deliver(), discovered(), dtn::core::RouteEvent::getAction(), dtn::core::NodeEvent::getAction(), dtn::core::TimeEvent::getAction(), dtn::core::RouteEvent::getBundle(), dtn::data::Bundle::getDestination(), dtn::core::BundleSchedule::getEID(), dtn::core::BundleCore::getInstance(), getNeighbour(), dtn::core::NodeEvent::getNode(), getSchedule(), isLocal(), dtn::data::LIFETIME_EXPIRED, m_nexttime, dtn::data::NO_KNOWN_ROUTE_TO_DESTINATION_FROM_HERE, dtn::core::NODE_INFO_UPDATED, dtn::core::EventSwitch::raiseEvent(), dtn::core::ROUTE_PROCESS_BUNDLE, dtn::utils::Conditional::signal(), dtn::core::TIME_SECOND_TICK, and dtn::core::BundleCore::transmit().
| void dtn::core::BundleRouter::terminate | ( | ) | [protected, virtual] |
Reimplemented from dtn::utils::Service.
References m_nexttime, and dtn::utils::Conditional::signal().
| void dtn::core::BundleRouter::discovered | ( | const Node & | node | ) | [private, virtual] |
Updates the list of reachable nodes. If the node is currently unknown a NODE_AVAILABLE event will be raised.
| node | The node with new information. |
References dtn::core::Node::getURI(), m_lock, m_neighbours, dtn::core::NODE_AVAILABLE, dtn::core::PERMANENT, and dtn::core::EventSwitch::raiseEvent().
Referenced by raiseEvent().
list<Node> dtn::core::BundleRouter::m_neighbours [private] |
Referenced by discovered(), getNeighbour(), getNeighbours(), isNeighbour(), tick(), and ~BundleRouter().
string dtn::core::BundleRouter::m_eid [private] |
Referenced by discovered(), getNeighbour(), getNeighbours(), isNeighbour(), tick(), and ~BundleRouter().
Referenced by raiseEvent(), terminate(), and tick().
1.5.6