uk.org.arlott.simon.hw.f24.lbsta
Class ScriptAction

java.lang.Object
  extended by uk.org.arlott.simon.hw.f24.lbsta.ScriptComponent
      extended by uk.org.arlott.simon.hw.f24.lbsta.ScriptAction

public class ScriptAction
extends ScriptComponent

Represents an action to perform in a script.


Field Summary
 int bridgeID
          Bridge ID.
 int bridgePort
          Bridge Port.
 int dstHostAddress
          Destination host address.
 boolean enable
          Enable/disable value.
static int ENABLE_OR_DISABLE_PORT
          Enable or disable port action.
static int HOST_ENABLE_OR_DISABLE_RANDOM_PACKETS
          Enable or disable random packet sending on a host action.
static int HOST_SEND_PACKET
          Send packet from a host action.
 int hostAddress
          Host address.
static int RESET_BRIDGES
          Reset bridges action.
 int srcHostAddress
          Source host address.
 int type
          Type of this action.
 
Constructor Summary
private ScriptAction(int type)
          Creates a new ScriptAction of the specified type.
 
Method Summary
static ScriptAction createEnableOrDisablePort(int bridgeID, int bridgePort, boolean enable)
          Creates a new Bridge Port Enable/Disable action.
static ScriptAction createHostEnableOrDisableRandomPackets(int hostAddress, boolean enable)
          Creates a new Host Random Packets Enable/Disable action.
static ScriptAction createHostSendPacket(int srcHostAddress, int dstHostAddress)
          Creates a new Send Host Packet action.
static ScriptAction createResetBridges()
          Creates a new Reset Bridges action.
 void doAction(Network network)
          Peforms this action on the network.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESET_BRIDGES

public static final int RESET_BRIDGES
Reset bridges action.

See Also:
Constant Field Values

ENABLE_OR_DISABLE_PORT

public static final int ENABLE_OR_DISABLE_PORT
Enable or disable port action.

See Also:
Constant Field Values

HOST_SEND_PACKET

public static final int HOST_SEND_PACKET
Send packet from a host action.

See Also:
Constant Field Values

HOST_ENABLE_OR_DISABLE_RANDOM_PACKETS

public static final int HOST_ENABLE_OR_DISABLE_RANDOM_PACKETS
Enable or disable random packet sending on a host action.

See Also:
Constant Field Values

type

public int type
Type of this action.


bridgeID

public int bridgeID
Bridge ID.


bridgePort

public int bridgePort
Bridge Port.


enable

public boolean enable
Enable/disable value.


hostAddress

public int hostAddress
Host address.


srcHostAddress

public int srcHostAddress
Source host address.


dstHostAddress

public int dstHostAddress
Destination host address.

Constructor Detail

ScriptAction

private ScriptAction(int type)
Creates a new ScriptAction of the specified type.

Parameters:
type - The type of action to create.
Method Detail

createResetBridges

public static ScriptAction createResetBridges()
Creates a new Reset Bridges action.

Returns:
A new ScriptAction.

createEnableOrDisablePort

public static ScriptAction createEnableOrDisablePort(int bridgeID,
                                                     int bridgePort,
                                                     boolean enable)
Creates a new Bridge Port Enable/Disable action.

Parameters:
bridgeID - The Bridge ID.
bridgePort - The Bridge Port ID.
enable - The new status of the bridge port.
Returns:
A new ScriptAction.

createHostSendPacket

public static ScriptAction createHostSendPacket(int srcHostAddress,
                                                int dstHostAddress)
Creates a new Send Host Packet action.

Parameters:
srcHostAddress - The address of the source host.
dstHostAddress - The address of the destination host.
Returns:
A new ScriptAction.

createHostEnableOrDisableRandomPackets

public static ScriptAction createHostEnableOrDisableRandomPackets(int hostAddress,
                                                                  boolean enable)
Creates a new Host Random Packets Enable/Disable action.

Parameters:
hostAddress - The host address.
enable - The new status of the random packets setting.
Returns:
A new ScriptAction.

doAction

public void doAction(Network network)
Peforms this action on the network.

Parameters:
network - The Network to perform the action on.