J-Sim v1.2.1-p7 API

drcl.diffserv.scheduling
Class ColorQueue

java.lang.Object
  extended bydrcl.DrclObj
      extended bydrcl.comp.Component
          extended bydrcl.comp.queue.ActiveQueue
              extended bydrcl.inet.core.Queue
                  extended bydrcl.diffserv.scheduling.ColorQueue
All Implemented Interfaces:
java.lang.Cloneable, DFConstants, InetConstants, InetCoreConstants, ObjectDuplicable, PktClassifier, java.io.Serializable

public class ColorQueue
extends Queue
implements PktClassifier, DFConstants

Three Color Queue -- an extension of RED

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class drcl.comp.Component
Component.Locks
 
Field Summary
protected  PktClassifier classifier
           
 boolean COLOR_EWMA
           
 boolean COLOR_HOLT_WINTERS
           
static java.lang.String DROP_FRONT
           
protected  int drop_pref
          drop preference
static java.lang.String DROP_RAND
           
static java.lang.String DROP_TAIL
           
 drcl.diffserv.scheduling.ColorQueue.edp edp_
          early-drop params
 drcl.diffserv.scheduling.ColorQueue.edv edv_
          early-drop variables
protected  FiniteVSQueue green_q_
          virtual GREEN profile FIFO queue
protected  FiniteVSQueue q_
          underlying (usually) FIFO queue
protected  FiniteVSQueue red_q_
          virtual RED profile FIFO queue
 UniformDistribution ug
           
protected  FiniteVSQueue yellow_q_
          virtual YELLOW profile FIFO queue
 
Fields inherited from class drcl.comp.queue.ActiveQueue
nrequests, outport, OUTPUT_PORT_ID
 
Fields inherited from class drcl.comp.Component
FLAG_COMPONENT_NOTIFICATION, FLAG_DEBUG_ENABLED, FLAG_DIRECT_OUTPUT_ENABLED, FLAG_ENABLED, FLAG_ERROR_ENABLED, FLAG_EVENT_ENABLED, FLAG_EXPOSED, FLAG_GARBAGE_DISPLAY_ENABLED, FLAG_GARBAGE_ENABLED, FLAG_HAS_EXPOSED_CHILD, FLAG_PORT_NOTIFICATION, FLAG_STARTED, FLAG_STOPPED, FLAG_TRACE_ENABLED, FLAG_UNDEFINED_START, id, infoPort, locks, name, parent, PortGroup_DEFAULT_GROUP, PortGroup_EVENT, PortGroup_SERVICE, Root, Trace_DATA, Trace_SEND
 
Fields inherited from interface drcl.diffserv.DFConstants
_AF_CLASSES, _SINGLE_RATE, _TWO_RATE, AF11, AF11_TOS, AF12, AF12_TOS, AF13, AF13_TOS, AF1x, AF1x_TOS, AF21, AF21_TOS, AF22, AF22_TOS, AF23, AF23_TOS, AF2x, AF2x_TOS, AF31, AF31_TOS, AF32, AF32_TOS, AF33, AF33_TOS, AF3x, AF3x_TOS, BE, BE_TOS, DFCLASS_MASK, DSCPMask, DSCPShift, EF, EF_TOS, GREEN, IN_PROFILE, MODES, OUT_PROFILE, RED, SINGLE_RATE, TWO_RATE, YELLOW
 
Fields inherited from interface drcl.inet.core.InetCoreConstants
CONFIG_PORT_ID, PULL_PORT_ID
 
