Package com.biglybt.plugin.dht
Class DHTPlugin
- java.lang.Object
-
- com.biglybt.plugin.dht.DHTPlugin
-
- All Implemented Interfaces:
Plugin
,DHTPluginInterface
public class DHTPlugin extends java.lang.Object implements Plugin, DHTPluginInterface
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.biglybt.plugin.dht.DHTPluginInterface
DHTPluginInterface.DHTInterface
-
-
Field Summary
Fields Modifier and Type Field Description private static boolean
AZ_CVS_DHT_ENABLE
private static boolean
AZ_MAIN_DHT_ENABLE
private static boolean
AZ_MAIN_DHT_V6_ENABLE
private DHTPluginImpl
biglybt_dht
private static boolean
BIGLYBT_MAIN_DHT_ENABLE
private DHTPluginImpl
cvs_dht
private int
dht_data_port
private DHTLogger
dht_log
private DHTPluginImpl[]
dhts
static byte
DT_FREQUENCY
static byte
DT_NONE
static byte
DT_SIZE
private boolean
enabled
static int
EVENT_DHT_AVAILABLE
private boolean
extended_use
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
private boolean
got_extended_use
private AESemaphore
init_sem
private boolean[]
ipfilter_logging
private java.util.List
listeners
private LoggerChannel
log
private DHTPluginImpl
main_dht
private DHTPluginImpl
main_v6_dht
static int
MAX_VALUE_SIZE
static int
NW_AZ_CVS
static int
NW_AZ_MAIN
static int
NW_BIGLYBT_MAIN
static int
NW_MAIN
Deprecated.Use NW_AZ_MAINprivate static java.lang.String
PLUGIN_CONFIGSECTION_ID
private PluginInterface
plugin_interface
private static java.lang.String
PLUGIN_NAME
private static java.lang.String
PLUGIN_RESOURCE_ID
private static java.lang.String
PLUGIN_VERSION
private AEMonitor
port_change_mon
private int
port_change_outstanding
private boolean
port_changing
private BooleanParameter
prefer_i2p
private ActionParameter
reseed
private long
start_mono_time
private int
status
static int
STATUS_DISABLED
static int
STATUS_FAILED
static int
STATUS_INITALISING
static int
STATUS_RUNNING
private BooleanParameter
torrent_xfer
private UPnPMapping
upnp_mapping
private BooleanParameter
warn_user
-
Fields inherited from interface com.biglybt.plugin.dht.DHTPluginInterface
FLAG_BRIDGED
-
-
Constructor Summary
Constructors Constructor Description DHTPlugin()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(DHTPluginListener l)
protected void
changePort(int _new_port)
DHTPluginKeyStats
decodeStats(DHTPluginValue value)
void
get(byte[] original_key, java.lang.String description, byte flags, int max_values, long timeout, boolean exhaustive, boolean high_priority, DHTPluginOperationListener original_listener)
long
getClockSkew()
java.net.InetSocketAddress
getConnectionOrientedEndpoint()
java.net.InetSocketAddress[]
getConnectionOrientedEndpoints()
DHT
getDHT(int network)
DHTPluginInterface.DHTInterface[]
getDHTInterfaces()
DHT[]
getDHTs()
DHTPluginContact
getLocalAddress()
DHTPluginContact[]
getLocalAddresses()
DHTPluginValue
getLocalValue(byte[] key)
java.lang.String
getNetwork()
int
getStatus()
java.util.List<DHTPluginValue>
getValues()
java.util.List<DHTPluginValue>
getValues(byte[] key)
java.util.List<DHTPluginValue>
getValues(int network, boolean ipv6)
boolean
hasLocalKey(byte[] hash)
DHTPluginContact
importContact(java.net.InetSocketAddress address)
DHTPluginContact
importContact(java.net.InetSocketAddress address, byte version)
DHTPluginContact
importContact(java.net.InetSocketAddress address, byte version, boolean is_cvs)
DHTPluginContact
importContact(java.util.Map<java.lang.String,java.lang.Object> map)
protected void
initComplete(UITextField status_area, boolean logging, java.lang.String override_ip)
void
initialize(PluginInterface _plugin_interface)
This method is called when the Plugin is loaded by the clientboolean
isDiversified(byte[] key)
boolean
isEnabled()
boolean
isExtendedUseAllowed()
boolean
isInitialising()
boolean
isReachable()
boolean
isSleeping()
boolean
isTorrentXferEnabled()
static void
load(PluginInterface plugin_interface)
protected long
loadClockSkew()
void
log(java.lang.String str)
boolean
peekEnabled()
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)
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
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
-
Methods inherited from interface com.biglybt.pif.Plugin
getInitialProperties
-
-
-
-
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
Deprecated.Use NW_AZ_MAIN- See Also:
- Constant Field Values
-
NW_AZ_MAIN
public static final int NW_AZ_MAIN
- See Also:
- Constant Field Values
-
NW_AZ_CVS
public static final int NW_AZ_CVS
- See Also:
- Constant Field Values
-
NW_BIGLYBT_MAIN
public static final int NW_BIGLYBT_MAIN
- See Also:
- Constant Field Values
-
MAX_VALUE_SIZE
public static final int MAX_VALUE_SIZE
- See Also:
- Constant Field Values
-
PLUGIN_VERSION
private static final java.lang.String PLUGIN_VERSION
- See Also:
- Constant Field Values
-
PLUGIN_NAME
private static final java.lang.String PLUGIN_NAME
- See Also:
- Constant Field Values
-
PLUGIN_CONFIGSECTION_ID
private static final java.lang.String PLUGIN_CONFIGSECTION_ID
- See Also:
- Constant Field Values
-
PLUGIN_RESOURCE_ID
private static final java.lang.String PLUGIN_RESOURCE_ID
- See Also:
- Constant Field Values
-
AZ_MAIN_DHT_ENABLE
private static final boolean AZ_MAIN_DHT_ENABLE
-
AZ_CVS_DHT_ENABLE
private static final boolean AZ_CVS_DHT_ENABLE
-
AZ_MAIN_DHT_V6_ENABLE
private static final boolean AZ_MAIN_DHT_V6_ENABLE
-
BIGLYBT_MAIN_DHT_ENABLE
private static final boolean BIGLYBT_MAIN_DHT_ENABLE
-
plugin_interface
private PluginInterface plugin_interface
-
status
private int status
-
dhts
private DHTPluginImpl[] dhts
-
main_dht
private DHTPluginImpl main_dht
-
cvs_dht
private DHTPluginImpl cvs_dht
-
main_v6_dht
private DHTPluginImpl main_v6_dht
-
biglybt_dht
private DHTPluginImpl biglybt_dht
-
reseed
private ActionParameter reseed
-
enabled
private boolean enabled
-
dht_data_port
private int dht_data_port
-
got_extended_use
private boolean got_extended_use
-
extended_use
private boolean extended_use
-
init_sem
private AESemaphore init_sem
-
port_change_mon
private AEMonitor port_change_mon
-
port_changing
private boolean port_changing
-
port_change_outstanding
private int port_change_outstanding
-
ipfilter_logging
private boolean[] ipfilter_logging
-
warn_user
private BooleanParameter warn_user
-
prefer_i2p
private BooleanParameter prefer_i2p
-
torrent_xfer
private BooleanParameter torrent_xfer
-
upnp_mapping
private UPnPMapping upnp_mapping
-
log
private LoggerChannel log
-
dht_log
private DHTLogger dht_log
-
listeners
private java.util.List listeners
-
start_mono_time
private long start_mono_time
-
-
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 the client- Specified by:
initialize
in interfacePlugin
- Parameters:
_plugin_interface
- the interface that the plugin must use to communicate with the client
-
getConnectionOrientedEndpoint
public java.net.InetSocketAddress getConnectionOrientedEndpoint()
- Specified by:
getConnectionOrientedEndpoint
in interfaceDHTPluginInterface
-
getConnectionOrientedEndpoints
public java.net.InetSocketAddress[] getConnectionOrientedEndpoints()
- Specified by:
getConnectionOrientedEndpoints
in interfaceDHTPluginInterface
-
changePort
protected void changePort(int _new_port)
-
initComplete
protected void initComplete(UITextField status_area, boolean logging, java.lang.String override_ip)
-
setPluginInfo
protected void setPluginInfo()
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabled
in interfaceDHTPluginInterface
-
peekEnabled
public boolean peekEnabled()
-
isInitialising
public boolean isInitialising()
- Specified by:
isInitialising
in interfaceDHTPluginInterface
-
setSuspended
public boolean setSuspended(boolean susp)
-
isExtendedUseAllowed
public boolean isExtendedUseAllowed()
- Specified by:
isExtendedUseAllowed
in interfaceDHTPluginInterface
-
getNetwork
public java.lang.String getNetwork()
- Specified by:
getNetwork
in interfaceDHTPluginInterface
-
isReachable
public boolean isReachable()
-
isDiversified
public boolean isDiversified(byte[] key)
-
put
public void put(byte[] key, java.lang.String description, byte[] value, byte flags, DHTPluginOperationListener listener)
- Specified by:
put
in interfaceDHTPluginInterface
-
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()
- Specified by:
getValues
in interfaceDHTPluginInterface
-
getValues
public java.util.List<DHTPluginValue> getValues(byte[] key)
- Specified by:
getValues
in interfaceDHTPluginInterface
-
getValues
public java.util.List<DHTPluginValue> getValues(int network, boolean ipv6)
-
get
public void get(byte[] original_key, java.lang.String description, byte flags, int max_values, long timeout, boolean exhaustive, boolean high_priority, DHTPluginOperationListener original_listener)
- Specified by:
get
in interfaceDHTPluginInterface
-
hasLocalKey
public boolean hasLocalKey(byte[] hash)
-
remove
public void remove(byte[] key, java.lang.String description, DHTPluginOperationListener listener)
- Specified by:
remove
in interfaceDHTPluginInterface
-
remove
public void remove(DHTPluginContact[] targets, byte[] key, java.lang.String description, DHTPluginOperationListener listener)
- Specified by:
remove
in interfaceDHTPluginInterface
-
importContact
public DHTPluginContact importContact(java.util.Map<java.lang.String,java.lang.Object> map)
- Specified by:
importContact
in interfaceDHTPluginInterface
-
importContact
public DHTPluginContact importContact(java.net.InetSocketAddress address)
- Specified by:
importContact
in interfaceDHTPluginInterface
-
importContact
public DHTPluginContact importContact(java.net.InetSocketAddress address, byte version)
- Specified by:
importContact
in interfaceDHTPluginInterface
-
importContact
public DHTPluginContact importContact(java.net.InetSocketAddress address, byte version, boolean is_cvs)
- Specified by:
importContact
in interfaceDHTPluginInterface
-
getLocalAddress
public DHTPluginContact getLocalAddress()
- Specified by:
getLocalAddress
in interfaceDHTPluginInterface
-
getLocalAddresses
public DHTPluginContact[] getLocalAddresses()
- Specified by:
getLocalAddresses
in interfaceDHTPluginInterface
-
registerHandler
public void registerHandler(byte[] handler_key, DHTPluginTransferHandler handler, java.util.Map<java.lang.String,java.lang.Object> options)
- Specified by:
registerHandler
in interfaceDHTPluginInterface
-
unregisterHandler
public void unregisterHandler(byte[] handler_key, DHTPluginTransferHandler handler)
- Specified by:
unregisterHandler
in interfaceDHTPluginInterface
-
getStatus
public int getStatus()
-
isSleeping
public boolean isSleeping()
- Specified by:
isSleeping
in interfaceDHTPluginInterface
-
isTorrentXferEnabled
public boolean isTorrentXferEnabled()
-
getDHTs
public DHT[] getDHTs()
-
getDHT
public DHT getDHT(int network)
-
getDHTInterfaces
public DHTPluginInterface.DHTInterface[] getDHTInterfaces()
- Specified by:
getDHTInterfaces
in interfaceDHTPluginInterface
-
loadClockSkew
protected long loadClockSkew()
-
saveClockSkew
protected void saveClockSkew()
-
getClockSkew
public long getClockSkew()
-
decodeStats
public DHTPluginKeyStats decodeStats(DHTPluginValue value)
- Specified by:
decodeStats
in interfaceDHTPluginInterface
-
addListener
public void addListener(DHTPluginListener l)
- Specified by:
addListener
in interfaceDHTPluginInterface
-
removeListener
public void removeListener(DHTPluginListener l)
- Specified by:
removeListener
in interfaceDHTPluginInterface
-
log
public void log(java.lang.String str)
- Specified by:
log
in interfaceDHTPluginInterface
-
-