|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuk.org.arlott.simon.hw.f24.lbsta.Bridge
public class Bridge
Represents a bridge on the network.
| Nested Class Summary | |
|---|---|
class |
Bridge.HostCacheEntry
Host Cache Entry object. |
| Field Summary | |
|---|---|
private static boolean[] |
allIDs
All the bridge IDs in use. |
private int |
forwardDelay
Forward Delay set by root bridge in seconds. |
private int |
helloTime
Hello Time set by root bridge in seconds. |
private int |
helloTimer
Current Hello Time timer in milliseconds. |
private static int |
holdTime
The Hold Time. |
private java.util.HashMap<java.lang.Integer,Bridge.HostCacheEntry> |
hostCache
The host cache. |
private int |
id
Bridge's ID. |
private boolean |
inNetwork
Whether or not this bridge is in the network. |
private static int |
lastAssigned
The last assigned bridge ID. |
private Log |
log
The event log. |
static int |
MAX_ID
The maximum bridge ID. |
static int |
MAX_PORTS
The number of bridge ports to create. |
private int |
maxAge
Max Age set by root bridge in seconds. |
private static int |
MESSAGE_AGE_INCREMENT
The message age increment per hop. |
private int |
myForwardDelay
Bridge's set Forward Delay in seconds. |
private int |
myHelloTime
Bridge's set Hello Time in seconds. |
private int |
myMaxAge
Bridge's set Max Age in seconds. |
private Network |
network
The network this bridge is on. |
BridgePort[] |
ports
The bridge ports on this bridge |
private java.util.Vector<Packet> |
queuedPackets
Packets queued to be added to the network. |
private int |
rootID
Current root bridge's ID. |
private int |
rootPathCost
Path cost to root. |
private BridgePort |
rootPort
Root port. |
static int |
TIME_INCREMENT
The time increment per loop iteration. |
private boolean |
topologyChange
The Topology Change flag. |
private boolean |
topologyChangeDetected
The Topology Change Detected flag. |
private int |
topologyChangeNotificationTimer
The Toplogy Change Notification timer. |
private int |
topologyChangeTimer
The Topology Change timer. |
int |
x
The X co-ordinate position of this bridge. |
int |
y
The X co-ordinate position of this bridge. |
| Constructor Summary | |
|---|---|
Bridge(int x,
int y,
Network network)
Creates a new Bridge. |
|
| Method Summary | |
|---|---|
private void |
acknowledgeTopologyChange(BridgePort port)
|
void |
addToNetwork()
Adds this bridge to the network. |
private void |
becomeDesignatedPort(BridgePort bp)
|
private void |
configBPDUGeneration()
|
private void |
configurationUpdate()
|
private boolean |
designatedForSomePort()
|
private boolean |
designatedPort(BridgePort port)
|
private void |
designatedPortSelection()
|
void |
disablePort(BridgePort port)
|
void |
enablePort(BridgePort port)
|
private static int |
findFreeID()
Finds an unused bridge ID. |
private void |
forwardDelayTimerExpiry(BridgePort port)
|
int |
getForwardDelay()
Gets the bridge Forward Delay. |
int |
getHelloTime()
Gets the bridge Hello Time. |
java.util.HashMap<java.lang.Integer,Bridge.HostCacheEntry> |
getHostCache()
Gets the host cache. |
int |
getID()
Gets the ID. |
java.lang.String[] |
getLog()
Gets the log entries for this bridge. |
int |
getMaxAge()
Gets the bridge Max Age. |
int |
getNetworkForwardDelay()
Gets the network Forward Delay. |
int |
getNetworkHelloTime()
Gets the network Hello Time. |
int |
getNetworkMaxAge()
Gets the network Max Age. |
int |
getRootID()
Gets the root ID. |
private void |
helloTimerExpiry()
|
private void |
holdTimerExpiry(BridgePort port)
|
void |
initialise()
|
private void |
initialisePort(BridgePort port)
|
private void |
makeBlocking(BridgePort port)
|
private void |
makeForwarding(BridgePort port)
|
private void |
messageAgeTimerExpiry(BridgePort port)
|
void |
networkChanged()
Indicates that the network has been modified. |
private void |
portStateSelection()
|
java.util.Vector<Packet> |
processPacket(BridgePort port,
Packet p)
Processes a packet received by a bridge port. |
private void |
receivedConfigBPDU(BridgePort port,
ConfigurationMessage config)
|
private void |
receivedTCNBPDU(BridgePort port,
TopologyChangeMessage tcn)
|
private void |
recordConfigInformation(BridgePort port,
ConfigurationMessage config)
|
private void |
recordConfigTimeoutValues(ConfigurationMessage config)
|
void |
removeFromNetwork()
Removes this host from the network. |
private void |
reply(BridgePort port)
|
void |
reset()
Resets this bridge. |
private void |
rootSelection()
|
void |
setForwardDelay(int forwardDelay)
Sets the bridge Forward Delay. |
void |
setHelloTime(int helloTime)
Sets the bridge Hello Time. |
private boolean |
setID(Bridge b,
int newID)
Sets the ID of a bridge. |
boolean |
setID(int newID)
Sets the ID. |
private static boolean |
setInNetwork(Bridge b,
boolean inNetwork)
Updates the in network state of a bridge. |
void |
setMaxAge(int maxAge)
Sets the bridge Max Age. |
void |
setPathCost(BridgePort port,
int pathCost)
|
private boolean |
superSedesPortInfo(BridgePort port,
ConfigurationMessage config)
|
java.util.Vector<Packet> |
tick()
Performs one network simulation iteration. |
private void |
topologyChangeAcknowledged()
|
private void |
topologyChangeDetection()
|
private void |
topologyChangeNotificationTimerExpiry()
|
private void |
topologyChangeTimerExpiry()
|
private void |
transmitConfig(BridgePort port)
|
private void |
transmitTCN()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MAX_PORTS
public static final int MAX_ID
public static final int TIME_INCREMENT
private static final int MESSAGE_AGE_INCREMENT
public BridgePort[] ports
public int x
public int y
private Log log
private Network network
private java.util.Vector<Packet> queuedPackets
private java.util.HashMap<java.lang.Integer,Bridge.HostCacheEntry> hostCache
private static boolean[] allIDs
private static int lastAssigned
private boolean inNetwork
private int id
private int rootID
private int rootPathCost
private BridgePort rootPort
private int helloTimer
private int myHelloTime
private int helloTime
private int myMaxAge
private int maxAge
private int myForwardDelay
private int forwardDelay
private boolean topologyChange
private boolean topologyChangeDetected
private int topologyChangeTimer
private int topologyChangeNotificationTimer
private static final int holdTime
| Constructor Detail |
|---|
public Bridge(int x,
int y,
Network network)
Bridge.
x - The X co-ordinate position.y - The Y co-ordinate position.network - The Network this bridge is on.| Method Detail |
|---|
public void networkChanged()
public void addToNetwork()
throws TooManyBridgesException
TooManyBridgesException - If there are too many bridges on the network already.public void removeFromNetwork()
private static boolean setInNetwork(Bridge b,
boolean inNetwork)
b - The Bridge to modify.inNetwork - Whether or not the host is in the network or not.
true if the action was successful.private static int findFreeID()
public int getID()
public boolean setID(int newID)
newID - The new ID for the bridge.
true if the ID is not already in use.
private boolean setID(Bridge b,
int newID)
b - The Bridge to modify.newID - The new ID of the bridge.
true if the ID is not already in use.public int getRootID()
public int getNetworkHelloTime()
public int getHelloTime()
public void setHelloTime(int helloTime)
helloTime - The Hello Time configured for this bridge.public int getNetworkMaxAge()
public int getMaxAge()
public void setMaxAge(int maxAge)
maxAge - The Max Age configured for this bridge.public int getNetworkForwardDelay()
public int getForwardDelay()
public void setForwardDelay(int forwardDelay)
forwardDelay - The Forward Delay configured for this bridge.public java.util.HashMap<java.lang.Integer,Bridge.HostCacheEntry> getHostCache()
public java.lang.String[] getLog()
public void reset()
public java.util.Vector<Packet> tick()
public java.util.Vector<Packet> processPacket(BridgePort port,
Packet p)
port - The BridgePort the packet was received on.p - The Packet to process.
private void transmitConfig(BridgePort port)
private boolean superSedesPortInfo(BridgePort port,
ConfigurationMessage config)
private void recordConfigInformation(BridgePort port,
ConfigurationMessage config)
private void recordConfigTimeoutValues(ConfigurationMessage config)
private void configBPDUGeneration()
private boolean designatedPort(BridgePort port)
private void reply(BridgePort port)
private void transmitTCN()
private void configurationUpdate()
private void rootSelection()
private void designatedPortSelection()
private void becomeDesignatedPort(BridgePort bp)
private void portStateSelection()
private void makeForwarding(BridgePort port)
private void makeBlocking(BridgePort port)
private void topologyChangeDetection()
private void topologyChangeAcknowledged()
private void acknowledgeTopologyChange(BridgePort port)
private void receivedConfigBPDU(BridgePort port,
ConfigurationMessage config)
private void receivedTCNBPDU(BridgePort port,
TopologyChangeMessage tcn)
private void helloTimerExpiry()
private void messageAgeTimerExpiry(BridgePort port)
private void forwardDelayTimerExpiry(BridgePort port)
private boolean designatedForSomePort()
private void topologyChangeNotificationTimerExpiry()
private void topologyChangeTimerExpiry()
private void holdTimerExpiry(BridgePort port)
public void initialise()
private void initialisePort(BridgePort port)
public void enablePort(BridgePort port)
public void disablePort(BridgePort port)
public void setPathCost(BridgePort port,
int pathCost)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||