LimeWire Consolidated API

com.limegroup.gnutella.connection
Class ConnectionCapabilitiesImpl

java.lang.Object
  extended by com.limegroup.gnutella.connection.ConnectionCapabilitiesImpl
All Implemented Interfaces:
ConnectionCapabilities

public class ConnectionCapabilitiesImpl
extends Object
implements ConnectionCapabilities

A ConnectionCapabilities that delegates to HandshakeResponse objects to keep track of what headers were read or written, and CapabilitiesVM and MessagesSupportedVendorMessage objects to keep track of what vendor messages & capabilities are supported.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.limegroup.gnutella.connection.ConnectionCapabilities
ConnectionCapabilities.Capability
 
Constructor Summary
ConnectionCapabilitiesImpl()
           
 
Method Summary
 boolean canAcceptIncomingTCP()
           
 boolean canDoFWT()
           
 int getCapability(ConnectionCapabilities.Capability capability)
           
 HandshakeResponse getHeadersRead()
          Accessor for the HandshakeResponse instance containing all of the Gnutella connection headers passed by this node.
 HandshakeResponse getHeadersWritten()
           
 int getNumIntraUltrapeerConnections()
          Returns the number of intra-Ultrapeer connections this node maintains.
 int getRemoteHostFeatureQuerySelector()
           
 boolean getRemoteHostSupportsFeatureQueries()
          Return whether or not the remote host supports feature queries.
 int getRemoteHostUpdateVersion()
          Gets the remote host's 'update' version.
 int getSupportedOOBProxyControlVersion()
          Returns the peer's supported version of the out-of-band proxying control message or -1.
 String getUserAgent()
          Returns the vendor string reported by this connection, i.e., the USER_AGENT property, or null if it wasn't set.
 String getVersion()
          Accessor for the LimeWire version reported in the connection headers for this node.
 boolean isCapabilitiesVmSet()
           
 boolean isClientSupernodeConnection()
          Returns true iff the connection is an Ultrapeer and I am a leaf, i.e., if I wrote "X-Ultrapeer: false", this connection wrote "X-Ultrapeer: true" (not necessarily in that order).
 boolean isGoodLeaf()
           
 boolean isGoodUltrapeer()
           
 boolean isGUESSUltrapeer()
          Returns whether or not this connection is to a ultrapeer supporting GUESS.
 boolean isHighDegreeConnection()
           
 boolean isLeafConnection()
          Returns true iff this connection wrote "Ultrapeer: false".
 boolean isLimeWire()
          Returns whether or not the remote host is a LimeWire (or derivative)
 boolean isOldLimeWire()
          Returns whether or not this is considered an 'old' LimeWire.
 boolean isQueryRoutingEnabled()
          True if the remote host supports query routing (QRP).
 boolean isSupernodeClientConnection()
          Returns true iff I am a supernode shielding the given connection, i.e., if I wrote "X-Ultrapeer: true" and this connection wrote "X-Ultrapeer: false, and both support query routing.
 boolean isSupernodeConnection()
          Returns true iff this connection wrote "Supernode: true".
 boolean isSupernodeSupernodeConnection()
          Returns true iff the connection is an Ultrapeer and I am a Ultrapeer, ie: if I wrote "X-Ultrapeer: true", this connection wrote "X-Ultrapeer: true" (not necessarily in that order).
 boolean isUltrapeerQueryRoutingConnection()
          Returns whether or not this connection is to an Ultrapeer that supports query routing between Ultrapeers at 1 hop.
 boolean receivedHeaders()
          Accessor for whether or not this connection has received any headers.
 int remostHostIsActiveDHTNode()
          Returns the DHT version if the remote host is an active DHT node or -1 if it is not.
 int remostHostIsPassiveDHTNode()
          Returns the DHT version if the remote host is a passive DHT node or -1 if it is not.
 int remoteHostIsPassiveLeafNode()
          Returns the DHT version of the remote host is a passive leaf DHT node or -1 if it is not.
 int remoteHostSupportsHeaderUpdate()
           
 int remoteHostSupportsHopsFlow()
           
 int remoteHostSupportsInspections()
           
 int remoteHostSupportsLeafGuidance()
           
 int remoteHostSupportsPushProxy()
           
 int remoteHostSupportsTCPConnectBack()
           
 int remoteHostSupportsTCPRedirect()
           
 int remoteHostSupportsUDPConnectBack()
           
 int remoteHostSupportsUDPCrawling()
           
 int remoteHostSupportsUDPRedirect()
           
 boolean remoteHostSupportsWhatIsNew()
           
 void setCapabilitiesVendorMessage(CapabilitiesVM vm)
           
 void setHeadersRead(HandshakeResponse createResponse)
           
 void setHeadersWritten(HandshakeResponse writtenHeaders)
           
 void setMessagesSupportedVendorMessage(MessagesSupportedVendorMessage vm)
           
 boolean supportsGGEP()
          Deprecated. 
 boolean supportsPongCaching()
           
 boolean supportsProbeQueries()
          Returns whether or not this connections supports "probe" queries, or queries sent at TTL=1 that should not block the send path of subsequent, higher TTL queries.
 int supportsVendorMessage(byte[] vendorID, int selector)
           
 boolean supportsVMRouting()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionCapabilitiesImpl

