org.lastbamboo.common.turn.server
Interface TurnClient

All Known Implementing Classes:
TurnClientImpl

public interface TurnClient

Interface for classes that keep track of data for TURN clients that this server has allocated addresses for. Keeps track of permissions to external hosts, the IP address of the client, and the means of contacting the client.


Method Summary
 void addConnection(org.littleshoot.mina.common.IoSession session)
          Adds the specified connection for this TURN client.
 void close()
          Closes the client and all associated connections.
 org.littleshoot.mina.common.IoSession getIoSession()
          Accessor for the handler for reading and writing data with this client.
 InetSocketAddress getMappedAddress()
          Accessor for the MAPPED ADDRESS, otherwise known as the server reflexive address.
 int getNumConnections()
          Returns the number of connections for this TURN client.
 InetSocketAddress getRelayAddress()
          Accessor for the IP and port this server has allocated on behalf of the TURN client.
 void handleConnect(InetSocketAddress socketAddress)
          Tells the client to appropriately handle a connect request to the specified remote host.
 boolean hasActiveDestination()
          Returns whether or not the TURN client has set its "active destination" turning off TURN messaging on that connection.
 boolean hasIncomingPermission(org.littleshoot.mina.common.IoSession session)
          Returns whether or not the remote host who created the specified session has permission to open a connection to this TURN client.
 void removeConnection(org.littleshoot.mina.common.IoSession session)
          Removes the connection.
 void startServer()
          Starts the separate server running on the client's allocated address for accepting connections from remote hosts.
 boolean write(InetSocketAddress remoteAddress, org.littleshoot.mina.common.ByteBuffer data)
          Writes data from this TURN client to the specified remote address.
 

Method Detail

write

boolean write(InetSocketAddress remoteAddress,
              org.littleshoot.mina.common.ByteBuffer data)
Writes data from this TURN client to the specified remote address. If there's already a connection to the remote address, this uses that. Otherwise, it opens a connection and begins allowing incoming data from that connection.

Parameters:
remoteAddress - The IP address and port of the remote host to send data to.
data - The data to send the remote host.
Returns:
true if the data was send to an existing binding. Otherwise, this returns false to indicate that there was no existing matching 5-tuple for the remote host and that we're attempting to connect to that remote host.

handleConnect

void handleConnect(InetSocketAddress socketAddress)
Tells the client to appropriately handle a connect request to the specified remote host.

Parameters:
socketAddress - The address to handle.

getRelayAddress

InetSocketAddress getRelayAddress()
Accessor for the IP and port this server has allocated on behalf of the TURN client. This is the endpoint other hosts can contact this client on.

Returns:
The IP address and port this server has allocated for the client.

close

void close()
Closes the client and all associated connections.


getIoSession

org.littleshoot.mina.common.IoSession getIoSession()
Accessor for the handler for reading and writing data with this client.

Returns:
The handler for reading and writing data with this client.

hasActiveDestination

boolean hasActiveDestination()
Returns whether or not the TURN client has set its "active destination" turning off TURN messaging on that connection.

Returns:
true if the client has set the active destination, otherwise false.

hasIncomingPermission

boolean hasIncomingPermission(org.littleshoot.mina.common.IoSession session)
Returns whether or not the remote host who created the specified session has permission to open a connection to this TURN client. The remote host has permission if the TURN client has issued a connect request to that host that is still active.

Parameters:
session - The connection from the remote host.
Returns:
true if the remote host has permission to connect to the TURN client, otherwise false.

addConnection

void addConnection(org.littleshoot.mina.common.IoSession session)
Adds the specified connection for this TURN client. This is typically called when a remote host makes a connection to the TURN server.

Parameters:
session - The class for reading and writing data with the remote host.

removeConnection

void removeConnection(org.littleshoot.mina.common.IoSession session)
Removes the connection.

Parameters:
session - The class for reading and writing data with the remote host.

getNumConnections

int getNumConnections()
Returns the number of connections for this TURN client.

Returns:
The number of connections for this TURN client.

startServer

void startServer()
Starts the separate server running on the client's allocated address for accepting connections from remote hosts.


getMappedAddress

InetSocketAddress getMappedAddress()
Accessor for the MAPPED ADDRESS, otherwise known as the server reflexive address.

Returns:
The MAPPED ADDRESS.


Copyright © 2013 LittleShoot. All Rights Reserved.