Class TransportNegotiator
java.lang.Object
org.jivesoftware.smackx.jingleold.JingleNegotiator
org.jivesoftware.smackx.jingleold.nat.TransportNegotiator
- Direct Known Subclasses:
TransportNegotiator.Ice
,TransportNegotiator.RawUdp
Transport negotiator.
This class is responsible for managing the transport negotiation process,
handling all the stanza interchange and the stage control.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Ice transport negotiator.static final class
Raw-UDP transport negotiator. -
Field Summary
Fields inherited from class org.jivesoftware.smackx.jingleold.JingleNegotiator
session
-
Constructor Summary
ConstructorDescriptionTransportNegotiator
(JingleSession session, TransportResolver transResolver, ContentNegotiator parentNegotiator) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
acceptableTransportCandidate
(TransportCandidate tc, List<TransportCandidate> localCandidates) Return true if the transport candidate is acceptable for the current negotiator.void
close()
Called from above to session-terminate.dispatchIncomingPacket
(IQ iq, String id) Dispatch an incoming packet.protected void
doStart()
Called from above to start the negotiator during a session-initiate.Get the best accepted local candidate we have offered.final TransportCandidate
Obtain the best local candidate we want to offer.abstract TransportCandidate
Obtain the best common transport candidate obtained in the negotiation.Return a JingleTransport that best reflects this transport negotiator.abstract JingleTransport
Get a new instance of the right TransportNegotiator class with this candidate.final Iterator<TransportCandidate>
Get an iterator for the list of valid (ie, checked) remote candidates.final boolean
Return true if the transport is fully established.Methods inherited from class org.jivesoftware.smackx.jingleold.JingleNegotiator
addExpectedId, addListener, getConnection, getListenersList, getNegotiatorState, getSession, isExpectedId, isStarted, removeExpectedId, removeListener, setNegotiatorState, setSession, start
-
Field Details
-
CANDIDATES_ACCEPT_PERIOD
- See Also:
-
-
Constructor Details
-
TransportNegotiator
public TransportNegotiator(JingleSession session, TransportResolver transResolver, ContentNegotiator parentNegotiator) Default constructor.- Parameters:
session
- The Jingle sessiontransResolver
- The JingleTransportManager to useparentNegotiator
- the parent negotiator.
-
-
Method Details
-
getJingleTransport
Get a new instance of the right TransportNegotiator class with this candidate.- Parameters:
cand
- the transport candidate.- Returns:
- A TransportNegotiator instance
-
acceptableTransportCandidate
public abstract boolean acceptableTransportCandidate(TransportCandidate tc, List<TransportCandidate> localCandidates) Return true if the transport candidate is acceptable for the current negotiator.- Parameters:
tc
- the transport candidate.localCandidates
- a list of local transport candidates.- Returns:
- true if the transport candidate is acceptable
-
getBestLocalCandidate
Obtain the best local candidate we want to offer.- Returns:
- the best local candidate
-
getAcceptedLocalCandidate
Get the best accepted local candidate we have offered.- Returns:
- a transport candidate we have offered.
-
doStart
Called from above to start the negotiator during a session-initiate.- Specified by:
doStart
in classJingleNegotiator
-
close
Called from above to session-terminate.- Overrides:
close
in classJingleNegotiator
-
getJingleTransport
Return a JingleTransport that best reflects this transport negotiator.- Returns:
- the jingle transport.
-
getOfferedCandidates
-
getBestRemoteCandidate
Obtain the best common transport candidate obtained in the negotiation.- Returns:
- the bestRemoteCandidate
-
isFullyEstablished
Return true if the transport is fully established.- Returns:
- true if the transport is fully established.
-
getValidRemoteCandidates
Get an iterator for the list of valid (ie, checked) remote candidates.- Returns:
- The iterator for the list of valid (ie, already checked) remote candidates.
-
dispatchIncomingPacket
public final List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException Dispatch an incoming packet. The method is responsible for recognizing the stanza type and, depending on the current state, delivering the stanza to the right event handler and wait for a response.- Specified by:
dispatchIncomingPacket
in classJingleNegotiator
- Parameters:
iq
- the stanza receivedid
- the ID of the response that will be sent- Returns:
- the new Jingle stanza to send.
- Throws:
XMPPException
- if an XMPP protocol error was received.SmackException
- if Smack detected an exceptional situation.InterruptedException
- if the calling thread was interrupted.
-