public ConnectionCapabilitiesImpl()
Method Detail

getUserAgent

public String getUserAgent()
Description copied from interface: ConnectionCapabilities
Returns the vendor string reported by this connection, i.e., the USER_AGENT property, or null if it wasn't set.

Specified by:
getUserAgent in interface ConnectionCapabilities
Returns:
the vendor string, or null if unknown

isLimeWire

public boolean isLimeWire()
Description copied from interface: ConnectionCapabilities
Returns whether or not the remote host is a LimeWire (or derivative)

Specified by:
isLimeWire in interface ConnectionCapabilities

isOldLimeWire

public boolean isOldLimeWire()
Description copied from interface: ConnectionCapabilities
Returns whether or not this is considered an 'old' LimeWire.

Specified by:
isOldLimeWire in interface ConnectionCapabilities

isGoodUltrapeer

public boolean isGoodUltrapeer()
Specified by:
isGoodUltrapeer in interface ConnectionCapabilities

isGoodLeaf

public boolean isGoodLeaf()
Specified by:
isGoodLeaf in interface ConnectionCapabilities

supportsPongCaching

public boolean supportsPongCaching()
Specified by:
supportsPongCaching in interface ConnectionCapabilities

getNumIntraUltrapeerConnections

public int getNumIntraUltrapeerConnections()
Returns the number of intra-Ultrapeer connections this node maintains.

Specified by:
getNumIntraUltrapeerConnections in interface ConnectionCapabilities
Returns:
the number of intra-Ultrapeer connections this node maintains

isHighDegreeConnection

public boolean isHighDegreeConnection()
Specified by:
isHighDegreeConnection in interface ConnectionCapabilities

isUltrapeerQueryRoutingConnection

public boolean isUltrapeerQueryRoutingConnection()
Description copied from interface: ConnectionCapabilities
Returns whether or not this connection is to an Ultrapeer that supports query routing between Ultrapeers at 1 hop.

Specified by:
isUltrapeerQueryRoutingConnection in interface ConnectionCapabilities
Returns:
true if this is an Ultrapeer connection that exchanges query routing tables with other Ultrapeers at 1 hop, otherwise false

supportsProbeQueries

public boolean supportsProbeQueries()
Description copied from interface: ConnectionCapabilities
Returns whether or not this connections supports "probe" queries, or queries sent at TTL=1 that should not block the send path of subsequent, higher TTL queries.

Specified by:
supportsProbeQueries in interface ConnectionCapabilities
Returns:
true if this connection supports probe queries, otherwise false

receivedHeaders

public boolean receivedHeaders()
Description copied from interface: ConnectionCapabilities
Accessor for whether or not this connection has received any headers.

Specified by:
receivedHeaders in interface ConnectionCapabilities
Returns:
true if this connection has finished initializing and therefore has headers, otherwise false

getHeadersRead

public HandshakeResponse getHeadersRead()
Description copied from interface: ConnectionCapabilities
Accessor for the HandshakeResponse instance containing all of the Gnutella connection headers passed by this node.

Specified by:
getHeadersRead in interface ConnectionCapabilities
Returns:
the HandshakeResponse instance containing all of the Gnutella connection headers passed by this node

getVersion

public String getVersion()
Description copied from interface: ConnectionCapabilities
Accessor for the LimeWire version reported in the connection headers for this node.

Specified by:
getVersion in interface ConnectionCapabilities

isLeafConnection

public boolean isLeafConnection()
Description copied from interface: ConnectionCapabilities
Returns true iff this connection wrote "Ultrapeer: false". This does NOT necessarily mean the connection is shielded.

Specified by:
isLeafConnection in interface ConnectionCapabilities

