com.aelitis.azureus.core.dht.transport.udp.impl
Class DHTUDPUtils

java.lang.Object
  extended by com.aelitis.azureus.core.dht.transport.udp.impl.DHTUDPUtils

public class DHTUDPUtils
extends Object

Author:
parg

Field Summary
protected static int CT_UDP
           
static int DHTTRANSPORTCONTACT_SIZE
           
static int DHTTRANSPORTVALUE_SIZE_WITHOUT_VALUE
           
static int INETSOCKETADDRESS_IPV4_SIZE
           
static int INETSOCKETADDRESS_IPV6_SIZE
           
static IOException INVALID_PROTOCOL_VERSION_EXCEPTION
           
 
Constructor Summary
DHTUDPUtils()
           
 
Method Summary
protected static InetSocketAddress deserialiseAddress(DataInputStream is)
           
protected static DHTTransportAlternativeContactImpl deserialiseAltContact(DataInputStream is)
           
protected static void deserialiseAltContactRequest(DHTUDPPacketRequestPing ping, DataInputStream is)
           
protected static DHTTransportAlternativeContact[] deserialiseAltContacts(DataInputStream is)
           
protected static byte[] deserialiseByteArray(DataInputStream is, int max_length)
           
protected static byte[][] deserialiseByteArrayArray(DataInputStream is, int max_length)
           
protected static DHTTransportUDPContactImpl deserialiseContact(DHTTransportUDPImpl transport, DataInputStream is)
           
protected static DHTTransportContact[] deserialiseContacts(DHTTransportUDPImpl transport, DataInputStream is)
           
protected static int deserialiseLength(DataInputStream is, int max_length)
           
protected static DHTTransportFullStats deserialiseStats(int version, DataInputStream is)
           
protected static DHTTransportValue deserialiseTransportValue(DHTUDPPacket packet, DataInputStream is, long skew)
           
protected static DHTTransportValue[] deserialiseTransportValues(DHTUDPPacket packet, DataInputStream is, long skew)
           
protected static DHTTransportValue[][] deserialiseTransportValuesArray(DHTUDPPacket packet, DataInputStream is, long skew, int max_length)
           
protected static void deserialiseVivaldi(DHTUDPPacketReply reply, DataInputStream is)
           
static List<DHTTransportAlternativeContact> getAlternativeContacts(int network, int max)
           
protected static byte[] getBogusNodeID()
           
protected static byte[] getNodeID(InetSocketAddress address, byte protocol_version)
           
static void registerAlternativeNetwork(DHTTransportAlternativeNetwork net)
           
protected static void registerTransport(DHTTransportUDPImpl transport)
           
protected static void serialiseAddress(DataOutputStream os, InetSocketAddress address)
           
protected static void serialiseAltContact(DataOutputStream os, DHTTransportAlternativeContact contact)
           
protected static void serialiseAltContactRequest(DHTUDPPacketRequestPing ping, DataOutputStream os)
           
protected static void serialiseAltContacts(DataOutputStream os, DHTTransportAlternativeContact[] contacts)
           
protected static void serialiseByteArray(DataOutputStream os, byte[] data, int max_length)
           
protected static void serialiseByteArray(DataOutputStream os, byte[] data, int start, int length, int max_length)
           
protected static void serialiseByteArrayArray(DataOutputStream os, byte[][] data, int max_length)
           
protected static void serialiseContact(DataOutputStream os, DHTTransportContact contact)
           
protected static void serialiseContacts(DataOutputStream os, DHTTransportContact[] contacts)
           
protected static void serialiseLength(DataOutputStream os, int len, int max_length)
           
protected static void serialiseStats(int version, DataOutputStream os, DHTTransportFullStats stats)
           
protected static void serialiseTransportValue(DHTUDPPacket packet, DataOutputStream os, DHTTransportValue value, long skew)
           
protected static void serialiseTransportValues(DHTUDPPacket packet, DataOutputStream os, DHTTransportValue[] values, long skew)
           
