dtnsim::Node Class Reference

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

#include <Node.h>

Inheritance diagram for dtnsim::Node:

dtnsim::SimEventHandler dtn::BundleDaemon dtn::BundleEventHandler

List of all members.

Public Member Functions

 Node (const char *name)
 Constructor.
void do_init ()
 Virtual initialization function.
size_t event_queue_size ()
 Override of BundleDaemon::event_queue_size since eventq_ is shadowed to be a simple std::queue instead of a MsgQueue.
void configure ()
 Second pass at initialization, called by the simulator once the whole config has been parsed.
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.
bool process_one_bundle_event ()
 Drain and process a bundle event from the queue, if one exists.
void run_one_event_now (BundleEvent *event)
 Run the given event immediately.
void handle_bundle_delivered (BundleDeliveredEvent *event)
 Overridden event handlers from BundleDaemon.
void handle_bundle_received (BundleReceivedEvent *event)
 Event type specific handlers.
void handle_bundle_transmitted (BundleTransmittedEvent *event)
 Event type specific handlers.
void handle_bundle_expired (BundleExpiredEvent *event)
 Event type specific handlers.
const char * name ()
 Accessor for name.
BundleRouterrouter ()
 Accessor for router.
void set_active ()
 Set the node as the "active" node in the simulation.
DTNStorageConfigstorage_config ()
 Accessor for the storage config at this node.

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.
oasys::TimerSystem * timersys_
DTNStorageConfig storage_config_
 Fake-Durable storage.
oasys::DurableStore * store_
 Fake-Durable storage.
BundleStorebundle_store_
 Fake-Durable storage.
ProphetStoreprophet_store_
 Fake-Durable storage.
LinkStorelink_store_
 Fake-Durable storage.
RegistrationStorereg_store_
 Fake-Durable storage.


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 51 of file sim/Node.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 37 of file sim/Node.cc.

References dtn::DTNStorageConfig::payload_dir_, and storage_config_.

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

Destructor.

Definition at line 81 of file sim/Node.h.


Member Function Documentation

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

void dtnsim::Node::configure (  ) 

Second pass at initialization, called by the simulator once the whole config has been parsed.

Definition at line 121 of file sim/Node.cc.

References dtn::BundleRouter::initialize(), dtn::BundleDaemon::router_, and set_active().

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

size_t dtnsim::Node::event_queue_size (  )  [inline, virtual]

Override of BundleDaemon::event_queue_size since eventq_ is shadowed to be a simple std::queue instead of a MsgQueue.

Reimplemented from dtn::BundleDaemon.

Definition at line 67 of file sim/Node.h.

References eventq_.

void dtnsim::Node::handle_bundle_delivered ( BundleDeliveredEvent event  )  [virtual]

Overridden event handlers from BundleDaemon.

Reimplemented from dtn::BundleDaemon.

Definition at line 183 of file sim/Node.cc.

References dtn::BundleDeliveredEvent::bundleref_.

void dtnsim::Node::handle_bundle_expired ( BundleExpiredEvent event  )  [virtual]

Event type specific handlers.

Reimplemented from dtn::BundleDaemon.

Definition at line 217 of file sim/Node.cc.

References dtn::BundleExpiredEvent::bundleref_.

void dtnsim::Node::handle_bundle_received ( BundleReceivedEvent event  )  [virtual]

Event type specific handlers.

Reimplemented from dtn::BundleDaemon.

Definition at line 191 of file sim/Node.cc.

References dtn::BundleDaemon::find_duplicate().

void dtnsim::Node::handle_bundle_transmitted ( BundleTransmittedEvent event  )  [virtual]

Event type specific handlers.

Reimplemented from dtn::BundleDaemon.

Definition at line 208 of file sim/Node.cc.

References dtn::BundleTransmittedEvent::bundleref_.

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

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 131 of file sim/Node.cc.

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

Referenced by dtnsim::NodeCommand::exec(), dtnsim::SimLink::handle_arrival_events(), process(), and dtnsim::SimConvergenceLayer::update_connectivity().

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

Virtual function from SimEventHandler.

Implements dtnsim::SimEventHandler.

Definition at line 169 of file sim/Node.cc.

References post_event(), dtnsim::SIM_BUNDLE_EVENT, and dtnsim::SimEvent::type().

bool dtnsim::Node::process_one_bundle_event (  ) 

Drain and process a bundle event from the queue, if one exists.

Definition at line 142 of file sim/Node.cc.

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

Referenced by dtnsim::Simulator::run_node_events().

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

Accessor for router.

Reimplemented from dtn::BundleDaemon.

Definition at line 120 of file sim/Node.h.

References dtn::BundleDaemon::router_.

void dtnsim::Node::run_one_event_now ( BundleEvent event  ) 

Run the given event immediately.

Definition at line 158 of file sim/Node.cc.

References active_node(), dtn::BundleDaemon::handle_event(), set_active(), and dtn::BundleEvent::type_str().

void dtnsim::Node::set_active (  ) 

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

This swings the static instance_ pointers to point to the node and its state so all singleton accesses throughout the code will reference the correct object(s).

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

Definition at line 105 of file sim/Node.cc.

References bundle_store_, link_store_, name_, prophet_store_, reg_store_, and timersys_.

Referenced by configure(), dtnsim::NodeCommand::exec(), dtnsim::Simulator::run_console(), dtnsim::Simulator::run_node_events(), run_one_event_now(), and dtnsim::SimConvergenceLayer::update_connectivity().

DTNStorageConfig* dtnsim::Node::storage_config (  )  [inline]

Accessor for the storage config at this node.

Definition at line 143 of file sim/Node.h.

References storage_config_.


Member Data Documentation

Fake-Durable storage.

Definition at line 155 of file sim/Node.h.

Referenced by do_init(), and set_active().

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

The event queue.

Reimplemented from dtn::BundleDaemon.

Definition at line 149 of file sim/Node.h.

Referenced by do_init(), event_queue_size(), post_event(), and process_one_bundle_event().

Fake-Durable storage.

Definition at line 157 of file sim/Node.h.

Referenced by do_init(), and set_active().

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

Definition at line 146 of file sim/Node.h.

Referenced by name(), and set_active().

u_int32_t dtnsim::Node::next_bundleid_ [protected]

Definition at line 147 of file sim/Node.h.

u_int32_t dtnsim::Node::next_regid_ [protected]

Definition at line 148 of file sim/Node.h.

Fake-Durable storage.

Definition at line 156 of file sim/Node.h.

Referenced by do_init(), and set_active().

Fake-Durable storage.

Definition at line 158 of file sim/Node.h.

Referenced by do_init(), and set_active().

Fake-Durable storage.

Definition at line 153 of file sim/Node.h.

Referenced by do_init(), Node(), and storage_config().

oasys::DurableStore* dtnsim::Node::store_ [protected]

Fake-Durable storage.

Definition at line 154 of file sim/Node.h.

Referenced by do_init().

oasys::TimerSystem* dtnsim::Node::timersys_ [protected]

Definition at line 150 of file sim/Node.h.

Referenced by do_init(), and set_active().


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

Generated on Fri Jan 30 09:43:15 2009 for DTN Reference Implementation by  doxygen 1.5.8