|
|||||||||
| 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.BridgePort
public class BridgePort
Represents a bridge port on the network.
| Field Summary | |
|---|---|
static int |
BLOCKING
Bridge port blocking state. |
private Bridge |
bridge
The bridge this port is part of. |
private java.util.HashSet<BridgePort> |
bridgePorts
The bridge ports connected to this brigde port. |
boolean |
configPending
Configuration message pending flag. |
int |
designatedBridge
The designated bridge on the LAN. |
int |
designatedCost
The designated cost on the LAN. |
int |
designatedPort
The designated port on the LAN. |
int |
designatedRoot
The designated root on the LAN. |
static int |
DISABLED
Bridge port disabled state. |
int |
forwardDelayTimer
The forward delay timer. |
static int |
FORWARDING
Bridge port forwarding state. |
int |
holdTimer
The hold timer. |
static int |
HORIZONTAL_LEFT
Bridge port is horizonal at the left of the bridge. |
static int |
HORIZONTAL_RIGHT
Bridge port is horizonal at the right of the bridge. |
private int |
id
The ID of this bridge port. |
private java.util.HashSet<LAN> |
lans
The LANs connected to this bridge port. |
static int |
LEARNING
Bridge port learning state. |
static int |
LISTENING
Bridge port listening state. |
static int |
MAX_ID
Maximum bridge port ID. |
int |
messageAgeTimer
The message age timer. |
private java.util.HashSet<Packet> |
packets
The packets on this bridge port. |
private int |
pathCost
The path cost of this bridge port. |
private int |
state
The state of this bridge port. |
static java.lang.String[] |
STATES
The port states as strings. |
boolean |
topologyChangeAcknowledge
Topology change acknowledgement flag. |
static int |
VERTICAL_BOTTOM
Bridge port is vertical at the bottom of the bridge. |
static int |
VERTICAL_TOP
Bridge port is vertical at the top of the bridge. |
private int |
x
The X co-ordinate position of this bridge port. |
private int |
y
The Y co-ordinate position of this bridge port. |
| Constructor Summary | |
|---|---|
BridgePort(Bridge bridge,
int x,
int y)
Creates a new BridgePort. |
|
| Method Summary | |
|---|---|
void |
addPacket(Packet p)
Adds a packet to this bridge port. |
private void |
checkConnect()
Check if the bridge is connected to anything and enable the port if possible. |
private void |
checkDisconnect()
Check if the bridge is connected to anything and disable the port if neccessary. |
void |
connect(BridgePort b)
Connects to a bridge port. |
void |
connect(LAN l)
Connects to LAN. |
void |
disable()
Disable the port. |
void |
disconnect(BridgePort b)
Disconnects from a bridge port. |
void |
disconnect(LAN l)
Disconnects from a LAN. |
void |
disconnectAll()
Disconnects from all LANs and bridge ports and removes all packets. |
void |
enable()
Enable the port (only if it is connected to something). |
Bridge |
getBridge()
Gets the bridge this port is connected to. |
java.util.Vector<BridgePort> |
getBridgePorts()
Gets all bridge ports connected to this bridge port. |
int |
getID()
Gets this bridge port's ID. |
java.util.HashSet<LAN> |
getLANs()
Get all LANs connected to this bridge port. |
java.util.Vector<Packet> |
getPackets()
Gets all the packets on this bridge port. |
int |
getPathCost()
Gets the path cost of this bridge port. |
int |
getState()
Gets the state of this bridge port. |
int |
getType()
Gets the type of this port. |
int |
getX()
Gets the X position of this port. |
int |
getXoffset()
Gets the X offset position of this port. |
int |
getY()
Gets the Y position of this port. |
int |
getYoffset()
Gets the Y offset position of this port. |
boolean |
isConnected()
Find out if this bridge port is connected to any LANs or bridge ports. |
boolean |
isConnectedTo(BridgePort b)
Find out if this bridge port is connected to another bridge port. |
boolean |
isConnectedTo(LAN l)
Find out if this bridge port is connected to a LAN. |
void |
presetID(int id)
Presets this bridge port's ID (before it has been connected to anything). |
java.util.Vector<Packet> |
processPacket(Packet p)
Processes a packet received by this bridge port. |
void |
removeAllPackets()
Removes all packets from this bridge port. |
void |
removePacket(Packet p)
Removes a packet from this bridge port. |
void |
setID(int id)
Sets this bridge port's ID. |
void |
setPathCost(int pathCost)
Sets the path cost of this bridge port. |
void |
setState(int newState)
Sets the state of the bridge port. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int HORIZONTAL_LEFT
public static final int HORIZONTAL_RIGHT
public static final int VERTICAL_TOP
public static final int VERTICAL_BOTTOM
public static final int DISABLED
public static final int LISTENING
public static final int LEARNING
public static final int FORWARDING
public static final int BLOCKING
public static final java.lang.String[] STATES
public static final int MAX_ID
private Bridge bridge
private java.util.HashSet<Packet> packets
private java.util.HashSet<LAN> lans
private java.util.HashSet<BridgePort> bridgePorts
private int x
private int y
private int id
private int state
private int pathCost
public int messageAgeTimer
public int forwardDelayTimer
public int holdTimer
public int designatedRoot
public int designatedBridge
public int designatedPort
public int designatedCost
public boolean topologyChangeAcknowledge
public boolean configPending
| Constructor Detail |
|---|
public BridgePort(Bridge bridge,
int x,
int y)
BridgePort.
bridge - The Bridge this port is part of.x - The X co-ordinate position of this port.y - The Y co-ordinate position of this port.| Method Detail |
|---|
public int getX()
public int getY()
public int getXoffset()
public int getYoffset()
public int getType()
public int getID()
public void setID(int id)
id - The new ID.public void presetID(int id)
id - The new ID.public int getState()
public void setState(int newState)
newState - The new state of the bridge port.public int getPathCost()
public void setPathCost(int pathCost)
pathCost - The new path cost of the bridge port.public Bridge getBridge()
Bridge this port is on.public boolean isConnected()
true if connected to something.public java.util.HashSet<LAN> getLANs()
public void connect(LAN l)
l - The LAN to connect to.public boolean isConnectedTo(LAN l)
l - The LAN.
true if connected to l.public void disconnect(LAN l)
l - The LAN to disconnect from.public java.util.Vector<BridgePort> getBridgePorts()
public void connect(BridgePort b)
b - The BridgePort to connect to.public boolean isConnectedTo(BridgePort b)
b - The other BridgePort.
true if connected to b.public void disconnect(BridgePort b)
b - The BridgePort to disconnect from.public void disconnectAll()
public void addPacket(Packet p)
addPacket in interface PacketTransportp - The Packet to add.public void removePacket(Packet p)
removePacket in interface PacketTransportp - The Packet to remove.public java.util.Vector<Packet> getPackets()
public void removeAllPackets()
public java.util.Vector<Packet> processPacket(Packet p)
processPacket in interface PacketDestinationp - The Packet to process.
private void checkConnect()
private void checkDisconnect()
public void enable()
public void disable()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||