org.iitb.untwine
Class Port

java.lang.Object
  |
  +--org.iitb.untwine.Port
All Implemented Interfaces:
java.io.Serializable

public class Port
extends java.lang.Object
implements java.io.Serializable

This class is designed to store the details of a Port (interface) on a device

See Also:
Serialized Form

Constructor Summary
Port()
          Default class constructor.
Port(int number, int st, int en)
          Class copy constructor.
 
Method Summary
 void addConnection(java.lang.Object obj)
          Add the object of class String passed as parameter in the prttList.
 void calculateThroughList(java.util.Vector subnetHost)
          Calculate through list from the Forwarding database and list of hosts connected to subnet.
 java.util.Vector getConnectionList()
          Returns the IP addresses of host connected to it.
 int getEnable()
          Returns the enabled/disabled status of the port.
 java.util.Vector getFDB()
          Returns the forwarding database of this port.
 int getNumber()
          Returns the port number of the port.
 int getState()
          Returns the state of the port.
 java.util.Vector getThroughList()
          Returns the through database of this port.
 boolean isDirectConnected()
          Returns whether this Port is directly connected to a other link layer device (eg.
 boolean isHostConnected()
          Returns whether this Port is connected to a Host.
 boolean isRouterConnected()
          Returns whether this Port is connected to a Router.
 void macAdd(java.lang.Object obj)
          Add the object of class String passed as parameter in the portList.
 void setDirectConnection()
          Sets the connection of this Port to another data link layer device directly.
 void setHostConnection()
          Sets the connection of this Port to a Host.
 void setRouterConnection()
          Sets the connection of this Port to a Router.
 void setSharedConnection()
          Sets the connection of this Port to another data link layer device through a shared segment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Port

public Port()
Default class constructor. Initializes all the vector and variables to null.

Port

public Port(int number,
            int st,
            int en)
Class copy constructor. Constructs the object with port number, state and enable status of the port as specified in parameter and initializes all the vector and variables to null.
Parameters:
number - Port number
st - Current state of the port
en - Enable/Disable status of the port
Method Detail

getNumber

public int getNumber()
Returns the port number of the port.
Returns:
port number as int.

getState

public int getState()
Returns the state of the port. Integer value corresponds to that obtained by object dot1dStp.dot1dStpPortTable.dot1dStpPortEntry.dot1dStpPortState
Returns:
State of the port as int.

getEnable

public int getEnable()
Returns the enabled/disabled status of the port. Integer value corresponds to that obtained by object dot1dStp.dot1dStpPortTable.dot1dStpPortEntry.dot1dStpPortEnable
Returns:
Disabled/Enabled status of the port as int.

macAdd

public void macAdd(java.lang.Object obj)
Add the object of class String passed as parameter in the portList. This object contains the MAC address learnt on this Port.
Parameters:
obj - Object of class Sting (MAC address).

getFDB

public java.util.Vector getFDB()
Returns the forwarding database of this port.
Returns:
Vector of Strings containing MAC addresses learnt on this Port.

getThroughList

public java.util.Vector getThroughList()
Returns the through database of this port.
Returns:
Vector of of Strings containing MAC addresses forwarded through this Port.

getConnectionList

public java.util.Vector getConnectionList()
Returns the IP addresses of host connected to it.
Returns:
Vector of of Strings containing IP addresses or Router/Switch/Host seen on this Port.

addConnection

public void addConnection(java.lang.Object obj)
Add the object of class String passed as parameter in the prttList. This object contains the IP address connected seen on this Port.
Parameters:
obj - Object of class Sting (IP address).

calculateThroughList

public void calculateThroughList(java.util.Vector subnetHost)
Calculate through list from the Forwarding database and list of hosts connected to subnet.
Parameters:
subnetHost - List of hosts in the subnet

isHostConnected

public boolean isHostConnected()
Returns whether this Port is connected to a Host.
Returns:
boolean indicating whether host is connected to this Port.

isRouterConnected

public boolean isRouterConnected()
Returns whether this Port is connected to a Router.
Returns:
boolean indicating whether Router is connected to this Port.

isDirectConnected

public boolean isDirectConnected()
Returns whether this Port is directly connected to a other link layer device (eg. Switch).
Returns:
boolean indicating whether another Layer-2 device is connected directly to this Port.

setHostConnection

public void setHostConnection()
Sets the connection of this Port to a Host.

setRouterConnection

public void setRouterConnection()
Sets the connection of this Port to a Router.

setDirectConnection

public void setDirectConnection()
Sets the connection of this Port to another data link layer device directly.

setSharedConnection

public void setSharedConnection()
Sets the connection of this Port to another data link layer device through a shared segment.