protected static void serialiseTransportValuesArray(DHTUDPPacket packet, DataOutputStream os, DHTTransportValue[][] values, long skew, int max_length)
           
protected static void serialiseVivaldi(DHTUDPPacketReply reply, DataOutputStream os)
           
static void unregisterAlternativeNetwork(DHTTransportAlternativeNetwork net)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID_PROTOCOL_VERSION_EXCEPTION

public static final IOException INVALID_PROTOCOL_VERSION_EXCEPTION

CT_UDP

protected static final int CT_UDP
See Also:
Constant Field Values

INETSOCKETADDRESS_IPV4_SIZE

public static final int INETSOCKETADDRESS_IPV4_SIZE
See Also:
Constant Field Values

INETSOCKETADDRESS_IPV6_SIZE

public static final int INETSOCKETADDRESS_IPV6_SIZE
See Also:
Constant Field Values

DHTTRANSPORTCONTACT_SIZE

public static final int DHTTRANSPORTCONTACT_SIZE
See Also:
Constant Field Values

DHTTRANSPORTVALUE_SIZE_WITHOUT_VALUE

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

DHTUDPUtils

public DHTUDPUtils()
Method Detail

getNodeID

protected static byte[] getNodeID(InetSocketAddress address,
                                  byte protocol_version)
                           throws DHTTransportException
Throws:
DHTTransportException

getBogusNodeID

protected static byte[] getBogusNodeID()

serialiseLength

protected static void serialiseLength(DataOutputStream os,
                                      int len,
                                      int max_length)
                               throws IOException
Throws:
IOException

deserialiseLength

protected static int deserialiseLength(DataInputStream is,
                                       int max_length)
                                throws IOException
Throws:
IOException

deserialiseByteArray

protected static byte[] deserialiseByteArray(DataInputStream is,
                                             int max_length)
                                      throws IOException
Throws:
IOException

serialiseByteArray

protected static void serialiseByteArray(DataOutputStream os,
                                         byte[] data,
                                         int max_length)
                                  throws IOException
Throws:
IOException

serialiseByteArray

protected static void serialiseByteArray(DataOutputStream os,
                                         byte[] data,
                                         int start,
                                         int length,
                                         int max_length)
                                  throws IOException
Throws:
IOException

serialiseByteArrayArray

protected static void serialiseByteArrayArray(DataOutputStream os,
                                              byte[][] data,
                                              int max_length)
                                       throws IOException
Throws:
IOException

deserialiseByteArrayArray

protected static byte[][] deserialiseByteArrayArray(DataInputStream is,
                                                    int max_length)
                                             throws IOException
Throws:
IOException

serialiseAddress

protected static void serialiseAddress(DataOutputStream os,
                                       InetSocketAddress address)
                                throws IOException,
                                       DHTTransportException
Throws:
IOException
DHTTransportException

deserialiseAddress

protected static InetSocketAddress deserialiseAddress(DataInputStream is)
                                               throws IOException
Throws:
IOException

deserialiseTransportValuesArray

protected static DHTTransportValue[][] deserialiseTransportValuesArray(DHTUDPPacket packet,
                                                                       DataInputStream is,
                                                                       long skew,
                                                                       int max_length)
                                                                throws IOException
Throws:
IOException

serialiseTransportValuesArray

protected static void serialiseTransportValuesArray(DHTUDPPacket packet,
                                                    DataOutputStream os,
                                                    DHTTransportValue[][] values,
                                                    long skew,
                                                    int max_length)
                                             throws IOException,
                                                    DHTTransportException
Throws:
IOException
DHTTransportException

serialiseContact

protected static void serialiseContact(DataOutputStream os,
                                       DHTTransportContact contact)
                                throws IOException,
                                       DHTTransportException
Throws:
IOException
DHTTransportException

deserialiseContact

protected static DHTTransportUDPContactImpl deserialiseContact(DHTTransportUDPImpl transport,
                                                               DataInputStream is)
                                                        throws IOException,
                                                               DHTTransportException
Throws:
IOException
DHTTransportException

serialiseAltContact

protected static void serialiseAltContact(DataOutputStream os,
                                          DHTTransportAlternativeContact contact)
                                   throws IOException,
                                          DHTTransportException
Throws:
IOException
DHTTransportException

deserialiseAltContact

protected static DHTTransportAlternativeContactImpl deserialiseAltContact(DataInputStream is)
                                                                   throws IOException,
                                                                          DHTTransportException
Throws:
IOException
DHTTransportException

deserialiseTransportValues

protected static DHTTransportValue[] deserialiseTransportValues(DHTUDPPacket packet,
                                                                DataInputStream is,
                                                                long skew)
                                                         throws IOException
Throws:
IOException

serialiseTransportValues

protected static void serialiseTransportValues(DHTUDPPacket packet,
                                               DataOutputStream os,
                                               DHTTransportValue[] values,
                                               long skew)
                                        throws IOException,
                                               DHTTransportException
Throws:
IOException
DHTTransportException

deserialiseTransportValue

protected static DHTTransportValue deserialiseTransportValue(DHTUDPPacket packet,
                                                             DataInputStream is,
                                                             long skew)
                                                      throws IOException,
                                                             DHTTransportException
Throws:
IOException
DHTTransportException

serialiseTransportValue

protected static void serialiseTransportValue(DHTUDPPacket packet,
                                              DataOutputStream os,
                                              DHTTransportValue value,
                                              long skew)
                                       throws IOException,
                                              DHTTransportException
Throws:
IOException
DHTTransportException

serialiseContacts

protected static void serialiseContacts(DataOutputStream os,
                                        DHTTransportContact[] contacts)
                                 throws IOException
Throws:
IOException

deserialiseContacts

protected static DHTTransportContact[] deserialiseContacts(DHTTransportUDPImpl transport,
                                                           DataInputStream is)
                                                    throws IOException
Throws:
IOException

serialiseAltContacts

protected static void serialiseAltContacts(DataOutputStream os,
                                           DHTTransportAlternativeContact[] contacts)
                                    throws IOException
Throws:
IOException

deserialiseAltContacts

protected static DHTTransportAlternativeContact[] deserialiseAltContacts(DataInputStream is)
                                                                  throws IOException
Throws:
IOException

serialiseAltContactRequest

protected static void serialiseAltContactRequest(DHTUDPPacketRequestPing ping,
                                                 DataOutputStream os)
                                          throws IOException
Throws:
IOException

deserialiseAltContactRequest

protected static void deserialiseAltContactRequest(DHTUDPPacketRequestPing ping,
                                                   DataInputStream is)
                                            throws IOException
Throws:
IOException

serialiseVivaldi

protected static void serialiseVivaldi(DHTUDPPacketReply reply,
                                       DataOutputStream os)
                                throws IOException
Throws:
IOException

deserialiseVivaldi

protected static void deserialiseVivaldi(DHTUDPPacketReply reply,
                                         DataInputStream is)
                                  throws IOException
Throws:
IOException

serialiseStats

protected static void serialiseStats(int version,
                                     DataOutputStream os,
                                     DHTTransportFullStats stats)
                              throws IOException
Throws:
IOException

deserialiseStats

protected static DHTTransportFullStats deserialiseStats(int version,
                                                        DataInputStream is)
                                                 throws IOException
Throws:
IOException

registerTransport

protected static void registerTransport(DHTTransportUDPImpl transport)

registerAlternativeNetwork

public static void registerAlternativeNetwork(DHTTransportAlternativeNetwork net)

unregisterAlternativeNetwork

public static void unregisterAlternativeNetwork(DHTTransportAlternativeNetwork net)

getAlternativeContacts

public static List<DHTTransportAlternativeContact> getAlternativeContacts(int network,
                                                                          int max)