dtnsim::Node Class Reference

#include <Node.h>

Inheritance diagram for dtnsim::Node:

dtnsim::SimEventHandler dtn::BundleDaemon dtn::BundleEventHandler oasys::Thread oasys::Logger dtnsim::GlueNode dtnsim::SimpleNode List of all members.

Detailed Description

Class representing a node in the simulator (i.e.

a router plus associated links, etc).

Derives from the core dtn BundleDaemon and whenever an event is processed that relates to a node, that node is installed as the BundleDaemon::instance().

Definition at line 44 of file Node.h.

Public Member Functions

 Node (const char *name)
 Constructor.
void do_init ()
 Virtual initialization function.
virtual ~Node ()
 Destructor.
virtual void post_event (BundleEvent *event, bool at_back=true)
 Virtual post function, overridden in the simulator to use the modified event queue.
virtual void process (SimEvent *e)
 Virtual function from SimEventHandler.
void process_bundle_events ()
 Process all pending bundle events until the queue is empty.
const char * name ()
 Accessor for name.
BundleRouterrouter ()
 Accessor for router.
void set_active ()
 Set the node as the "active" node in the simulation.

Static Public Member Functions

static Nodeactive_node ()
 Return the current active node.

Protected Attributes

const std::string name_
u_int32_t next_bundleid_
u_int32_t next_regid_
std::queue< BundleEvent * > * eventq_
 The event queue.


Constructor & Destructor Documentation

dtnsim::Node::Node ( const char *  name  ) 

Constructor.

Definition at line 31 of file Node.cc.

References log_info, and oasys::Logger::logpathf().

virtual dtnsim::Node::~Node (  )  [inline, virtual]

Destructor.

Reimplemented in dtnsim::GlueNode.

Definition at line 59 of file Node.h.


Member Function Documentation

void dtnsim::Node::do_init (  )  [virtual]

Virtual initialization function.

Reimplemented from dtn::BundleDaemon.

Definition at line 44 of file Node.cc.

References dtn::BundleDaemon::actions_, eventq_, and dtn::BundleDaemon::router_.

Referenced by dtnsim::Topology::create_node().

void dtnsim::Node::post_event ( BundleEvent event,
bool  at_back = true 
) [virtual]

Virtual post function, overridden in the simulator to use the modified event queue.

Reimplemented from dtn::BundleDaemon.

Definition at line 58 of file Node.cc.

References eventq_, log_debug, and dtn::BundleEvent::type_str().

Referenced by process().

void dtnsim::Node::process ( SimEvent e  )  [virtual]

Virtual function from SimEventHandler.

Implements dtnsim::SimEventHandler.

Definition at line 86 of file Node.cc.

References dtn::ContactManager::add_link(), dtn::BundleDaemon::contactmgr(), dtn::BundleDaemon::contactmgr_, dtnsim::SimAddRouteEvent::dest_, dtn::ContactManager::find_link(), dtnsim::SimAddLinkEvent::link_, log_debug, dtnsim::SimAddRouteEvent::nexthop_, post_event(), process_bundle_events(), set_active(), dtnsim::SIM_ADD_LINK, dtnsim::SIM_ADD_ROUTE, dtnsim::SIM_ROUTER_EVENT, dtnsim::SimEvent::type(), and dtnsim::SimEvent::type_str().

void dtnsim::Node::process_bundle_events (  ) 

Process all pending bundle events until the queue is empty.

Definition at line 70 of file Node.cc.

References eventq_, dtn::BundleDaemon::handle_event(), log_debug, and dtn::BundleEvent::type_str().

Referenced by process().

const char* dtnsim::Node::name (  )  [inline]

Accessor for name.

Definition at line 80 of file Node.h.

References name_.

Referenced by dtnsim::SimRegistration::deliver_bundle(), dtnsim::NodeCommand::exec(), dtnsim::Connectivity::lookup(), dtnsim::TrAgent::send_bundle(), and dtnsim::SimRegistration::SimRegistration().

BundleRouter* dtnsim::Node::router (  )  [inline]

Accessor for router.

Reimplemented from dtn::BundleDaemon.

Definition at line 85 of file Node.h.

References dtn::BundleDaemon::router_.

void dtnsim::Node::set_active (  )  [inline]

Set the node as the "active" node in the simulation.

This swings the static BundleDaemon::instance_ pointer to point to the node so all singleton accesses throughout the code will reference the correct node.

It also sets the node name as the logging prefix in oasys.

Definition at line 95 of file Node.h.

References oasys::Log::instance(), and name_.

Referenced by dtnsim::NodeCommand::exec(), and process().

static Node* dtnsim::Node::active_node (  )  [inline, static]

Return the current active node.

Definition at line 104 of file Node.h.

Referenced by dtnsim::SimConvergenceLayer::send_bundle().


Member Data Documentation

const std::string dtnsim::Node::name_ [protected]

Reimplemented from oasys::Thread.

Definition at line 110 of file Node.h.

Referenced by name(), and set_active().

u_int32_t dtnsim::Node::next_bundleid_ [protected]

Definition at line 111 of file Node.h.

u_int32_t dtnsim::Node::next_regid_ [protected]

Definition at line 112 of file Node.h.

std::queue<BundleEvent*>* dtnsim::Node::eventq_ [protected]

The event queue.

Reimplemented from dtn::BundleDaemon.

Definition at line 113 of file Node.h.

Referenced by do_init(), post_event(), and process_bundle_events().


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