org.lastbamboo.common.ice.candidate
Class IceUdpCandidatePair

java.lang.Object
  extended by org.lastbamboo.common.ice.candidate.IceUdpCandidatePair
All Implemented Interfaces:
Comparable<IceCandidatePair>, IceCandidatePair

public class IceUdpCandidatePair
extends Object
implements IceCandidatePair

A UDP ICE candidate pair.


Field Summary
protected  org.littleshoot.mina.common.IoSession m_ioSession
           
 
Constructor Summary
IceUdpCandidatePair(IceCandidate localCandidate, IceCandidate remoteCandidate, IceStunCheckerFactory stunCheckerFactory, IceConnector iceConnector)
          Creates a new pair without an existing connection between the endpoints.
IceUdpCandidatePair(IceCandidate localCandidate, IceCandidate remoteCandidate, org.littleshoot.mina.common.IoSession ioSession, IceStunCheckerFactory stunCheckerFactory)
          Creates a new pair.
 
Method Summary
<T> T
accept(IceCandidatePairVisitor<T> visitor)
          Accepts the specified visitor to an ICE candidate pair.
 void cancelStunTransaction()
          Cancels the existing STUN transaction.
 org.littleshoot.stun.stack.message.StunMessage check(org.littleshoot.stun.stack.message.BindingRequest request, long rto)
           
 void close()
           
 int compareTo(IceCandidatePair other)
           
 boolean equals(Object obj)
           
 int getComponentId()
          Accessor for the component ID for the pair.
 String getFoundation()
          Accessor for the foundation for the pair.
 org.littleshoot.mina.common.IoSession getIoSession()
           
 IceCandidate getLocalCandidate()
          Accessor for the local candidate for the pair.
 long getPriority()
          Accessor for the priority for the pair.
 IceCandidate getRemoteCandidate()
          Accessor for the remote candidate for the pair.
 IceCandidatePairState getState()
          Accesses the state of the pair.
 int hashCode()
           
 boolean isNominated()
          Returns whether or not this pair has already been nominated.
 boolean isNominateOnSuccess()
           
 boolean isTcp()
          Returns whether or not a pair is a TCP pair.
 boolean isTurnPair()
          Check for whether or not this pair is for a TURN connection.
 void nominate()
          Nominates this pair as potentially the final pair for exchanging media.
 void nominateOnSuccess()
           
 void recomputePriority()
          Recomputes the priority for the pair.
 void setIoSession(org.littleshoot.mina.common.IoSession session)
          Sets the IoSession for the pair.
 void setState(IceCandidatePairState state)
          Sets the state of the pair.
 String toString()
           
 void useCandidate()
          Sets a flag indicating checks on this pair should include the USE-CANDIDATE attribute in their Binding Requests.
 boolean useCandidateSet()
          Returns whether or not the USE-CANDIDATE attribute is set, i.e.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

m_ioSession

protected volatile org.littleshoot.mina.common.IoSession m_ioSession
Constructor Detail

IceUdpCandidatePair

public IceUdpCandidatePair(IceCandidate localCandidate,
                           IceCandidate remoteCandidate,
                           IceStunCheckerFactory stunCheckerFactory,
                           IceConnector iceConnector)
Creates a new pair without an existing connection between the endpoints.

Parameters:
localCandidate - The local candidate.
remoteCandidate - The candidate from the remote agent.
stunCheckerFactory - The class for creating new STUN checkers.
iceConnector - The class for creating a connection between the candidates.

IceUdpCandidatePair

public IceUdpCandidatePair(IceCandidate localCandidate,
                           IceCandidate remoteCandidate,
                           org.littleshoot.mina.common.IoSession ioSession,
                           IceStunCheckerFactory stunCheckerFactory)
Creates a new pair.

Parameters:
localCandidate - The local candidate.
remoteCandidate - The candidate from the remote agent.
ioSession - The IoSession connecting to the two endpoints.
stunCheckerFactory - The class for creating new STUN checkers.
Method Detail

check

public org.littleshoot.stun.stack.message.StunMessage check(org.littleshoot.stun.stack.message.BindingRequest request,
                                                            long rto)
Specified by:
check in interface IceCandidatePair

useCandidate

public void useCandidate()
Description copied from interface: IceCandidatePair
Sets a flag indicating checks on this pair should include the USE-CANDIDATE attribute in their Binding Requests. See: 8.1.1.1. Regular Nomination.

Specified by:
useCandidate in interface IceCandidatePair

useCandidateSet

public boolean useCandidateSet()
Description copied from interface: IceCandidatePair
Returns whether or not the USE-CANDIDATE attribute is set, i.e. whether or not this pair includes the USE-CANDIDATE attribute in its outgoing Binding Requests.

