Class Node

java.lang.Object
  extended byNode

public class Node
extends java.lang.Object

   
 Node -- Class defining the data structures and code for the
 protocol stack for a node participating in the fishnet

 This code is under student control; we provide a baseline
 "hello world" example just to show how it interfaces with the FishNet classes.

 NOTE: per-node global variables are prohibited.
  In simulation mode, we execute many nodes in parallel, and thus
  they would share any globals.  Please put per-node state in class Node
  instead.

 In other words, all the code defined here should be generic -- it shouldn't
 matter to this code whether it is executing in a simulation or emulation
 
 This code must be written as a state machine -- each upcall must do its work and return so that 
 other upcalls can be delivered
 


Constructor Summary
Node(Manager manager, int addr)
          Create a new node
 
Method Summary
 void onCommand(java.lang.String command)
          Called by the manager when there is a command for this node from the user.
 void onReceive(java.lang.Integer from, byte[] msg)
          Called by the manager when a packet has arrived for this node
 void pingTimedOut()
          Callback method given to manager to invoke when a timer fires.
 void start()
          Called by the manager to start this node up.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Node

public Node(Manager manager,
            int addr)
Create a new node

Parameters:
manager - The manager that is managing Fishnet
addr - The address of this node
Method Detail

start

public void start()
Called by the manager to start this node up.


onReceive

public void onReceive(java.lang.Integer from,
                      byte[] msg)
Called by the manager when a packet has arrived for this node

Parameters:
from - The address of the node that has sent this packet
msg - The serialized form of the packet.

onCommand

public void onCommand(java.lang.String command)
Called by the manager when there is a command for this node from the user. Command can be input either from keyboard or file. For now sending messages as ping to a neighbor.

Parameters:
command - The command for this node

pingTimedOut

public void pingTimedOut()
Callback method given to manager to invoke when a timer fires.