public class StunServerTransaction extends Object
Modifier and Type | Field and Description |
---|---|
private long |
expirationTime
The time in milliseconds when the next retransmission should follow.
|
private boolean |
expired
Determines whether or not the transaction has expired.
|
private boolean |
isRetransmitting
Determines whether or not the transaction is in a retransmitting state.
|
(package private) static long |
LIFETIME
The time that we keep server transactions active.
|
private TransportAddress |
localListeningAddress
The TransportAddress that we received our request on.
|
private TransportAddress |
localSendingAddress
The TransportAddress we use when sending responses
|
private TransportAddress |
requestSource
The address that we are receiving requests from.
|
private Response |
response
The response sent in response to the request.
|
private TransportAddress |
responseDestination
The address that we are sending responses to.
|
private StunStack |
stackCallback
The StunStack that created us.
|
private TransactionID |
transactionID
The id of the transaction.
|
Constructor and Description |
---|
StunServerTransaction(StunStack stackCallback,
TransactionID tranID,
TransportAddress localListeningAddress,
TransportAddress requestSource)
Creates a server transaction
|
Modifier and Type | Method and Description |
---|---|
void |
expire()
Cancels the transaction.
|
TransportAddress |
getLocalListeningAddress()
Returns the local TransportAddress that this transaction is
receiving requests on.
|
TransportAddress |
getRequestSourceAddress()
Returns the remote TransportAddress that this transaction is
receiving requests from.
|
protected Response |
getResponse()
Returns the Response that the StunStack has sent
through this transaction or null if no Response has
been sent yet.
|
TransportAddress |
getResponseDestinationAddress()
Returns the remote TransportAddress that this transaction is
receiving requests from.
|
TransportAddress |
getSendingAddress()
Returns the local TransportAddress that this transaction is
sending responses from.
|
TransactionID |
getTransactionID()
Returns the ID of the current transaction.
|
boolean |
isExpired()
Determines whether this StunServerTransaction is expired now.
|
boolean |
isExpired(long now)
Determines whether this StunServerTransaction will be expired at
a specific point in time.
|
boolean |
isRetransmitting()
Specifies whether this server transaction is in the retransmitting state.
|
protected void |
retransmitResponse()
Retransmits the response that was originally sent to the request that
caused this transaction.
|
void |
sendResponse(Response response,
TransportAddress sendThrough,
TransportAddress sendTo)
Sends the specified response through the
sendThrough
NetAccessPoint descriptor to the specified destination and changes
the transaction's state to retransmitting. |
void |
start()
Start the transaction.
|
static final long LIFETIME
private final StunStack stackCallback
private TransportAddress responseDestination
private final TransportAddress requestSource
private Response response
private final TransportAddress localListeningAddress
private TransportAddress localSendingAddress
private final TransactionID transactionID
private long expirationTime
private boolean expired
private boolean isRetransmitting
public StunServerTransaction(StunStack stackCallback, TransactionID tranID, TransportAddress localListeningAddress, TransportAddress requestSource)
stackCallback
- the stack that created us.tranID
- the transaction id contained by the request that was the
cause for this transaction.localListeningAddress
- the TransportAddress that this
transaction is receiving requests on.requestSource
- the TransportAddress that this
transaction is receiving requests from.public void start()
public void sendResponse(Response response, TransportAddress sendThrough, TransportAddress sendTo) throws StunException, IOException, IllegalArgumentException
sendThrough
NetAccessPoint descriptor to the specified destination and changes
the transaction's state to retransmitting.response
- the response to send the transaction to.sendThrough
- the local address through which responses are to
be sentsendTo
- the destination for responses of this transaction.IOException
- if an error occurs while sending message bytes
through the network socket.IllegalArgumentException
- if the apDescriptor references an
access point that had not been installed,StunException
- if message encoding fails,protected void retransmitResponse() throws StunException, IOException, IllegalArgumentException
IOException
- if an error occurs while sending message bytes
through the network socket.IllegalArgumentException
- if the apDescriptor references an
access point that had not been installed,StunException
- if message encoding fails,public void expire()
public boolean isExpired()
public boolean isExpired(long now)
now
- the time in milliseconds at which the expired state
of this StunServerTransaction is to be returnedpublic TransactionID getTransactionID()
public boolean isRetransmitting()
public TransportAddress getSendingAddress()
public TransportAddress getResponseDestinationAddress()
public TransportAddress getLocalListeningAddress()
public TransportAddress getRequestSourceAddress()
protected Response getResponse()
Copyright © 2018. All rights reserved.