Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber
Class RawUdpTransportManager

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.media.TransportManager<CallPeerJabberImpl>
      extended by net.java.sip.communicator.impl.protocol.jabber.TransportManagerJabberImpl
          extended by net.java.sip.communicator.impl.protocol.jabber.RawUdpTransportManager

public class RawUdpTransportManager
extends TransportManagerJabberImpl

A TransportManagerJabberImpl implementation that would only gather a single candidate pair (i.e. RTP and RTCP).

Author:
Emil Ivov, Lyubomir Marinov

Constructor Summary
RawUdpTransportManager(CallPeerJabberImpl callPeer)
          Creates a new instance of this transport manager, binding it to the specified peer.
 
Method Summary
protected  void closeStreamConnector(MediaType mediaType, StreamConnector streamConnector)
          Closes a specific StreamConnector associated with a specific MediaType.
protected  StreamConnector createStreamConnector(MediaType mediaType)
          Creates a media StreamConnector for a stream of a specific MediaType.
 String getICECandidateExtendedType()
          Returns the extended type of the candidate selected if this transport manager is using ICE.
 String getICEState()
          Returns the current state of ICE processing.
 MediaStreamTarget getStreamTarget(MediaType mediaType)
          Implements TransportManagerJabberImpl.getStreamTarget(MediaType).
 String getXmlNamespace()
          Implements TransportManagerJabberImpl.getXmlNamespace().
 void removeContent(String name)
          Removes a content with a specific name from the transport-related part of the session represented by this TransportManagerJabberImpl which may have been reported through previous calls to the startCandidateHarvest and startConnectivityEstablishment methods.
 void startCandidateHarvest(List<ContentPacketExtension> theirOffer, List<ContentPacketExtension> ourAnswer, TransportInfoSender transportInfoSender)
          Starts transport candidate harvest.
 void startCandidateHarvest(List<ContentPacketExtension> ourOffer, TransportInfoSender transportInfoSender)
          Starts transport candidate harvest.
 boolean startConnectivityEstablishment(Iterable<ContentPacketExtension> remote)
          Overrides TransportManagerJabberImpl#startConnectivityEstablishment(Iterable<ContentPacketExtension>) in order to remember the remote counterpart of the negotiation between the local and the remote peer for subsequent calls to getStreamTarget(MediaType).
 List<ContentPacketExtension> wrapupCandidateHarvest()
          Simply returns the list of local candidates that we gathered during the harvest.
 
Methods inherited from class net.java.sip.communicator.impl.protocol.jabber.TransportManagerJabberImpl
close, findContentByName, getCurrentGeneration, getIntendedDestination, getNextID, incrementGeneration, removeContent, wrapupConnectivityEstablishment
 
Methods inherited from class net.java.sip.communicator.service.protocol.media.TransportManager
closeStreamConnector, getCallPeer, getICECandidateExtendedType, getLastUsedLocalHost, getNextMediaPortToTry, getStreamConnector, initializePortNumbers, sendHolePunchPacket, setNextMediaPortToTry, setTrafficClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RawUdpTransportManager

public RawUdpTransportManager(CallPeerJabberImpl callPeer)
Creates a new instance of this transport manager, binding it to the specified peer.

Parameters:
callPeer - the CallPeer whose traffic we will be taking care of.
Method Detail

closeStreamConnector

protected void closeStreamConnector(MediaType mediaType,
                                    StreamConnector streamConnector)
Closes a specific StreamConnector associated with a specific MediaType. If this TransportManager has a reference to the specified streamConnector, it remains.

Overrides:
closeStreamConnector in class TransportManager<CallPeerJabberImpl>
Parameters:
mediaType - the MediaType associated with the specified streamConnector
streamConnector - the StreamConnector to be closed
See Also:
TransportManager.closeStreamConnector(MediaType)

createStreamConnector

protected StreamConnector createStreamConnector(MediaType mediaType)
                                         throws OperationFailedException
Creates a media StreamConnector for a stream of a specific MediaType.

Overrides:
createStreamConnector in class TransportManager<CallPeerJabberImpl>
Parameters:
mediaType - the MediaType of the stream for which a StreamConnector is to be created
Returns:
a StreamConnector for the stream of the specified mediaType
Throws:
OperationFailedException - if the binding of the sockets fails

getStreamTarget

public MediaStreamTarget getStreamTarget(MediaType mediaType)
Implements TransportManagerJabberImpl.getStreamTarget(MediaType). Gets the MediaStreamTarget to be used as the target of the MediaStream with a specific MediaType.

Specified by:
getStreamTarget in class TransportManagerJabberImpl
Parameters:
mediaType - the MediaType of the MediaStream which is to have its target set to the returned MediaStreamTarget
Returns:
the MediaStreamTarget to be used as the target of the MediaStream with the specified MediaType
See Also:
TransportManagerJabberImpl.getStreamTarget(MediaType)

getXmlNamespace

