public class TurnCandidateHarvest extends StunCandidateHarvest
Modifier and Type | Field and Description |
---|---|
private static Logger |
logger
The Logger used by the TurnCandidateHarvest class and
its instances for logging output.
|
private Request |
requestToStartResolvingCandidate
The Request created by the last call to
createRequestToStartResolvingCandidate() . |
harvester, hostCandidate, SEND_KEEP_ALIVE_MESSAGE_INTERVAL_NOT_SPECIFIED
Constructor and Description |
---|
TurnCandidateHarvest(TurnCandidateHarvester harvester,
HostCandidate hostCandidate)
Initializes a new TurnCandidateHarvest which is to represent the
harvesting of TURN Candidates for a specific
HostCandidate performed by a specific
TurnCandidateHarvester.
|
Modifier and Type | Method and Description |
---|---|
void |
close(RelayedCandidateDatagramSocket relayedCandidateSocket)
Notifies this TurnCandidateHarvest that a specific
RelayedCandidateDatagramSocket is closing and that this instance
is to delete the associated TURN Allocation.
|
protected boolean |
completedResolvingCandidate(Request request,
Response response)
Completes the harvesting of Candidates for
StunCandidateHarvest.hostCandidate . |
protected void |
createCandidates(Response response)
Creates new Candidates determined by a specific STUN
Response.
|
protected Message |
createKeepAliveMessage(LocalCandidate candidate)
Creates a new STUN Message to be sent to the STUN server
associated with the StunCandidateHarvester of this instance in
order to keep a specific LocalCandidate (harvested by this
instance) alive.
|
private void |
createRelayedCandidate(Response response)
Creates a RelayedCandidate using the
XOR-RELAYED-ADDRESS attribute in a specific STUN
Response for the actual TransportAddress of the new
candidate.
|
protected RelayedCandidate |
createRelayedCandidate(TransportAddress transportAddress,
TransportAddress mappedAddress)
Creates a new RelayedCandidate instance which is to represent a
specific TransportAddress harvested through
StunCandidateHarvest.hostCandidate and the TURN server associated with
StunCandidateHarvest.harvester . |
protected Request |
createRequestToRetry(Request request)
Creates a new Request instance which is to be sent by this
StunCandidateHarvest in order to retry a specific
Request.
|
protected Request |
createRequestToStartResolvingCandidate()
Creates a new Request which is to be sent to
StunCandidateHarvester.stunServer in order to start resolving
StunCandidateHarvest.hostCandidate . |
protected boolean |
processErrorOrFailure(Response response,
Request request,
TransactionID transactionID)
Notifies this StunCandidateHarvest that a specific
Request has either received an error Response or has
failed to receive any Response.
|
protected void |
processSuccess(Response response,
Request request,
TransactionID transactionID)
Handles a specific STUN success Response to a specific STUN
Request.
|
byte[] |
sendRequest(RelayedCandidateDatagramSocket relayedCandidateDatagramSocket,
Request request)
Sends a specific Request on behalf of a specific
RelayedCandidateDatagramSocket to the TURN server associated
with this TurnCandidateHarvest.
|
addCandidate, addShortTermCredentialAttributes, close, containsCandidate, createServerReflexiveCandidate, createServerReflexiveCandidate, getCandidateCount, getCandidates, getMappedAddress, processFailure, processResponse, sendKeepAliveMessage, sendKeepAliveMessage, sendRequest, setSendKeepAliveMessageInterval, startResolvingCandidate
processTimeout, processUnreachable
private static final Logger logger
private Request requestToStartResolvingCandidate
createRequestToStartResolvingCandidate()
.public TurnCandidateHarvest(TurnCandidateHarvester harvester, HostCandidate hostCandidate)
harvester
- the TurnCandidateHarvester which is performing
the TURN harvestinghostCandidate
- the HostCandidate for which TURN
Candidates are to be harvestedpublic void close(RelayedCandidateDatagramSocket relayedCandidateSocket)
Note: The method is part of the internal API of RelayedCandidateDatagramSocket and TurnCandidateHarvest and is not intended for public use.
relayedCandidateSocket
- the RelayedCandidateDatagramSocket
which notifies this instance and which requests that the associated TURN
Allocation be deletedprotected boolean completedResolvingCandidate(Request request, Response response)
StunCandidateHarvest.hostCandidate
. Notifies StunCandidateHarvest.harvester
about the completion
of the harvesting of Candidate for hostCandidate
performed by this StunCandidateHarvest.completedResolvingCandidate
in class StunCandidateHarvest
request
- the Request sent by this
StunCandidateHarvest with which the harvesting of
Candidates for hostCandidate has completedresponse
- the Response received by this
StunCandidateHarvest, if any, with which the harvesting of
Candidates for hostCandidate has completedStunCandidateHarvest.completedResolvingCandidate(Request, Response)
protected void createCandidates(Response response)
createCandidates
in class StunCandidateHarvest
response
- the received STUN ResponseStunCandidateHarvest.createCandidates(Response)
protected Message createKeepAliveMessage(LocalCandidate candidate) throws StunException
createKeepAliveMessage
in class StunCandidateHarvest
candidate
- the LocalCandidate (harvested by this instance)
to create a new keep-alive STUN message forStunException
- if anything goes wrong while creating the new
keep-alive STUN Message for the specified candidate
or the candidate is of an unsupported CandidateTypeStunCandidateHarvest.createKeepAliveMessage(LocalCandidate)
private void createRelayedCandidate(Response response)
response
- the STUN Response which is supposed to contain
the address we should use for the new candidateprotected RelayedCandidate createRelayedCandidate(TransportAddress transportAddress, TransportAddress mappedAddress)
StunCandidateHarvest.hostCandidate
and the TURN server associated with
StunCandidateHarvest.harvester
.transportAddress
- the TransportAddress to be represented
by the new RelayedCandidate instancemappedAddress
- the mapped TransportAddress reported by the
TURN server with the delivery of the relayed transportAddress to
be represented by the new RelayedCandidate instanceStunCandidateHarvest.hostCandidate
and the TURN server associated with
StunCandidateHarvest.harvester
protected Request createRequestToRetry(Request request)
createRequestToRetry
in class StunCandidateHarvest
request
- the Request which is to be retried by this
StunCandidateHarvestStunCandidateHarvest.createRequestToRetry(Request)
protected Request createRequestToStartResolvingCandidate()
StunCandidateHarvester.stunServer
in order to start resolving
StunCandidateHarvest.hostCandidate
.createRequestToStartResolvingCandidate
in class StunCandidateHarvest
StunCandidateHarvester.stunServer
in order to start resolving
StunCandidateHarvest.hostCandidate
StunCandidateHarvest.createRequestToStartResolvingCandidate()
protected boolean processErrorOrFailure(Response response, Request request, TransactionID transactionID)
processErrorOrFailure
in class StunCandidateHarvest
response
- the error Response which has been received for
requestrequest
- the Request to which Response respondstransactionID
- the TransactionID of response and
request because response and request only have
it as a byte array and TransactionID is required for
the applicationData property valueStunCandidateHarvest.processErrorOrFailure(Response, Request,
TransactionID)
protected void processSuccess(Response response, Request request, TransactionID transactionID)
processSuccess
in class StunCandidateHarvest
response
- the received STUN success Response which is to
be handledrequest
- the STUN Request to which response
respondstransactionID
- the TransactionID of response and
request because response and request only have
it as a byte array and TransactionID is required for
the applicationData property valueStunCandidateHarvest.processSuccess(Response, Request,
TransactionID)
public byte[] sendRequest(RelayedCandidateDatagramSocket relayedCandidateDatagramSocket, Request request) throws StunException
relayedCandidateDatagramSocket
- the
RelayedCandidateDatagramSocket which sends the specified
Request and which is to be notified of the resultrequest
- the Request to be sent to the TURN server
associated with this TurnCandidateHarvestStunException
- if anything goes wrong while sending the specified
RequestCopyright © 2018. All rights reserved.