All Packages Class Hierarchy This Package Previous Next Index
Class magician.Node.PortInterface
java.lang.Object
|
+----magician.Node.PortInterface
- public class PortInterface
- extends Object
- implements Runnable, ActiveNetsConstants, PerfConstants
This module accepts outgoing packets packets as byte arrays, and decides which
Port must send them
- See Also:
- PortManager
-
bytesSent
-
-
packetsSent
-
-
SPLoader
- Loader for loading KU SmartPackets which use serialization
-
PortInterface()
- creates a PortInterface object
-
createNewOTWPacket(KUSmartPacketV2)
- creates a new OnTheWirePacket given the executable object
-
defineType(KUSmartPacketV2)
- creates a Type definition for the incoming class
-
finalize()
- cleans up before exiting
-
findOTWPFor(KUSmartPacketV2)
- create ANEP encapsulation for SP object
-
getANAddress(String)
- verifies if given address is an Active Net address and
if not returns the AN address of the AN gateway from which
destination can be reached
-
getExecutable(byte[])
- extract executable SmartPacket object from ANEP encapsulation
-
getLinkAddress(String)
- translates a virtual Active Node name to a link layer Address,
currently IP.
-
getLinkBandwidthToNode(String)
- get link bandwidth to neighbor
-
getLLAddress(String)
- get the link layer address for Active Node
-
getPort(String)
- get the port that a Active Node is listening to
-
run()
-
-
sendPacket(String, int, byte[])
- accepts a byte array representing an envinroment specific SmartPacket
and sends it to the specified Active Node by calling a PortManager's send method
-
SendSmartPacket(String, Object)
- Routine to send SmartPackets.
-
transmit(InetPacket)
- accepts a byte array representing an envinroment specific SmartPacket
and sends it to the specified Active Node by calling a PortManager's send method
packetsSent
public static long packetsSent
bytesSent
public static long bytesSent
SPLoader
public static SmartPacketLoader SPLoader
- Loader for loading KU SmartPackets which use serialization
PortInterface
public PortInterface()
- creates a PortInterface object
run
public void run()
getANAddress
protected static synchronized String getANAddress(String addr)
- verifies if given address is an Active Net address and
if not returns the AN address of the AN gateway from which
destination can be reached
- Parameters:
- addr - the address to be checked
- Returns:
- the corresponding Active Node name
getLinkAddress
protected static synchronized String getLinkAddress(String nodeName)
- translates a virtual Active Node name to a link layer Address,
currently IP.
- Parameters:
- nodeName - the name of the Active Node
- Returns:
- a String representing the link layer address
getPort
protected static int getPort(String nodeName)
- get the port that a Active Node is listening to
- Parameters:
- nodeName - the name of the Active Node
- Returns:
- the port it is listening to
getLinkBandwidthToNode
protected static int getLinkBandwidthToNode(String nodeName)
- get link bandwidth to neighbor
- Parameters:
- nodeName - name of neighbor
- Returns:
- the link bandwidth (in Kbps) if link exists else 0.
getLLAddress
protected static String getLLAddress(String nodeName)
- get the link layer address for Active Node
- Parameters:
- nodeName - name of the node
- Returns:
- a String containing the link layer address
transmit
protected static synchronized boolean transmit(InetPacket ipkt)
- accepts a byte array representing an envinroment specific SmartPacket
and sends it to the specified Active Node by calling a PortManager's send method
- Parameters:
- addr - the IP address of the Active Node
- port - the port to which to send the packet
- packetBytes - a byte array containing bytes of the SmartPacket
sendPacket
protected void sendPacket(String addr,
int port,
byte packetBytes[]) throws IOException
- accepts a byte array representing an envinroment specific SmartPacket
and sends it to the specified Active Node by calling a PortManager's send method
- Parameters:
- addr - the IP address of the Active Node
- port - the port to which to send the packet
- packetBytes - a byte array containing bytes of the SmartPacket
- Throws: IOException
- if packet could not be sent to given address
SendSmartPacket
protected synchronized boolean SendSmartPacket(String PortName,
Object SPObject)
- Routine to send SmartPackets.
- Parameters:
- PortName - name of destination active node
- SPObject - the SmartPacket object
- Returns:
- true if transmission successful, false otherwise
findOTWPFor
protected static OnTheWirePacket findOTWPFor(KUSmartPacketV2 SPObject)
- create ANEP encapsulation for SP object
- Parameters:
- SPObject - the Smartpacket object
- Returns:
- an ANEP encapsulation of the SmartPacket
- See Also:
- OnTheWirePacket
getExecutable
protected static KUSmartPacketV2 getExecutable(byte packetbytes[]) throws NullPointerException
- extract executable SmartPacket object from ANEP encapsulation
- Parameters:
- packetbytes - bytes of the ANEP packet
- Returns:
- the executable Smartpacket object
- Throws: NullPointerException
- if executable cannot be created
defineType
protected static byte[] defineType(KUSmartPacketV2 SPObject)
- creates a Type definition for the incoming class
- Parameters:
- cl - the class whose type is being defined
- Returns:
- a 16 byte array representing the Type ID
createNewOTWPacket
protected static synchronized OnTheWirePacket createNewOTWPacket(KUSmartPacketV2 SPObject)
- creates a new OnTheWirePacket given the executable object
- Parameters:
- destination - the destination of the SmartPacket
- SPObject - the executable SmartPacket Object
- Returns:
- a new OnTheWirePacket object
- See Also:
- OnTheWirePacket
finalize
public void finalize()
- cleans up before exiting
- Overrides:
- finalize in class Object
All Packages Class Hierarchy This Package Previous Next Index