class ConnectivityCheckServer extends Object implements RequestListener, CredentialsAuthority
Modifier and Type | Field and Description |
---|---|
private boolean |
alive
A flag that determines whether we have received a STUN request or not.
|
private static Logger |
classLogger
The Logger used by the ConnectivityCheckServer
class and its instances for logging output.
|
private Logger |
logger
The
Logger used by ConnectivityCheckServer instances. |
private Agent |
parentAgent
The agent that created us.
|
private boolean |
started
The indicator which determines whether this
ConnectivityCheckServer is currently started.
|
private StunStack |
stunStack
The StunStack that we will use for connectivity checks.
|
Constructor and Description |
---|
ConnectivityCheckServer(Agent parentAgent)
Creates a new ConnectivityCheckServer setting
parentAgent as the agent that will be used for retrieving
information such as user fragments for example.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkLocalUserName(String username)
Verifies whether username is currently known to this server
and returns true if so.
|
private static int |
compareUnsignedLong(long a,
long b)
Compares a and b as unsigned long values.
|
private long |
extractPriority(Request request)
Returns the value of the
PriorityAttribute in request if
there is one or throws an IllegalArgumentException with the
corresponding message. |
byte[] |
getLocalKey(String username)
Implements the
CredentialsAuthority.getLocalKey(String) method in
a way that would return this handler's parent agent password if
username is either the local ufrag or the username that the
agent's remote peer was expected to use. |
byte[] |
getRemoteKey(String username,
String media)
Implements the
CredentialsAuthority.getRemoteKey(String, String)
method in a way that would return this handler's parent agent remote
password if username is either the remote ufrag or the username
that we are expected to use when querying the remote peer. |
(package private) boolean |
isAlive()
Returns a boolean value indicating whether we have received a STUN
request or not.
|
void |
processRequest(StunMessageEvent evt)
Handles the
Request delivered in evt by possibly
queuing a triggered check and sending a success or an error response
depending on how processing goes. |
private boolean |
repairRoleConflict(StunMessageEvent evt)
Resolves a role conflicts by either sending a 487 Role Conflict
response or by changing this server's parent agent role.
|
void |
start()
Starts this ConnectivityCheckServer.
|
void |
stop()
Stops this ConnectivityCheckServer.
|
private static final Logger classLogger
ConnectivityCheckServer
, because it doesn't take into account
the per-instance log level. Instances should use logger
instead.private final Agent parentAgent
private boolean started
private final StunStack stunStack
private boolean alive
private Logger logger
Logger
used by ConnectivityCheckServer
instances.public ConnectivityCheckServer(Agent parentAgent)
parentAgent
- the Agent that is creating this instance.private static int compareUnsignedLong(long a, long b)
boolean isAlive()
public void processRequest(StunMessageEvent evt) throws IllegalArgumentException
Request
delivered in evt by possibly
queuing a triggered check and sending a success or an error response
depending on how processing goes.processRequest
in interface RequestListener
evt
- the StunMessageEvent
containing the Request
that we need to process.IllegalArgumentException
- if the request is malformed and the
stack needs to reply with a 400 Bad Request response.private long extractPriority(Request request) throws IllegalArgumentException
PriorityAttribute
in request if
there is one or throws an IllegalArgumentException with the
corresponding message.request
- the Request
whose priority we'd like to obtain.PriorityAttribute
in request if
there is oneIllegalArgumentException
- if the request does not contain a
PRIORITY attribute and the stack needs to respond with a 400 Bad Request
Response
.private boolean repairRoleConflict(StunMessageEvent evt)
evt
- the StunMessageEvent
containing the
ICE-CONTROLLING or ICE-CONTROLLED attribute that
allowed us to detect the role conflict.public boolean checkLocalUserName(String username)
checkLocalUserName
in interface CredentialsAuthority
username
- the user name whose validity we'd like to check.public byte[] getLocalKey(String username)
CredentialsAuthority.getLocalKey(String)
method in
a way that would return this handler's parent agent password if
username is either the local ufrag or the username that the
agent's remote peer was expected to use.getLocalKey
in interface CredentialsAuthority
username
- the local ufrag that we should return a password for.public byte[] getRemoteKey(String username, String media)
CredentialsAuthority.getRemoteKey(String, String)
method in a way that would return this handler's parent agent remote
password if username is either the remote ufrag or the username
that we are expected to use when querying the remote peer.getRemoteKey
in interface CredentialsAuthority
username
- the remote ufrag that we should return a password for.media
- the media name that we want to get remote key.public void start()
public void stop()
start()
on it.Copyright © 2018. All rights reserved.