WrapNode Class Reference
[pydtn]

Entity to provide access to a DTN::Node through the simulator. More...

#include <pydtn/WrapNode.h>

Inheritance diagram for WrapNode:

Inheritance graph
[legend]
Collaboration diagram for WrapNode:

Collaboration graph
[legend]

List of all members.

Public Types

typedef std::list
< NodeCollector * > 
CollectorList
 List of NodeCollectors.

Public Member Functions

 WrapNode ()
 Default constructor.
virtual ~WrapNode ()
 Virtual destructor.
Entitycreate () const
 
Returns:
a new WrapNode as a base-class pointer

void configure (const ArgList &args)
 Configure the underlying DTN::Node.
void emit (const ArgList &args)
 Generate an Event.
InterpreterItem get (const ArgList &args)
 Override base-class method.
void addLink (DTN::Link *l)
 Add a DTN::Link to the underlying DTN::Node.
void addConsumer (DTN::Consumer *c)
 Add a DTN::Consumer to the underlying DTN::Node.
void addApplication (DTN::Application *a)
 Add a DTN::Application to the underlying DTN::Node.
void addCollector (NodeCollector *c)
 Add a NodeCollector to the node.
void setVolatileStorePolicy (DTN::VolatileStorePolicy *p)
 Set the volatile storage policy for the node.
void setForwardingPolicy (DTN::ForwardingPolicy *p)
 Set the forwarding policy for the node.
void setVolatileStore (DTN::VolatileBundleStore *s)
 Set the volatile store for the node.
void setPersistentStore (DTN::PersistentBundleStore *s)
 Set the persistent store for the node.
bool handler (BundleEvent &event)
 Handle a BundleEvent.
bool handler (ResendEvent &event)
 Handle a ResendEvent.
std::string identifier () const
 
Returns:
the string "node"

void finalize () const
 Actions to perform when the simulator exits.
void collect () const
 On-demand data collection.
void setAddr (const DTN::ByteString &a)
 Sets the internal DTN::Node's address.
DTN::Nodenode ()
 
Returns:
the internal DTN::Node (non-const only)

const DTN::ByteString & addr () const
 
Returns:
the internal DTN::Node's address

const std::string & addrString () const
 
Returns:
a printable version of addr()

void forwardOn (DTN::Link &l)
 Calls the internal DTN::Node's method for handling newly available DTN::Links.
void drop (DTN::Bundle *b, const DTN::DropCause &c=DTN::DropCause::inst)
 Calls the internal DTN::Node's method for dropping a DTN::Bundle.
size_t volatileBundles () const
 
Returns:
DTN::Node::volatileBundles()

DTN::BundlePointer cachedVolatile ()
 
Returns:
DTN::Node::cachedVolatile()

const DTN::BundlePointer cachedVolatile () const
 
Returns:
DTN::Node::cachedVolatile()

size_t persistentBundles () const
 
Returns:
DTN::Node::persistentBundles()

DTN::BundlePointer cachedPersistent ()
 
Returns:
DTN::Node::cachedPersistent()

const DTN::BundlePointer cachedPersistent () const
 
Returns:
DTN::Node::cachedPersistent()

const TimebundleLifetime () const
 
Returns:
the node's time-to-live for bundles


Detailed Description

Entity to provide access to a DTN::Node through the simulator.

The "heavy lifting" is done by the internal DTN::Node, with this class primarily forwarding calls. configure() and emit() do the most work, since they have to parse argument lists and compose the calls to DTN::Node's methods.

Definition at line 58 of file WrapNode.h.


Member Function Documentation

void WrapNode::configure ( const ArgList args  ) 

Configure the underlying DTN::Node.

The following are valid configuration argument lists:

Parameters:
args The list of configuration parameters

Reimplemented in Mobility::MobileNode, and Mobility::RandomWaypointNode.

Definition at line 113 of file WrapNode.cc.

References addrString(), Entity::create(), CustodyEntity::generatePolicy(), ForwardingEntity::generatePolicy(), GlobalTracer::instance(), ItemWrapper::item, Registry::lookup(), TracerChain::node(), parse_double(), parse_string(), parse_time(), resolve_symbol(), DTN::Node::setAddr(), DTN::Node::setCustodyPolicy(), DTN::Node::setForwardingPolicy(), DTN::Node::setPersistentCap(), DTN::Node::setVolatileCap(), and ItemWrapper::type.

Referenced by Mobility::MobileNode::configure().

void WrapNode::emit ( const ArgList args  ) 

Generate an Event.

The following types of events may be generated:

Parameters:
args The list of parameters specifying the event to be emitted

Reimplemented in Mobility::MobileNode, and Mobility::RandomWaypointNode.

Definition at line 222 of file WrapNode.cc.

References addr(), PydtnBundle::b, DTN::Bundle::clone(), DTN::Bundle::kBcast, DTN::Bundle::kCustodial, DTN::Bundle::kData, DTN::Node::nextSeq(), parse_long(), parse_node(), parse_string(), parse_time(), PydtnBundle_Check(), Clock::schedule(), and Time::tv.

Referenced by Mobility::MobileNode::emit().

void WrapNode::addLink ( DTN::Link l  ) 

