com.aelitis.azureus.plugins.dht.impl
Class DHTPluginImpl

java.lang.Object
  extended by com.aelitis.azureus.plugins.dht.impl.DHTPluginImpl
All Implemented Interfaces:
DHTPluginInterface.DHTInterface

public class DHTPluginImpl
extends java.lang.Object
implements DHTPluginInterface.DHTInterface

Author:
parg

Constructor Summary
DHTPluginImpl(PluginInterface _plugin_interface, DHTNATPuncherAdapter _nat_adapter, DHTPluginImplAdapter _adapter, byte _protocol_version, int _network, boolean _v6, java.lang.String _ip, int _port, ActionParameter _reseed, BooleanParameter _warn_user_param, boolean _logging, LoggerChannel _log, DHTLogger _dht_log)
           
 
Method Summary
 byte[] call(DHTPluginProgressListener listener, DHTPluginContact target, byte[] handler_key, byte[] data, long timeout)
           
 void checkForReSeed(boolean force)
           
 void closedownInitiated()
           
 DHTPluginKeyStats decodeStats(DHTPluginValue value)
           
 void get(byte[] key, java.lang.String description, byte flags, int max_values, long timeout, boolean exhaustive, boolean high_priority, DHTPluginOperationListener listener)
           
 long getClockSkew()
           
 java.util.List<DHTPluginContact> getClosestContacts(byte[] to_id, boolean live_only)
           
protected  java.io.File getDataDir(int network)
           
 DHT getDHT()
           
 byte[] getID()
           
 DHTPluginContact getLocalAddress()
           
 DHTPluginValue getLocalValue(byte[] key)
           
 int getNetwork()
           
 int getPort()
           
 DHTPluginContact[] getReachableContacts()
           
 DHTPluginContact[] getRecentContacts()
           
protected  java.net.InetSocketAddress getSeedAddress()
           
 int getStatus()
           
 java.lang.String getStatusText()
           
 java.util.List<DHTPluginValue> getValues()
           
 java.util.List<DHTPluginValue> getValues(byte[] key)
           
 DHTPluginContact importContact(java.net.InetSocketAddress address)
           
 DHTPluginContact importContact(java.net.InetSocketAddress address, byte version)
           
 DHTPluginContact importContact(java.util.Map<java.lang.String,java.lang.Object> map)
           
protected  DHTTransportContact importRootSeed()
           
protected  DHTTransportContact importSeed(java.net.InetAddress ia, int port)
           
protected  DHTTransportContact importSeed(java.net.InetSocketAddress ia)
           
 DHTTransportContact importSeed(java.lang.String ip, int port)
           
 void integrateDHT(boolean first, DHTTransportContact remove_afterwards)
           
 boolean isDiversified(byte[] key)
           
 boolean isIPV6()
           
 boolean isReachable()
           
 boolean isRecentAddress(java.lang.String address)
           
 void logStats()
           
