#include <Node.h>
Inheritance diagram for dtnsim::Node:
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 65 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) |
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. | |
BundleRouter * | router () |
Accessor for router. | |
void | set_active () |
Set the node as the "active" node in the simulation. | |
u_int32_t | next_bundleid () |
Return the next available bundle id. | |
u_int32_t | next_regid () |
Return the next available registration id. | |
Static Public Member Functions | |
static Node * | active_node () |
Return the current active node. | |
Protected Attributes | |
const std::string | name_ |
Action when the MESSAGE_RECEIVED event arrives. | |
u_int32_t | next_bundleid_ |
u_int32_t | next_regid_ |
std::queue< BundleEvent * > * | eventq_ |
The event queue. |
dtnsim::Node::Node | ( | const char * | name | ) |
Constructor.
Definition at line 52 of file Node.cc.
References log_info, and oasys::Logger::logpathf().
virtual dtnsim::Node::~Node | ( | ) | [inline, virtual] |
void dtnsim::Node::do_init | ( | ) | [virtual] |
Virtual initialization function.
Reimplemented from dtn::BundleDaemon.
Definition at line 64 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 | ) | [virtual] |
void dtnsim::Node::process | ( | SimEvent * | e | ) | [virtual] |
Virtual function from SimEventHandler.
Implements dtnsim::SimEventHandler.
Definition at line 101 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 | ( | ) |
const char* dtnsim::Node::name | ( | ) | [inline] |
Accessor for name.
Definition at line 101 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 106 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 116 of file Node.h.
References oasys::Log::instance(), dtn::BundleDaemon::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 125 of file Node.h.
References dtn::BundleDaemon::instance_.
Referenced by dtnsim::SimConvergenceLayer::send_bundle().
u_int32_t dtnsim::Node::next_bundleid | ( | ) | [inline] |
Return the next available bundle id.
Definition at line 133 of file Node.h.
References next_bundleid_.
Referenced by dtnsim::TrAgent::send_bundle().
u_int32_t dtnsim::Node::next_regid | ( | ) | [inline] |
Return the next available registration id.
Definition at line 141 of file Node.h.
References next_regid_.
const std::string dtnsim::Node::name_ [protected] |
Action when the MESSAGE_RECEIVED event arrives.
Reimplemented from oasys::Thread.
Definition at line 167 of file Node.h.
Referenced by name(), and set_active().
u_int32_t dtnsim::Node::next_bundleid_ [protected] |
u_int32_t dtnsim::Node::next_regid_ [protected] |
std::queue<BundleEvent*>* dtnsim::Node::eventq_ [protected] |
The event queue.
Reimplemented from dtn::BundleDaemon.
Definition at line 170 of file Node.h.
Referenced by do_init(), post_event(), and process_bundle_events().