Add a DTN::Link to the underlying DTN::Node.

This calls DTN::Node::addLink().

Parameters:
l The DTN::Link to add; the DTN::Node takes ownership of the memory

Definition at line 463 of file WrapNode.cc.

References DTN::Node::addLink().

Referenced by WrapLink::configure(), and Mobility::WirelessLink::configure().

void WrapNode::addConsumer ( DTN::Consumer c  ) 

Add a DTN::Consumer to the underlying DTN::Node.

Parameters:
c The DTN::Consumer to add; the DTN::Node takes ownership of the memory

Definition at line 470 of file WrapNode.cc.

References DTN::ConsumerChain::addConsumer(), and DTN::Node::setConsumer().

Referenced by addApplication(), and Mobility::MobileNode::MobileNode().

void WrapNode::addApplication ( DTN::Application a  ) 

Add a DTN::Application to the underlying DTN::Node.

Parameters:
a The DTN::Application to add; the DTN::Node takes ownership of the memory

Definition at line 482 of file WrapNode.cc.

References addConsumer(), and DTN::Consumer::setOwner().

Referenced by Mobility::MobileNode::addMobileApp(), aodv_attach(), PydtnAppObject_new(), and sampleapp_attach().

void WrapNode::addCollector ( NodeCollector c  ) 

Add a NodeCollector to the node.

Parameters:
c The NodeCollector to add; the WrapNode takes ownership of the memory

Definition at line 490 of file WrapNode.cc.

Referenced by storeprofile_collect().

void WrapNode::setVolatileStorePolicy ( DTN::VolatileStorePolicy p  ) 

Set the volatile storage policy for the node.

Parameters:
p The storage policy to use; the node takes ownership

Definition at line 497 of file WrapNode.cc.

References DTN::Node::setVolatileStorePolicy().

void WrapNode::setForwardingPolicy ( DTN::ForwardingPolicy p  ) 

Set the forwarding policy for the node.

Parameters:
p The forwarding policy to use; the WrapNode takes ownership of the memory

Definition at line 504 of file WrapNode.cc.

References DTN::Node::setForwardingPolicy().

Referenced by aodv_attach(), and epidemic_attach().

void WrapNode::setVolatileStore ( DTN::VolatileBundleStore s  ) 

Set the volatile store for the node.

Parameters:
s The volatile store to use; the node takes ownership

Definition at line 511 of file WrapNode.cc.

References DTN::Node::setVolatileStore().

void WrapNode::setPersistentStore ( DTN::PersistentBundleStore s  ) 

Set the persistent store for the node.

Parameters:
s The persistent store to use; the node takes ownership

Definition at line 518 of file WrapNode.cc.

References DTN::Node::setPersistentStore().

Referenced by epidemic_attach().

bool WrapNode::handler ( BundleEvent event  )  [virtual]

Handle a BundleEvent.

This method simply forwards a BundleEvent's internal DTN::Bundle to DTN::Node::recv().

Parameters:
event An incoming BundleEvent
Returns:
true

Todo:
We need a better mechanism for setting the trigger time. Per-bundle timers wouldn't be a bad idea.

Implements BundleHandler.

Definition at line 525 of file WrapNode.cc.

References DTN::Node::addPersistent(), DTN::Node::addr(), DTN::Node::broadcast(), BundleEvent::data(), DTN::Node::drop(), DTN::Node::forward(), DTN::Bundle::kBcast, BundleEvent::pData(), DTN::Node::recv(), Clock::schedule(), Event::source(), BundleEvent::storeLocally(), Clock::time(), DTN::Bundle::type(), and DTN::Node::usedPersistentCap().

Referenced by ResendEvent::handle().

bool WrapNode::handler ( ResendEvent event  ) 

Handle a ResendEvent.

This method triggers a call to the internal DTN::Node's retryStored() method and schedules another event.

Parameters:
event An incoming ResendEvent
Returns:
true

Definition at line 580 of file WrapNode.cc.

References DTN::Node::retryStored(), Clock::schedule(), Clock::time(), and DTN::Node::usedPersistentCap().

void WrapNode::setAddr ( const DTN::ByteString &  a  ) 

Sets the internal DTN::Node's address.

Parameters:
a The address for the node

Definition at line 618 of file WrapNode.cc.

References DTN::Node::setAddr().

void WrapNode::forwardOn ( DTN::Link l  ) 

Calls the internal DTN::Node's method for handling newly available DTN::Links.

Parameters:
l A DTN::Link that has just become available

Definition at line 664 of file WrapNode.cc.

References DTN::Node::forwardOn().

Referenced by WrapLink::handler(), and SimLink::setUp().

void WrapNode::drop ( DTN::Bundle b,
const DTN::DropCause c = DTN::DropCause::inst 
)

Calls the internal DTN::Node's method for dropping a DTN::Bundle.

Parameters:
b A DTN::Bundle to drop
c The reason for the drop

Definition at line 670 of file WrapNode.cc.

References DTN::Node::drop().

Referenced by WrapLink::handler().


The documentation for this class was generated from the following files:
Generated on Mon Mar 24 11:15:48 2008 for Pydtn Simulator by  doxygen 1.5.4