rtpi.reliability.unreliableUdpMulticast
Class UnreliableUdpMulticast

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--rtpi.reliability.unreliableUdpMulticast.UnreliableUdpMulticast

public final class UnreliableUdpMulticast
extends java.lang.Thread
implements Reliable, TransportRecipient

This is a dummy implementation of the Reliableinterface. It uses UDP multicast and does not provide any other QoS than UNRELIABLE. It does also not provide redundant transmission. This reliability service uses the IPMCTransport class as a foundation for transmitting and receiving packets.

Author:
Martin Mauve

Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
UnreliableUdpMulticast(java.net.InetAddress taddr, int tport, int tttl, int rate, int bufferT)
          Create a new instance of UdpUnreliable.
 
Method Summary
 void connectionClosed()
          This is called if the undelying IPMCTransport has suffered a fatal error.
 int getCombinedHeaderSize()
          This returns the size of the combined RTP/I and reliability headers.
 int getTransportPayloadSize()
          This returns the size of the payload that can be transported in a single packet.
 void joinGroup()
          This joins the multicast group.
 void leaveGroup()
          This leaves the multicast group.
 void quit()
          This terminates the reliability service.
 void receiveTransportPacket(TransportPacket packet)
          This method is called when a transport packet has been received.
 void registerRecipient(ReliableRecipient rec)
          This registers the recipient of the ADUs and loss notifications.
 void run()
           
 void setDefaultInterest(int type, int qos)
          This method is used to set a default QoS for all subcomponent and RTP/I ADU type pairs to which no other QoS has been specified.
 void setInterest(long subcomponentID, int type, int qos)
          This method is used to set the QoS for a given subcomponent and RTP/I ADU type pair.
 void setRate(int rate)
          This sets the maximum datarate of the underlying IPMCTransport.
 void transmitRtpiAdu(java.util.LinkedList packets, float redundancy, int transmissionInterval)
          This method is used to transmit an ADU.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnreliableUdpMulticast

public UnreliableUdpMulticast(java.net.InetAddress taddr,
                              int tport,
                              int tttl,
                              int rate,
                              int bufferT)
Create a new instance of UdpUnreliable.
Parameters:
taddr - The multicast address that is used to transmit and receive the packets.
tport - The port.
tttl - The time to live.
rate - The maximum datrate at which packets may be sent. This rate is enforced by traffic shaping in the underlying IPMCTransport. The datarate is given in bits/second.
bufferT - The maximum time a received packet will be buffered before it is discarded. Buffering is required when some packets have arrived for an ADU while others are still missing. A reliability service hands only complete ADUs to its recipient.
Method Detail

getTransportPayloadSize

public int getTransportPayloadSize()
This returns the size of the payload that can be transported in a single packet. This payload size INCLUDES all RTP/I and reliability headers.
Specified by:
getTransportPayloadSize in interface Reliable

getCombinedHeaderSize

public int getCombinedHeaderSize()
This returns the size of the combined RTP/I and reliability headers.
Specified by:
getCombinedHeaderSize in interface Reliable

run

public void run()
Overrides:
run in class java.lang.Thread

quit

public void quit()
This terminates the reliability service.
Specified by:
quit in interface Reliable

transmitRtpiAdu

public void transmitRtpiAdu(java.util.LinkedList packets,
                            float redundancy,
                            int transmissionInterval)
                     throws QosNotSupportedException,
                            IllegalValueException
This method is used to transmit an ADU. The ADU may consist of multiple RTP/I packets if the ADU is too large to fit into a single (network) packet. The RTP/I packets MUST form a single valid RTP/I ADU. As an option the ADU may be transmitted with a certain amount of redundancy that is to be transmitted in a certain time interval to compensate for packet loss. It is important to notice that a given implementation may not support redundancy.
Specified by:
transmitRtpiAdu in interface Reliable
Parameters:
packet - A linked list of the RTP/I packets that belong to a single ADU.
redundancy - The amount of redundancy that should be added to this ADU.
transmissionInterval - The interval during which redundancy information may be transmitted.

receiveTransportPacket

public void receiveTransportPacket(TransportPacket packet)
This method is called when a transport packet has been received. This packet is checked and if it is the last packet of an ADU, then the ADU is handed to the recipient of this reliability service.
Specified by:
receiveTransportPacket in interface TransportRecipient
Parameters:
packet - The transport packet that has been received.

connectionClosed

public void connectionClosed()
This is called if the undelying IPMCTransport has suffered a fatal error.
Specified by:
connectionClosed in interface TransportRecipient

joinGroup

public void joinGroup()
This joins the multicast group. This MUST be called before any ADUs can be transmitted or received.
Specified by:
joinGroup in interface Reliable

leaveGroup

public void leaveGroup()
This leaves the multicast group. After this method has been called no ADUs may be transmitted and no further ADUs can be received. However, already received ADUs may still be delivered.
Specified by:
leaveGroup in interface Reliable

registerRecipient

public void registerRecipient(ReliableRecipient rec)
This registers the recipient of the ADUs and loss notifications.
Specified by:
registerRecipient in interface Reliable
Parameters:
rec - The reipient.

setRate

public void setRate(int rate)
This sets the maximum datarate of the underlying IPMCTransport.
Parameters:
The - new rate in bits/second.

setInterest

public void setInterest(long subcomponentID,
                        int type,
                        int qos)
                 throws QosNotSupportedException
This method is used to set the QoS for a given subcomponent and RTP/I ADU type pair. It is important to notice that a given implementation of the Reliable interface may only support certain QoS settings.
Specified by:
setInterest in interface Reliable
Parameters:
subcomponentID - The ID of the subcomponent.
type - The RTP/I ADU type.
qos - The desired QoS.

setDefaultInterest

public void setDefaultInterest(int type,
                               int qos)
                        throws QosNotSupportedException
This method is used to set a default QoS for all subcomponent and RTP/I ADU type pairs to which no other QoS has been specified. It is important to notice that a given implementation of the Reliable interface may only support certain QoS settings.
Specified by:
setDefaultInterest in interface Reliable
Parameters:
subcomponentID - The ID of the subcomponent.
type - The RTP/I ADU type.
qos - The desired QoS.