net.clackrouter.component.extension
Class REDQueue

java.lang.Object
  extended by net.clackrouter.component.base.ClackComponent
      extended by net.clackrouter.component.base.Queue
          extended by net.clackrouter.component.extension.REDQueue
All Implemented Interfaces:
ComponentDataHandler, ComponentVizLauncher, Alarm

public class REDQueue
extends Queue
implements ComponentDataHandler, ComponentVizLauncher

Implementation of a Random Early Detection (RED) queue.

TODO: Currently, this implementation is lacking a GUI to set and modify the parameters in real-time, which is really needed for it to be useful. Its on the to-do list.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.clackrouter.component.base.ClackComponent
ClackComponent.Waiter
 
Field Summary
 double alpha
           
 double avgLen
           
 double curLen
           
static double DEFAULT_ALPHA
           
static double DEFAULT_LEN
           
static double DEFAULT_MAX_PROBABILITY
           
static double DEFAULT_MAX_THRESHOLD
           
static double DEFAULT_MIN_THRESHOLD
           
 double maxLen
           
 double maxProb
           
 double maxThresh
           
static long MIN_AVG_UPDATE_INTERVAL
           
 double minThresh
           
static int NUM_PORTS
           
static int PORT_HEAD
           
static int PORT_TAIL
           
 
Fields inherited from class net.clackrouter.component.base.Queue
DEFAULT_SIZE, m_max_size, m_queue, m_recent_drop, m_total_drops, mQueueOccData, startTime
 
Fields inherited from class net.clackrouter.component.base.ClackComponent
componentCell, m_has_error, m_log, m_name, m_num_ports, m_packetcount_in, m_packetcount_out, m_ports, mListeners, mRouter, pendingError, SIGNAL_ERROR_LEN_MSEC, UNIQUE_COUNT, view
 
Constructor Summary
REDQueue(Router router, java.lang.String name)
           
REDQueue(Router router, java.lang.String name, double mLen, double minTh, double maxTh, double mProb, double a)
           
 
Method Summary
 void acceptPacket(VNSPacket packet, int port_number)
          Receives a packet and sees if RED will drop or enqueue
 boolean acceptWrite(java.lang.String key, java.lang.String value)
           
 java.lang.String[] getLauncherStrings()
           
 int getMaxOccupancy()
          The max occupancy of the queue
 int getOccupancy()
          The current occupancy of the queue
 javax.swing.JPanel getPropertiesView()
          Method for getting the properties view associated with this component Property views are used to display more detailed information about internal component state.
 java.util.Properties getReadHandlerValues()
           
 java.util.Properties getWriteHandlerValues()
           
 VNSPacket handlePullRequest(int port_number)
          Removes a packet from the RED queue and recalculates the avg len
 boolean isModifying()
          Reports whether this component modifies packets passed through it This value is used by the static checking algorithm used to make sure port connections are valid.
 void launch(java.lang.String s)
           
 void poll()
          Callback method to implement component functionality that is not initiated by a packet push.
 void setupPorts(int numPorts)
          Allocates an array of ClackPort objects to be used by this component
 
Methods inherited from class net.clackrouter.component.base.Queue
getQueueOccData, getSerializableProperties, getTotalDropped, getView, initializeProperties, queueOccupancyChanged, recentDropTest, setMaxOccupancy
 
Methods inherited from class net.clackrouter.component.base.ClackComponent
createCopy, createInputPullPort, createInputPushPort, createOutputPullPort, createOutputPushPort, error, fireListeners, getColor, getComponentCell, getHierarchicalView, getLog, getName, getNumPorts, getPacketCountIn, getPacketCountOut, getPendingError, getPort, getRouter, getTime, getTypeName, getUniqueCount, hasError, isHierarchical, log, notifyAlarm, registerListener, sendOutPort, setAlarm, setComponentCell, setName, setPendingError, setView, showErrorDialog, signalError, try_repaint, unregisterListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PORT_HEAD

public static final int PORT_HEAD
See Also:
Constant Field Values

