|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectNode
public class Node
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 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Node(Manager manager, int addr)
manager
- The manager that is managing Fishnetaddr
- The address of this nodeMethod Detail |
---|
public void start()
public void onReceive(java.lang.Integer from, byte[] msg)
from
- The address of the node that has sent this packetmsg
- The serialized form of the packet.public void onCommand(java.lang.String command)
command
- The command for this nodepublic void pingTimedOut()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |