SimLink Class Reference
[pydtn]

A DTN::Link in the simulator. More...

#include <pydtn/SimLink.h>

Inheritance diagram for SimLink:

Inheritance graph
[legend]
Collaboration diagram for SimLink:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 SimLink (WrapLink *owner, bool up=true)
 Constructor.
virtual ~SimLink ()
 Virtual destructor.
bool available () const
 Reimplementation of the base-class method.
void send (DTN::Bundle *b)
 Send a DTN::Bundle through this link.
const DTN::ByteString & remoteAddr () const
 
Returns:
the address of the other end of the link

const Timelatency () const
 
Returns:
the delay between endpoints

unsigned long int bandwidth () const
 
Returns:
the number of bytes that this link can transmit each second

bool busy () const
 
Returns:
whether the link is currently busy

const TimebusyUntil () const
 
Returns:
if busy, the time at which the link will be available

bool up () const
 
Returns:
whether the link is currently up

const TimeupSince () const
 
Returns:
the Time at which the link was brought up

void setLatency (double lat)
 
Parameters:
lat The latency (in seconds) to set for this link

void setBandwidth (unsigned long int bw)
 
Parameters:
bw The transmission rate (in bits per second) to set for this link

void setBusy (bool b)
 
Parameters:
b The new busy state for this link

void setUp ()
 If the link is down, set its state to up.
void setDown ()
 If the link is up, set its state to down.


Detailed Description

A DTN::Link in the simulator.

This is tightly coupled with WrapLink, for reasons which are discussed in the latter's documenation.

Definition at line 49 of file SimLink.h.


Constructor & Destructor Documentation

SimLink::SimLink ( WrapLink owner,
bool  up = true 
)

Constructor.

SimLink must know the WrapLink that contains it, since this class is responsible for forwarding a DTN::Node's messages, but those messages must be scheduled as Events that can be handled by an Entity. The object is initialized with a latency of 0 seconds and a bandwidth of 1 B/s. The configuration script is expected to set these to more meaningful values, and the defaults merely ensure that there are no overflows or divisions by zero.

Parameters:
owner The WrapLink that holds this object; this does not take ownership of the data
up The initial state of the link

Definition at line 47 of file SimLink.cc.

References Clock::time().


Member Function Documentation

bool SimLink::available (  )  const [inline, virtual]

Reimplementation of the base-class method.

Returns:
not busy()

Reimplemented from DTN::Link.

Definition at line 74 of file SimLink.h.

void SimLink::send ( DTN::Bundle b  )  [virtual]

Send a DTN::Bundle through this link.

A new BundleEvent is created with the owner specified as both the event source and destination. The event is scheduled for the current simulator time.

Parameters:
b A data bundle, included in the outgoing event; passes ownership

Implements DTN::Link.

Definition at line 66 of file SimLink.cc.

References Clock::schedule(), DTN::Bundle::size(), and Clock::time().

Referenced by AliasLink::send().


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