org.jivesoftware.smackx.jingle.nat
Class ICECandidate

java.lang.Object
  extended by org.jivesoftware.smackx.jingle.nat.TransportCandidate
      extended by org.jivesoftware.smackx.jingle.nat.ICECandidate
All Implemented Interfaces:
java.lang.Comparable

public class ICECandidate
extends TransportCandidate
implements java.lang.Comparable

ICE Transport candidate.

A candidate represents the possible transport for data interchange between the two endpoints.

Author:
Thiago Camargo

Nested Class Summary
static class ICECandidate.Type
           
 
Nested classes/interfaces inherited from class org.jivesoftware.smackx.jingle.nat.TransportCandidate
TransportCandidate.CandidateEcho, TransportCandidate.Channel, TransportCandidate.Fixed, TransportCandidate.Protocol
 
Constructor Summary
ICECandidate()
           
ICECandidate(java.lang.String ip, int generation, int network, java.lang.String password, int port, java.lang.String username, int preference, ICECandidate.Type type)
          Constructor with the basic elements of a transport definition.
 
Method Summary
 void check(java.util.List<TransportCandidate> localCandidates)
          Check if a transport candidate is usable.
 int compareTo(java.lang.Object arg)
          Compare the to other Transport candidate.
 boolean equals(java.lang.Object obj)
           
 TransportCandidate.Channel getChannel()
          Get the channel
 java.lang.String getId()
          Get the ID
 int getNetwork()
          Get the network interface used for this connection
 int getPreference()
          Get the preference number for this transportElement
 TransportCandidate.Protocol getProto()
          Get the protocol used for the transmission
 ICECandidate.Type getType()
          Get the Candidate Type
 java.lang.String getUsername()
          Get the username for this transportElement in ICE
 boolean isNull()
          Return true if the candidate is not valid.
 void setChannel(TransportCandidate.Channel channel)
          Set the channel for this transportElement
 void setId(java.lang.String id)
          Set the ID
 void setNetwork(int network)
          Set the interface for this connection
 void setPreference(int preference)
          Set the preference order for this transportElement
 void setProto(TransportCandidate.Protocol proto)
          Set the protocol for the transmission
 void setType(ICECandidate.Type type)
          Set the Candidate Type
 void setUsername(java.lang.String username)
          Set the username for this transportElement in ICE
 
Methods inherited from class org.jivesoftware.smackx.jingle.nat.TransportCandidate
addCandidateEcho, addListener, getCandidateEcho, getConnection, getGeneration, getIp, getListenersList, getLocalIp, getName, getPassword, getPort, getSessionId, getSymmetric, removeCandidateEcho, setConnection, setGeneration, setIp, setLocalIp, setName, setPassword, setPort, setSessionId, setSymmetric
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ICECandidate

public ICECandidate()

ICECandidate

public ICECandidate(java.lang.String ip,
                    int generation,
                    int network,
                    java.lang.String password,
                    int port,
                    java.lang.String username,
                    int preference,
                    ICECandidate.Type type)
Constructor with the basic elements of a transport definition.

Parameters:
ip - the IP address to use as a local address
generation - used to keep track of the candidates
network - used for diagnostics (used when the machine has several NICs)
password - user name, as it is used in ICE
port - the port at the candidate IP address
username - user name, as it is used in ICE
preference - preference for this transportElement, as it is used in ICE
type - type as defined in ICE-12
Method Detail

getId

public java.lang.String getId()
Get the ID

Returns:
the id

setId

public void setId(java.lang.String id)
Set the ID

Parameters:
id - the id to set

getProto

public TransportCandidate.Protocol getProto()
Get the protocol used for the transmission

Returns:
the protocol used for transmission

setProto

public void setProto(TransportCandidate.Protocol proto)
Set the protocol for the transmission

Parameters:
proto - the protocol to use

getNetwork

public int getNetwork()
Get the network interface used for this connection

Returns:
the interface number

setNetwork

public void setNetwork(int network)
Set the interface for this connection

Parameters:
network - the interface number

getUsername

public java.lang.String getUsername()
Get the username for this transportElement in ICE

Returns:
a username string

getChannel

public TransportCandidate.Channel getChannel()
Get the channel

Returns:
the channel associated

setChannel

public void setChannel(TransportCandidate.Channel channel)
Set the channel for this transportElement

Parameters:
channel - the new channel

setUsername

public void setUsername(java.lang.String username)
Set the username for this transportElement in ICE

Parameters:
username - the username used in ICE

getPreference

public int getPreference()
Get the preference number for this transportElement

Returns:
the preference for this transportElement

setPreference

public void setPreference(int preference)
Set the preference order for this transportElement

Parameters:
preference - a number identifying the preference (as defined in ICE)

getType

public ICECandidate.Type getType()
Get the Candidate Type

Returns:
candidate Type

setType

public void setType(ICECandidate.Type type)
Set the Candidate Type

Parameters:
type - candidate type.

check

public void check(java.util.List<TransportCandidate> localCandidates)
Check if a transport candidate is usable. The transport resolver should check if the transport candidate the other endpoint has provided is usable.

ICE Candidate can check connectivity using UDP echo Test.

Overrides:
check in class TransportCandidate

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class TransportCandidate

isNull

public boolean isNull()
Description copied from class: TransportCandidate
Return true if the candidate is not valid.

Overrides:
isNull in class TransportCandidate
Returns:
true if the candidate is null.

compareTo

public int compareTo(java.lang.Object arg)
Compare the to other Transport candidate.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
arg - another Transport candidate
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object