All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class magician.Node.Demultiplexer

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

public class Demultiplexer
extends Object
implements Runnable, ActiveNetsConstants, PerfConstants
The incoming SmartPacket consists of an outer frame and an inner frame. The outer frame consists of the Service Selector field which indicates the processing environment that is to be used to execute the SmartPacket. The primary function of the Demultiplexer class is to read the Service Selector field and use it to route the SmartPacket to the correct processing environment. The Demultiplexer runs a a thread and reads the packets from a queue which is filled in by the PortManager. The processing environment IDs (corresponding to the values of the Service Selector fields) and paths to the executables are stored on the Four11 information server. At boot time, the Active Node manager reads this information and initializes the Demux with all the processing environments.


Variable Index

 o IncomingSPs_Q
queue for incoming packets
 o numDiscards
 o numForwarded
is not cyclic
 o numPackets
 o PACKETCOUNT
packet count per logging cycle.

Constructor Index

 o Demultiplexer(Hashtable)
initializes the Demux

Method Index

 o checkVersion()
check for the version of the ANEP packet
 o defineTypeProcessor(byte[], Object)
define a new type processing environment to the Demux as a pair.
 o getAddress(int)
goes through the TLV options to obtain the embedded address
 o getEventManager()
gets a handle to the log device for reading
 o getForwardUnknownPacketFlag()
checks the flags field at the beginning of the byte stream to see if packet has to be discarded or forwarded if type is unknown at the current node
 o getTypeID()
returns the type ID of the packet
 o initStream()
performs initialization steps so that the individual fields of the incoming packet can be read
 o logEvent(String, long)
private method to log events to Event manager
 o queuePacket(int, byte[])
called by PortManager to deposit newly arrived packet stream
 o run()
The run() method reads the packets off the queue, uses the TypeID field to index into the ProcessingEnvs table to find the environment to call to run the SmartPacket in

Variables

 o IncomingSPs_Q
 public static Queue IncomingSPs_Q
queue for incoming packets

 o PACKETCOUNT
 public static int PACKETCOUNT
packet count per logging cycle. This is a cyclic counter which counts upto PACKETCOUNT packets, logs the time it takes to reach the value and is reset

 o numPackets
 public static int numPackets
 o numDiscards
 public static int numDiscards
 o numForwarded
 public static int numForwarded
is not cyclic

Constructors

 o Demultiplexer
 public Demultiplexer(Hashtable ProcEnvs)
initializes the Demux

Parameters:
ProcEnvs - all processing environments available at this node

Methods

 o getEventManager
 protected EventManager getEventManager()
gets a handle to the log device for reading

Returns:
an event manager object
 o defineTypeProcessor
 protected void defineTypeProcessor(byte typeID[],
                                    Object procEnv)
define a new type processing environment to the Demux as a pair. When processing a SmartPacket, its type ID is used to get the path to the processing environment and the new environment is exec'ed.

Parameters:
typeID - the type of packet which needs processing
procEnv - an Object representing the processing environment
 o initStream
 protected void initStream()
performs initialization steps so that the individual fields of the incoming packet can be read

 o queuePacket
 protected static synchronized void queuePacket(int port,
                                                byte packet[])
called by PortManager to deposit newly arrived packet stream

Parameters:
port - the port on which the packet arrived
packet - the packet stream
 o checkVersion
 protected boolean checkVersion() throws StreamCorruptedException
check for the version of the ANEP packet

Returns:
true if version is correct, false otherwise
 o getTypeID
 protected int getTypeID() throws StreamCorruptedException
returns the type ID of the packet

Returns:
the type id as an int
 o getForwardUnknownPacketFlag
 protected boolean getForwardUnknownPacketFlag() throws StreamCorruptedException
checks the flags field at the beginning of the byte stream to see if packet has to be discarded or forwarded if type is unknown at the current node

Returns:
true if forwarding is enabled, false otherwise
 o getAddress
 protected byte[] getAddress(int addrType) throws StreamCorruptedException
goes through the TLV options to obtain the embedded address

Parameters:
addrType - type of address, whether source or destination
Returns:
a byte array containing the forwarding address
 o logEvent
 void logEvent(String evType,
               long evValue)
private method to log events to Event manager

Parameters:
evType - a String identifying the event being logged
evValue - value to be logged
 o run
 public void run()
The run() method reads the packets off the queue, uses the TypeID field to index into the ProcessingEnvs table to find the environment to call to run the SmartPacket in


All Packages  Class Hierarchy  This Package  Previous  Next  Index
1