protected  DHTPluginValue mapValue(DHTTransportValue value)
           
 void put(byte[] key, java.lang.String description, byte[] value, byte flags, boolean high_priority, DHTPluginOperationListener listener)
           
 void put(byte[] key, java.lang.String description, byte[] value, byte flags, DHTPluginOperationListener listener)
           
 byte[] read(DHTPluginProgressListener listener, DHTPluginContact target, byte[] handler_key, byte[] key, long timeout)
           
 void registerHandler(byte[] handler_key, DHTPluginTransferHandler handler, java.util.Map<java.lang.String,java.lang.Object> options)
           
 void remove(byte[] key, java.lang.String description, DHTPluginOperationListener listener)
           
 void remove(DHTPluginContact[] targets, byte[] key, java.lang.String description, DHTPluginOperationListener listener)
           
 void setLogging(boolean l)
           
 void setPort(int new_port)
           
 void setSuspended(boolean susp)
           
 void tick()
           
 void unregisterHandler(byte[] handler_key, DHTPluginTransferHandler handler)
           
 void updateStats(int sample_stats_ticks)
           
 void write(DHTPluginProgressListener listener, DHTPluginContact target, byte[] handler_key, byte[] key, byte[] data, long timeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DHTPluginImpl

public DHTPluginImpl(PluginInterface _plugin_interface,
                     DHTNATPuncherAdapter _nat_adapter,
                     DHTPluginImplAdapter _adapter,
                     byte _protocol_version,
                     int _network,
                     boolean _v6,
                     java.lang.String _ip,
                     int _port,
                     ActionParameter _reseed,
                     BooleanParameter _warn_user_param,
                     boolean _logging,
                     LoggerChannel _log,
                     DHTLogger _dht_log)
Method Detail

updateStats

public void updateStats(int sample_stats_ticks)

getStatus

public int getStatus()

getStatusText

public java.lang.String getStatusText()

isReachable

public boolean isReachable()

setLogging

public void setLogging(boolean l)

tick

public void tick()

getPort

public int getPort()

setPort

public void setPort(int new_port)

getClockSkew

public long getClockSkew()

logStats

public void logStats()

getDataDir

protected java.io.File getDataDir(int network)

integrateDHT

public void integrateDHT(boolean first,
                         DHTTransportContact remove_afterwards)

checkForReSeed

public void checkForReSeed(boolean force)

importRootSeed

protected DHTTransportContact importRootSeed()

importSeed

public DHTTransportContact importSeed(java.lang.String ip,
                                      int port)

importSeed

protected DHTTransportContact importSeed(java.net.InetAddress ia,
                                         int port)

importSeed

protected DHTTransportContact importSeed(java.net.InetSocketAddress ia)

getSeedAddress

protected java.net.InetSocketAddress getSeedAddress()

isDiversified

public boolean isDiversified(byte[] key)

put

public void put(byte[] key,
                java.lang.String description,
                byte[] value,
                byte flags,
                DHTPluginOperationListener listener)

put

public void put(byte[] key,
                java.lang.String description,
                byte[] value,
                byte flags,
                boolean high_priority,
                DHTPluginOperationListener listener)

getLocalValue

public DHTPluginValue getLocalValue(byte[] key)

getValues

public java.util.List<DHTPluginValue> getValues()

getValues

public java.util.List<DHTPluginValue> getValues(byte[] key)

get

public void get(byte[] key,
                java.lang.String description,
                byte flags,
                int max_values,
                long timeout,
                boolean exhaustive,
                boolean high_priority,
                DHTPluginOperationListener listener)

remove

public void remove(byte[] key,
                   java.lang.String description,
                   DHTPluginOperationListener listener)

remove

public void remove(DHTPluginContact[] targets,
                   byte[] key,
                   java.lang.String description,
                   DHTPluginOperationListener listener)

getLocalAddress

public DHTPluginContact getLocalAddress()

importContact

public DHTPluginContact importContact(java.util.Map<java.lang.String,java.lang.Object> map)

importContact

public DHTPluginContact importContact(java.net.InetSocketAddress address)

importContact

public DHTPluginContact importContact(java.net.InetSocketAddress address,
                                      byte version)

registerHandler

public void registerHandler(byte[] handler_key,
                            DHTPluginTransferHandler handler,
                            java.util.Map<java.lang.String,java.lang.Object> options)

unregisterHandler

public void unregisterHandler(byte[] handler_key,
                              DHTPluginTransferHandler handler)

read

public byte[] read(DHTPluginProgressListener listener,
                   DHTPluginContact target,
                   byte[] handler_key,
                   byte[] key,
                   long timeout)

write

public void write(DHTPluginProgressListener listener,
                  DHTPluginContact target,
                  byte[] handler_key,
                  byte[] key,
                  byte[] data,
                  long timeout)

call

public byte[] call(DHTPluginProgressListener listener,
                   DHTPluginContact target,
                   byte[] handler_key,
                   byte[] data,
                   long timeout)

getDHT

public DHT getDHT()

setSuspended

public void setSuspended(boolean susp)

closedownInitiated

public void closedownInitiated()

isRecentAddress

public boolean isRecentAddress(java.lang.String address)

mapValue

protected DHTPluginValue mapValue(DHTTransportValue value)

decodeStats

public DHTPluginKeyStats decodeStats(DHTPluginValue value)

getID

public byte[] getID()
Specified by:
getID in interface DHTPluginInterface.DHTInterface

isIPV6

public boolean isIPV6()
Specified by:
isIPV6 in interface DHTPluginInterface.DHTInterface

getNetwork

public int getNetwork()
Specified by:
getNetwork in interface DHTPluginInterface.DHTInterface

getReachableContacts

public DHTPluginContact[] getReachableContacts()
Specified by:
getReachableContacts in interface DHTPluginInterface.DHTInterface

getRecentContacts

public DHTPluginContact[] getRecentContacts()
Specified by:
getRecentContacts in interface DHTPluginInterface.DHTInterface

getClosestContacts

public java.util.List<DHTPluginContact> getClosestContacts(byte[] to_id,
                                                           boolean live_only)
Specified by:
getClosestContacts in interface DHTPluginInterface.DHTInterface