#include <Node.h>
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. | |
BundleRouter * | router () |
Accessor for router. | |
void | set_active () |
Set the node as the "active" node in the simulation. | |
DTNStorageConfig * | storage_config () |
Accessor for the storage config at this node. | |
Static Public Member Functions | |
static Node * | active_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. | |
BundleStore * | bundle_store_ |
Fake-Durable storage. | |
ProphetStore * | prophet_store_ |
Fake-Durable storage. | |
LinkStore * | link_store_ |
Fake-Durable storage. | |
RegistrationStore * | reg_store_ |
Fake-Durable storage. |
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.
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] |
static Node* dtnsim::Node::active_node | ( | ) | [inline, static] |
Return the current active node.
Definition at line 135 of file sim/Node.h.
Referenced by dtnsim::SimLink::handle_arrival_events(), dtnsim::SimConvergenceLayer::open_contact(), dtnsim::Simulator::run_console(), run_one_event_now(), dtnsim::TrAgent::send_bundle(), and dtnsim::SimLink::start_next_bundle().
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] |
Virtual initialization function.
Reimplemented from dtn::BundleDaemon.
Definition at line 58 of file sim/Node.cc.
References dtn::BundleDaemon::actions_, bundle_store_, dtn::BundleDaemon::BundleActions, eventq_, link_store_, prophet_store_, reg_store_, storage_config_, store_, and timersys_.
Referenced by dtnsim::Topology::create_node().
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] |
Accessor for name.
Definition at line 115 of file sim/Node.h.
References name_.
Referenced by dtnsim::SimRegistration::deliver_bundle(), dtnsim::SimLog::log_entry(), dtnsim::Connectivity::lookup(), dtnsim::Simulator::run_node_events(), dtnsim::SimRegistration::SimRegistration(), and dtnsim::SimConvergenceLayer::update_connectivity().
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_.
BundleStore* dtnsim::Node::bundle_store_ [protected] |
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().
LinkStore* dtnsim::Node::link_store_ [protected] |
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] |
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.
ProphetStore* dtnsim::Node::prophet_store_ [protected] |
Fake-Durable storage.
Definition at line 156 of file sim/Node.h.
Referenced by do_init(), and set_active().
RegistrationStore* dtnsim::Node::reg_store_ [protected] |
Fake-Durable storage.
Definition at line 158 of file sim/Node.h.
Referenced by do_init(), and set_active().
DTNStorageConfig dtnsim::Node::storage_config_ [protected] |
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] |
oasys::TimerSystem* dtnsim::Node::timersys_ [protected] |