com.aelitis.azureus.core.networkmanager.impl.udp
Class UDPConnectionSet

java.lang.Object
  extended by com.aelitis.azureus.core.networkmanager.impl.udp.UDPConnectionSet

public class UDPConnectionSet
extends Object


Nested Class Summary
protected  class UDPConnectionSet.SequenceGenerator
           
 
Field Summary
static int MAX_BUFFERED_PAYLOAD
           
static int MIN_WRITE_PAYLOAD
           
 
Constructor Summary
protected UDPConnectionSet(UDPConnectionManager _manager, String _connection_key, UDPSelector _selector, int _local_port, InetSocketAddress _remote_address)
           
 
Method Summary
protected  void add(UDPConnection connection)
           
protected  int bytesToInt(byte[] bytes, int offset)
           
protected  long bytesToLong(byte[] bytes)
           
protected  long bytesToLong(byte[] bytes, int offset)
           
protected  boolean canWrite(UDPConnection connection)
           
protected  int cipherInt(RC4Engine cipher, int i)
           
 void close(UDPConnection connection, String reason)
           
protected  void dumpState()
           
protected  void failed(Throwable e)
           
 void failed(UDPConnection connection, Throwable reason)
           
protected  int getExplicitAckTicks()
           
protected  String getKey()
           
protected  String getName()
           
protected  InetSocketAddress getRemoteAddress()
           
protected  UDPPacket getRetransmitPacket()
           
protected  int getRetransmitTicks()
           
protected  int getRetransmitTicks(int resend_count)
           
protected  UDPSelector getSelector()
           
protected  boolean hasFailed()
           
protected  boolean idleLimitExceeded()
           
protected  byte[] intToBytes(int i)
           
protected  void logStats()
           
protected  void poll()
           
 void receive(byte[] initial_data, int initial_data_length)
           
protected  void receiveAckCommand(ByteBuffer buffer)
           
protected  void receiveCloseCommand(ByteBuffer buffer)
           
protected  void receiveCrypto(ByteBuffer buffer)
           
protected  void receiveDataCommand(int sequence, ByteBuffer buffer, int header_length)
           
protected  void receiveStatsReply(ByteBuffer buffer)
           
protected  void receiveStatsRequest(ByteBuffer buffer)
           
protected  boolean remoteLastInSequence(int alt_sequence)
           
protected  boolean remove(UDPConnection connection)
           
protected  void removed()
           
protected  void retransmitExpired()
           
protected  void send(UDPPacket packet)
           
protected  void sendAckCommand(boolean timer_expired)
           
protected  void sendCloseCommand(UDPConnection connection)
           
protected  int sendCrypto(ByteBuffer[] buffers, int offset, int length)
           
protected  int sendDataCommand(UDPConnection connection, ByteBuffer[] buffers, int offset, int length)
           
protected  void sendStatsRequest()
           
protected  void setSecret(UDPConnection connection, byte[] session_secret)
           
protected  void startKeepAliveTimer()
           
protected  void stopKeepAliveTimer()
           
protected  void timerTick()
           
protected  void trace(String str)
           
protected  void trace(UDPConnection connection, String str)
           
protected  int write(UDPConnection connection, ByteBuffer[] buffers, int offset, int length)
           
protected  int writeHeaderEnd(ByteBuffer buffer, boolean randomise_size)
           
protected  int[] writeHeaderStart(ByteBuffer buffer, byte command, byte flags)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_WRITE_PAYLOAD

public static final int MIN_WRITE_PAYLOAD
See Also:
Constant Field Values

MAX_BUFFERED_PAYLOAD

public static final int MAX_BUFFERED_PAYLOAD
See Also:
Constant Field Values
Constructor Detail

UDPConnectionSet

protected UDPConnectionSet(UDPConnectionManager _manager,
                           String _connection_key,
                           UDPSelector _selector,
                           int _local_port,
                           InetSocketAddress _remote_address)
Method Detail

getSelector

protected UDPSelector getSelector()

getRemoteAddress

protected InetSocketAddress getRemoteAddress()

getKey

protected String getKey()

add

protected void add(UDPConnection connection)
            throws IOException
Throws:
IOException

remove

protected boolean remove(UDPConnection connection)

poll

protected void poll()

setSecret

protected void setSecret(UDPConnection connection,
                         byte[] session_secret)

timerTick

protected void timerTick()
                  throws IOException
Throws:
IOException

getRetransmitTicks

protected int getRetransmitTicks()

getExplicitAckTicks

protected int getExplicitAckTicks()

startKeepAliveTimer

protected void startKeepAliveTimer()

stopKeepAliveTimer

protected void stopKeepAliveTimer()

idleLimitExceeded

protected boolean idleLimitExceeded()

getRetransmitPacket

protected UDPPacket getRetransmitPacket()

getRetransmitTicks

protected int getRetransmitTicks(int resend_count)

retransmitExpired

protected void retransmitExpired()
                          throws IOException
Throws:
IOException

remoteLastInSequence

protected boolean remoteLastInSequence(int alt_sequence)

dumpState

protected void dumpState()

send

protected void send(UDPPacket packet)
             throws IOException
Throws:
IOException

receive

public void receive(byte[] initial_data,
                    int initial_data_length)
             throws IOException
Throws:
IOException

sendCrypto

protected int sendCrypto(ByteBuffer[] buffers,
                         int offset,
                         int length)
                  throws IOException
Throws:
IOException

receiveCrypto

protected void receiveCrypto(ByteBuffer buffer)
                      throws IOException
Throws:
IOException

sendDataCommand

protected int sendDataCommand(UDPConnection connection,
                              ByteBuffer[] buffers,
                              int offset,
                              int length)
                       throws IOException
Throws:
IOException

receiveDataCommand

protected void receiveDataCommand(int sequence,
                                  ByteBuffer buffer,
                                  int header_length)
                           throws IOException
Throws:
IOException

sendAckCommand

protected void sendAckCommand(boolean timer_expired)
                       throws IOException
Throws:
IOException

receiveAckCommand

protected void receiveAckCommand(ByteBuffer buffer)
                          throws IOException
Throws:
IOException

sendStatsRequest

protected void sendStatsRequest()
                         throws IOException
Throws:
IOException

receiveStatsRequest

protected void receiveStatsRequest(ByteBuffer buffer)
                            throws IOException
Throws:
IOException

receiveStatsReply

protected void receiveStatsReply(ByteBuffer buffer)
                          throws IOException
Throws:
IOException

sendCloseCommand

protected void sendCloseCommand(UDPConnection connection)
                         throws IOException
Throws:
IOException

receiveCloseCommand

protected void receiveCloseCommand(ByteBuffer buffer)
                            throws IOException
Throws:
IOException

writeHeaderStart

protected int[] writeHeaderStart(ByteBuffer buffer,
                                 byte command,
                                 byte flags)
                          throws IOException
Throws:
IOException

writeHeaderEnd

protected int writeHeaderEnd(ByteBuffer buffer,
                             boolean randomise_size)
                      throws IOException
Throws:
IOException

write

protected int write(UDPConnection connection,
                    ByteBuffer[] buffers,
                    int offset,
                    int length)
             throws IOException
Throws:
IOException

canWrite

protected boolean canWrite(UDPConnection connection)

close

public void close(UDPConnection connection,
                  String reason)

failed

public void failed(UDPConnection connection,
                   Throwable reason)

failed

protected void failed(Throwable e)

hasFailed

protected boolean hasFailed()

removed

protected void removed()

cipherInt

protected int cipherInt(RC4Engine cipher,
                        int i)

bytesToInt

protected int bytesToInt(byte[] bytes,
                         int offset)

intToBytes

protected byte[] intToBytes(int i)

bytesToLong

protected long bytesToLong(byte[] bytes)

bytesToLong

protected long bytesToLong(byte[] bytes,
                           int offset)

getName

protected String getName()

logStats

protected void logStats()

trace

protected void trace(String str)

trace

protected void trace(UDPConnection connection,
                     String str)