isSupernodeConnection

public boolean isSupernodeConnection()
Description copied from interface: ConnectionCapabilities
Returns true iff this connection wrote "Supernode: true".

Specified by:
isSupernodeConnection in interface ConnectionCapabilities

isClientSupernodeConnection

public boolean isClientSupernodeConnection()
Description copied from interface: ConnectionCapabilities
Returns true iff the connection is an Ultrapeer and I am a leaf, i.e., if I wrote "X-Ultrapeer: false", this connection wrote "X-Ultrapeer: true" (not necessarily in that order). Does NOT require that QRP is enabled between the two; the Ultrapeer could be using reflector indexing, for example.

Specified by:
isClientSupernodeConnection in interface ConnectionCapabilities

isSupernodeSupernodeConnection

public boolean isSupernodeSupernodeConnection()
Description copied from interface: ConnectionCapabilities
Returns true iff the connection is an Ultrapeer and I am a Ultrapeer, ie: if I wrote "X-Ultrapeer: true", this connection wrote "X-Ultrapeer: true" (not necessarily in that order). Does NOT require that QRP is enabled between the two; the Ultrapeer could be using reflector indexing, for example.

Specified by:
isSupernodeSupernodeConnection in interface ConnectionCapabilities

isGUESSUltrapeer

public boolean isGUESSUltrapeer()
Description copied from interface: ConnectionCapabilities
Returns whether or not this connection is to a ultrapeer supporting GUESS.

Specified by:
isGUESSUltrapeer in interface ConnectionCapabilities
Returns:
true if the node on the other end of this Ultrapeer connection supports GUESS, false otherwise

isSupernodeClientConnection

public boolean isSupernodeClientConnection()
Description copied from interface: ConnectionCapabilities
Returns true iff I am a supernode shielding the given connection, i.e., if I wrote "X-Ultrapeer: true" and this connection wrote "X-Ultrapeer: false, and both support query routing.

Specified by:
isSupernodeClientConnection in interface ConnectionCapabilities

supportsGGEP

@Deprecated
public boolean supportsGGEP()
Deprecated. 


isQueryRoutingEnabled

public boolean isQueryRoutingEnabled()
True if the remote host supports query routing (QRP). This is only meaningful in the context of leaf-ultrapeer relationships.

Specified by:
isQueryRoutingEnabled in interface ConnectionCapabilities

supportsVendorMessage

public int supportsVendorMessage(byte[] vendorID,
                                 int selector)
Specified by:
supportsVendorMessage in interface ConnectionCapabilities
Returns:
-1 if the message isn't supported, else the version number supported.

supportsVMRouting

public boolean supportsVMRouting()
Specified by:
supportsVMRouting in interface ConnectionCapabilities
Returns:
whether this connection supports routing of vendor messages (i.e. will not drop a VM that has ttl <> 1 and hops > 0)

remoteHostSupportsUDPConnectBack

public int remoteHostSupportsUDPConnectBack()
Specified by:
remoteHostSupportsUDPConnectBack in interface ConnectionCapabilities
Returns:
-1 if the message isn't supported, else the version number supported.

remoteHostSupportsTCPConnectBack

public int remoteHostSupportsTCPConnectBack()
Specified by:
remoteHostSupportsTCPConnectBack in interface ConnectionCapabilities
Returns:
-1 if the message isn't supported, else the version number supported.

remoteHostSupportsUDPRedirect

public int remoteHostSupportsUDPRedirect()
Specified by:
remoteHostSupportsUDPRedirect in interface ConnectionCapabilities
Returns:
-1 if the message isn't supported, else the version number supported.

remoteHostSupportsTCPRedirect

public int remoteHostSupportsTCPRedirect()
Specified by:
remoteHostSupportsTCPRedirect in interface ConnectionCapabilities
Returns:
-1 if the message isn't supported, else the version number supported.

remoteHostSupportsUDPCrawling

public int remoteHostSupportsUDPCrawling()
Specified by:
remoteHostSupportsUDPCrawling in interface ConnectionCapabilities
Returns:
-1 if UDP crawling is supported, else the version number supported.

remoteHostSupportsHopsFlow

public int remoteHostSupportsHopsFlow()
Specified by:
remoteHostSupportsHopsFlow in interface ConnectionCapabilities
Returns:
-1 if the message isn't supported, else the version number supported.

remoteHostSupportsPushProxy