Fields inherited from interface drcl.inet.InetConstants
BYTE_MODE, DEFAULT_BANDWIDTH, DEFAULT_BUFFER_SIZE, DEFAULT_MTU, EVENT_ID_CHANGED_PORT_ID, EVENT_IDENTITY_ADDED, EVENT_IDENTITY_REMOVED, EVENT_IF_NEIGHBOR_DOWN, EVENT_IF_NEIGHBOR_UP, EVENT_IF_PORT_ID, EVENT_LINK_BROKEN, EVENT_LINK_BROKEN_PORT_ID, EVENT_MCAST_HOST_PORT_ID, EVENT_PKT_ARRIVAL, EVENT_PKT_ARRIVAL_PORT_ID, EVENT_RT_ENTRY_ADDED, EVENT_RT_ENTRY_MODIFIED, EVENT_RT_ENTRY_REMOVED, EVENT_RT_MCAST_CHANGED_PORT_ID, EVENT_RT_UCAST_CHANGED_PORT_ID, EVENT_VIF_NEIGHBOR_DOWN, EVENT_VIF_NEIGHBOR_UP, EVENT_VIF_PORT_ID, HOST_ENTRY_EXT, ID_CSL, MCAST_QUERY_PORT_ID, PACKET_MODE, PID_AODV, PID_DV, PID_DVMRP, PID_HELLO, PID_IGMP, PID_OSPF, PID_RSVP, PID_TCP, PID_UDP, SERVICE_CONFIGSW_PORT_ID, SERVICE_ID_PORT_ID, SERVICE_IF_PORT_ID, SERVICE_MCAST_PORT_ID, SERVICE_RT_PORT_ID, UCAST_QUERY_PORT_ID
 
Constructor Summary
ColorQueue()
           
ColorQueue(java.lang.String id)
           
 
Method Summary
 int classify(Packet pkt_)
          Returns the class the packet belongs to.
 void config(double minth_g, double maxth_g, double imaxp_g, double minth_y, double maxth_y, double imaxp_y, double minth_r, double maxth_r, double imaxp_r, double qw_, double bw, int meanpsize_)
           
 java.lang.Object dequeue()
          Retrieve the next packet in the queue for transmission.
 void duplicate(java.lang.Object source_)
          Duplicates the content of source_, including ID, name, child components and connections among them, to this component.
 java.lang.Object enqueue(java.lang.Object obj_)
          Picks packet to drop.
 java.lang.Object firstElement()
          Retrieves but not dequeue the first object in the queue.
 double getBandwidth()
           
 int getCapacity()
          Returns the capacity of the queue.
 PktClassifier getClassifier()
           
 int getDropPreference()
           
 int getGreenQSize()
           
 int getMaxGreenQSize()
           
 int getMaxRedQSize()
           
 int getMaxYellowQSize()
           
 int getRedQSize()
           
 long getSeed()
           
 int getSize()
          Returns the current size of the queue.
 int getYellowQSize()
           
 java.lang.String info(java.lang.String prefix_)
           
 boolean isEmpty()
          Return true if the queue is empty.
 boolean isFull()
          Return true if the queue is full.
protected  Packet pickPacketForECN(Packet pkt)
          Picks packet for early congestion notification (ECN).
 void print_edp()
           
 void print_edv()
           
 void reset()
          Resets the queue.
 void setBandwidth(double v_)
           
 void setCapacity(int size)
          Sets the capacity (in bytes) of the queue.
 void setClassifier(PktClassifier c_)
           
 void setCongestBit(boolean cb_)
           
 void setDefault()
           
 void setDropPreference(java.lang.String pref_)
           
 void setGreenQMaxSize(int size)
           
 void setMax_P_Green_Inv(double p_)
           
 void setMax_P_Red_Inv(double p_)
           
 void setMax_P_Yellow_Inv(double p_)
           
 void setMaxThresh_GREEN(double max)
           
 void setMaxThresh_RED(double max)
           
 void setMaxThresh_YELLOW(double max)
           
 void setMeanPacketsize(int size)
          Interface for user to supply parameters
 void setMinThresh_GREEN(double max)
           
 void setMinThresh_RED(double max)
           
 void setMinThresh_YELLOW(double max)
           
 void setPtc()
           
 void setQ_w(double q_w_)
           
 void setRedQMaxSize(int size)
           
 void setSeed(long seed_)
           
 void setWait(boolean wait_)
           
 void setYellowQMaxSize(int size)
           
 
Methods inherited from class drcl.inet.core.Queue
createConfigPort, getMode, isByteMode, isPacketMode, setMode
 
Methods inherited from class drcl.comp.queue.ActiveQueue
_getnrequests, _setnrequests, enqueueAt, getAvailableSize, getEnqueCount, increaseEnqueCount, info, lastElement, peekAt, process, pull, retrieveAt
 
