Class DHTUDPUtils
- java.lang.Object
-
- com.biglybt.core.dht.transport.udp.impl.DHTUDPUtils
-
public class DHTUDPUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<DHTTransportAlternativeNetwork>
alt_networks
private static int
CALC_PERIOD
protected static int
CT_UDP
static int
DHTTRANSPORTCONTACT_SIZE
static int
DHTTRANSPORTVALUE_SIZE_WITHOUT_VALUE
private static GlobalManagerStats
gm_stats
private static SHA1Simple
hasher
static int
INETSOCKETADDRESS_IPV4_SIZE
static int
INETSOCKETADDRESS_IPV6_SIZE
static java.io.IOException
INVALID_PROTOCOL_VERSION_EXCEPTION
private static long
last_calc
private static GlobalManagerStats.CountryDetails[]
last_details_recv
private static long
last_details_recv_total
private static GlobalManagerStats.CountryDetails[]
last_details_sent
private static long
last_details_sent_total
private static long
last_upload_stats
private static int
MAX_CC_STATS
private static java.util.Map<java.lang.String,byte[]>
node_id_history
private static java.util.List<DHTTransportUDPImpl>
transports
-
Constructor Summary
Constructors Constructor Description DHTUDPUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static java.net.InetSocketAddress
deserialiseAddress(java.io.DataInputStream is)
protected static DHTTransportAlternativeContactImpl
deserialiseAltContact(java.io.DataInputStream is)
protected static void
deserialiseAltContactRequest(DHTUDPPacketRequestPing ping, java.io.DataInputStream is)
protected static DHTTransportAlternativeContact[]
deserialiseAltContacts(java.io.DataInputStream is)
protected static byte[]
deserialiseByteArray(java.io.DataInputStream is, int max_length)
protected static byte[][]
deserialiseByteArrayArray(java.io.DataInputStream is, int max_length)
protected static DHTTransportUDPContactImpl
deserialiseContact(DHTTransportUDPImpl transport, java.io.DataInputStream is)
protected static DHTTransportContact[]
deserialiseContacts(DHTTransportUDPImpl transport, java.io.DataInputStream is)
protected static int
deserialiseLength(java.io.DataInputStream is, int max_length)
protected static DHTTransportFullStats
deserialiseStats(int version, java.io.DataInputStream is)
protected static DHTTransportValue
deserialiseTransportValue(DHTUDPPacket packet, java.io.DataInputStream is, long skew)
protected static DHTTransportValue[]
deserialiseTransportValues(DHTUDPPacket packet, java.io.DataInputStream is, long skew)
protected static DHTTransportValue[][]
deserialiseTransportValuesArray(DHTUDPPacket packet, java.io.DataInputStream is, long skew, int max_length)
protected static java.lang.Object
deserialiseUploadStats(java.io.DataInputStream is)
protected static void
deserialiseVivaldi(DHTUDPPacketReply reply, java.io.DataInputStream is)
static java.util.List<DHTTransportAlternativeContact>
getAlternativeContacts(int network, int max)
protected static byte[]
getBogusNodeID()
protected static byte[]
getNodeID(java.net.InetSocketAddress address, byte protocol_version)
protected static void
receiveUploadStats(DHTTransportUDPContactImpl contact, java.lang.Object _stats)
static void
registerAlternativeNetwork(DHTTransportAlternativeNetwork net)
protected static void
registerTransport(DHTTransportUDPImpl transport)
protected static void
serialiseAddress(java.io.DataOutputStream os, java.net.InetSocketAddress address)
protected static void
serialiseAltContact(java.io.DataOutputStream os, DHTTransportAlternativeContact contact)
protected static void
serialiseAltContactRequest(DHTUDPPacketRequestPing ping, java.io.DataOutputStream os)
protected static void
serialiseAltContacts(java.io.DataOutputStream os, DHTTransportAlternativeContact[] contacts)
protected static void
serialiseByteArray(java.io.DataOutputStream os, byte[] data, int max_length)
protected static void
serialiseByteArray(java.io.DataOutputStream os, byte[] data, int start, int length, int max_length)
protected static void
serialiseByteArrayArray(java.io.DataOutputStream os, byte[][] data, int max_length)
protected static void
serialiseContact(java.io.DataOutputStream os, DHTTransportContact contact)
protected static void
serialiseContacts(java.io.DataOutputStream os, DHTTransportContact[] contacts)
protected static void
serialiseLength(java.io.DataOutputStream os, int len, int max_length)
protected static void
serialiseStats(int version, java.io.DataOutputStream os, DHTTransportFullStats stats)
protected static void
serialiseTransportValue(DHTUDPPacket packet, java.io.DataOutputStream os, DHTTransportValue value, long skew)
protected static void
serialiseTransportValues(DHTUDPPacket packet, java.io.DataOutputStream os, DHTTransportValue[] values, long skew)
protected static void
serialiseTransportValuesArray(DHTUDPPacket packet, java.io.DataOutputStream os, DHTTransportValue[][] values, long skew, int max_length)
protected static void
serialiseUploadStats(int protocol_version, int packet_type, java.io.DataOutputStream os)
protected static void
serialiseVivaldi(DHTUDPPacketReply reply, java.io.DataOutputStream os)
static void
unregisterAlternativeNetwork(DHTTransportAlternativeNetwork net)
-
-
-
Field Detail
-
INVALID_PROTOCOL_VERSION_EXCEPTION
public static final java.io.IOException INVALID_PROTOCOL_VERSION_EXCEPTION
-
CT_UDP
protected static final int CT_UDP
- See Also:
- Constant Field Values
-
node_id_history
private static final java.util.Map<java.lang.String,byte[]> node_id_history
-
hasher
private static final SHA1Simple hasher
-
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
-
transports
private static final java.util.List<DHTTransportUDPImpl> transports
-
alt_networks
private static final java.util.List<DHTTransportAlternativeNetwork> alt_networks
-
MAX_CC_STATS
private static final int MAX_CC_STATS
- See Also:
- Constant Field Values
-
CALC_PERIOD
private static final int CALC_PERIOD
- See Also:
- Constant Field Values
-
last_calc
private static volatile long last_calc
-
last_details_recv
private static volatile GlobalManagerStats.CountryDetails[] last_details_recv
-
last_details_sent
private static volatile GlobalManagerStats.CountryDetails[] last_details_sent
-
last_details_recv_total
private static volatile long last_details_recv_total
-
last_details_sent_total
private static volatile long last_details_sent_total
-
gm_stats
private static volatile GlobalManagerStats gm_stats
-
last_upload_stats
private static volatile long last_upload_stats
-
-
Method Detail
-
getNodeID
protected static byte[] getNodeID(java.net.InetSocketAddress address, byte protocol_version) throws DHTTransportException
- Throws:
DHTTransportException
-
getBogusNodeID
protected static byte[] getBogusNodeID()
-
serialiseLength
protected static void serialiseLength(java.io.DataOutputStream os, int len, int max_length) throws java.io.IOException
- Throws:
java.io.IOException
-
deserialiseLength
protected static int deserialiseLength(java.io.DataInputStream is, int max_length) throws java.io.IOException
- Throws:
java.io.IOException
-
deserialiseByteArray
protected static byte[] deserialiseByteArray(java.io.DataInputStream is, int max_length) throws java.io.IOException
- Throws:
java.io.IOException
-
serialiseByteArray
protected static void serialiseByteArray(java.io.DataOutputStream os, byte[] data, int max_length) throws java.io.IOException
- Throws:
java.io.IOException
-
serialiseByteArray
protected static void serialiseByteArray(java.io.DataOutputStream os, byte[] data, int start, int length, int max_length) throws java.io.IOException
- Throws:
java.io.IOException
-
serialiseByteArrayArray
protected static void serialiseByteArrayArray(java.io.DataOutputStream os, byte[][] data, int max_length) throws java.io.IOException
- Throws:
java.io.IOException
-
deserialiseByteArrayArray
protected static byte[][] deserialiseByteArrayArray(java.io.DataInputStream is, int max_length) throws java.io.IOException
- Throws:
java.io.IOException
-
serialiseAddress
protected static void serialiseAddress(java.io.DataOutputStream os, java.net.InetSocketAddress address) throws java.io.IOException, DHTTransportException
- Throws:
java.io.IOException
DHTTransportException
-
deserialiseAddress
protected static java.net.InetSocketAddress deserialiseAddress(java.io.DataInputStream is) throws java.io.IOException
- Throws:
java.io.IOException
-
deserialiseTransportValuesArray
protected static DHTTransportValue[][] deserialiseTransportValuesArray(DHTUDPPacket packet, java.io.DataInputStream is, long skew, int max_length) throws java.io.IOException
- Throws:
java.io.IOException
-
serialiseTransportValuesArray
protected static void serialiseTransportValuesArray(DHTUDPPacket packet, java.io.DataOutputStream os, DHTTransportValue[][] values, long skew, int max_length) throws java.io.IOException, DHTTransportException
- Throws:
java.io.IOException
DHTTransportException
-
serialiseContact
protected static void serialiseContact(java.io.DataOutputStream os, DHTTransportContact contact) throws java.io.IOException, DHTTransportException
- Throws:
java.io.IOException
DHTTransportException
-
deserialiseContact
protected static DHTTransportUDPContactImpl deserialiseContact(DHTTransportUDPImpl transport, java.io.DataInputStream is) throws java.io.IOException, DHTTransportException
- Throws:
java.io.IOException
DHTTransportException
-
serialiseAltContact
protected static void serialiseAltContact(java.io.DataOutputStream os, DHTTransportAlternativeContact contact) throws java.io.IOException, DHTTransportException
- Throws:
java.io.IOException
DHTTransportException
-
deserialiseAltContact
protected static DHTTransportAlternativeContactImpl deserialiseAltContact(java.io.DataInputStream is) throws java.io.IOException, DHTTransportException
- Throws:
java.io.IOException
DHTTransportException
-
deserialiseTransportValues
protected static DHTTransportValue[] deserialiseTransportValues(DHTUDPPacket packet, java.io.DataInputStream is, long skew) throws java.io.IOException
- Throws:
java.io.IOException
-
serialiseTransportValues
protected static void serialiseTransportValues(DHTUDPPacket packet, java.io.DataOutputStream os, DHTTransportValue[] values, long skew) throws java.io.IOException, DHTTransportException
- Throws:
java.io.IOException
DHTTransportException
-
deserialiseTransportValue
protected static DHTTransportValue deserialiseTransportValue(DHTUDPPacket packet, java.io.DataInputStream is, long skew) throws java.io.IOException, DHTTransportException
- Throws:
java.io.IOException
DHTTransportException
-
serialiseTransportValue
protected static void serialiseTransportValue(DHTUDPPacket packet, java.io.DataOutputStream os, DHTTransportValue value, long skew) throws java.io.IOException, DHTTransportException
- Throws:
java.io.IOException
DHTTransportException
-
serialiseContacts
protected static void serialiseContacts(java.io.DataOutputStream os, DHTTransportContact[] contacts) throws java.io.IOException
- Throws:
java.io.IOException
-
deserialiseContacts
protected static DHTTransportContact[] deserialiseContacts(DHTTransportUDPImpl transport, java.io.DataInputStream is) throws java.io.IOException
- Throws:
java.io.IOException
-
serialiseAltContacts
protected static void serialiseAltContacts(java.io.DataOutputStream os, DHTTransportAlternativeContact[] contacts) throws java.io.IOException
- Throws:
java.io.IOException
-
deserialiseAltContacts
protected static DHTTransportAlternativeContact[] deserialiseAltContacts(java.io.DataInputStream is) throws java.io.IOException
- Throws:
java.io.IOException
-
serialiseAltContactRequest
protected static void serialiseAltContactRequest(DHTUDPPacketRequestPing ping, java.io.DataOutputStream os) throws java.io.IOException
- Throws:
java.io.IOException
-
deserialiseAltContactRequest
protected static void deserialiseAltContactRequest(DHTUDPPacketRequestPing ping, java.io.DataInputStream is) throws java.io.IOException
- Throws:
java.io.IOException
-
serialiseVivaldi
protected static void serialiseVivaldi(DHTUDPPacketReply reply, java.io.DataOutputStream os) throws java.io.IOException
- Throws:
java.io.IOException
-
deserialiseVivaldi
protected static void deserialiseVivaldi(DHTUDPPacketReply reply, java.io.DataInputStream is) throws java.io.IOException
- Throws:
java.io.IOException
-
serialiseStats
protected static void serialiseStats(int version, java.io.DataOutputStream os, DHTTransportFullStats stats) throws java.io.IOException
- Throws:
java.io.IOException
-
deserialiseStats
protected static DHTTransportFullStats deserialiseStats(int version, java.io.DataInputStream is) throws java.io.IOException
- Throws:
java.io.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 java.util.List<DHTTransportAlternativeContact> getAlternativeContacts(int network, int max)
-
serialiseUploadStats
protected static void serialiseUploadStats(int protocol_version, int packet_type, java.io.DataOutputStream os) throws java.io.IOException
- Throws:
java.io.IOException
-
deserialiseUploadStats
protected static java.lang.Object deserialiseUploadStats(java.io.DataInputStream is) throws java.io.IOException
- Throws:
java.io.IOException
-
receiveUploadStats
protected static void receiveUploadStats(DHTTransportUDPContactImpl contact, java.lang.Object _stats)
-
-