com.aelitis.azureus.plugins.dht
Class DHTPlugin

java.lang.Object
  extended by com.aelitis.azureus.plugins.dht.DHTPlugin
All Implemented Interfaces:
DHTPluginInterface, Plugin

public class DHTPlugin
extends Object
implements Plugin, DHTPluginInterface

Author:
parg

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.aelitis.azureus.plugins.dht.DHTPluginInterface
DHTPluginInterface.DHTInterface
 
Field Summary
static byte DT_FREQUENCY
           
static byte DT_NONE
           
static byte DT_SIZE
           
static int EVENT_DHT_AVAILABLE
           
static byte FLAG_ANON
           
static byte FLAG_DOWNLOADING
           
static byte FLAG_MULTI_VALUE
           
static byte FLAG_PRECIOUS
           
static byte FLAG_SEEDING
           
static byte FLAG_SINGLE_VALUE
           
static byte FLAG_STATS
           
static int MAX_VALUE_SIZE
           
static int NW_CVS
           
static int NW_MAIN
           
static int STATUS_DISABLED
           
static int STATUS_FAILED
           
static int STATUS_INITALISING
           
static int STATUS_RUNNING
           
 
Fields inherited from interface com.aelitis.azureus.plugins.dht.DHTPluginInterface
FLAG_BRIDGED
 
Constructor Summary
DHTPlugin()
           
 
Method Summary
 void addListener(DHTPluginListener l)
           
protected  void changePort(int _new_port)
           
 DHTPluginKeyStats decodeStats(DHTPluginValue value)
           
 void get(byte[] original_key, String description, byte flags, int max_values, long timeout, boolean exhaustive, boolean high_priority, DHTPluginOperationListener original_listener)
           
 long getClockSkew()
           
 DHT getDHT(int network)
           
 DHTPluginInterface.DHTInterface[] getDHTInterfaces()
           
 DHT[] getDHTs()
           
 DHTPluginContact getLocalAddress()
           
 DHTPluginValue getLocalValue(byte[] key)
           
 String getNetwork()
           
 int getStatus()
           
 List<DHTPluginValue> getValues()
           
 List<DHTPluginValue> getValues(byte[] key)
           
 List<DHTPluginValue> getValues(int network, boolean ipv6)
           
 boolean hasLocalKey(byte[] hash)
           
 DHTPluginContact importContact(InetSocketAddress address)
           
 DHTPluginContact importContact(InetSocketAddress address, byte version)
           
 DHTPluginContact importContact(InetSocketAddress address, byte version, boolean is_cvs)
           
 DHTPluginContact importContact(Map<String,Object> map)
           
protected  void initComplete(UITextField status_area, boolean logging, String override_ip)
           
 void initialize(PluginInterface _plugin_interface)
          This method is called when the Plugin is loaded by Azureus
 boolean isDiversified(byte[] key)
           
 boolean isEnabled()
           
 boolean isExtendedUseAllowed()
           
 boolean isInitialising()
           
 boolean isReachable()
           
 boolean isSleeping()
           
static void load(PluginInterface plugin_interface)
           
protected  long loadClockSkew()
           
 void log(String str)
           
 boolean peekEnabled()
           
 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)
           
 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 removeListener(DHTPluginListener l)
           
protected  void saveClockSkew()
           
