edu.gwu.simplenetsim
Interface TransportLayer

All Superinterfaces:
StackLayer

public interface TransportLayer
extends StackLayer

Interface TransportLayer must be implemented by any class that wants to implement a transport layer.

See Also:
StackLayer

Method Summary
 void closeConnection(int connID)
          The application layer is supposed to call closeConnection to terminate the connection.
 void init(int nodeNum, ApplicationLayer appLayer, NetworkLayer networkLayer)
          Method init takes in a node-ID, and references to the layers above and below.
 boolean isReady(int connID)
          Because a connection set up can take time (a few rounds of packets going back and forth), the application layer repeatedly calls isReady to see whether the connection has been set up.
 int openConnection(int src, int dest, int portNum)
          The application layer calls this to initiate a connection.
 void receivePacket(TransportPacket packet)
          The network layer calls this method when a packet has arrived.
 void sendPacket(TransportPacket packet)
          After a connection is set up, the application sends packets by calling this method.
 
Methods inherited from interface edu.gwu.simplenetsim.StackLayer
timerBeep
 

Method Detail

init

void init(int nodeNum,
          ApplicationLayer appLayer,
          NetworkLayer networkLayer)
Method init takes in a node-ID, and references to the layers above and below.

Parameters:
nodeNum - an int value
appLayer - an ApplicationLayer value
networkLayer - a NetworkLayer value

openConnection

int openConnection(int src,
                   int dest,
                   int portNum)
The application layer calls this to initiate a connection. This is where you handle connection set up.

Parameters:
src - an int value, the source.
dest - an int value, the destination.
portNum - an int value, the port number.
Returns:
an int value

isReady

boolean isReady(int connID)
Because a connection set up can take time (a few rounds of packets going back and forth), the application layer repeatedly calls isReady to see whether the connection has been set up.

Parameters:
connID - an int value
Returns:
a boolean value

sendPacket

void sendPacket(TransportPacket packet)
After a connection is set up, the application sends packets by calling this method. This layer should make a network packet and call the layer below.

Parameters:
packet - a TransportPacket value

receivePacket

void receivePacket(TransportPacket packet)
The network layer calls this method when a packet has arrived.

Parameters:
packet - a TransportPacket value

closeConnection

void closeConnection(int connID)
The application layer is supposed to call closeConnection to terminate the connection. However, we are not doing this now.

Parameters:
connID - an int value