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 Object
implements DHTPluginInterface.DHTInterface

Author:
parg

Constructor Summary
DHTPluginImpl(PluginInterface _plugin_interface, DHTNATPuncherAdapter _nat_adapter, DHTPluginImplAdapter _adapter, byte _protocol_version, int _network, boolean _v6, 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, String description, byte flags, int max_values, long timeout, boolean exhaustive, boolean high_priority, DHTPluginOperationListener listener)
           
 long getClockSkew()
           
 List<DHTPluginContact> getClosestContacts(byte[] to_id, boolean live_only)
           
protected  File getDataDir(int network)
           
 DHT getDHT()
           
 byte[] getID()
           
 DHTPluginContact getLocalAddress()
           
 DHTPluginValue getLocalValue(byte[] key)
           
 int getNetwork()
           
 int getPort()
           
 DHTPluginContact[] getReachableContacts()
           
 DHTPluginContact[] getRecentContacts()
           
protected  InetSocketAddress getSeedAddress()
           
 int getStatus()
           
 String getStatusText()
           
 List<DHTPluginValue> getValues()
           
 List<DHTPluginValue> getValues(byte[] key)
           
 DHTPluginContact importContact(InetSocketAddress address)
           
 DHTPluginContact importContact(InetSocketAddress address, byte version)
           
 DHTPluginContact importContact(Map<String,Object> map)
           
protected  DHTTransportContact importRootSeed()
           
protected  DHTTransportContact importSeed(InetAddress ia, int port)
           
protected  DHTTransportContact importSeed(InetSocketAddress ia)
           
 DHTTransportContact importSeed(String ip, int port)
           
 void integrateDHT(boolean first, DHTTransportContact remove_afterwards)
           
 boolean isDiversified(byte[] key)
           
 boolean isIPV6()
           
 boolean isReachable()
           
 boolean isRecentAddress(String address)
           
 void logStats()
           
protected  DHTPluginValue mapValue(DHTTransportValue value)
           
 void put(byte[] key, String description, byte[] value, byte flags, boolean high_priority, DHTPluginOperationListener listener)
           
 void put(byte[] key, 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, Map<String,Object> options)
           
 void remove(byte[] key, String description, DHTPluginOperationListener listener)
           
 void remove(DHTPluginContact[] targets, byte[] key, 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,
                     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 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 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(String ip,
                                      int port)

importSeed

protected DHTTransportContact importSeed(InetAddress ia,
                                         int port)

importSeed

protected DHTTransportContact importSeed(InetSocketAddress ia)

getSeedAddress

protected InetSocketAddress getSeedAddress()

isDiversified

public boolean isDiversified(byte[] key)

put

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

put

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

getLocalValue

public DHTPluginValue getLocalValue(byte[] key)

getValues

public List<DHTPluginValue> getValues()

getValues

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

get

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

remove

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

remove

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

getLocalAddress

public DHTPluginContact getLocalAddress()

importContact

public DHTPluginContact importContact(Map<String,Object> map)

importContact

public DHTPluginContact importContact(InetSocketAddress address)

importContact

public DHTPluginContact importContact(InetSocketAddress address,
                                      byte version)

registerHandler

public void registerHandler(byte[] handler_key,
                            DHTPluginTransferHandler handler,
                            Map<String,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(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 List<DHTPluginContact> getClosestContacts(byte[] to_id,
                                                 boolean live_only)
Specified by:
getClosestContacts in interface DHTPluginInterface.DHTInterface