Class TrawlerNodeARPCommands

java.lang.Object
  extended byTrawlerNodeARPCommands

public class TrawlerNodeARPCommands
extends java.lang.Object

   
 Provides method to create and parse commands sent between the Trawler and the emulated node
 


Constructor Summary
TrawlerNodeARPCommands()
           
 
Method Summary
static java.lang.String addNeighbor(int fishAddr, java.net.InetAddress ipAddress, int port)
          Return a command to add a neighbor.
static boolean receiveAddNeighbor(java.lang.String cmd, java.util.ArrayList data)
          Parse an addNeighbor command.
static int receiveRemoveNeighbor(java.lang.String cmd)
          Parse a removeNeighbor command
static boolean receiveReset(java.lang.String cmd)
          Parse a reset command
static java.lang.String removeNeighbor(int fishAddr)
          Return a command to remove a neighbor
static java.lang.String reset()
          Return a command to reset a node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrawlerNodeARPCommands

public TrawlerNodeARPCommands()
Method Detail

addNeighbor

public static java.lang.String addNeighbor(int fishAddr,
                                           java.net.InetAddress ipAddress,
                                           int port)
Return a command to add a neighbor.

Parameters:
fishAddr - Fishnet address of neighbor
ipAddress - IP Address of neighbor
port - Port the neighbor is using for communication with peers
Returns:
A command to add a neighbor.

removeNeighbor

public static java.lang.String removeNeighbor(int fishAddr)
Return a command to remove a neighbor

Parameters:
fishAddr - Fishnet address of neighbor to remove
Returns:
A command to remove a neighbor

reset

public static java.lang.String reset()
Return a command to reset a node

Returns:
A command to reset a node

receiveAddNeighbor

public static boolean receiveAddNeighbor(java.lang.String cmd,
                                         java.util.ArrayList data)
Parse an addNeighbor command.

Parameters:
cmd - The command received
data - An ArrayList that will be populated with the data if this is an addNeighbor command. data[0] = fishned address and data[1] = EmulatorARPData.
Returns:
True if this was an addNeighbor command

receiveRemoveNeighbor

public static int receiveRemoveNeighbor(java.lang.String cmd)
Parse a removeNeighbor command

Parameters:
cmd - The command received
Returns:
The address of the node to remove. -1 if this was not a removeNeighbor command

receiveReset

public static boolean receiveReset(java.lang.String cmd)
Parse a reset command

Parameters:
cmd - The command seen
Returns:
True if this was a reset command