WrapLink Class Reference
[pydtn]

Entity to provide access to a Link through the simulator. More...

#include <pydtn/WrapLink.h>

Inheritance diagram for WrapLink:

Inheritance graph
[legend]
Collaboration diagram for WrapLink:

Collaboration graph
[legend]

List of all members.

Public Member Functions

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

void configure (const ArgList &args)
 Configure the link.
void emit (const ArgList &args)
 Generate an Event.
InterpreterItem get (const ArgList &args)
 Override base-class method.
bool handler (BundleEvent &event)
 Handle a BundleEvent.
virtual bool handler (LinkAvailEvent &event)
 Handle a LinkAvailEvent.
virtual bool handler (LinkUpDownEvent &event)
 Handle a LinkUpDownEvent.
std::string identifier () const
 
Returns:
the string "link"

WrapNodesource ()
 
Returns:
the DTN::Node that can send data along this DTN::Link

WrapNodedestination ()
 
Returns:
the DTN::Node that can receive data along this DTN::Link

const WrapNodesource () const
 
Returns:
the DTN::Node that can send data along this DTN::Link

const WrapNodedestination () const
 
Returns:
the DTN::Node that can receive data along this DTN::Link

SimLinklink ()
 
Returns:
the internal SimLink

const SimLinklink () const
 
Returns:
a constant version of the internal SimLink


Protected Attributes

WrapNodem_source
 The node that sends along this link.
WrapNodem_destination
 The node that receives along this link.
SimLink m_link
 The actual link.


Detailed Description

Entity to provide access to a Link through the simulator.

Unlike WrapNode, the internal SimLink class is defined in this module, and there is a tight interconnection between the two. The reason for this difference is that in a general implemenation, it is possible to specify the characteristics of a DTN::Node with a fair degree of precision, but the description of a DTN::Link might vary greatly from one environment to another. In particular, a simulator will generally have a direct reference (or pointer) to the DTN::Node at the far end of a DTN::Link, while in a deployment the DTN::Link might at best know if the connection is currently useable.

Definition at line 59 of file WrapLink.h.


Member Function Documentation

void WrapLink::configure ( const ArgList args  ) 

Configure the link.

The following are valid configuration argument lists:

Parameters:
args The list of configuration parameters

Reimplemented in Mobility::WirelessLink, and RF::RFLink.

Definition at line 66 of file WrapLink.cc.

References WrapNode::addLink(), GlobalTracer::instance(), TracerChain::link(), m_destination, m_link, m_source, parse_double(), parse_node(), parse_string(), SimLink::setBandwidth(), and SimLink::setLatency().

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

void WrapLink::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

Definition at line 144 of file WrapLink.cc.

References parse_string(), parse_time(), and Clock::schedule().

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

Handle a BundleEvent.

This method calculates the delay time before a DTN::Bundle can be fully delivered to its next-hop DTN::Node. The delay is then added to the current time, and a new BundleEvent is scheduled at that time with the DTN::Node's WrapNode as the destination.

The delay time is calculated as the latency (in microseconds) plus the length of the header and payload divided by the bandwidth.

Parameters:
event An incoming BundleEvent
Returns:
true

Implements BundleHandler.

Reimplemented in Mobility::WirelessLink, and RF::RFLink.

Definition at line 206 of file WrapLink.cc.

References WrapNode::drop(), DTN::LinkFailureDrop::inst, m_destination, m_link, m_source, BundleEvent::pData(), Clock::schedule(), BundleEvent::sentAt(), Clock::time(), SimLink::up(), and SimLink::upSince().

Referenced by LinkUpDownEvent::handle(), and LinkAvailEvent::handle().

bool WrapLink::handler ( LinkAvailEvent event  )  [virtual]

Handle a LinkAvailEvent.

This method sets the busy state of the internal SimLink to false, so that it can once again accept data.

Parameters:
event A LinkAvailEvent
Returns:
true

Definition at line 230 of file WrapLink.cc.

References WrapNode::forwardOn(), m_link, m_source, SimLink::setBusy(), and SimLink::up().

bool WrapLink::handler ( LinkUpDownEvent event  )  [virtual]

Handle a LinkUpDownEvent.

This method sets the up state of the internal SimLink to the value specified by the event.

Parameters:
event A LinkUpDownEvent
Returns:
true

Definition at line 242 of file WrapLink.cc.

References GlobalTracer::instance(), TracerChain::link(), m_link, SimLink::setDown(), SimLink::setUp(), and LinkUpDownEvent::state().


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