public abstract class MediaProxySession extends Thread implements ProxyCandidate, DatagramListener
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
protected org.jivesoftware.openfire.mediaproxy.Channel |
channelAtoB |
protected org.jivesoftware.openfire.mediaproxy.Channel |
channelAtoBControl |
protected org.jivesoftware.openfire.mediaproxy.Channel |
channelBtoA |
protected org.jivesoftware.openfire.mediaproxy.Channel |
channelBtoAControl |
protected InetAddress |
hostA |
protected InetAddress |
hostB |
protected InetAddress |
localAddress |
protected int |
localPortA |
protected int |
localPortB |
protected int |
portA |
protected int |
portB |
protected DatagramSocket |
socketA |
protected DatagramSocket |
socketAControl |
protected DatagramSocket |
socketB |
protected DatagramSocket |
socketBControl |
protected Thread |
threadAtoB |
protected Thread |
threadAtoBControl |
protected Thread |
threadBtoA |
protected Thread |
threadBtoAControl |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
MediaProxySession(String id,
String creator,
String localAddress,
String hostA,
int portA,
String hostB,
int portB,
int minPort,
int maxPort)
Creates a new static UDP channel between Host A and Host B.
|
Modifier and Type | Method and Description |
---|---|
void |
addAgentListener(SessionListener sessionListener)
Adds a listener for Session events
|
void |
clearAgentListeners()
Removes every Session events listeners
|
boolean |
datagramReceived(DatagramPacket datagramPacket)
Implement DatagramListener to timestamp last packet arrived
|
void |
dispatchAgentStopped()
Dispatch Stop Event
|
String |
getCreator()
Get the agent creator.
|
protected int |
getFreePort()
Obtain a free port with a nested control port we can use.
|
InetAddress |
getHostA()
Get the Host A IP
|
InetAddress |
getHostB()
Get the Host B IP
|
InetAddress |
getLocalhost()
Get localhost of the Session
|
int |
getLocalPortA()
Get the localport that listen for Host A Packets
|
int |
getLocalPortB()
Get the localport that listen for Host B Packets
|
String |
getPass()
Get the pass of this Session
A pass can be used to authorize an Session modification
|
int |
getPortA()
Get the Port A IP
|
int |
getPortB()
Get the Port B IP
|
String |
getSID()
Get the ID of the Session
|
long |
getTimestamp()
Get last packet arrived timestamp
|
void |
removeAgentListener(SessionListener sessionListener)
Removes an Session events listener
|
void |
run()
Thread override method
|
void |
sendFromPortA(String host,
int port) |
void |
sendFromPortB(String host,
int port) |
void |
setHostA(InetAddress hostA)
Set the Host A IP
|
void |
setHostB(InetAddress hostB)
Set the Host B IP
|
void |
setPortA(int portA)
Set port A value
|
void |
setPortB(int portB)
Set port B value
|
void |
stopAgent()
Stop the Session
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
start
protected InetAddress localAddress
protected InetAddress hostA
protected InetAddress hostB
protected int portA
protected int portB
protected int localPortA
protected int localPortB
protected DatagramSocket socketA
protected DatagramSocket socketAControl
protected DatagramSocket socketB
protected DatagramSocket socketBControl
protected org.jivesoftware.openfire.mediaproxy.Channel channelAtoB
protected org.jivesoftware.openfire.mediaproxy.Channel channelAtoBControl
protected org.jivesoftware.openfire.mediaproxy.Channel channelBtoA
protected org.jivesoftware.openfire.mediaproxy.Channel channelBtoAControl
protected Thread threadAtoB
protected Thread threadAtoBControl
protected Thread threadBtoA
protected Thread threadBtoAControl
public MediaProxySession(String id, String creator, String localAddress, String hostA, int portA, String hostB, int portB, int minPort, int maxPort)
id
- of the Session (Could be a Jingle session ID)creator
- the session creator name or descriptionlocalAddress
- the localhost IP that will listen for UDP packetshostA
- the hostname or IP of the point A of the ChannelportA
- the port number point A of the ChannelhostB
- the hostname or IP of the point B of the ChannelportB
- the port number point B of the ChannelminPort
- the minimal port value to be used by the servermaxPort
- the maximun port value to be used by the serverprotected int getFreePort()
public String getSID()
getSID
in interface ProxyCandidate
public String getPass()
getPass
in interface ProxyCandidate
public String getCreator()
public long getTimestamp()
public void run()
public void stopAgent()
stopAgent
in interface ProxyCandidate
public InetAddress getLocalhost()
getLocalhost
in interface ProxyCandidate
public InetAddress getHostA()
getHostA
in interface ProxyCandidate
public InetAddress getHostB()
getHostB
in interface ProxyCandidate
public void setPortA(int portA)
setPortA
in interface ProxyCandidate
portA
- the port number for Apublic void setPortB(int portB)
setPortB
in interface ProxyCandidate
portB
- the port number for Bpublic void setHostA(InetAddress hostA)
setHostA
in interface ProxyCandidate
hostA
- the host for Apublic void setHostB(InetAddress hostB)
setHostB
in interface ProxyCandidate
hostB
- the host for Bpublic int getPortA()
getPortA
in interface ProxyCandidate
public int getPortB()
getPortB
in interface ProxyCandidate
public int getLocalPortA()
getLocalPortA
in interface ProxyCandidate
public int getLocalPortB()
getLocalPortB
in interface ProxyCandidate
public void sendFromPortA(String host, int port)
sendFromPortA
in interface ProxyCandidate
public void sendFromPortB(String host, int port)
sendFromPortB
in interface ProxyCandidate
public boolean datagramReceived(DatagramPacket datagramPacket)
datagramReceived
in interface DatagramListener
datagramPacket
- the datagram packetpublic void addAgentListener(SessionListener sessionListener)
sessionListener
- the sessionj listener to addpublic void removeAgentListener(SessionListener sessionListener)
sessionListener
- the session listener to removepublic void clearAgentListeners()
public void dispatchAgentStopped()
Copyright © 2003–2020 Ignite Realtime. All rights reserved.