com.aelitis.azureus.core.versioncheck
Class VersionCheckClient

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

public class VersionCheckClient
extends Object

Client for checking version information from a remote server.


Field Summary
static String AZ_MSG_SERVER_ADDRESS_V6
           
static String HTTP_SERVER_ADDRESS_V4
           
static String HTTP_SERVER_ADDRESS_V6
           
static int HTTP_SERVER_PORT
           
static String REASON_CHECK_SWT
           
static String REASON_DHT_BOOTSTRAP
           
static String REASON_DHT_ENABLE_ALLOWED
           
static String REASON_DHT_EXTENDED_ALLOWED
           
static String REASON_DHT_FLAGS
           
static String REASON_EXTERNAL_IP
           
static String REASON_PLUGIN_UPDATE
           
static String REASON_RECOMMENDED_PLUGINS
           
static String REASON_SECONDARY_CHECK
           
static String REASON_UPDATE_CHECK_PERIODIC
           
static String REASON_UPDATE_CHECK_START
           
static String TCP_SERVER_ADDRESS_V4
           
static String TCP_SERVER_ADDRESS_V6
           
static int TCP_SERVER_PORT
           
static String UDP_SERVER_ADDRESS_V4
           
static String UDP_SERVER_ADDRESS_V6
           
static int UDP_SERVER_PORT
           
 
Method Summary
 void addVersionCheckClientListener(boolean triggerStartListener, VersionCheckClientListener l)
           
 void clearCache()
           
static Map<String,Object> constructVersionCheckMessage(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.
 Set<String> getAutoInstallPluginIDs()
           
 long getCacheTime(boolean v6)
           
 Map<String,Object> getCountryInfo()
           
 List<InetSocketAddress> getDHTBootstrap(boolean ipv4)
           
 byte getDHTFlags()
           
 Set<String> getDisabledPluginIDs()
           
 String getExternalIpAddress(boolean only_if_cached, boolean v6)
          Get the ip address seen by the version check server.
 String getExternalIpAddress(boolean only_if_cached, boolean v6, boolean force)
           
 InetAddress getExternalIpAddressHTTP(boolean v6)
           
 InetAddress getExternalIpAddressTCP(InetAddress bind_ip, int bind_port, boolean v6)
           
 InetAddress getExternalIpAddressUDP(InetAddress bind_ip, int bind_port, boolean v6)
           
 long getFeatureFlags()
           
protected  String getHost(boolean v6, String v6_address, String v4_address)
           
 String getHTTPGetString(boolean for_proxy, boolean v6)
           
 Map getMostRecentVersionCheckData()
           
 String[] getRecommendedPlugins()
           
static VersionCheckClient getSingleton()
          Get the singleton instance of the version check client.
 Map getVersionCheckInfo(String reason)
          Get the version check reply info.
 Map getVersionCheckInfo(String reason, int address_type)
           
protected  Map getVersionCheckInfoSupport(String reason, boolean only_if_cached, boolean force, boolean v6)
           
 void initialise()
           
static void main(String[] args)
           
protected  void preProcessReply(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 String REASON_UPDATE_CHECK_START
See Also:
Constant Field Values

REASON_UPDATE_CHECK_PERIODIC

public static final String REASON_UPDATE_CHECK_PERIODIC
See Also:
Constant Field Values

REASON_CHECK_SWT

public static final String REASON_CHECK_SWT
See Also:
Constant Field Values

REASON_DHT_FLAGS

public static final String REASON_DHT_FLAGS
See Also:
Constant Field Values

REASON_DHT_EXTENDED_ALLOWED

public static final String REASON_DHT_EXTENDED_ALLOWED
See Also:
Constant Field Values

REASON_DHT_ENABLE_ALLOWED

public static final String REASON_DHT_ENABLE_ALLOWED
See Also:
Constant Field Values

REASON_EXTERNAL_IP

public static final String REASON_EXTERNAL_IP
See Also:
Constant Field Values

REASON_RECOMMENDED_PLUGINS

public static final String REASON_RECOMMENDED_PLUGINS
See Also:
Constant Field Values

REASON_SECONDARY_CHECK

public static final String REASON_SECONDARY_CHECK
See Also:
Constant Field Values

REASON_PLUGIN_UPDATE

public static final String REASON_PLUGIN_UPDATE
See Also:
Constant Field Values

REASON_DHT_BOOTSTRAP

public static final String REASON_DHT_BOOTSTRAP
See Also:
Constant Field Values

HTTP_SERVER_ADDRESS_V4

public static final 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 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 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 String AZ_MSG_SERVER_ADDRESS_V6
See Also:
Constant Field Values

HTTP_SERVER_ADDRESS_V6

public static final String HTTP_SERVER_ADDRESS_V6
See Also:
Constant Field Values

TCP_SERVER_ADDRESS_V6

public static final String TCP_SERVER_ADDRESS_V6
See Also:
Constant Field Values

UDP_SERVER_ADDRESS_V6

public static final 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 Map getVersionCheckInfo(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 Map getVersionCheckInfo(String reason,
                               int address_type)

getVersionCheckInfoSupport

protected Map getVersionCheckInfoSupport(String reason,
                                         boolean only_if_cached,
                                         boolean force,
                                         boolean v6)

getMostRecentVersionCheckData

public Map getMostRecentVersionCheckData()

getCacheTime

public long getCacheTime(boolean v6)

clearCache

public void clearCache()

getFeatureFlags

public long getFeatureFlags()

getDisabledPluginIDs

public Set<String> getDisabledPluginIDs()

getAutoInstallPluginIDs

public Set<String> getAutoInstallPluginIDs()

getExternalIpAddress

public 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 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 String[] getRecommendedPlugins()

getDHTBootstrap

public List<InetSocketAddress> getDHTBootstrap(boolean ipv4)

getCountryInfo

public Map<String,Object> getCountryInfo()

getHTTPGetString

public String getHTTPGetString(boolean for_proxy,
                               boolean v6)

preProcessReply

protected void preProcessReply(Map reply,
                               boolean v6)

getExternalIpAddressHTTP

public InetAddress getExternalIpAddressHTTP(boolean v6)
                                     throws Exception
Throws:
Exception

getExternalIpAddressTCP

public InetAddress getExternalIpAddressTCP(InetAddress bind_ip,
                                           int bind_port,
                                           boolean v6)
                                    throws Exception
Throws:
Exception

getExternalIpAddressUDP

public InetAddress getExternalIpAddressUDP(InetAddress bind_ip,
                                           int bind_port,
                                           boolean v6)
                                    throws Exception
Throws:
Exception

getHost

protected String getHost(boolean v6,
                         String v6_address,
                         String v4_address)

constructVersionCheckMessage

public static Map<String,Object> constructVersionCheckMessage(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(String[] args)