All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class magician.Node.KUSmartPacketV2

java.lang.Object
   |
   +----magician.Node.KUSmartPacketV2

public abstract class KUSmartPacketV2
extends Object
implements Runnable, Serializable
This is the base class for all communication in the active network. Any new SmartPacket that the user creates must extend this class. This class represents the interface to the node resources. All access to node resources are governed through this class. In this release, access to small state at an active node is not governed through this class. Use ActiveNodeManager.CreateSmallState(), ActiveNodeManager.GetSmallState(), and ActiveNodeManager.SetSmallState() primitives for such access. However, it must be noted that those primitives will be rolled in with this interface in the next release. SmartPackets that are derived directly from this class are not guaranteed reliable communication. To use reliable communication, use ReliableCommFW class. This class provides the entry point for all user code. The user code must be inserted by overriding the exec() method of this class. If one wishes to build a complex protocol hierarchy before the user code is executed, the build() method must be overridden with the appropriate framework code. See ReliableCommFW for an example of a framework implementing reliable communication.

See Also:
ReliableCommFW

Variable Index

 o CPU_Requirements
the cpu cycles required by htis packet (currently ignored)
 o Destination_Address
name of destination active node
 o halted
 o IO_BW_Requirements
the network bandwidth requirements in bits/second (not used)
 o MAX_RETRIES
number of retries to get next hop from routing method
 o Memory_Requirements
the memory in bytes consumed by this packet during execution (currently not recorded)
 o NextHop
name of next hop active node
 o PacketID
Packet ID, used by ActiveNodeManager to track packet
 o Source_Address
name of source active node
 o thisNode
 o TypeID
the type identifier for this Smartpacket.

Constructor Index

 o KUSmartPacketV2()

Method Index

 o AcquireSmallState(String)
synchronously acquires small state
 o build()
interface that is to be used to build frameworks beyond the basic unreliable delivery provided by this class
 o CreateSmallState(String)
enables small state to be created by user packet
 o describeComponents(Field[], ObjectOutputStream)
describes the components of the type class to the serilaized stream This is called by user frameworks that are derived from this class to describe related components that form the same type
 o DestroySmallState(String)
destroys previously created small state
 o exec()
this method is overridden by user to implement user logic
 o GetCanonicalAddress(String)
returns the canonical name of the active node if it exists, else returns the gateway node from which the node can be reached
 o getExecTime()
 o getExecTime2()
 o getExecTime3()
 o GetLinkLayerAddress(String)
gives the base address of the active node, default is IP address
 o getMyKcc()
 o getMyUcc()
 o GetNetName()
gives the name of the network to which this node belongs
 o GetNextHop()
returns the name of the active node that is the next hop towards the destination
 o GetNodeName()
gives the name of this active node
 o GetNumberOfHops(String)
gives the number of hops required to reach a particular node from this node
 o getPid()
 o getPidCc(int)
 o getPidKcc(int)
 o getPidUcc(int)
 o GetService(String)
returns a service registered at the active node
 o GetSmallState(String)
synchronously acquires small state
 o GetSmallState(String, long)
synchronously acquires small state but user can specify maximum time period
 o getSourceAddress()
gives the name of the active node from which this Smartpacket was sent
 o getStime(int)
 o getTypeId()
returns the type identifier for the SmartPacket
 o getUtime(int)
 o halt()
 o pathNotFound()
called when node cannot find route to destination
 o run()
method called by Node to execute the Smartpacket
 o SendForProcessing(String)
To be used when smartpacket is expected to execute at this node
 o SendSmartPacket()
sends this Smartpacket towards destination
 o SendSmartPacket(String)
To be used when packet is to be sent directly without execution at the local node
 o SetSmallState(String, Object)
sets the contents of the named small state
 o setTflag(int)
 o sleep(long)
sleep for specified amount of time
 o stop()
stops execution of SmartPacket
 o tagB()
 o tagE()
 o yield()
relinquish the CPU

Variables

 o CPU_Requirements
 protected long CPU_Requirements
the cpu cycles required by htis packet (currently ignored)

 o Memory_Requirements
 protected int Memory_Requirements
the memory in bytes consumed by this packet during execution (currently not recorded)

 o IO_BW_Requirements
 protected int IO_BW_Requirements
the network bandwidth requirements in bits/second (not used)

 o Source_Address
 protected String Source_Address
name of source active node

 o Destination_Address
 public String Destination_Address
name of destination active node

 o PacketID
 protected transient int PacketID
Packet ID, used by ActiveNodeManager to track packet

 o NextHop
 protected transient String NextHop
name of next hop active node

 o MAX_RETRIES
 static final int MAX_RETRIES
number of retries to get next hop from routing method

 o TypeID
 protected byte TypeID[]
the type identifier for this Smartpacket.

 o thisNode
 protected transient String thisNode
 o halted
 protected transient boolean halted

Constructors

 o KUSmartPacketV2
 public KUSmartPacketV2()