PORT_TAIL

public static final int PORT_TAIL
See Also:
Constant Field Values

NUM_PORTS

public static final int NUM_PORTS
See Also:
Constant Field Values

DEFAULT_LEN

public static double DEFAULT_LEN

DEFAULT_MIN_THRESHOLD

public static double DEFAULT_MIN_THRESHOLD

DEFAULT_MAX_THRESHOLD

public static double DEFAULT_MAX_THRESHOLD

DEFAULT_MAX_PROBABILITY

public static double DEFAULT_MAX_PROBABILITY

DEFAULT_ALPHA

public static double DEFAULT_ALPHA

minThresh

public double minThresh

maxThresh

public double maxThresh

maxProb

public double maxProb

avgLen

public double avgLen

curLen

public double curLen

maxLen

public double maxLen

alpha

public double alpha

MIN_AVG_UPDATE_INTERVAL

public static long MIN_AVG_UPDATE_INTERVAL
Constructor Detail

REDQueue

public REDQueue(Router router,
                java.lang.String name)

REDQueue

public REDQueue(Router router,
                java.lang.String name,
                double mLen,
                double minTh,
                double maxTh,
                double mProb,
                double a)
Method Detail

setupPorts

public void setupPorts(int numPorts)
Description copied from class: ClackComponent
Allocates an array of ClackPort objects to be used by this component

Overrides:
setupPorts in class Queue
Parameters:
numPorts - the number of ports to create

acceptPacket

public void acceptPacket(VNSPacket packet,
                         int port_number)
Receives a packet and sees if RED will drop or enqueue

Overrides:
acceptPacket in class Queue
Parameters:
packet - The pushed packet
port_number - The number of the port that this packet is arriving on

handlePullRequest

public VNSPacket handlePullRequest(int port_number)
Removes a packet from the RED queue and recalculates the avg len

Overrides:
handlePullRequest in class Queue
Parameters:
port_number - The port that a packet is being requested on
Returns:
A packet if available for pull, or null

poll

public void poll()
Description copied from class: ClackComponent

Callback method to implement component functionality that is not initiated by a packet push.

The pull method is often used to implement a "pull" component, or to serve as a packet source. The Router calls poll() once per processing loop if the component has been registered using the Router.registerForPoll(ClackComponent) method.

Overrides:
poll in class ClackComponent

getOccupancy

public int getOccupancy()
Description copied from class: Queue
The current occupancy of the queue

Overrides:
getOccupancy in class Queue

getMaxOccupancy

public int getMaxOccupancy()
Description copied from class: Queue
The max occupancy of the queue

Overrides:
getMaxOccupancy in class Queue

isModifying

public boolean isModifying()
Description copied from class: ClackComponent
Reports whether this component modifies packets passed through it This value is used by the static checking algorithm used to make sure port connections are valid. Sub-classes that do not modify packets should override this method

Overrides:
isModifying in class Queue
Returns:
by default, we assume the component modifies packets

getReadHandlerValues

public java.util.Properties getReadHandlerValues()
Specified by:
getReadHandlerValues in interface ComponentDataHandler

getWriteHandlerValues

public java.util.Properties getWriteHandlerValues()
Specified by:
getWriteHandlerValues in interface ComponentDataHandler

acceptWrite

public boolean acceptWrite(java.lang.String key,
                           java.lang.String value)
Specified by:
acceptWrite in interface ComponentDataHandler

getPropertiesView

public javax.swing.JPanel getPropertiesView()
Description copied from class: ClackComponent
Method for getting the properties view associated with this component Property views are used to display more detailed information about internal component state. This method creates a default property view, and can be overriden to provide custom properties views

Overrides:
getPropertiesView in class Queue
Returns:
this component's property view

getLauncherStrings

public java.lang.String[] getLauncherStrings()
Specified by:
getLauncherStrings in interface ComponentVizLauncher

launch

public void launch(java.lang.String s)
Specified by:
launch in interface ComponentVizLauncher