com.aelitis.azureus.core.versioncheck
Class VersionCheckClient

java.lang.Object
  extended by com.aelitis.azureus.core.versioncheck.VersionCheckClient

public class VersionCheckClient
extends java.lang.Object

Client for checking version information from a remote server.


Field Summary
static java.lang.String AZ_MSG_SERVER_ADDRESS_V6
           
static java.lang.String HTTP_SERVER_ADDRESS_V4
           
static java.lang.String HTTP_SERVER_ADDRESS_V6
           
static int HTTP_SERVER_PORT
           
static java.lang.String REASON_CHECK_SWT
           
static java.lang.String REASON_DHT_BOOTSTRAP
           
static java.lang.String REASON_DHT_ENABLE_ALLOWED
           
static java.lang.String REASON_DHT_EXTENDED_ALLOWED
           
static java.lang.String REASON_DHT_FLAGS
           
static java.lang.String REASON_EXTERNAL_IP
           
static java.lang.String REASON_PLUGIN_UPDATE
           
static java.lang.String REASON_RECOMMENDED_PLUGINS
           
static java.lang.String REASON_SECONDARY_CHECK
           
static java.lang.String REASON_UPDATE_CHECK_PERIODIC
           
static java.lang.String REASON_UPDATE_CHECK_START
           
static java.lang.String TCP_SERVER_ADDRESS_V4
           
static java.lang.String TCP_SERVER_ADDRESS_V6
           
static int TCP_SERVER_PORT
           
static java.lang.String UDP_SERVER_ADDRESS_V4
           
static java.lang.String UDP_SERVER_ADDRESS_V6
           
static int UDP_SERVER_PORT
           
 
Method Summary
 void addVersionCheckClientListener(boolean triggerStartListener, VersionCheckClientListener l)
           
 void clearCache()
           
static java.util.Map<java.lang.String,java.lang.Object> constructVersionCheckMessage(java.lang.String reason)
          Construct the default version check message.
 boolean DHTEnableAllowed()
          Is the DHT plugin allowed to be enabled.
 boolean DHTExtendedUseAllowed()
          Is the DHT allowed to be used by external plugins.
 java.util.Set<java.lang.String> getAutoInstallPluginIDs()
           
 long getCacheTime(boolean v6)
           
 java.util.Map<java.lang.String,java.lang.Object> getCountryInfo()
           
 java.util.List<java.net.InetSocketAddress> getDHTBootstrap(boolean ipv4)
           
 byte getDHTFlags()
           
 java.util.Set<java.lang.String> getDisabledPluginIDs()
           
 java.lang.String getExternalIpAddress(boolean only_if_cached, boolean v6)
          Get the ip address seen by the version check server.
 java.lang.String getExternalIpAddress(boolean only_if_cached, boolean v6, boolean force)
           
 java.net.InetAddress getExternalIpAddressHTTP(boolean v6)
           
 java.net.InetAddress getExternalIpAddressTCP(java.net.InetAddress bind_ip, int bind_port, boolean v6)
           
 java.net.InetAddress getExternalIpAddressUDP(java.net.InetAddress bind_ip, int bind_port, boolean v6)
           
 long getFeatureFlags()
           
protected  java.lang.String getHost(boolean v6, java.lang.String v6_address, java.lang.String v4_address)
           
 java.lang.String getHTTPGetString(boolean for_proxy, boolean v6)
           
 java.util.Map getMostRecentVersionCheckData()
           
 java.lang.String[] getRecommendedPlugins()
           
static VersionCheckClient getSingleton()
          Get the singleton instance of the version check client.
 java.util.Map getVersionCheckInfo(java.lang.String reason)
          Get the version check reply info.
 java.util.Map getVersionCheckInfo(java.lang.String reason, int address_type)
           
protected  java.util.Map getVersionCheckInfoSupport(java.lang.String reason, boolean only_if_cached, boolean force, boolean v6)
           
 void initialise()
           
static void main(java.lang.String[] args)
           
protected  void preProcessReply(java.util.Map reply, boolean v6)
           
 void removeVersionCheckClientListener(VersionCheckClientListener l)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REASON_UPDATE_CHECK_START

public static final java.lang.String REASON_UPDATE_CHECK_START
See Also:
Constant Field Values

REASON_UPDATE_CHECK_PERIODIC

public static final java.lang.String REASON_UPDATE_CHECK_PERIODIC
See Also:
Constant Field Values

REASON_CHECK_SWT

public static final java.lang.String REASON_CHECK_SWT
See Also:
Constant Field Values

REASON_DHT_FLAGS

public static final java.lang.String REASON_DHT_FLAGS
See Also:
Constant Field Values

REASON_DHT_EXTENDED_ALLOWED

public static final java.lang.String REASON_DHT_EXTENDED_ALLOWED
See Also:
Constant Field Values

REASON_DHT_ENABLE_ALLOWED

public static final java.lang.String REASON_DHT_ENABLE_ALLOWED
See Also:
Constant Field Values

REASON_EXTERNAL_IP

public static final java.lang.String REASON_EXTERNAL_IP
See Also:
Constant Field Values

REASON_RECOMMENDED_PLUGINS

public static final java.lang.String REASON_RECOMMENDED_PLUGINS
See Also:
Constant Field Values

REASON_SECONDARY_CHECK

public static final java.lang.String REASON_SECONDARY_CHECK
See Also:
Constant Field Values

REASON_PLUGIN_UPDATE

