SSF.Net
Class droptailQueue

java.lang.Object
  |
  +--SSF.Net.droptailQueue
All Implemented Interfaces:
packetQueue

public class droptailQueue
extends java.lang.Object
implements packetQueue

A simple FIFO packet queue.


Field Summary
 int pktCount
          auxiliary monitoring variable
 int pktDropCount
          auxiliary monitoring variable
 boolean pktDropped
           
 
Constructor Summary
droptailQueue()
           
droptailQueue(NIC nic)
          Called by NIC if DML attribute interface.queue is omitted; then droptailQueue is the default packetQueue installed.
 
Method Summary
 void config(NIC nic, com.renesys.raceway.DML.Configuration cfg)
          Does not accept any user-defined Configuration, required by interface packetQueue.
 boolean enqueue(ProtocolMessage msg)
          Logical model: The Buffer holds N bits max; bits go out one by one at the NIC bitrate.
 long getNumberOfBitsInQueue()
          Returns queue size in bits at the moment of calling.
 void init()
          Required by interface packetQueue.
 void setMonitor(PacketQueueMonitor mon)
          Set reference to a correctly configured class implementing the Java interface PacketQueueMonitor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pktDropped

public boolean pktDropped

pktCount

public int pktCount
auxiliary monitoring variable


pktDropCount

public int pktDropCount
auxiliary monitoring variable

Constructor Detail

droptailQueue

public droptailQueue()

droptailQueue

public droptailQueue(NIC nic)
Called by NIC if DML attribute interface.queue is omitted; then droptailQueue is the default packetQueue installed.

Method Detail

config

public void config(NIC nic,
                   com.renesys.raceway.DML.Configuration cfg)
Does not accept any user-defined Configuration, required by interface packetQueue. Obtains values of attributes buffer and bitrate from the instance of SSF.Net.NIC that constructs this droptailQueue.

Specified by:
config in interface packetQueue

init

public void init()
Required by interface packetQueue. Called by NIC.init().

Specified by:
init in interface packetQueue

setMonitor

public void setMonitor(PacketQueueMonitor mon)
Set reference to a correctly configured class implementing the Java interface PacketQueueMonitor.


enqueue

public boolean enqueue(ProtocolMessage msg)
Logical model: The Buffer holds N bits max; bits go out one by one at the NIC bitrate. If attempt to enqueue a message whose size is larger than the currently available free buffer space, drop it. queueingDelay is measured in integer multiples of simulated time "ticks". Warning: if Net.frequency (ticks per second) is smaller than NIC's bitrate (bits/sec) the delay calculations are not accurate enough to obtain correct value of number of bits in the buffer. Transmit a message. Each interface tracks its "queueing delay," which accumulates as packets are written out. Each packet contributes its transmission time (size in bits / bitrate) to the queueing delay of future packets. This guarantees that the interface will never exceed the local configured bitrate.

Fairness among competing flows is an entirely separate issue; without buffering and write-behind interleaving, latecomers will be delayed by early arrivals, even if they were written "simultaneously" by different traffic sources and should therefore compete for timeslots.

If the buffer is full (that is, the number of bytes that have already been transmitted in this timeslot would fill the configured buffer size), then drop the packet rather than scheduling it.

Return true if a packet is successfully enqueued, or false if the queue rejects the packet.

Specified by:
enqueue in interface packetQueue

getNumberOfBitsInQueue

public long getNumberOfBitsInQueue()
Returns queue size in bits at the moment of calling. Queue size is calculated as queueing delay (long, in tick units) times interface bitrate (double, in bits/tick) therefore it is rounded down to nearest long integer value.