Methods inherited from class drcl.comp.Component
_resume, _start, _stop, addComponent, addComponent, addEventPort, addEventPort, addForkPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addServerPort, addServerPort, cancelFork, componentAdded, componentRemoved, connect, containsComponent, containsComponent, containsPort, debug, disconnectAll, disconnectAllPeers, disconnectAllPorts, drop, drop, error, error, expose, exposeEventPorts, exposePort, exposePort, exposePort, exposePort, exposePort, findAvailable, findAvailable, findAvailable, finishing, fork, forkAt, getAllComponents, getAllPorts, getAllPorts, getAllWiresInside, getAllWiresInsideOut, getAllWiresOut, getComponent, getComponentFlag, getComponentFlag, getContract, getContractHT, getContractHT, getDebugFlagsInBinary, getDebugLevelNames, getForkManager, getID, getName, getParent, getPort, getPort, getRoot, getRuntime, getTime, iduplicate, isAncestorOf, isComponentNotificationEnabled, isContainer, isDebugEnabled, isDebugEnabledAt, isDirectlyRelatedTo, isDirectOutputEnabled, isEnabled, isErrorNoticeEnabled, isEventExportEnabled, isGarbageDisplayEnabled, isGarbageEnabled, isPortNotificationEnabled, isPortRemovable, isStarted, isStopped, isTraceEnabled, lock, notify, notifyAll, operate, portAdded, portRemoved, reboot, removeAll, removeAllComponents, removeAllPorts, removeAllPorts, removeComponent, removeComponent, removePort, removePort, removePort, resume, run, sduplicate, send, sendAt, setComponentFlag, setComponentFlag, setComponentNotificationEnabled, setContract, setDebugEnabled, setDebugEnabled, setDebugEnabledAt, setDebugEnabledAt, setDebugEnabledAt, setDirectOutputEnabled, setDirectOutputEnabled, setEnabled, setErrorNoticeEnabled, setErrorNoticeEnabled, setEventExportEnabled, setEventExportEnabled, setExecutionBoundary, setGarbageDisplayEnabled, setGarbageDisplayEnabled, setGarbageEnabled, setGarbageEnabled, setID, setID, setName, setPort, setPort, setPortNotificationEnabled, setPortRemovable, setRuntime, setTraceEnabled, setTraceEnabled, sleepFor, sleepUntil, stop, toString, unexpose, unlock, useLocalForkManager, useLocalForkManager, wait, yield
 
Methods inherited from class drcl.DrclObj
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DROP_TAIL

public static final java.lang.String DROP_TAIL
See Also:
Constant Field Values

DROP_FRONT

public static final java.lang.String DROP_FRONT
See Also:
Constant Field Values

DROP_RAND

public static final java.lang.String DROP_RAND
See Also:
Constant Field Values

COLOR_EWMA

public boolean COLOR_EWMA

COLOR_HOLT_WINTERS

public boolean COLOR_HOLT_WINTERS

ug

public UniformDistribution ug

edp_

public drcl.diffserv.scheduling.ColorQueue.edp edp_
early-drop params


edv_

public drcl.diffserv.scheduling.ColorQueue.edv edv_
early-drop variables


q_

protected FiniteVSQueue q_
underlying (usually) FIFO queue


red_q_

protected FiniteVSQueue red_q_
virtual RED profile FIFO queue


yellow_q_

protected FiniteVSQueue yellow_q_
virtual YELLOW profile FIFO queue


green_q_

protected FiniteVSQueue green_q_
virtual GREEN profile FIFO queue


drop_pref

protected int drop_pref
drop preference


classifier

protected PktClassifier classifier
Constructor Detail

ColorQueue

public ColorQueue()

ColorQueue

public ColorQueue(java.lang.String id)
Method Detail

firstElement

public java.lang.Object firstElement()
Description copied from class: ActiveQueue
Retrieves but not dequeue the first object in the queue.

Overrides:
firstElement in class ActiveQueue
Returns:
the object; null if queue is empty.

reset

public void reset()
Resets the queue.

Overrides:
reset in class Queue

dequeue

public java.lang.Object dequeue()
Retrieve the next packet in the queue for transmission.

Specified by:
dequeue in class ActiveQueue
Returns:
the retrieved packet.

pickPacketForECN

protected Packet pickPacketForECN(Packet pkt)
Picks packet for early congestion notification (ECN). This packet is then marked or dropped. Having a separate function do this is convenient for supporting derived classes that use the standard COLOR algorithm to compute average queue size but use a different algorithm for choosing the packet for ECN notification.


enqueue