protected  void setPluginInfo()
           
 boolean setSuspended(boolean susp)
           
 void unregisterHandler(byte[] handler_key, DHTPluginTransferHandler handler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT_DHT_AVAILABLE

public static final int EVENT_DHT_AVAILABLE
See Also:
Constant Field Values

STATUS_DISABLED

public static final int STATUS_DISABLED
See Also:
Constant Field Values

STATUS_INITALISING

public static final int STATUS_INITALISING
See Also:
Constant Field Values

STATUS_RUNNING

public static final int STATUS_RUNNING
See Also:
Constant Field Values

STATUS_FAILED

public static final int STATUS_FAILED
See Also:
Constant Field Values

FLAG_SINGLE_VALUE

public static final byte FLAG_SINGLE_VALUE
See Also:
Constant Field Values

FLAG_DOWNLOADING

public static final byte FLAG_DOWNLOADING
See Also:
Constant Field Values

FLAG_SEEDING

public static final byte FLAG_SEEDING
See Also:
Constant Field Values

FLAG_MULTI_VALUE

public static final byte FLAG_MULTI_VALUE
See Also:
Constant Field Values

FLAG_STATS

public static final byte FLAG_STATS
See Also:
Constant Field Values

FLAG_ANON

public static final byte FLAG_ANON
See Also:
Constant Field Values

FLAG_PRECIOUS

public static final byte FLAG_PRECIOUS
See Also:
Constant Field Values

DT_NONE

public static final byte DT_NONE
See Also:
Constant Field Values

DT_FREQUENCY

public static final byte DT_FREQUENCY
See Also:
Constant Field Values

DT_SIZE

public static final byte DT_SIZE
See Also:
Constant Field Values

NW_MAIN

public static final int NW_MAIN
See Also:
Constant Field Values

NW_CVS

public static final int NW_CVS
See Also:
Constant Field Values

MAX_VALUE_SIZE

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

DHTPlugin

public DHTPlugin()
Method Detail

load

public static void load(PluginInterface plugin_interface)

initialize

public void initialize(PluginInterface _plugin_interface)
Description copied from interface: Plugin
This method is called when the Plugin is loaded by Azureus

Specified by:
initialize in interface Plugin
Parameters:
_plugin_interface - the interface that the plugin must use to communicate with Azureus

changePort

protected void changePort(int _new_port)

initComplete

protected void initComplete(UITextField status_area,
                            boolean logging,
                            String override_ip)

setPluginInfo

protected void setPluginInfo()

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface DHTPluginInterface

peekEnabled

public boolean peekEnabled()

isInitialising

public boolean isInitialising()
Specified by:
isInitialising in interface DHTPluginInterface

setSuspended

public boolean setSuspended(boolean susp)

isExtendedUseAllowed

public boolean isExtendedUseAllowed()
Specified by:
isExtendedUseAllowed in interface DHTPluginInterface

getNetwork

public String getNetwork()
Specified by:
getNetwork in interface DHTPluginInterface

isReachable

public boolean isReachable()

isDiversified

public boolean isDiversified(byte[] key)

put

public void put(byte[] key,
                String description,
                byte[] value,
                byte flags,
                DHTPluginOperationListener listener)
Specified by:
put in interface DHTPluginInterface

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()
Specified by:
getValues in interface DHTPluginInterface

getValues

public List<DHTPluginValue> getValues(byte[] key)
Specified by:
getValues in interface DHTPluginInterface

getValues

public List<DHTPluginValue> getValues(int network,
                                      boolean ipv6)

get

public void get(byte[] original_key,
                String description,
                byte flags,
                int max_values,
                long timeout,
                boolean exhaustive,
                boolean high_priority,
                DHTPluginOperationListener original_listener)
Specified by:
get in interface DHTPluginInterface

hasLocalKey

public boolean hasLocalKey(byte[] hash)

remove

public void remove(byte[] key,
                   String description,
                   DHTPluginOperationListener listener)
Specified by:
remove in interface DHTPluginInterface

remove

public void remove(DHTPluginContact[] targets,
                   byte[] key,
                   String description,
                   DHTPluginOperationListener listener)
Specified by:
remove in interface DHTPluginInterface

importContact

public DHTPluginContact importContact(Map<String,Object> map)
Specified by:
importContact in interface DHTPluginInterface

importContact

public DHTPluginContact importContact(InetSocketAddress address)
Specified by:
importContact in interface DHTPluginInterface

importContact

public DHTPluginContact importContact(InetSocketAddress address,
                                      byte version)
Specified by:
importContact in interface DHTPluginInterface

importContact

public DHTPluginContact importContact(InetSocketAddress address,
                                      byte version,
                                      boolean is_cvs)
Specified by:
importContact in interface DHTPluginInterface

getLocalAddress

public DHTPluginContact getLocalAddress()
Specified by:
getLocalAddress in interface DHTPluginInterface

registerHandler

public void registerHandler(byte[] handler_key,
                            DHTPluginTransferHandler handler,
                            Map<String,Object> options)
Specified by:
registerHandler in interface DHTPluginInterface

unregisterHandler

public void unregisterHandler(byte[] handler_key,
                              DHTPluginTransferHandler handler)
Specified by:
unregisterHandler in interface DHTPluginInterface

getStatus

public int getStatus()

isSleeping

public boolean isSleeping()
Specified by:
isSleeping in interface DHTPluginInterface

getDHTs

public DHT[] getDHTs()

getDHT

public DHT getDHT(int network)

getDHTInterfaces

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

loadClockSkew

protected long loadClockSkew()

saveClockSkew

protected void saveClockSkew()

getClockSkew

public long getClockSkew()

decodeStats

public DHTPluginKeyStats decodeStats(DHTPluginValue value)
Specified by:
decodeStats in interface DHTPluginInterface

addListener

public void addListener(DHTPluginListener l)
Specified by:
addListener in interface DHTPluginInterface

removeListener

public void removeListener(DHTPluginListener l)
Specified by:
removeListener in interface DHTPluginInterface

log

public void log(String str)
Specified by:
log in interface DHTPluginInterface