network
Class RoutingTable
java.lang.Object
java.util.AbstractMap
java.util.HashMap
java.util.LinkedHashMap
network.RoutingTable
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map, java.io.Serializable
- public class RoutingTable
- extends java.util.LinkedHashMap
Contains a list of up to MAX_SIZE of the most active
virtual addresses.
Outside of this file, please do not use any inherited methods.
- Author:
- cooperse, hoele
- See Also:
- Serialized Form
Constructor Summary |
RoutingTable(Network network,
java.util.Vector channelListeners)
Creates an empty routing table. |
Method Summary |
void |
addRoute(java.lang.String fromVirtualAddress,
Neighbor neighbor)
Add a route to the routing table, call this when a packet is received. |
void |
printChannelList(java.lang.String from)
print channels associated with from address |
boolean |
sendPacket(XMLPacket packet,
Neighbor fromNeighbor)
Routes the given packet. |
Methods inherited from class java.util.LinkedHashMap |
clear, containsValue, get |
Methods inherited from class java.util.HashMap |
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
RoutingTable
public RoutingTable(Network network,
java.util.Vector channelListeners)
- Creates an empty routing table.
- Parameters:
network
- The Network this routing table is for.
addRoute
public void addRoute(java.lang.String fromVirtualAddress,
Neighbor neighbor)
- Add a route to the routing table, call this when a packet is received.
- Parameters:
fromVirtualAddress
- The virtual address the packet is from.neighbor
- The neighbor the packet came through.
sendPacket
public boolean sendPacket(XMLPacket packet,
Neighbor fromNeighbor)
- Routes the given packet.
- Parameters:
packet
- The packet to be sent.
- Returns:
- True if packet is routed.
printChannelList
public void printChannelList(java.lang.String from)
- print channels associated with from address
- Parameters:
from
- virtual address