public static final java.lang.String REASON_PLUGIN_UPDATE
See Also:
Constant Field Values

REASON_DHT_BOOTSTRAP

public static final java.lang.String REASON_DHT_BOOTSTRAP
See Also:
Constant Field Values

HTTP_SERVER_ADDRESS_V4

public static final java.lang.String HTTP_SERVER_ADDRESS_V4
See Also:
Constant Field Values

HTTP_SERVER_PORT

public static final int HTTP_SERVER_PORT
See Also:
Constant Field Values

TCP_SERVER_ADDRESS_V4

public static final java.lang.String TCP_SERVER_ADDRESS_V4
See Also:
Constant Field Values

TCP_SERVER_PORT

public static final int TCP_SERVER_PORT
See Also:
Constant Field Values

UDP_SERVER_ADDRESS_V4

public static final java.lang.String UDP_SERVER_ADDRESS_V4
See Also:
Constant Field Values

UDP_SERVER_PORT

public static final int UDP_SERVER_PORT
See Also:
Constant Field Values

AZ_MSG_SERVER_ADDRESS_V6

public static final java.lang.String AZ_MSG_SERVER_ADDRESS_V6
See Also:
Constant Field Values

HTTP_SERVER_ADDRESS_V6

public static final java.lang.String HTTP_SERVER_ADDRESS_V6
See Also:
Constant Field Values

TCP_SERVER_ADDRESS_V6

public static final java.lang.String TCP_SERVER_ADDRESS_V6
See Also:
Constant Field Values

UDP_SERVER_ADDRESS_V6

public static final java.lang.String UDP_SERVER_ADDRESS_V6
See Also:
Constant Field Values
Method Detail

getSingleton

public static VersionCheckClient getSingleton()
Get the singleton instance of the version check client.

Returns:
version check client

initialise

public void initialise()

getVersionCheckInfo

public java.util.Map getVersionCheckInfo(java.lang.String reason)
Get the version check reply info.

Returns:
reply data, possibly cached, if the server was already checked within the last minute

getVersionCheckInfo

public java.util.Map getVersionCheckInfo(java.lang.String reason,
                                         int address_type)

getVersionCheckInfoSupport

protected java.util.Map getVersionCheckInfoSupport(java.lang.String reason,
                                                   boolean only_if_cached,
                                                   boolean force,
                                                   boolean v6)

getMostRecentVersionCheckData

public java.util.Map getMostRecentVersionCheckData()

getCacheTime

public long getCacheTime(boolean v6)

clearCache

public void clearCache()

getFeatureFlags

public long getFeatureFlags()

getDisabledPluginIDs

public java.util.Set<java.lang.String> getDisabledPluginIDs()

getAutoInstallPluginIDs

public java.util.Set<java.lang.String> getAutoInstallPluginIDs()

getExternalIpAddress

public java.lang.String getExternalIpAddress(boolean only_if_cached,
                                             boolean v6)
Get the ip address seen by the version check server. NOTE: This information may be cached, see getVersionCheckInfo().

Returns:
external ip address, or empty string if no address information found

getExternalIpAddress

public java.lang.String getExternalIpAddress(boolean only_if_cached,
                                             boolean v6,
                                             boolean force)

DHTEnableAllowed

public boolean DHTEnableAllowed()
Is the DHT plugin allowed to be enabled.

Returns:
true if DHT can be enabled, false if it should not be enabled

DHTExtendedUseAllowed

public boolean DHTExtendedUseAllowed()
Is the DHT allowed to be used by external plugins.

Returns:
true if extended DHT use is allowed, false if not allowed

getDHTFlags

public byte getDHTFlags()

getRecommendedPlugins

public java.lang.String[] getRecommendedPlugins()

getDHTBootstrap

public java.util.List<java.net.InetSocketAddress> getDHTBootstrap(boolean ipv4)

getCountryInfo

public java.util.Map<java.lang.String,java.lang.Object> getCountryInfo()

getHTTPGetString

public java.lang.String getHTTPGetString(boolean for_proxy,
                                         boolean v6)

preProcessReply

protected void preProcessReply(java.util.Map reply,
                               boolean v6)

getExternalIpAddressHTTP

public java.net.InetAddress getExternalIpAddressHTTP(boolean v6)
                                              throws java.lang.Exception
Throws:
java.lang.Exception

getExternalIpAddressTCP

public java.net.InetAddress getExternalIpAddressTCP(java.net.InetAddress bind_ip,
                                                    int bind_port,
                                                    boolean v6)
                                             throws java.lang.Exception
Throws:
java.lang.Exception

getExternalIpAddressUDP

public java.net.InetAddress getExternalIpAddressUDP(java.net.InetAddress bind_ip,
                                                    int bind_port,
                                                    boolean v6)
                                             throws java.lang.Exception
Throws:
java.lang.Exception

getHost

protected java.lang.String getHost(boolean v6,
                                   java.lang.String v6_address,
                                   java.lang.String v4_address)

constructVersionCheckMessage

public static java.util.Map<java.lang.String,java.lang.Object> constructVersionCheckMessage(java.lang.String reason)
Construct the default version check message.

Returns:
message to send

addVersionCheckClientListener

public void addVersionCheckClientListener(boolean triggerStartListener,
                                          VersionCheckClientListener l)

removeVersionCheckClientListener

public void removeVersionCheckClientListener(VersionCheckClientListener l)

main

public static void main(java.lang.String[] args)