org.jivesoftware.smackx.jingle.nat
Class STUN

java.lang.Object
  extended by IQ
      extended by org.jivesoftware.smackx.jingle.nat.STUN

public class STUN
extends IQ

STUN IQ Packet used to request and retrieve a STUN server and port to make p2p connections easier. STUN is usually used by Jingle Media Transmission between two parties that are behind NAT.

High Level Usage Example:

STUN stun = STUN.getSTUNServer(xmppConnection);

Author:
Thiago Camargo

Nested Class Summary
static class STUN.Provider
          IQProvider for RTP Bridge packets.
static class STUN.StunServerAddress
          Provides easy abstract to store STUN Server Addresses and Ports
 
Field Summary
static java.lang.String DOMAIN
          Element name of the packet extension.
static java.lang.String ELEMENT_NAME
          Element name of the packet extension.
static java.lang.String NAMESPACE
          Namespace of the packet extension.
 
Constructor Summary
STUN()
          Creates a STUN IQ
 
Method Summary
 java.lang.String getChildElementXML()
          Get the Child Element XML of the Packet
 java.lang.String getPublicIp()
          Get Public Ip returned from the XMPP server
 java.util.List<STUN.StunServerAddress> getServers()
          Get a list of STUN Servers recommended by the Server
static STUN getSTUNServer(XMPPConnection xmppConnection)
          Get a new STUN Server Address and port from the server.
static boolean serviceAvailable(XMPPConnection xmppConnection)
          Check if the server support STUN Service.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOMAIN

public static final java.lang.String DOMAIN
Element name of the packet extension.

See Also:
Constant Field Values

ELEMENT_NAME

public static final java.lang.String ELEMENT_NAME
Element name of the packet extension.

See Also:
Constant Field Values

NAMESPACE

public static final java.lang.String NAMESPACE
Namespace of the packet extension.

See Also:
Constant Field Values
Constructor Detail

STUN

public STUN()
Creates a STUN IQ

Method Detail

getServers

public java.util.List<STUN.StunServerAddress> getServers()
Get a list of STUN Servers recommended by the Server

Returns:

getPublicIp

public java.lang.String getPublicIp()
Get Public Ip returned from the XMPP server

Returns:

getChildElementXML

public java.lang.String getChildElementXML()
Get the Child Element XML of the Packet

Returns:

getSTUNServer

public static STUN getSTUNServer(XMPPConnection xmppConnection)
Get a new STUN Server Address and port from the server. If a error occurs or the server donīt support STUN Service, null is returned.

Parameters:
xmppConnection -
Returns:

serviceAvailable

public static boolean serviceAvailable(XMPPConnection xmppConnection)
Check if the server support STUN Service.

Parameters:
xmppConnection -
Returns: