org.lastbamboo.common.p2p
Class DefaultTcpUdpEndpoint

java.lang.Object
  extended by org.lastbamboo.common.p2p.DefaultTcpUdpEndpoint
All Implemented Interfaces:
org.lastbamboo.common.offer.answer.OfferAnswerListener<org.littleshoot.util.FiveTuple>, org.lastbamboo.common.offer.answer.OfferAnswerTransactionListener, TcpUdpSocket<org.littleshoot.util.FiveTuple>, org.littleshoot.util.KeyStorage

public class DefaultTcpUdpEndpoint
extends Object
implements TcpUdpSocket<org.littleshoot.util.FiveTuple>, org.lastbamboo.common.offer.answer.OfferAnswerTransactionListener, org.lastbamboo.common.offer.answer.OfferAnswerListener<org.littleshoot.util.FiveTuple>, org.littleshoot.util.KeyStorage

Class for creating sockets that can be created using either a TCP or a reliable UDP connection, depending on which successfully connects first.


Constructor Summary
DefaultTcpUdpEndpoint(org.lastbamboo.common.offer.answer.Offerer offerer, org.lastbamboo.common.offer.answer.OfferAnswerFactory<org.littleshoot.util.FiveTuple> offerAnswerFactory, int relayWaitTime, org.lastbamboo.common.offer.answer.IceMediaStreamDesc desc)
          Creates a new reliable TCP or UDP socket.
DefaultTcpUdpEndpoint(org.lastbamboo.common.offer.answer.Offerer offerer, org.lastbamboo.common.offer.answer.OfferAnswerFactory<org.littleshoot.util.FiveTuple> offerAnswerFactory, int relayWaitTime, long offerTimeoutTime, org.lastbamboo.common.offer.answer.IceMediaStreamDesc desc)
           
 
Method Summary
 byte[] getReadKey()
           
 byte[] getWriteKey()
           
 org.littleshoot.util.FiveTuple newSocket(URI uri)
          Creates a new socket.
 void onOfferAnswerFailed(org.lastbamboo.common.offer.answer.OfferAnswer offerAnswer)
           
 void onTcpSocket(Socket sock)
           
 void onTransactionFailed(org.lastbamboo.common.offer.answer.OfferAnswerMessage response)
           
 void onTransactionSucceeded(org.lastbamboo.common.offer.answer.OfferAnswerMessage response)
           
 void onUdpSocket(org.littleshoot.util.FiveTuple sock)
           
 void setReadKey(byte[] key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTcpUdpEndpoint

public DefaultTcpUdpEndpoint(org.lastbamboo.common.offer.answer.Offerer offerer,
                             org.lastbamboo.common.offer.answer.OfferAnswerFactory<org.littleshoot.util.FiveTuple> offerAnswerFactory,
                             int relayWaitTime,
                             org.lastbamboo.common.offer.answer.IceMediaStreamDesc desc)
                      throws IOException
Creates a new reliable TCP or UDP socket.

Parameters:
offerer - The client connection to the P2P signaling server.
offerAnswerFactory - The class for creating new offers and answers.
relayWaitTime - The number of seconds to wait before using the relay.
Throws:
IOException - If there's an error connecting.

DefaultTcpUdpEndpoint

public DefaultTcpUdpEndpoint(org.lastbamboo.common.offer.answer.Offerer offerer,
                             org.lastbamboo.common.offer.answer.OfferAnswerFactory<org.littleshoot.util.FiveTuple> offerAnswerFactory,
                             int relayWaitTime,
                             long offerTimeoutTime,
                             org.lastbamboo.common.offer.answer.IceMediaStreamDesc desc)
                      throws IOException
Throws:
IOException
Method Detail

newSocket

public org.littleshoot.util.FiveTuple newSocket(URI uri)
                                         throws IOException,
                                                org.lastbamboo.common.offer.answer.NoAnswerException
Description copied from interface: TcpUdpSocket
Creates a new socket.

Specified by:
newSocket in interface TcpUdpSocket<org.littleshoot.util.FiveTuple>
Parameters:
uri - The URI to create a socket from. This could be a SIP URI, for example.
Returns:
The new socket.
Throws:
IOException - If there's an IO error creating the socket.
org.lastbamboo.common.offer.answer.NoAnswerException - If the answerer doesn't reply.

onTransactionSucceeded

public void onTransactionSucceeded(org.lastbamboo.common.offer.answer.OfferAnswerMessage response)
Specified by:
onTransactionSucceeded in interface org.lastbamboo.common.offer.answer.OfferAnswerTransactionListener

onTransactionFailed

public void onTransactionFailed(org.lastbamboo.common.offer.answer.OfferAnswerMessage response)
Specified by:
onTransactionFailed in interface org.lastbamboo.common.offer.answer.OfferAnswerTransactionListener

onTcpSocket

public void onTcpSocket(Socket sock)
Specified by:
onTcpSocket in interface org.lastbamboo.common.offer.answer.OfferAnswerListener<org.littleshoot.util.FiveTuple>

onUdpSocket

public void onUdpSocket(org.littleshoot.util.FiveTuple sock)
Specified by:
onUdpSocket in interface org.lastbamboo.common.offer.answer.OfferAnswerListener<org.littleshoot.util.FiveTuple>

onOfferAnswerFailed

public void onOfferAnswerFailed(org.lastbamboo.common.offer.answer.OfferAnswer offerAnswer)
Specified by:
onOfferAnswerFailed in interface org.lastbamboo.common.offer.answer.OfferAnswerListener<org.littleshoot.util.FiveTuple>

getWriteKey

public byte[] getWriteKey()
Specified by:
getWriteKey in interface org.littleshoot.util.KeyStorage

getReadKey

public byte[] getReadKey()
Specified by:
getReadKey in interface org.littleshoot.util.KeyStorage

setReadKey

public void setReadKey(byte[] key)
Specified by:
setReadKey in interface org.littleshoot.util.KeyStorage


Copyright © 2013 LittleShoot. All Rights Reserved.