org.lastbamboo.common.ice.transport
Class AbstractIceStunChecker

java.lang.Object
  extended by org.lastbamboo.common.ice.transport.AbstractIceStunChecker
All Implemented Interfaces:
IceStunChecker, org.littleshoot.stun.stack.transaction.StunTransactionListener
Direct Known Subclasses:
IceUdpStunChecker

public abstract class AbstractIceStunChecker
extends Object
implements IceStunChecker, org.littleshoot.stun.stack.transaction.StunTransactionListener

Abstract class for STUN connectivity checkers. This performs STUN checks and notifies the callers of responses. Subclasses supply the transport.


Field Summary
protected  boolean m_closed
           
protected  Map<org.apache.commons.id.uuid.UUID,org.littleshoot.stun.stack.message.StunMessage> m_idsToResponses
           
protected  org.littleshoot.mina.common.IoSession m_ioSession
           
protected  Object m_requestLock
           
protected  boolean m_transactionCanceled
          TODO: Review if this works!!
protected  org.littleshoot.stun.stack.transaction.StunTransactionTracker<org.littleshoot.stun.stack.message.StunMessage> m_transactionTracker
           
protected  int m_writeCallsForChecker
           
 
Constructor Summary
AbstractIceStunChecker(org.littleshoot.mina.common.IoSession ioSession, org.littleshoot.stun.stack.transaction.StunTransactionTracker<org.littleshoot.stun.stack.message.StunMessage> transactionTracker)
           
 
Method Summary
 void cancelTransaction()
          Cancels the existing STUN transaction.
 void close()
          Close any connections associated with the checker.
 Object onTransactionFailed(org.littleshoot.stun.stack.message.StunMessage request, org.littleshoot.stun.stack.message.StunMessage response)
           
 Object onTransactionSucceeded(org.littleshoot.stun.stack.message.StunMessage request, org.littleshoot.stun.stack.message.StunMessage response)
           
protected  void waitIfNoResponse(org.littleshoot.stun.stack.message.BindingRequest request, long waitTime)
           
 org.littleshoot.stun.stack.message.StunMessage write(org.littleshoot.stun.stack.message.BindingRequest bindingRequest, long rto)
          Writes a STUN binding request with the RTO value used for retransmissions explicitly set.
protected abstract  org.littleshoot.stun.stack.message.StunMessage writeInternal(org.littleshoot.stun.stack.message.BindingRequest bindingRequest, long rto)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_ioSession

protected final org.littleshoot.mina.common.IoSession m_ioSession

m_writeCallsForChecker

protected volatile int m_writeCallsForChecker

m_idsToResponses

protected final Map<org.apache.commons.id.uuid.UUID,org.littleshoot.stun.stack.message.StunMessage> m_idsToResponses

m_transactionTracker

protected final org.littleshoot.stun.stack.transaction.StunTransactionTracker<org.littleshoot.stun.stack.message.StunMessage> m_transactionTracker

m_requestLock

protected final Object m_requestLock

m_transactionCanceled

protected volatile boolean m_transactionCanceled
TODO: Review if this works!!


m_closed

protected volatile boolean m_closed
Constructor Detail

AbstractIceStunChecker

public AbstractIceStunChecker(org.littleshoot.mina.common.IoSession ioSession,
                              org.littleshoot.stun.stack.transaction.StunTransactionTracker<org.littleshoot.stun.stack.message.StunMessage> transactionTracker)
Method Detail

write

public org.littleshoot.stun.stack.message.StunMessage write(org.littleshoot.stun.stack.message.BindingRequest bindingRequest,
                                                            long rto)
Description copied from interface: IceStunChecker
Writes a STUN binding request with the RTO value used for retransmissions explicitly set.

Specified by:
write in interface IceStunChecker
Parameters:
bindingRequest - The STUN binding request.
rto - The value to use for RTO when calculating retransmission times. Note this only applies to UDP.
Returns:
The response message.

writeInternal

protected abstract org.littleshoot.stun.stack.message.StunMessage writeInternal(org.littleshoot.stun.stack.message.BindingRequest bindingRequest,
                                                                                long rto)

waitIfNoResponse

protected final void waitIfNoResponse(org.littleshoot.stun.stack.message.BindingRequest request,
                                      long waitTime)

cancelTransaction

public void cancelTransaction()
Description copied from interface: IceStunChecker
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:
cancelTransaction in interface IceStunChecker

onTransactionFailed

public Object onTransactionFailed(org.littleshoot.stun.stack.message.StunMessage request,
                                  org.littleshoot.stun.stack.message.StunMessage response)
Specified by:
onTransactionFailed in interface org.littleshoot.stun.stack.transaction.StunTransactionListener

onTransactionSucceeded

public Object onTransactionSucceeded(org.littleshoot.stun.stack.message.StunMessage request,
                                     org.littleshoot.stun.stack.message.StunMessage response)
Specified by:
onTransactionSucceeded in interface org.littleshoot.stun.stack.transaction.StunTransactionListener

close

public void close()
Description copied from interface: IceStunChecker
Close any connections associated with the checker.

Specified by:
close in interface IceStunChecker


Copyright © 2013 LittleShoot. All Rights Reserved.