public String getXmlNamespace()
Implements TransportManagerJabberImpl.getXmlNamespace(). Gets the XML namespace of the Jingle transport implemented by this TransportManagerJabberImpl.

Specified by:
getXmlNamespace in class TransportManagerJabberImpl
Returns:
the XML namespace of the Jingle transport implemented by this TransportManagerJabberImpl
See Also:
TransportManagerJabberImpl.getXmlNamespace()

removeContent

public void removeContent(String name)
Removes a content with a specific name from the transport-related part of the session represented by this TransportManagerJabberImpl which may have been reported through previous calls to the startCandidateHarvest and startConnectivityEstablishment methods.

Specified by:
removeContent in class TransportManagerJabberImpl
Parameters:
name - the name of the content to be removed from the transport-related part of the session represented by this TransportManagerJabberImpl
See Also:
TransportManagerJabberImpl.removeContent(String)

startCandidateHarvest

public void startCandidateHarvest(List<ContentPacketExtension> ourOffer,
                                  TransportInfoSender transportInfoSender)
                           throws OperationFailedException
Starts transport candidate harvest. This method should complete rapidly and, in case of lengthy procedures like STUN/TURN/UPnP candidate harvests are necessary, they should be executed in a separate thread. Candidate harvest would then need to be concluded in the wrapupCandidateHarvest() method which would be called once we absolutely need the candidates.

Specified by:
startCandidateHarvest in class TransportManagerJabberImpl
Parameters:
ourOffer - the content list that should tell us how many stream connectors we actually need.
transportInfoSender - the TransportInfoSender to be used by this TransportManagerJabberImpl to send transport-info JingleIQs from the local peer to the remote peer if this TransportManagerJabberImpl wishes to utilize transport-info. Local candidate addresses sent by this TransportManagerJabberImpl in transport-info are expected to not be included in the result of wrapupCandidateHarvest().
Throws:
OperationFailedException - in case we fail allocating ports

startCandidateHarvest

public void startCandidateHarvest(List<ContentPacketExtension> theirOffer,
                                  List<ContentPacketExtension> ourAnswer,
                                  TransportInfoSender transportInfoSender)
                           throws OperationFailedException
Starts transport candidate harvest. This method should complete rapidly and, in case of lengthy procedures like STUN/TURN/UPnP candidate harvests are necessary, they should be executed in a separate thread. Candidate harvest would then need to be concluded in the wrapupCandidateHarvest() method which would be called once we absolutely need the candidates.

Specified by:
startCandidateHarvest in class TransportManagerJabberImpl
Parameters:
theirOffer - a media description offer that we've received from the remote party and that we should use in case we need to know what transports our peer is using.
ourAnswer - the content descriptions that we should be adding our transport lists to (although not necessarily in this very instance).
transportInfoSender - the TransportInfoSender to be used by this TransportManagerJabberImpl to send transport-info JingleIQs from the local peer to the remote peer if this TransportManagerJabberImpl wishes to utilize transport-info. Local candidate addresses sent by this TransportManagerJabberImpl in transport-info are expected to not be included in the result of wrapupCandidateHarvest().
Throws:
OperationFailedException - if we fail to allocate a port number.
See Also:
TransportManagerJabberImpl.startCandidateHarvest(List, List, TransportInfoSender)

startConnectivityEstablishment

public boolean startConnectivityEstablishment(Iterable<ContentPacketExtension> remote)
Overrides TransportManagerJabberImpl#startConnectivityEstablishment(Iterable<ContentPacketExtension>) in order to remember the remote counterpart of the negotiation between the local and the remote peer for subsequent calls to getStreamTarget(MediaType).

Overrides:
startConnectivityEstablishment in class TransportManagerJabberImpl
Parameters:
remote - the collection of ContentPacketExtensions which represents the remote counterpart of the negotiation between the local and the remote peer
Returns:
true because RawUdpTransportManager does not perform connectivity checks
See Also:
TransportManagerJabberImpl.startConnectivityEstablishment(Iterable)

wrapupCandidateHarvest

public List<ContentPacketExtension> wrapupCandidateHarvest()
Simply returns the list of local candidates that we gathered during the harvest. This is a raw UDP transport manager so there's no real wrapping up to do.

Specified by:
wrapupCandidateHarvest in class TransportManagerJabberImpl
Returns:
the list of local candidates that we gathered during the harvest
See Also:
TransportManagerJabberImpl.wrapupCandidateHarvest()

getICECandidateExtendedType

public String getICECandidateExtendedType()
Returns the extended type of the candidate selected if this transport manager is using ICE.

Specified by:
getICECandidateExtendedType in class TransportManager<CallPeerJabberImpl>
Returns:
The extended type of the candidate selected if this transport manager is using ICE. Otherwise, returns null.

getICEState

public String getICEState()
Returns the current state of ICE processing.

Specified by:
getICEState in class TransportManager<CallPeerJabberImpl>
Returns:
the current state of ICE processing.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.