|
DRCL J-Sim API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectdrcl.DrclObj
drcl.net.traffic.TrafficShaper
Defines the base class for regulating incoming packets and outputing the packets
according to the associated traffic model.
A TrafficShaper holds a buffer that accommodates the difference of the traffic patterns between the incoming traffic and the traffic model instance that is associated with this component.
To embed this class in a component (e.g., TrafficShaperComponent),
call adjust(drcl.net.Packet, double) for each packet to be regulated.
The method returns the amount of time that must be delayed for outputting the packet in
order to conform to the associated traffic model. If the time is greater than zero, then the
packet is held in the buffer until dequeue() is called to release the packet.
One can use nextOutputTime() to get the absolute time
when the next packet in the buffer can be released.
Subclasses must override #adjust(double, int).
Subclasses do not need to be concerned about the buffer as it is taken care of in
adjust(drcl.net.Packet, double). The current time passed to this method is
maintained relatively to the time when this shaper instance starts. A subclass also
needs to override duplicate(Object), info(String) and reset().
TrafficModel,
Serialized Form| Constructor Summary | |
TrafficShaper()
|
|
| Method Summary | |
double |
adjust(Packet p_,
double now_)
Returns the time adjustment (relative to the current time now_)
for outputing the packet. |
Packet |
dequeue()
Releases and returns the first packet being held in the buffer. |
void |
duplicate(java.lang.Object source_)
opies the content of the source_ object to this object.
|
int |
getAvailableBufferSize()
Returns the available buffer size of this traffic shaper (byte). |
int |
getBufferLength()
Returns the current buffer length of this traffic shaper (# of packets). |
int |
getBufferSize()
Returns the (maximum) buffer size of this traffic shaper (byte). |
abstract TrafficModel |
getTrafficModel()
Returns the associated traffic model. |
java.lang.String |
info(java.lang.String prefix_)
Prints out the content of this traffic shaper instance. |
double |
nextOutputTime()
Returns the output time of next packet. |
void |
reset()
|
void |
setBufferSize(int size_)
Sets the (maximum) buffer size of this traffic shaper (byte). |
abstract void |
setTrafficModel(TrafficModel traffic_)
Sets the associated traffic model. |
| Methods inherited from class drcl.DrclObj |
clone, toString |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public TrafficShaper()
| Method Detail |
public void reset()
public void duplicate(java.lang.Object source_)
DrclObjsource_ object to this object.
he subclass must implement this method to realize DrclObj.clone().
duplicate in interface ObjectDuplicableduplicate in class DrclObjpublic java.lang.String info(java.lang.String prefix_)
super.info(prefix_) and
then supply the content of the parameters defined in the subclass.
prefix_ - prefix_ that should be prepended at each line.
public final double adjust(Packet p_,
double now_)
now_)
for outputing the packet.
public Packet dequeue()
public abstract TrafficModel getTrafficModel()
public abstract void setTrafficModel(TrafficModel traffic_)
public void setBufferSize(int size_)
public int getBufferSize()
public int getBufferLength()
public double nextOutputTime()
public int getAvailableBufferSize()
|
DRCL J-Sim API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||