Class TransportResolver
java.lang.Object
org.jivesoftware.smackx.jingleold.nat.TransportResolver
- Direct Known Subclasses:
BasicResolver
,BridgedResolver
,FixedResolver
,ICEResolver
,STUNResolver
A TransportResolver is used for obtaining a list of valid transport
candidates. A transport candidate is composed by an IP address and a port number.
It is called candidate, because it can be elected or not.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Add a new transport candidatevoid
Add a transport resolver listener.abstract void
cancel()
Cancel any asynchronous resolution operation.void
clear()
Clear the list of candidates and start a new resolution process.protected void
Clear the list of candidategetCandidate
(int i) Get the n-th candidate.int
Get the number of transport candidates.Get an iterator for the list of candidates.Get the list of candidates.protected int
Obtain a free port we can use.Get the list of listeners.Get the candidate with the highest preference.getType()
abstract void
Initialize the Resolver.void
Initialize Transport Resolver and wait until it is completely uninitialized.boolean
Check if the Transport Resolver is initialized.boolean
Return true if the resolver has finished the search for transport candidates.boolean
Return true if the resolver is working.void
Removes a transport resolver listener.abstract void
resolve
(JingleSession session) Start a the resolution.void
Set the Transport Resolver as initialized.protected void
Indicate the end of the resolution process.protected void
Indicate the beginning of the resolution process.void
protected void
Trigger a new candidate added event.
-
Field Details
-
type
-
CHECK_TIMEOUT
- See Also:
-
candidates
-
-
Constructor Details
-
TransportResolver
protected TransportResolver()Default constructor.
-
-
Method Details
-
getType
-
setType
-
initialize
Initialize the Resolver.- Throws:
XMPPException
- if an XMPP protocol error was received.SmackException
- if Smack detected an exceptional situation.InterruptedException
- if the calling thread was interrupted.
-
resolve
public abstract void resolve(JingleSession session) throws XMPPException, SmackException, InterruptedException Start a the resolution.- Parameters:
session
- the Jingle session.- Throws:
XMPPException
- if an XMPP protocol error was received.SmackException
- if Smack detected an exceptional situation.InterruptedException
- if the calling thread was interrupted.
-
clear
Clear the list of candidates and start a new resolution process.- Throws:
XMPPException
- if an XMPP protocol error was received.
-
cancel
Cancel any asynchronous resolution operation.- Throws:
XMPPException
- if an XMPP protocol error was received.
-
isResolving
Return true if the resolver is working.- Returns:
- true if the resolver is working.
-
isResolved
Return true if the resolver has finished the search for transport candidates.- Returns:
- true if the search has finished
-
setInitialized
Set the Transport Resolver as initialized. -
isInitialized
Check if the Transport Resolver is initialized.- Returns:
- true if initialized
-
setResolveInit
Indicate the beginning of the resolution process. This method must be used by subclasses at the beginning of their resolve() method. -
setResolveEnd
Indicate the end of the resolution process. This method must be used by subclasses at the beginning of their resolve() method. -
addListener
Add a transport resolver listener.- Parameters:
li
- The transport resolver listener to be added.
-
removeListener
Removes a transport resolver listener.- Parameters:
li
- The transport resolver listener to be removed
-
getListenersList
Get the list of listeners.- Returns:
- the list of listeners
-
triggerCandidateAdded
protected void triggerCandidateAdded(TransportCandidate cand) throws SmackException.NotConnectedException, InterruptedException Trigger a new candidate added event.- Parameters:
cand
- The candidate added to the list of candidates.- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
clearCandidates
Clear the list of candidate -
addCandidate
protected void addCandidate(TransportCandidate cand) throws SmackException.NotConnectedException, InterruptedException Add a new transport candidate- Parameters:
cand
- The candidate to add- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
getCandidates
Get an iterator for the list of candidates.- Returns:
- an iterator
-
getPreferredCandidate
Get the candidate with the highest preference.- Returns:
- The best candidate, according to the preference order.
-
getCandidateCount
Get the number of transport candidates.- Returns:
- The length of the transport candidates list.
-
getCandidatesList
Get the list of candidates.- Returns:
- the list of transport candidates
-
getCandidate
Get the n-th candidate.- Parameters:
i
- the index of the candidate.- Returns:
- a transport candidate
-
initializeAndWait
Initialize Transport Resolver and wait until it is completely uninitialized.- Throws:
XMPPException
- if an XMPP protocol error was received.SmackException
- if Smack detected an exceptional situation.InterruptedException
- if the calling thread was interrupted.
-
getFreePort
Obtain a free port we can use.- Returns:
- A free port number.
-