public int remoteHostSupportsPushProxy()
Specified by:
remoteHostSupportsPushProxy in interface ConnectionCapabilities
Returns:
-1 if the message isn't supported, else the version number supported.

remoteHostSupportsLeafGuidance

public int remoteHostSupportsLeafGuidance()
Specified by:
remoteHostSupportsLeafGuidance in interface ConnectionCapabilities
Returns:
-1 if the message isn't supported, else the version number supported.

remoteHostSupportsHeaderUpdate

public int remoteHostSupportsHeaderUpdate()
Specified by:
remoteHostSupportsHeaderUpdate in interface ConnectionCapabilities
Returns:
-1 if the message isn't supported, else the version number supported.

getSupportedOOBProxyControlVersion

public int getSupportedOOBProxyControlVersion()
Returns the peer's supported version of the out-of-band proxying control message or -1.

Specified by:
getSupportedOOBProxyControlVersion in interface ConnectionCapabilities

remoteHostSupportsInspections

public int remoteHostSupportsInspections()
Specified by:
remoteHostSupportsInspections in interface ConnectionCapabilities
Returns:
the peer's supported version of inspection requests or -1.

getRemoteHostSupportsFeatureQueries

public boolean getRemoteHostSupportsFeatureQueries()
Description copied from interface: ConnectionCapabilities
Return whether or not the remote host supports feature queries.

Specified by:
getRemoteHostSupportsFeatureQueries in interface ConnectionCapabilities

getRemoteHostFeatureQuerySelector

public int getRemoteHostFeatureQuerySelector()
Specified by:
getRemoteHostFeatureQuerySelector in interface ConnectionCapabilities
Returns:
the maximum selector of capability supported, else -1 if no support.

remoteHostSupportsWhatIsNew

public boolean remoteHostSupportsWhatIsNew()
Specified by:
remoteHostSupportsWhatIsNew in interface ConnectionCapabilities
Returns:
true if the capability is supported.

getRemoteHostUpdateVersion

public int getRemoteHostUpdateVersion()
Description copied from interface: ConnectionCapabilities
Gets the remote host's 'update' version.

Specified by:
getRemoteHostUpdateVersion in interface ConnectionCapabilities

remostHostIsActiveDHTNode

public int remostHostIsActiveDHTNode()
Description copied from interface: ConnectionCapabilities
Returns the DHT version if the remote host is an active DHT node or -1 if it is not.

Specified by:
remostHostIsActiveDHTNode in interface ConnectionCapabilities

remostHostIsPassiveDHTNode

public int remostHostIsPassiveDHTNode()
Description copied from interface: ConnectionCapabilities
Returns the DHT version if the remote host is a passive DHT node or -1 if it is not.

Specified by:
remostHostIsPassiveDHTNode in interface ConnectionCapabilities

remoteHostIsPassiveLeafNode

public int remoteHostIsPassiveLeafNode()
Description copied from interface: ConnectionCapabilities
Returns the DHT version of the remote host is a passive leaf DHT node or -1 if it is not.

Specified by:
remoteHostIsPassiveLeafNode in interface ConnectionCapabilities

getCapability

public int getCapability(ConnectionCapabilities.Capability capability)
Specified by:
getCapability in interface ConnectionCapabilities

getHeadersWritten

public HandshakeResponse getHeadersWritten()
Specified by:
getHeadersWritten in interface ConnectionCapabilities

isCapabilitiesVmSet

public boolean isCapabilitiesVmSet()
Specified by:
isCapabilitiesVmSet in interface ConnectionCapabilities

setCapabilitiesVendorMessage

public void setCapabilitiesVendorMessage(CapabilitiesVM vm)
Specified by:
setCapabilitiesVendorMessage in interface ConnectionCapabilities

setHeadersRead

public void setHeadersRead(HandshakeResponse createResponse)
Specified by:
setHeadersRead in interface ConnectionCapabilities

setHeadersWritten

public void setHeadersWritten(HandshakeResponse writtenHeaders)
Specified by:
setHeadersWritten in interface ConnectionCapabilities

setMessagesSupportedVendorMessage

public void setMessagesSupportedVendorMessage(MessagesSupportedVendorMessage vm)
Specified by:
setMessagesSupportedVendorMessage in interface ConnectionCapabilities

canAcceptIncomingTCP

public boolean canAcceptIncomingTCP()
Specified by:
canAcceptIncomingTCP in interface ConnectionCapabilities

canDoFWT

public boolean canDoFWT()
Specified by:
canDoFWT in interface ConnectionCapabilities

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.