peersim.transport
Class E2ETransport

java.lang.Object
  extended by peersim.transport.E2ETransport
All Implemented Interfaces:
java.lang.Cloneable, Protocol, RouterInfo, Transport

public class E2ETransport
extends java.lang.Object
implements Transport, RouterInfo

This transport protocol is based on the E2ENetwork class. Each instance of this transport class is assigned to one of the routers contained in the (fully static singleton) E2ENetwork, and subsequently the E2ENetwork class is used to obtain the latency for messages sending based on the router assignment.


Parameter Summary
local
          The delay that corresponds to the time spent on the source (and destination) nodes.
 
Constructor Summary
E2ETransport(java.lang.String prefix)
          Reads configuration parameters.
 
Method Summary
 java.lang.Object clone()
          Clones the object.
 long getLatency(Node src, Node dest)
          Calculates latency using the static singleton E2ENetwork.
 int getRouter()
           
 void send(Node src, Node dest, java.lang.Object msg, int pid)
          Delivers the message reliably, with the latency calculated by getLatency(peersim.core.Node, peersim.core.Node).
 void setRouter(int router)
          Associates the node hosting this transport protocol instance with a router in the router network.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Parameter Detail

local

The delay that corresponds to the time spent on the source (and destination) nodes. In other words, full latency is calculated by fetching the latency that belongs to communicating between two routers, incremented by twice this delay. Defaults to 0.

Constructor Detail

E2ETransport

public E2ETransport(java.lang.String prefix)
Reads configuration parameters.

Method Detail

clone

public java.lang.Object clone()
Clones the object.

Specified by:
clone in interface Protocol
Overrides:
clone in class java.lang.Object

send

public void send(Node src,
                 Node dest,
                 java.lang.Object msg,
                 int pid)
Delivers the message reliably, with the latency calculated by getLatency(peersim.core.Node, peersim.core.Node).

Specified by:
send in interface Transport
Parameters:
src - sender node
dest - destination node
msg - message to be sent
pid - protocol identifier

getLatency

public long getLatency(Node src,
                       Node dest)
Calculates latency using the static singleton E2ENetwork. It looks up which routers the given nodes are assigned to, then looks up the corresponding latency. Finally it increments this value by adding twice the local delay configured by "local".

Specified by:
getLatency in interface Transport
Parameters:
src - sender node
dest - destination node

setRouter

public void setRouter(int router)
Associates the node hosting this transport protocol instance with a router in the router network.

Specified by:
setRouter in interface RouterInfo
Parameters:
router - the numeric index of the router

getRouter

public int getRouter()
Specified by:
getRouter in interface RouterInfo
Returns:
the router associated to this transport protocol.