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.
-
IncomingSPs_Q
- queue for incoming packets
-
numDiscards
-
-
numForwarded
- is not cyclic
-
numPackets
-
-
PACKETCOUNT
- packet count per logging cycle.
-
Demultiplexer(Hashtable)
- initializes the Demux
-
checkVersion()
-
check for the version of the ANEP packet
-
defineTypeProcessor(byte[], Object)
-
define a new type processing environment to the Demux as a pair.
-
getAddress(int)
- goes through the TLV options to obtain the embedded address
-
getEventManager()
- gets a handle to the log device for reading
-
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
-
getTypeID()
- returns the type ID of the packet
-
initStream()
- performs initialization steps so that the individual fields of the incoming packet
can be read
-
logEvent(String, long)
- private method to log events to Event manager
-
queuePacket(int, byte[])
- called by PortManager to deposit newly arrived packet stream
-
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
IncomingSPs_Q
public static Queue IncomingSPs_Q
- queue for incoming packets
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
numPackets
public static int numPackets
numDiscards
public static int numDiscards
numForwarded
public static int numForwarded
- is not cyclic
Demultiplexer
public Demultiplexer(Hashtable ProcEnvs)
- initializes the Demux
- Parameters:
- ProcEnvs - all processing environments available at this node
getEventManager
protected EventManager getEventManager()
- gets a handle to the log device for reading
- Returns:
- an event manager object
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
initStream
protected void initStream()
- performs initialization steps so that the individual fields of the incoming packet
can be read
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
checkVersion
protected boolean checkVersion() throws StreamCorruptedException
- check for the version of the ANEP packet
- Returns:
- true if version is correct, false otherwise
getTypeID
protected int getTypeID() throws StreamCorruptedException
- returns the type ID of the packet
- Returns:
- the type id as an int
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
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
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
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