Methods

 o tagE
 public native void tagE()
 o tagB
 public native void tagB()
 o getMyUcc
 public native long getMyUcc()
 o getMyKcc
 public native long getMyKcc()
 o getPidUcc
 public native long getPidUcc(int thePid)
 o getPidKcc
 public native long getPidKcc(int thePid)
 o getUtime
 public native long getUtime(int thePid)
 o getStime
 public native long getStime(int thePid)
 o getPidCc
 public native long getPidCc(int thePid)
 o getPid
 public native int getPid()
 o setTflag
 public native void setTflag(int pid)
 o getExecTime2
 public long getExecTime2()
 o getExecTime3
 public long getExecTime3()
 o getExecTime
 public long getExecTime()
 o run
 public final void run()
method called by Node to execute the Smartpacket

 o getTypeId
 public byte[] getTypeId()
returns the type identifier for the SmartPacket

Returns:
byte array representing the type identifier
 o getSourceAddress
 public String getSourceAddress()
gives the name of the active node from which this Smartpacket was sent

Returns:
a string representing the name of the source node
 o GetCanonicalAddress
 public String GetCanonicalAddress(String nodeName)
returns the canonical name of the active node if it exists, else returns the gateway node from which the node can be reached

Parameters:
nodeName - the name of the Active Node
Returns:
name of active node, if it exists, else name of gateway node
 o GetLinkLayerAddress
 public String GetLinkLayerAddress(String nodeName)
gives the base address of the active node, default is IP address

Parameters:
name - of the active node
Returns:
a string representing base address of active node
 o GetNodeName
 public String GetNodeName()
gives the name of this active node

Returns:
string respresenting name of this node
 o GetNetName
 public String GetNetName()
gives the name of the network to which this node belongs

Returns:
String representing network name
 o GetService
 public Object GetService(String service)
returns a service registered at the active node

Parameters:
service - name of the service
Returns:
object representing service if it exists, else null
 o GetNextHop
 public String GetNextHop()
returns the name of the active node that is the next hop towards the destination

Returns:
name of active node
 o GetNumberOfHops
 public int GetNumberOfHops(String node) throws NoRouteToHostException
gives the number of hops required to reach a particular node from this node

Returns:
number of hops required
Throws: NoRouteToHostException
if no route exists
 o SendSmartPacket
 public void SendSmartPacket()
sends this Smartpacket towards destination

 o SendSmartPacket
 public void SendSmartPacket(String destination)
To be used when packet is to be sent directly without execution at the local node

Parameters:
destination - the name of the destination active node
 o SendForProcessing
 public void SendForProcessing(String destination)
To be used when smartpacket is expected to execute at this node

Parameters:
destination - the ultimate destination of the packet
 o build
 public void build()
interface that is to be used to build frameworks beyond the basic unreliable delivery provided by this class

See Also:
ReliableCommFW
 o exec
 public void exec()
this method is overridden by user to implement user logic

 o describeComponents
 protected void describeComponents(Field components[],
                                   ObjectOutputStream out) throws IOException
describes the components of the type class to the serilaized stream This is called by user frameworks that are derived from this class to describe related components that form the same type

Parameters:
components - an array of Field objects that describe related classes
out - ObjectOutputStream that is provided by WriteObject method during serialization
Throws: IOException
if object cannot be serialized
 o stop
 protected void stop()
stops execution of SmartPacket

 o halt
 protected void halt()
 o sleep
 protected void sleep(long time)
sleep for specified amount of time

Parameters:
time - amount of time to sleep
 o yield
 protected void yield()
relinquish the CPU

 o CreateSmallState
 protected void CreateSmallState(String SSName) throws StateExistsException
enables small state to be created by user packet

Parameters:
SSName - name identifier of small state
 o GetSmallState
 protected Object GetSmallState(String SSName) throws StateNotFoundException, StateEmptyException
synchronously acquires small state

Parameters:
SSName - name identifier of small state
Returns:
Object stored in small state
Throws: StateNotFoundException
if named small state does not exist
Throws: StateEmptyException
if state exists but is empty
 o GetSmallState
 protected Object GetSmallState(String SSName,
                                long timeout) throws StateNotFoundException, StateEmptyException
synchronously acquires small state but user can specify maximum time period

Parameters:
SSName - name identifier of small state
Returns:
Object stored in small state
Throws: StateNotFoundException
if named small state does not exist
Throws: StateEmptyException
if state exists but is empty
 o AcquireSmallState
 protected Object AcquireSmallState(String SSName) throws StateNotFoundException
synchronously acquires small state

Parameters:
SSName - name identifier of small state
Returns:
Object stored in small state
Throws: StateNotFoundException
thrown if named small state does not exist
 o SetSmallState
 protected void SetSmallState(String SSName,
                              Object value) throws StateNotFoundException
sets the contents of the named small state

Parameters:
SSName - name identifier of small state
value - contents to be placed
Throws: StateNotFoundException
if named small state is not found
 o DestroySmallState
 protected void DestroySmallState(String SSName) throws StateNotFoundException
destroys previously created small state

Parameters:
SSName - name identifier of small state
 o pathNotFound
 protected void pathNotFound()
called when node cannot find route to destination


All Packages  Class Hierarchy  This Package  Previous  Next  Index
1