|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.littleshoot.stun.stack.message.StunMessageVisitorAdapter<org.littleshoot.stun.stack.message.StunMessage>
org.lastbamboo.common.turn.client.TcpTurnClient
public class TcpTurnClient
Class that handles all responsibilities of a TURN client. It does this in a couple of ways. First, it opens a connection to the TURN server and allocates a binding on the TURN server. Second, it decodes Data Indication messages arriving from the TURN server. When it receives a message, it creates sockets to the local HTTP server and forwards the data (HTTP data) enclosed in the Data Indication to the local HTTP server.
If this ever loses the connection to the TURN server, it notifies the listener that maintains TURN connections.
| Constructor Summary | |
|---|---|
TcpTurnClient(TurnClientListener clientListener,
org.littleshoot.util.CandidateProvider<InetSocketAddress> candidateProvider,
org.littleshoot.mina.filter.codec.ProtocolCodecFactory codecFactory)
Creates a new TCP TURN client. |
|
| Method Summary | |
|---|---|
void |
addIoServiceListener(org.littleshoot.mina.common.IoServiceListener serviceListener)
|
void |
close()
Closes this client's connection to the TURN server. |
void |
connect()
|
InetSocketAddress |
getHostAddress()
|
InetSocketAddress |
getMappedAddress()
Accesses the MAPPED ADDRESS attribute returned from the TURN server. |
InetSocketAddress |
getRelayAddress()
Accesses the allocated address for this TURN client on the TURN server. |
InetSocketAddress |
getServerReflexiveAddress()
|
InetAddress |
getStunServerAddress()
Gets the address of the STUN server this TURN client is using. |
boolean |
hostPortMapped()
|
boolean |
isConnected()
Returns whether or not the TURN client is connected. |
void |
sendConnectRequest(InetSocketAddress remoteAddress)
Tells the client to send a Connect Request for the specified remote address, telling the TURN server to attempt to connect to the specified address and to allow incoming connections from that address. |
void |
serviceActivated(org.littleshoot.mina.common.IoService service,
SocketAddress serviceAddress,
org.littleshoot.mina.common.IoHandler handler,
org.littleshoot.mina.common.IoServiceConfig config)
|
void |
serviceDeactivated(org.littleshoot.mina.common.IoService service,
SocketAddress serviceAddress,
org.littleshoot.mina.common.IoHandler handler,
org.littleshoot.mina.common.IoServiceConfig config)
|
void |
sessionCreated(org.littleshoot.mina.common.IoSession session)
|
void |
sessionDestroyed(org.littleshoot.mina.common.IoSession session)
|
org.littleshoot.stun.stack.message.StunMessage |
visitAllocateErrorResponse(org.littleshoot.stun.stack.message.turn.AllocateErrorResponse response)
|
org.littleshoot.stun.stack.message.StunMessage |
visitAllocateSuccessResponse(org.littleshoot.stun.stack.message.turn.AllocateSuccessResponse response)
|
org.littleshoot.stun.stack.message.StunMessage |
visitConnectionStatusIndication(org.littleshoot.stun.stack.message.turn.ConnectionStatusIndication indication)
|
org.littleshoot.stun.stack.message.StunMessage |
visitDataIndication(org.littleshoot.stun.stack.message.turn.DataIndication data)
|
org.littleshoot.stun.stack.message.StunMessage |
write(org.littleshoot.stun.stack.message.BindingRequest request,
InetSocketAddress remoteAddress)
|
org.littleshoot.stun.stack.message.StunMessage |
write(org.littleshoot.stun.stack.message.BindingRequest request,
InetSocketAddress remoteAddress,
long rto)
|
| Methods inherited from class org.littleshoot.stun.stack.message.StunMessageVisitorAdapter |
|---|
visitAllocateRequest, visitBindingErrorResponse, visitBindingRequest, visitBindingSuccessResponse, visitCanceledMessage, visitConnectErrorMesssage, visitConnectRequest, visitNullMessage, visitSendIndication |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TcpTurnClient(TurnClientListener clientListener,
org.littleshoot.util.CandidateProvider<InetSocketAddress> candidateProvider,
org.littleshoot.mina.filter.codec.ProtocolCodecFactory codecFactory)
clientListener - The listener for TURN client events.candidateProvider - The class that provides TURN candidate
servers.codecFactory - The codec factory.| Method Detail |
|---|
public void connect()
throws IOException
connect in interface org.lastbamboo.common.stun.client.StunClientIOExceptionpublic void close()
TurnClient
close in interface TurnClientclose in interface org.littleshoot.stun.stack.StunAddressProviderpublic void sendConnectRequest(InetSocketAddress remoteAddress)
TurnClient
sendConnectRequest in interface TurnClientremoteAddress - The address of the remote host.public InetSocketAddress getRelayAddress()
TurnClient
getRelayAddress in interface TurnClientgetRelayAddress in interface org.littleshoot.stun.stack.StunAddressProviderpublic InetSocketAddress getMappedAddress()
TurnClient
getMappedAddress in interface TurnClientpublic org.littleshoot.stun.stack.message.StunMessage visitAllocateSuccessResponse(org.littleshoot.stun.stack.message.turn.AllocateSuccessResponse response)
visitAllocateSuccessResponse in interface org.littleshoot.stun.stack.message.StunMessageVisitor<org.littleshoot.stun.stack.message.StunMessage>visitAllocateSuccessResponse in class org.littleshoot.stun.stack.message.StunMessageVisitorAdapter<org.littleshoot.stun.stack.message.StunMessage>public org.littleshoot.stun.stack.message.StunMessage visitAllocateErrorResponse(org.littleshoot.stun.stack.message.turn.AllocateErrorResponse response)
visitAllocateErrorResponse in interface org.littleshoot.stun.stack.message.StunMessageVisitor<org.littleshoot.stun.stack.message.StunMessage>visitAllocateErrorResponse in class org.littleshoot.stun.stack.message.StunMessageVisitorAdapter<org.littleshoot.stun.stack.message.StunMessage>public org.littleshoot.stun.stack.message.StunMessage visitConnectionStatusIndication(org.littleshoot.stun.stack.message.turn.ConnectionStatusIndication indication)
visitConnectionStatusIndication in interface org.littleshoot.stun.stack.message.StunMessageVisitor<org.littleshoot.stun.stack.message.StunMessage>visitConnectionStatusIndication in class org.littleshoot.stun.stack.message.StunMessageVisitorAdapter<org.littleshoot.stun.stack.message.StunMessage>public org.littleshoot.stun.stack.message.StunMessage visitDataIndication(org.littleshoot.stun.stack.message.turn.DataIndication data)
visitDataIndication in interface org.littleshoot.stun.stack.message.StunMessageVisitor<org.littleshoot.stun.stack.message.StunMessage>visitDataIndication in class org.littleshoot.stun.stack.message.StunMessageVisitorAdapter<org.littleshoot.stun.stack.message.StunMessage>
public void serviceActivated(org.littleshoot.mina.common.IoService service,
SocketAddress serviceAddress,
org.littleshoot.mina.common.IoHandler handler,
org.littleshoot.mina.common.IoServiceConfig config)
serviceActivated in interface org.littleshoot.mina.common.IoServiceListener
public void serviceDeactivated(org.littleshoot.mina.common.IoService service,
SocketAddress serviceAddress,
org.littleshoot.mina.common.IoHandler handler,
org.littleshoot.mina.common.IoServiceConfig config)
serviceDeactivated in interface org.littleshoot.mina.common.IoServiceListenerpublic void sessionCreated(org.littleshoot.mina.common.IoSession session)
sessionCreated in interface org.littleshoot.mina.common.IoServiceListenerpublic void sessionDestroyed(org.littleshoot.mina.common.IoSession session)
sessionDestroyed in interface org.littleshoot.mina.common.IoServiceListenerpublic InetAddress getStunServerAddress()
TurnClient
getStunServerAddress in interface TurnClientgetStunServerAddress in interface org.littleshoot.stun.stack.StunAddressProviderpublic InetSocketAddress getHostAddress()
getHostAddress in interface org.littleshoot.stun.stack.StunAddressProviderpublic InetSocketAddress getServerReflexiveAddress()
getServerReflexiveAddress in interface org.littleshoot.stun.stack.StunAddressProvider
public org.littleshoot.stun.stack.message.StunMessage write(org.littleshoot.stun.stack.message.BindingRequest request,
InetSocketAddress remoteAddress)
write in interface org.lastbamboo.common.stun.client.StunClient
public org.littleshoot.stun.stack.message.StunMessage write(org.littleshoot.stun.stack.message.BindingRequest request,
InetSocketAddress remoteAddress,
long rto)
write in interface org.lastbamboo.common.stun.client.StunClientpublic boolean isConnected()
TurnClient
isConnected in interface TurnClienttrue if the TURN client is connected to its server,
otherwise false.public boolean hostPortMapped()
public void addIoServiceListener(org.littleshoot.mina.common.IoServiceListener serviceListener)
addIoServiceListener in interface org.lastbamboo.common.stun.client.StunClient
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||