public abstract class IceAgent extends Object implements IceAuthenticator
| Modifier and Type | Field and Description |
|---|---|
protected ConnectivityCheckServer |
connectivityCheckServer |
protected List<IceEventListener> |
iceListeners |
protected String |
password |
protected boolean |
running |
protected Selector |
selector |
protected String |
ufrag |
| Modifier | Constructor and Description |
|---|---|
protected |
IceAgent() |
| Modifier and Type | Method and Description |
|---|---|
void |
addIceListener(IceEventListener listener) |
IceMediaStream |
addMediaStream(String streamName)
Creates an IceMediaStream and adds to it an RTP and an RTCP
components.
|
IceMediaStream |
addMediaStream(String streamName,
boolean rtcp)
Creates and registers a new media stream with an RTP component.
An secondary component may be created if the stream supports RTCP. |
IceMediaStream |
addMediaStream(String streamName,
boolean rtcp,
boolean rtcpMux)
Creates and registers a new media stream with an RTP component.
An secondary component may be created if the stream supports RTCP. |
void |
generateIceCredentials() |
InetAddress |
getExternalAddress() |
byte[] |
getLocalKey(String ufrag)
Gets the password assigned to a local user.
|
IceMediaStream |
getMediaStream(String streamName)
Gets a media stream by name
|
List<IceMediaStream> |
getMediaStreams() |
String |
getPassword()
Gets the password of the local user fragment
|
byte[] |
getRemoteKey(String ufrag,
String media)
Gets the password assigned to a remote user.
|
CandidatePair |
getSelectedRtcpCandidate(String stream) |
CandidatePair |
getSelectedRtpCandidate(String stream) |
String |
getUfrag()
Gets the local user fragment.
|
void |
harvest(RtpPortManager portManager)
Gathers all available candidates and sets the components of each media
stream.
|
abstract boolean |
isControlling()
Checks whether the Agent is controlling the ICE process.
|
abstract boolean |
isLite()
Checks whether the Agent implements ICE Lite
|
boolean |
isRunning()
Indicates whether the ICE agent is currently started.
|
boolean |
isSelectionFinished() |
boolean |
isUserRegistered(String ufrag)
Verifies whether a local user is registered.
|
void |
removeIceListener(IceEventListener listener) |
void |
reset() |
CandidatePair |
selectCandidatePair(DatagramChannel channel) |
void |
setExternalAddress(InetAddress externalAddress) |
abstract void |
start()
Starts the ICE agent by activating its STUN stack.
|
abstract void |
stop()
Stops the ICE agent.
|
boolean |
validateUsername(String username)
Validates the autenticity of a STUN USERNAME attribute.
The agent MUST consider the username to be valid if it consists of two values separated by a colon, where the first value is equal to the username fragment generated by the agent in an offer or answer for a session in-progress. |
protected String ufrag
protected String password
protected Selector selector
protected ConnectivityCheckServer connectivityCheckServer
protected volatile boolean running
protected final List<IceEventListener> iceListeners
public void generateIceCredentials()
public abstract boolean isLite()
public abstract boolean isControlling()
public boolean isRunning()
public String getUfrag()
ice-ufragpublic String getPassword()
ice-pwdpublic IceMediaStream addMediaStream(String streamName)
streamName - the name of the stream to createagent - the Agent that should create the stream.public IceMediaStream addMediaStream(String streamName, boolean rtcp)
streamName - the name of the media streamrtcp - Indicates whether the media server supports RTCP.public IceMediaStream addMediaStream(String streamName, boolean rtcp, boolean rtcpMux)
streamName - the name of the media streamrtcp - Indicates whether the media server supports RTCP.rtcpMux - Indicates whether the media stream supports rtcp-muxpublic IceMediaStream getMediaStream(String streamName)
streamName - The name of the media streampublic List<IceMediaStream> getMediaStreams()
public void harvest(RtpPortManager portManager) throws HarvestException, NoCandidatesGatheredException
portManager - The manager that handles port range for ICE candidate harvestHarvestException - An error occurred while harvesting candidatesNoCandidatesGatheredExceptionpublic abstract void start()
Full ICE implementations start connectivity checks while listening
for incoming checks.
Lite implementations are restricted to listen to incoming
connectivity checks.
public abstract void stop()
public boolean isSelectionFinished()
public CandidatePair selectCandidatePair(DatagramChannel channel)
public CandidatePair getSelectedRtpCandidate(String stream)
public CandidatePair getSelectedRtcpCandidate(String stream)
public void addIceListener(IceEventListener listener)
public void removeIceListener(IceEventListener listener)
public byte[] getLocalKey(String ufrag)
IceAuthenticatorgetLocalKey in interface IceAuthenticatorufrag - the fragment of the local userpublic byte[] getRemoteKey(String ufrag, String media)
IceAuthenticatorgetRemoteKey in interface IceAuthenticatorufrag - the fragment of the remote usermedia - the name of the target media streampublic boolean isUserRegistered(String ufrag)
IceAuthenticatorisUserRegistered in interface IceAuthenticatorufrag - the fragment of the local userpublic InetAddress getExternalAddress()
public void setExternalAddress(InetAddress externalAddress)
public boolean validateUsername(String username)
IceAuthenticatorvalidateUsername in interface IceAuthenticatorusername - The username to be validatedpublic void reset()
Copyright © 2017 TeleStax, Inc.. All Rights Reserved.