Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.protocol
Class StunServerDescriptor

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.StunServerDescriptor

public class StunServerDescriptor
extends Object

A StunServerDescriptor stores information necessary to create a STUN or TURN candidate harvester that we could use with ICE4J. Descriptors are normally initialized by protocol wizards. They are then used to convert the data into a String form suitable for storage in an accounts properties Map.

Author:
Yana Stamcheva, Emil Ivov

Field Summary
static int MAX_STUN_SERVER_COUNT
          The maximum number of stun servers that we would allow.
static String PROTOCOL_SSLTCP
          TCP with SSL protocol (only for Google Talk TURN server).
static String PROTOCOL_TCP
          TCP protocol.
static String PROTOCOL_UDP
          UDP protocol.
 
Constructor Summary
StunServerDescriptor(String address, int port, boolean supportTurn, String username, String password)
          Creates an instance of StunServer by specifying all parameters.
 
Method Summary
 String getAddress()
          Returns the IP address or FQDN of this server.
 byte[] getPassword()
          Returns the password associated to this server username.
 int getPort()
          Returns the port of this server.
 String getProtocol()
          Returns the protocol associated to this server.
 byte[] getUsername()
          Returns the username associated to this server.
 boolean isOldTurn()
          Returns true if the TURN protocol supported is not the RFC5766 ones.
 boolean isTurnSupported()
          Indicates if TURN is supported by this server.
static StunServerDescriptor loadDescriptor(Map<String,String> props, String namePrefix)
          Loads this descriptor from the specified Map.The method is meant for use with account property maps.
 void setAddress(String address)
          Sets the IP address or FQDN of this server.
 void setOldTurn(boolean val)
          Set the old TURN support.
 void setPassword(String password)
          Sets the password associated to this server username.
 void setPort(int port)
          Sets the port corresponding to this server.
 void setProtocol(String protocol)
          Sets the protocol associated to this server.
 void setTurnSupported(boolean turnSupported)
          Specifies whether this server can also act as a TURN relay.
 void setUsername(String username)
          Sets the username associated to this server.
 void storeDescriptor(Map<String,String> props, String namePrefix)
          Stores this descriptor into the specified Map.The method is meant for use with account property maps.
 String toString()
          Returns a String representation of this descriptor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_STUN_SERVER_COUNT

public static final int MAX_STUN_SERVER_COUNT
The maximum number of stun servers that we would allow.

See Also:
Constant Field Values

PROTOCOL_UDP

public static final String PROTOCOL_UDP
UDP protocol.

See Also:
Constant Field Values

PROTOCOL_TCP

public static final String PROTOCOL_TCP
TCP protocol.

See Also:
Constant Field Values

PROTOCOL_SSLTCP

public static final String PROTOCOL_SSLTCP
TCP with SSL protocol (only for Google Talk TURN server).

See Also:
Constant Field Values
Constructor Detail

StunServerDescriptor

public StunServerDescriptor(String address,
                            int port,
                            boolean supportTurn,
                            String username,
                            String password)
Creates an instance of StunServer by specifying all parameters.

Parameters:
address - the IP address or FQDN of the STUN server
port - the port of the server
supportTurn - indicates if this STUN server supports TURN
username - the user name for authenticating
password - the password
Method Detail

getAddress

public String getAddress()
Returns the IP address or FQDN of this server.

Returns:
the IP address or FQDN of this server

setAddress

public void setAddress(String address)
Sets the IP address or FQDN of this server.

Parameters:
address - the IP address or FQDN to set

getPort

public int getPort()
Returns the port of this server.

Returns:
the port of this server

setPort

public void setPort(int port)
Sets the port corresponding to this server.

Parameters:
port - the port to set

isTurnSupported

public boolean isTurnSupported()
Indicates if TURN is supported by this server.

Returns:
true if TURN is supported by this server, otherwise - returns false

setTurnSupported

public void setTurnSupported(boolean turnSupported)
Specifies whether this server can also act as a TURN relay.

Parameters:
turnSupported - true to indicate that TURN is supported, false - otherwise

getUsername

public byte[] getUsername()
Returns the username associated to this server.

Returns:
the username associated to this server

setUsername

public void setUsername(String username)
Sets the username associated to this server.

Parameters:
username - the username to set

getPassword

public byte[] getPassword()
Returns the password associated to this server username.

Returns:
the password associated to this server username

setPassword

public void setPassword(String password)
Sets the password associated to this server username.

Parameters:
password - the password to set

storeDescriptor

public void storeDescriptor(Map<String,String> props,
                            String namePrefix)
Stores this descriptor into the specified Map.The method is meant for use with account property maps. It also allows prepending an account prefix to all property names so that multiple descriptors can be stored in a single Map.

Parameters:
props - the account properties Map that we'd like to store this descriptor in.
namePrefix - the prefix that we should prepend to every property name.

loadDescriptor

public static StunServerDescriptor loadDescriptor(Map<String,String> props,
                                                  String namePrefix)
Loads this descriptor from the specified Map.The method is meant for use with account property maps. It also allows prepending an account prefix to all property names so that multiple descriptors can be read in a single Map.

Parameters:
props - the account properties Map that we'd like to load this descriptor from.
namePrefix - the prefix that we should prepend to every property name.
Returns:
the newly created descriptor or null if no descriptor was found.

isOldTurn

public boolean isOldTurn()
Returns true if the TURN protocol supported is not the RFC5766 ones.

Returns:
Returns true if the TURN protocol supported is not the RFC5766 ones.

setOldTurn

public void setOldTurn(boolean val)
Set the old TURN support.

Parameters:
val - value to set

getProtocol

public String getProtocol()
Returns the protocol associated to this server.

Returns:
the protocol associated to this server

setProtocol

public void setProtocol(String protocol)
Sets the protocol associated to this server.

Parameters:
protocol - protocol to set

toString

public String toString()
Returns a String representation of this descriptor

Overrides:
toString in class Object
Returns:
a String representation of this descriptor.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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