Specified by:
useCandidateSet in interface IceCandidatePair
Returns:
true if the USE-CANDIDATE attribute is in use.

cancelStunTransaction

public void cancelStunTransaction()
Description copied from interface: IceCandidatePair
Cancels the existing STUN transaction. The behavior for this is described in ICE section 7.2.1.4. on triggered checks. From that section, cancellation:

"means that the agent will not retransmit the request, will not treat the lack of response to be a failure, but will wait the duration of the transaction timeout for a response."

Specified by:
cancelStunTransaction in interface IceCandidatePair

recomputePriority

public void recomputePriority()
Description copied from interface: IceCandidatePair
Recomputes the priority for the pair.

Specified by:
recomputePriority in interface IceCandidatePair

getLocalCandidate

public IceCandidate getLocalCandidate()
Description copied from interface: IceCandidatePair
Accessor for the local candidate for the pair.

Specified by:
getLocalCandidate in interface IceCandidatePair
Returns:
The local candidate for the pair.

getRemoteCandidate

public IceCandidate getRemoteCandidate()
Description copied from interface: IceCandidatePair
Accessor for the remote candidate for the pair.

Specified by:
getRemoteCandidate in interface IceCandidatePair
Returns:
the remote candidate for the pair.

getPriority

public long getPriority()
Description copied from interface: IceCandidatePair
Accessor for the priority for the pair.

Specified by:
getPriority in interface IceCandidatePair
Returns:
The priority for the pair.

getState

public IceCandidatePairState getState()
Description copied from interface: IceCandidatePair
Accesses the state of the pair.

Specified by:
getState in interface IceCandidatePair
Returns:
The state of the pair.

getFoundation

public String getFoundation()
Description copied from interface: IceCandidatePair
Accessor for the foundation for the pair.

Specified by:
getFoundation in interface IceCandidatePair
Returns:
The foundation for the candidate pair. Note that this is a string because the foundation for the pair is the *concatenation* of the foundations of the candidates.

setState

public void setState(IceCandidatePairState state)
Description copied from interface: IceCandidatePair
Sets the state of the pair.

Specified by:
setState in interface IceCandidatePair
Parameters:
state - The state of the pair.

setIoSession

public void setIoSession(org.littleshoot.mina.common.IoSession session)
Description copied from interface: IceCandidatePair
Sets the IoSession for the pair.

Specified by:
setIoSession in interface IceCandidatePair
Parameters:
session - The IoSession.

getComponentId

public int getComponentId()
Description copied from interface: IceCandidatePair
Accessor for the component ID for the pair. Note that both candidates in the pair always have the same component ID.

Specified by:
getComponentId in interface IceCandidatePair
Returns:
The component ID for the pair.

nominate

public void nominate()
Description copied from interface: IceCandidatePair
Nominates this pair as potentially the final pair for exchanging media. The nominated pair with the highest priority is the pair that is ultimately used.

Specified by:
nominate in interface IceCandidatePair

isNominated

public boolean isNominated()
Description copied from interface: IceCandidatePair
Returns whether or not this pair has already been nominated.

Specified by:
isNominated in interface IceCandidatePair
Returns:
true if the pair has been nominated, otherwise false.

isTcp

public boolean isTcp()
Description copied from interface: IceCandidatePair
Returns whether or not a pair is a TCP pair.

Specified by:
isTcp in interface IceCandidatePair
Returns:
true if the pair is TCP, otherwise false.

nominateOnSuccess

public void nominateOnSuccess()
Specified by:
nominateOnSuccess in interface IceCandidatePair

isNominateOnSuccess

public boolean isNominateOnSuccess()
Specified by:
isNominateOnSuccess in interface IceCandidatePair

close

public void close()
Specified by:
close in interface IceCandidatePair

getIoSession

public org.littleshoot.mina.common.IoSession getIoSession()
Specified by:
getIoSession in interface IceCandidatePair

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

compareTo

public int compareTo(IceCandidatePair other)
Specified by:
compareTo in interface Comparable<IceCandidatePair>

isTurnPair

public boolean isTurnPair()
Description copied from interface: IceCandidatePair
Check for whether or not this pair is for a TURN connection. If so, we may handle it slightly differently upon nomination or at any other time.

Specified by:
isTurnPair in interface IceCandidatePair
Returns:
true if the local candidate for this pair is for our connection to our TURN server (the connection over which we sent an Allocate Request).

accept

public <T> T accept(IceCandidatePairVisitor<T> visitor)
Description copied from interface: IceCandidatePair
Accepts the specified visitor to an ICE candidate pair.

Specified by:
accept in interface IceCandidatePair
Type Parameters:
T - The class to return.
Parameters:
visitor - The visitor to accept.
Returns:
The class the visitor created.


Copyright © 2013 LittleShoot. All Rights Reserved.