public java.lang.Object enqueue(java.lang.Object obj_)
Picks packet to drop. By default it uses drop-tail. Having a separate function do this is convenient for supporting derived classes that use the standard three COLOR algorithm to compute average queue size but use a different algorithm for choosing the victim. protected Packet pickPacketToDrop() { if (drop_pref == _DROP_TAIL) return (Packet)q_.lastElement(); else if (drop_pref == DROP_FRONT) return (Packet)q_.firstElement(); else { int victim = (int)(ug.nextDouble()*q_.getLength()); if (victim == q_.getLength()) victim = victim -1; return((Packet)q_.retrieveAt(victim)); } }

Specified by:
enqueue in class ActiveQueue
Returns:
the object being dropped due to the enqueue; null otherwise.

duplicate

public void duplicate(java.lang.Object source_)
Description copied from class: Component
Duplicates the content of source_, including ID, name, child components and connections among them, to this component. Subclasses need to override this method to copy its own variables.

Specified by:
duplicate in interface ObjectDuplicable
Overrides:
duplicate in class Queue

setSeed

public void setSeed(long seed_)

getSeed

public long getSeed()

setMeanPacketsize

public void setMeanPacketsize(int size)
Interface for user to supply parameters


setWait

public void setWait(boolean wait_)

setCongestBit

public void setCongestBit(boolean cb_)

setMaxThresh_RED

public void setMaxThresh_RED(double max)

setMaxThresh_YELLOW

public void setMaxThresh_YELLOW(double max)

setMaxThresh_GREEN

public void setMaxThresh_GREEN(double max)

setMinThresh_RED

public void setMinThresh_RED(double max)

setMinThresh_YELLOW

public void setMinThresh_YELLOW(double max)

setMinThresh_GREEN

public void setMinThresh_GREEN(double max)

setDropPreference

public void setDropPreference(java.lang.String pref_)

getDropPreference

public int getDropPreference()

setCapacity

public void setCapacity(int size)
Description copied from class: Queue
Sets the capacity (in bytes) of the queue.

Specified by:
setCapacity in class Queue
Parameters:
size - the new capacity.

setRedQMaxSize

public void setRedQMaxSize(int size)

setYellowQMaxSize

public void setYellowQMaxSize(int size)

setGreenQMaxSize

public void setGreenQMaxSize(int size)

getSize

public int getSize()
Description copied from class: Queue
Returns the current size of the queue.

Specified by:
getSize in class Queue

getGreenQSize

public int getGreenQSize()

getYellowQSize

public int getYellowQSize()

getRedQSize

public int getRedQSize()

getCapacity

public int getCapacity()
Description copied from class: Queue
Returns the capacity of the queue.

Specified by:
getCapacity in class Queue

getMaxGreenQSize

public int getMaxGreenQSize()

getMaxYellowQSize

public int getMaxYellowQSize()

getMaxRedQSize

public int getMaxRedQSize()

setMax_P_Red_Inv

public void setMax_P_Red_Inv(double p_)

setMax_P_Yellow_Inv

public void setMax_P_Yellow_Inv(double p_)

setMax_P_Green_Inv

public void setMax_P_Green_Inv(double p_)

config

public void config(double minth_g,
                   double maxth_g,
                   double imaxp_g,
                   double minth_y,
                   double maxth_y,
                   double imaxp_y,
                   double minth_r,
                   double maxth_r,
                   double imaxp_r,
                   double qw_,
                   double bw,
                   int meanpsize_)

getBandwidth

public double getBandwidth()

setBandwidth

public void setBandwidth(double v_)

setPtc

public void setPtc()

setQ_w

public void setQ_w(double q_w_)

setClassifier

public void setClassifier(PktClassifier c_)

getClassifier

public PktClassifier getClassifier()

classify

public int classify(Packet pkt_)
Description copied from interface: PktClassifier
Returns the class the packet belongs to.

Specified by:
classify in interface PktClassifier

setDefault

public void setDefault()

print_edp

public void print_edp()

print_edv

public void print_edv()

info

public java.lang.String info(java.lang.String prefix_)
Overrides:
info in class Queue

isEmpty

public boolean isEmpty()
Description copied from class: ActiveQueue
Return true if the queue is empty.

Specified by:
isEmpty in class ActiveQueue

isFull

public boolean isFull()
Description copied from class: ActiveQueue
Return true if the queue is full.

Specified by:
isFull in class ActiveQueue

J-Sim v1.2.1-p7 API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~