All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----timer.TimerClient | +----network.Router
The basic implementation provided maintains a FIFO queue of packets to be dealt with, and forwards packets to all network links other than the one they arrived on. If the queue overflows then packets are dropped. This implementation also names each router so that debug messages can make sense.
You will need to add code to enable routers, by cooperating with each other and with the RoutedNetworkEdges at the edges of the network, to discover the network topology and route packets more efficiently (at the very least your routers should forward packets out only one link, and maintain the property that they make it to their destinations.
You will most likely need to modify run to handle forwarding, and either PacketArrived or run to deal with packets for your topology discovery. If you need to add fields to packets (you will) you should modify the class NetworkPacket.
public Router(String name, int queueLen)
public void PacketArrived(LinkPacket p, Link l)
public void run()
The provided algorithm forwards packets to all other links, and also implements a time-to-live field, which limits the number of hops. This field is added in NetworkPacket, and a constructor is used there to set the default ttl to 10 hops.
protected Enumeration ConnectedLinks()
public void AddLink(Link l)
public void RemoveLink(Link l)
public String toString()
All Packages Class Hierarchy This Package Previous Next Index