public interface TransportLayer
Interface TransportLayer
must be implemented by
any class that wants to implement a transport layer.
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 |
---|
void init(int nodeNum, ApplicationLayer appLayer, NetworkLayer networkLayer)
init
takes in a node-ID, and references
to the layers above and below.
nodeNum
- an int
valueappLayer
- an ApplicationLayer
valuenetworkLayer
- a NetworkLayer
valueint openConnection(int src, int dest, int portNum)
src
- an int
value, the source.dest
- an int
value, the destination.portNum
- an int
value, the port number.
int
valueboolean isReady(int connID)
isReady
to see whether the connection has
been set up.
connID
- an int
value
boolean
valuevoid sendPacket(TransportPacket packet)
packet
- a TransportPacket
valuevoid receivePacket(TransportPacket packet)
packet
- a TransportPacket
valuevoid closeConnection(int connID)
closeConnection
to terminate the connection. However, we are not doing this now.
connID
- an int
value