edu.gwu.simplenetsim
Interface NetworkLayer

All Superinterfaces:
StackLayer

public interface NetworkLayer
extends StackLayer

A network layer must implement this interface, which derives from StackLayer.

See Also:
StackLayer

Method Summary
 void init(int nodeNum, TransportLayer transportLayer, DatalinkLayer datalinkLayer, java.util.ArrayList<java.lang.Integer> neighbors)
          The simulator calls this method at time=0 to initialize.
 void receivePacket(NetworkPacket packet)
          This is called by the layer below.
 void sendPacket(NetworkPacket packet)
          This is called by the layer above to send a packet.
 void updateLinkStatus(int neighbor, LinkStatus status)
          This is called by the simulator at regular intervals to indicate the status of a link.
 
Methods inherited from interface edu.gwu.simplenetsim.StackLayer
timerBeep
 

Method Detail

init

void init(int nodeNum,
          TransportLayer transportLayer,
          DatalinkLayer datalinkLayer,
          java.util.ArrayList<java.lang.Integer> neighbors)
The simulator calls this method at time=0 to initialize.

Parameters:
nodeNum - an int value, the node ID.
transportLayer - a TransportLayer value, a ref to the layer above.
datalinkLayer - a DatalinkLayer value, the layer below.
neighbors - an ArrayList value, the list of nodeIDs of neighboring nodes. Note that two-way links are assumed.

sendPacket

void sendPacket(NetworkPacket packet)
This is called by the layer above to send a packet. It should call the layer below.

Parameters:
packet - a NetworkPacket value

receivePacket

void receivePacket(NetworkPacket packet)
This is called by the layer below. It should send a packet up to the transport layer.

Parameters:
packet - a NetworkPacket value

updateLinkStatus

void updateLinkStatus(int neighbor,
                      LinkStatus status)
This is called by the simulator at regular intervals to indicate the status of a link. It should be used to possibly trigger a round of routing computations. The status is about the link between this node and the specified neighbor.

Parameters:
neighbor - an int value
status - a LinkStatus value