org.littleshoot.stun.stack.transaction
Class StunTransactionTrackerImpl

java.lang.Object
  extended by org.littleshoot.stun.stack.transaction.StunTransactionTrackerImpl
All Implemented Interfaces:
StunTransactionListener, StunTransactionTracker<StunMessage>

public class StunTransactionTrackerImpl
extends Object
implements StunTransactionTracker<StunMessage>, StunTransactionListener

Class for matching requests and responses to their associated transactions.


Constructor Summary
StunTransactionTrackerImpl()
           
 
Method Summary
 void addTransaction(StunMessage request, StunTransactionListener listener, InetSocketAddress localAddress, InetSocketAddress remoteAddress)
          Adds a transaction for the specified request with the specified listener.
 StunClientTransaction<StunMessage> getClientTransaction(StunMessage message)
          Accessor for the client transcaction associated with the specified message.
 Object onTransactionFailed(StunMessage request, StunMessage response)
          Called when the transaction failed with an error response, a timeout, or for any other reason.
 Object onTransactionSucceeded(StunMessage request, StunMessage response)
          Called when the transaction completed normally with a successful binding response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StunTransactionTrackerImpl

public StunTransactionTrackerImpl()
Method Detail

addTransaction

public void addTransaction(StunMessage request,
                           StunTransactionListener listener,
                           InetSocketAddress localAddress,
                           InetSocketAddress remoteAddress)
Description copied from interface: StunTransactionTracker
Adds a transaction for the specified request with the specified listener.

Specified by:
addTransaction in interface StunTransactionTracker<StunMessage>
Parameters:
request - The request to add a transaction for.
listener - The listener for transaction events.
localAddress - The local address the request will be sent from. This allows the verification of the address when we receive responses, as required in some STUN usages such as ICE.
remoteAddress - The remote address the request will be sent to. This allows the verification of the address when we receive responses, as required in some STUN usages such as ICE.

getClientTransaction

public StunClientTransaction<StunMessage> getClientTransaction(StunMessage message)
Description copied from interface: StunTransactionTracker
Accessor for the client transcaction associated with the specified message.

Specified by:
getClientTransaction in interface StunTransactionTracker<StunMessage>
Parameters:
message - The message containing a branch ID and SIP method to use as a key for looking up the associated tranction.
Returns:
The transaction associated with the specified message, or null if there is no associated transaction. This can happen if the transaction has timed out, for example.

onTransactionFailed

public Object onTransactionFailed(StunMessage request,
                                  StunMessage response)
Description copied from interface: StunTransactionListener
Called when the transaction failed with an error response, a timeout, or for any other reason.

Specified by:
onTransactionFailed in interface StunTransactionListener
Parameters:
request - The original request.
response - The binding response.
Returns:
The return type of the event methods.

onTransactionSucceeded

public Object onTransactionSucceeded(StunMessage request,
                                     StunMessage response)
Description copied from interface: StunTransactionListener
Called when the transaction completed normally with a successful binding response.

Specified by:
onTransactionSucceeded in interface StunTransactionListener
Parameters:
request - The binding request.
response - The binding response.
Returns:
The return type of the event methods.


Copyright © 2013 LittleShoot. All Rights Reserved.