Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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

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.IceUdpTransportManager
              extended by net.java.sip.communicator.impl.protocol.jabber.P2PTransportManager
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class P2PTransportManager
extends IceUdpTransportManager

Google P2P TransportManager.

Author:
Sebastien Vincent

Field Summary
 
Fields inherited from class net.java.sip.communicator.impl.protocol.jabber.IceUdpTransportManager
cpeList, DEFAULT_STUN_SERVER_ADDRESS, DEFAULT_STUN_SERVER_PORT, iceAgent
 
Constructor Summary
P2PTransportManager(CallPeerJabberImpl callPeer)
          Creates a new instance of this transport manager, binding it to the specified peer.
 
Method Summary
protected  org.ice4j.ice.Agent createIceAgent()
          Creates the ICE agent that we would be using in this transport manager for all negotiation.
 org.jivesoftware.smack.packet.PacketExtension createTransport(org.ice4j.ice.IceMediaStream stream)
          Converts the ICE media stream and its local candidates into a GTalkTransportPacketExtension.
protected  org.jivesoftware.smack.packet.PacketExtension getTransportPacketExtension()
          Get the transport PacketExtension to add.
 String getXmlNamespace()
          Implements TransportManagerJabberImpl.getXmlNamespace().
 void startCandidateHarvest(List<ContentPacketExtension> ourOffer, TransportInfoSender transportInfoSender)
          Starts transport candidate harvest.
 boolean startConnectivityEstablishment(Iterable<ContentPacketExtension> remote)
          Starts the connectivity establishment of the associated ICE Agent.
 void wrapupConnectivityEstablishment()
          Waits for the associated ICE Agent to finish any started connectivity checks.
 
Methods inherited from class net.java.sip.communicator.impl.protocol.jabber.IceUdpTransportManager
close, createIceStream, createStreamConnector, getICECandidateExtendedType, getICEState, getStreamConnector, getStreamTarget, propertyChange, removeContent, startCandidateHarvest, wrapupCandidateHarvest
 
Methods inherited from class net.java.sip.communicator.impl.protocol.jabber.TransportManagerJabberImpl
findContentByName, getCurrentGeneration, getIntendedDestination, getNextID, incrementGeneration, removeContent
 
Methods inherited from class net.java.sip.communicator.service.protocol.media.TransportManager
closeStreamConnector, closeStreamConnector, getCallPeer, getICECandidateExtendedType, getLastUsedLocalHost, getNextMediaPortToTry, initializePortNumbers, sendHolePunchPacket, setNextMediaPortToTry, setTrafficClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

P2PTransportManager

public P2PTransportManager(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

createIceAgent

protected org.ice4j.ice.Agent createIceAgent()
Creates the ICE agent that we would be using in this transport manager for all negotiation.

Overrides:
createIceAgent in class IceUdpTransportManager
Returns:
the ICE agent to use for all the ICE negotiation that this transport manager would be going through

getXmlNamespace

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

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

getTransportPacketExtension

protected org.jivesoftware.smack.packet.PacketExtension getTransportPacketExtension()
Get the transport PacketExtension to add.

Overrides:
getTransportPacketExtension in class IceUdpTransportManager
Returns:
PacketExtension

createTransport

public org.jivesoftware.smack.packet.PacketExtension createTransport(org.ice4j.ice.IceMediaStream stream)
Converts the ICE media stream and its local candidates into a GTalkTransportPacketExtension.

Overrides:
createTransport in class IceUdpTransportManager
Parameters:
stream - the IceMediaStream that we'd like to describe in XML.
Returns:
the GTalkTransportPacketExtension

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 IceUdpTransportManager.wrapupCandidateHarvest() method which would be called once we absolutely need the candidates.

Overrides:
startCandidateHarvest in class IceUdpTransportManager
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 IceUdpTransportManager.wrapupCandidateHarvest().
Throws:
OperationFailedException - in case we fail allocating ports

startConnectivityEstablishment

public boolean startConnectivityEstablishment(Iterable<ContentPacketExtension> remote)
Starts the connectivity establishment of the associated ICE Agent.

Overrides:
startConnectivityEstablishment in class IceUdpTransportManager
Parameters:
remote - the collection of ContentPacketExtensions which represents the remote counterpart of the negotiation between the local and the remote peers
Returns:
true if connectivity establishment has been started in response to the call; otherwise, false
See Also:
TransportManagerJabberImpl.startConnectivityEstablishment(Iterable)

wrapupConnectivityEstablishment

public void wrapupConnectivityEstablishment()
                                     throws OperationFailedException
Waits for the associated ICE Agent to finish any started connectivity checks.

Overrides:
wrapupConnectivityEstablishment in class IceUdpTransportManager
Throws:
OperationFailedException - if ICE processing has failed
See Also:
TransportManagerJabberImpl.wrapupConnectivityEstablishment()

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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